390 lines
13 KiB
C#
390 lines
13 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
using System.Linq;
|
|
using System.Security.Cryptography;
|
|
using _0_Framework.Domain;
|
|
using Company.Domain.InstitutionContractContactInfoAgg;
|
|
using CompanyManagment.App.Contracts.InstitutionContract;
|
|
|
|
namespace Company.Domain.InstitutionContractAgg;
|
|
|
|
public class InstitutionContract : EntityBase
|
|
{
|
|
public InstitutionContract(string contractNo, long representativeId, string representativeName,
|
|
long contractingPartyId,
|
|
string contractingPartyName, DateTime contractDateGr, string contractDateFa, string state, string city,
|
|
string address, DateTime contractStartGr, string contractStartFa, DateTime contractEndGr,
|
|
string contractEndFa, double contractAmount, double dailyCompenseation, double obligation,
|
|
double totalAmount, int extensionNo, string workshopManualCount, string employeeManualCount, string description,
|
|
string officialCompany, string typeOfcontract, string hasValueAddedTax, double valueAddedTax,
|
|
List<InstitutionContractWorkshopInitial> workshopDetails, long lawId)
|
|
{
|
|
ContractNo = contractNo;
|
|
RepresentativeId = representativeId;
|
|
RepresentativeName = representativeName;
|
|
ContractingPartyId = contractingPartyId;
|
|
ContractingPartyName = contractingPartyName;
|
|
ContractDateGr = contractDateGr;
|
|
ContractDateFa = contractDateFa;
|
|
State = state;
|
|
City = city;
|
|
Address = address;
|
|
//ContactInfoId = contactInfoId;
|
|
ContractStartGr = contractStartGr;
|
|
ContractStartFa = contractStartFa;
|
|
ContractEndGr = contractEndGr;
|
|
ContractEndFa = contractEndFa;
|
|
ContractAmount = contractAmount;
|
|
DailyCompenseation = dailyCompenseation;
|
|
Obligation = obligation;
|
|
TotalAmount = totalAmount;
|
|
ExtensionNo = extensionNo;
|
|
WorkshopManualCount = workshopManualCount;
|
|
EmployeeManualCount = employeeManualCount;
|
|
Description = description;
|
|
OfficialCompany = officialCompany;
|
|
|
|
IsActiveString = "true";
|
|
Signature = "0";
|
|
TypeOfContract = typeOfcontract;
|
|
HasValueAddedTax = hasValueAddedTax;
|
|
ValueAddedTax = valueAddedTax;
|
|
VerificationStatus = InstitutionContractVerificationStatus.PendingForVerify;
|
|
ContactInfoList = [];
|
|
Installments = [];
|
|
WorkshopGroup = new InstitutionContractWorkshopGroup(id, workshopDetails);
|
|
PublicId = Guid.NewGuid();
|
|
LawId = lawId;
|
|
}
|
|
|
|
public long LawId { get; private set; }
|
|
|
|
public string ContractNo { get; private set; }
|
|
|
|
public long RepresentativeId { get; private set; }
|
|
|
|
public string RepresentativeName { get; private set; }
|
|
|
|
public long ContractingPartyId { get; private set; }
|
|
|
|
public string ContractingPartyName { get; private set; }
|
|
|
|
public DateTime ContractDateGr { get; private set; }
|
|
|
|
public string ContractDateFa { get; private set; }
|
|
|
|
public string State { get; private set; }
|
|
|
|
public string City { get; private set; }
|
|
|
|
public string Address { get; private set; }
|
|
|
|
//public long ContactInfoId { get; private set; }
|
|
public DateTime ContractStartGr { get; private set; }
|
|
|
|
public string ContractStartFa { get; private set; }
|
|
|
|
public DateTime ContractEndGr { get; private set; }
|
|
|
|
public string ContractEndFa { get; private set; }
|
|
|
|
// مبلغ قرارداد
|
|
public double ContractAmount { get; private set; }
|
|
|
|
//خسارت روزانه
|
|
public double DailyCompenseation { get; private set; }
|
|
|
|
//وجه التزام
|
|
public double Obligation { get; private set; }
|
|
|
|
// مبلغ کل قرارداد
|
|
public double TotalAmount { get; private set; }
|
|
|
|
public string WorkshopManualCount { get; private set; }
|
|
|
|
public string EmployeeManualCount { get; private set; }
|
|
|
|
public string IsActiveString { get; private set; }
|
|
|
|
public int ExtensionNo { get; private set; }
|
|
|
|
public string Description { get; private set; }
|
|
|
|
public string Signature { get; private set; }
|
|
|
|
public string OfficialCompany { get; private set; }
|
|
|
|
public string TypeOfContract { get; private set; }
|
|
|
|
public string HasValueAddedTax { get; private set; }
|
|
|
|
public double ValueAddedTax { get; private set; }
|
|
|
|
public Guid PublicId { get; private set; }
|
|
|
|
public string VerifyCode { get; private set; }
|
|
public DateTime VerifyCodeCreation { get; private set; }
|
|
public string VerifierFullName { get; private set; }
|
|
public string VerifierPhoneNumber { get; private set; }
|
|
|
|
[NotMapped] public bool VerifyCodeExpired => VerifyCodeCreation.Add(ExpireTime) <= DateTime.Now;
|
|
|
|
[NotMapped] public bool CanResendVerifyCode => VerifyCodeCreation.Add(ReSendTime) <= DateTime.Now;
|
|
|
|
[NotMapped] public TimeSpan ExpireTime => TimeSpan.FromMinutes(5);
|
|
|
|
|
|
[NotMapped] public TimeSpan ReSendTime => TimeSpan.FromMinutes(2);
|
|
|
|
public bool IsInstallment { get; set; }
|
|
|
|
public InstitutionContractVerificationStatus VerificationStatus { get; private set; }
|
|
|
|
public InstitutionContractWorkshopGroup WorkshopGroup { get; private set; }
|
|
|
|
public List<InstitutionContractContactInfo> ContactInfoList { get; set; }
|
|
|
|
public List<InstitutionContractInstallment> Installments { get; set; }
|
|
|
|
public List<InstitutionContractAmendment> Amendments { get; private set; }
|
|
|
|
public InstitutionContract()
|
|
{
|
|
ContactInfoList = [];
|
|
Installments = [];
|
|
}
|
|
|
|
public void Edit(DateTime contractDateGr, string contractDateFa, string state, string city, string address,
|
|
DateTime contractStartGr, string contractStartFa, DateTime contractEndGr, string contractEndFa,
|
|
double contractAmount, double dailyCompenseation, double obligation, double totalAmount,
|
|
string workshopManualCount, string employeeManualCount, string description, string officialCompany,
|
|
string typeOfcontract, double valueAddedTax, string hasValueAddedTax)
|
|
{
|
|
ContractDateGr = contractDateGr;
|
|
ContractDateFa = contractDateFa;
|
|
State = state;
|
|
City = city;
|
|
Address = address;
|
|
|
|
ContractStartGr = contractStartGr;
|
|
ContractStartFa = contractStartFa;
|
|
ContractEndGr = contractEndGr;
|
|
ContractEndFa = contractEndFa;
|
|
ContractAmount = contractAmount;
|
|
DailyCompenseation = dailyCompenseation;
|
|
Obligation = obligation;
|
|
TotalAmount = totalAmount;
|
|
WorkshopManualCount = workshopManualCount;
|
|
EmployeeManualCount = employeeManualCount;
|
|
Description = description;
|
|
OfficialCompany = officialCompany;
|
|
TypeOfContract = typeOfcontract;
|
|
|
|
HasValueAddedTax = hasValueAddedTax;
|
|
ValueAddedTax = valueAddedTax;
|
|
}
|
|
|
|
public void Active()
|
|
{
|
|
this.IsActiveString = "true";
|
|
}
|
|
|
|
public void DeActive()
|
|
{
|
|
this.IsActiveString = "false";
|
|
}
|
|
|
|
public void DeActiveBlue()
|
|
{
|
|
this.IsActiveString = "blue";
|
|
}
|
|
|
|
public void Sign()
|
|
{
|
|
this.Signature = "1";
|
|
}
|
|
|
|
public void UnSign()
|
|
{
|
|
this.Signature = "0";
|
|
}
|
|
|
|
public void Verified()
|
|
{
|
|
VerificationStatus = InstitutionContractVerificationStatus.Verified;
|
|
}
|
|
|
|
public void SetPendingWorkflow()
|
|
{
|
|
VerificationStatus = InstitutionContractVerificationStatus.PendingWorkflow;
|
|
}
|
|
|
|
public void SetInstallments(List<InstitutionContractInstallment> installments)
|
|
{
|
|
Installments = installments;
|
|
IsInstallment = true;
|
|
}
|
|
|
|
|
|
public void SetVerifyCode(string code,string verifierFullName, string verifierPhoneNumber)
|
|
{
|
|
VerifyCode = code;
|
|
VerifyCodeCreation = DateTime.Now;
|
|
VerifierFullName = verifierFullName;
|
|
VerifierPhoneNumber = verifierPhoneNumber;
|
|
}
|
|
|
|
public void SetWorkshopGroup(InstitutionContractWorkshopGroup workshopGroup)
|
|
{
|
|
WorkshopGroup = workshopGroup;
|
|
}
|
|
|
|
public void SetAmount(double totalAmount, double tax, double oneMonthPayment)
|
|
{
|
|
ContractAmount = oneMonthPayment;
|
|
TotalAmount = totalAmount;
|
|
ValueAddedTax = tax;
|
|
HasValueAddedTax = tax > 0 ? "true" : "false";
|
|
}
|
|
|
|
public void ClearGroup()
|
|
{
|
|
WorkshopGroup = null;
|
|
}
|
|
}
|
|
|
|
public class InstitutionContractAmendment : EntityBase
|
|
{
|
|
private InstitutionContractAmendment(){}
|
|
public InstitutionContractAmendment(long institutionContractId,
|
|
List<InstitutionContractInstallment> installments, double amount, bool hasInstallment,
|
|
InstitutionContractAmendmentChange amendmentChange, long lawId)
|
|
{
|
|
InstitutionContractId = institutionContractId;
|
|
Installments = installments is { Count: > 0} ? installments : [];
|
|
Amount = amount;
|
|
HasInstallment = hasInstallment;
|
|
AmendmentChanges = [amendmentChange];
|
|
LawId = lawId;
|
|
}
|
|
|
|
public long InstitutionContractId { get; set; }
|
|
public InstitutionContract InstitutionContract { get; set; }
|
|
public List<InstitutionContractInstallment> Installments { get; set; }
|
|
public double Amount { get; set; }
|
|
public bool HasInstallment { get; set; }
|
|
public string VerifyCode { get; set; }
|
|
public DateTime VerificationCreation { get; set; }
|
|
public List<InstitutionContractAmendmentChange> AmendmentChanges { get; set; }
|
|
|
|
public long LawId { get; set; }
|
|
|
|
public void SetVerifyCode(string code,string verifierFullName, string verifierPhoneNumber)
|
|
{
|
|
VerifyCode = code;
|
|
VerifyCodeCreation = DateTime.Now;
|
|
VerifierFullName = verifierFullName;
|
|
VerifierPhoneNumber = verifierPhoneNumber;
|
|
}
|
|
|
|
public string VerifierPhoneNumber { get; private set; }
|
|
|
|
public string VerifierFullName { get; private set; }
|
|
|
|
public DateTime VerifyCodeCreation { get; set; }
|
|
}
|
|
|
|
public class InstitutionContractAmendmentChange : EntityBase
|
|
{
|
|
private InstitutionContractAmendmentChange() { }
|
|
private InstitutionContractAmendmentChange(long institutionContractAmendmentId,
|
|
InstitutionContractAmendment institutionContractAmendment, InstitutionContractAmendmentChangeType changeType,
|
|
DateTime changeDateGr, bool? hasRollCallPlan, bool? hasCustomizeCheckoutPlan, bool? hasContractPlan,
|
|
bool? hasContractPlanInPerson, bool? hasInsurancePlan, bool? hasInsurancePlanInPerson, int? personnelCount,
|
|
long? workshopDetailsId)
|
|
{
|
|
InstitutionContractAmendmentId = institutionContractAmendmentId;
|
|
InstitutionContractAmendment = institutionContractAmendment;
|
|
ChangeType = changeType;
|
|
ChangeDateGr = changeDateGr;
|
|
HasRollCallPlan = hasRollCallPlan;
|
|
HasCustomizeCheckoutPlan = hasCustomizeCheckoutPlan;
|
|
HasContractPlan = hasContractPlan;
|
|
HasContractPlanInPerson = hasContractPlanInPerson;
|
|
HasInsurancePlan = hasInsurancePlan;
|
|
HasInsurancePlanInPerson = hasInsurancePlanInPerson;
|
|
PersonnelCount = personnelCount;
|
|
WorkshopDetailsId = workshopDetailsId;
|
|
}
|
|
|
|
public long InstitutionContractAmendmentId { get; private set; }
|
|
public InstitutionContractAmendment InstitutionContractAmendment { get; private set; }
|
|
public InstitutionContractAmendmentChangeType ChangeType { get; private set; }
|
|
public DateTime ChangeDateGr { get; private set; }
|
|
|
|
/// <summary>
|
|
/// پلن حضور و غیاب
|
|
/// </summary>
|
|
public bool? HasRollCallPlan { get; private set; }
|
|
|
|
/// <summary>
|
|
/// پلن فیش غیر رسمی
|
|
/// </summary>
|
|
public bool? HasCustomizeCheckoutPlan { get; private set; }
|
|
|
|
/// <summary>
|
|
/// پلن قرارداد و تصفیه
|
|
/// </summary>
|
|
public bool? HasContractPlan { get; private set; }
|
|
|
|
/// <summary>
|
|
/// پلن قرارداد و تصفیه حضوری
|
|
/// </summary>
|
|
public bool? HasContractPlanInPerson { get; private set; }
|
|
|
|
/// <summary>
|
|
/// پلن بیمه
|
|
/// </summary>
|
|
public bool? HasInsurancePlan { get; private set; }
|
|
|
|
/// <summary>
|
|
/// پلن بیمه حضوری
|
|
/// </summary>
|
|
public bool? HasInsurancePlanInPerson { get; private set; }
|
|
|
|
/// <summary>
|
|
/// تعداد پرسنل
|
|
/// </summary>
|
|
public int? PersonnelCount { get; private set; }
|
|
|
|
/// <summary>
|
|
/// تعداد کارگاه
|
|
/// </summary>
|
|
public long? WorkshopDetailsId { get; private set; }
|
|
}
|
|
|
|
public enum InstitutionContractAmendmentChangeType
|
|
{
|
|
PersonCount,
|
|
Services,
|
|
WorkshopCreated
|
|
}
|
|
|
|
public enum InstitutionContractVerificationStatus
|
|
{
|
|
/// <summary>
|
|
/// در انتظار تایید
|
|
/// </summary>
|
|
PendingForVerify = 0,
|
|
|
|
/// <summary>
|
|
/// در انتظار کارپوشه
|
|
/// </summary>
|
|
PendingWorkflow = 1,
|
|
|
|
/// <summary>
|
|
/// تایید شده
|
|
/// </summary>
|
|
Verified = 2
|
|
} |