diff --git a/Company.Domain/InstitutionContractAgg/InstitutionContract.cs b/Company.Domain/InstitutionContractAgg/InstitutionContract.cs index e61770ee..1193023d 100644 --- a/Company.Domain/InstitutionContractAgg/InstitutionContract.cs +++ b/Company.Domain/InstitutionContractAgg/InstitutionContract.cs @@ -1,6 +1,7 @@ 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; @@ -119,26 +120,23 @@ public class InstitutionContract : EntityBase 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; } - - [NotMapped] - public bool VerifyCodeExpired => VerifyCodeCreation.Add(ExpireTime) <= DateTime.Now; - [NotMapped] - public bool CanResendVerifyCode => VerifyCodeCreation.Add(ReSendTime) <= DateTime.Now; - + [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; } @@ -254,6 +252,19 @@ public class InstitutionContract : EntityBase public class InstitutionContractAmendment : EntityBase { + public InstitutionContractAmendment(long institutionContractId, InstitutionContract institutionContract, + List installments, double amount, bool hasInstallment, + InstitutionContractAmendmentChange amendmentChange, long lawId) + { + InstitutionContractId = institutionContractId; + InstitutionContract = institutionContract; + 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 Installments { get; set; } @@ -262,10 +273,38 @@ public class InstitutionContractAmendment : EntityBase public string VerifyCode { get; set; } public DateTime VerificationCreation { get; set; } public List AmendmentChanges { get; set; } + + public long LawId { get; set; } + + public void SetVerifyCode(string code) + { + VerifyCode = code; + VerificationCreation = DateTime.Now; + } } public class InstitutionContractAmendmentChange : EntityBase { + 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; } @@ -310,8 +349,6 @@ public class InstitutionContractAmendmentChange : EntityBase /// تعداد کارگاه /// public long? WorkshopDetailsId { get; private set; } - - } public enum InstitutionContractAmendmentChangeType