From 701ebaeb96df8896811b96d1676e2e797cafab34 Mon Sep 17 00:00:00 2001 From: MahanCh Date: Wed, 27 Aug 2025 11:47:41 +0330 Subject: [PATCH] feat: add in-person contract and insurance plan properties to institution contract --- .../InstitutionContract.cs | 28 +++++++++++++++---- .../CreateInstitutionContractRequest.cs | 14 ++++++++++ .../InstitutionContractApplication.cs | 6 +++- 3 files changed, 42 insertions(+), 6 deletions(-) diff --git a/Company.Domain/InstitutionContractAgg/InstitutionContract.cs b/Company.Domain/InstitutionContractAgg/InstitutionContract.cs index e1955fc4..ce8157d0 100644 --- a/Company.Domain/InstitutionContractAgg/InstitutionContract.cs +++ b/Company.Domain/InstitutionContractAgg/InstitutionContract.cs @@ -182,13 +182,17 @@ public class InstitutionContract : EntityBase public class InstitutionContractWorkshopDetail:EntityBase { - public InstitutionContractWorkshopDetail( string workshopName, bool hasRollCallPlan, - bool hasCustomizeCheckoutPlan, bool hasContractPlan,int personnelCount,double price) + public InstitutionContractWorkshopDetail(string workshopName, bool hasRollCallPlan, + bool hasCustomizeCheckoutPlan, bool hasContractPlan,bool hasContractPlanInPerson,bool hasInsurancePlan,bool hasInsurancePlanInPerson, + int personnelCount, double price) { WorkshopName = workshopName; HasRollCallPlan = hasRollCallPlan; HasCustomizeCheckoutPlan = hasCustomizeCheckoutPlan; HasContractPlan = hasContractPlan; + HasContractPlanInPerson = hasContractPlanInPerson; + HasInsurancePlan = hasInsurancePlan; + HasInsurancePlanInPerson = hasInsurancePlanInPerson; PersonnelCount = personnelCount; WorkshopCreated = false; Price = price; @@ -208,17 +212,31 @@ public class InstitutionContractWorkshopDetail:EntityBase /// /// پلن حضور و غیاب /// - public bool HasRollCallPlan { get; private set; } + public bool HasRollCallPlan { get; set; } /// /// پلن فیش غیر رسمی /// - public bool HasCustomizeCheckoutPlan { get; private set; } + public bool HasCustomizeCheckoutPlan { get; set; } /// /// پلن قرارداد و تصفیه /// - public bool HasContractPlan { get; private set; } + public bool HasContractPlan { get; set; } + + /// + /// پلن قرارداد و تصفیه حضوری + /// + public bool HasContractPlanInPerson { get; set; } + + /// + /// پلن بیمه + /// + public bool HasInsurancePlan { get; set; } + /// + /// پلن بیمه حضوری + /// + public bool HasInsurancePlanInPerson { get; set; } public int PersonnelCount { get; private set; } diff --git a/CompanyManagment.App.Contracts/InstitutionContract/CreateInstitutionContractRequest.cs b/CompanyManagment.App.Contracts/InstitutionContract/CreateInstitutionContractRequest.cs index 6d2fda57..5afb8879 100644 --- a/CompanyManagment.App.Contracts/InstitutionContract/CreateInstitutionContractRequest.cs +++ b/CompanyManagment.App.Contracts/InstitutionContract/CreateInstitutionContractRequest.cs @@ -155,6 +155,20 @@ public class CreateInstitutionContractWorkshopDetail /// پلن قرارداد و تصفیه /// public bool HasContractPlan { get; set; } + + /// + /// پلن قرارداد و تصفیه حضوری + /// + public bool HasContractPlanInPerson { get; set; } + + /// + /// پلن بیمه + /// + public bool HasInsurancePlan { get; set; } + /// + /// پلن بیمه حضوری + /// + public bool HasInsurancePlanInPerson { get; set; } /// /// تعداد پرسنل کارگاه diff --git a/CompanyManagment.Application/InstitutionContractApplication.cs b/CompanyManagment.Application/InstitutionContractApplication.cs index 9d7f9a86..948dac0a 100644 --- a/CompanyManagment.Application/InstitutionContractApplication.cs +++ b/CompanyManagment.Application/InstitutionContractApplication.cs @@ -949,6 +949,10 @@ public class InstitutionContractApplication : IInstitutionContractApplication if (command.ContractStartFa.TryToGeorgianDateTime(out var contractStartGr) == false) return opration.Failed("تاریخ شروع قرارداد معتبر نیست"); + if (command.IsInstallment && !command.Workshops.Any(x=>x.HasContractPlanInPerson || x.HasInsurancePlanInPerson)) + { + return opration.Failed("برای قراردادهای اقساطی حداقل یک کارگاه باید دارای طرح حضوری باشد"); + } contractStartGr.AddMonthsFa((int)command.Duration, out var contractEndGr); contractEndGr = contractEndGr.ToFarsi().FindeEndOfMonth().ToGeorgianDateTime(); @@ -976,7 +980,7 @@ public class InstitutionContractApplication : IInstitutionContractApplication var workshopDetails = command.Workshops.Select(x => new InstitutionContractWorkshopDetail(x.WorkshopName, x.HasRollCallPlan, x.HasCustomizeCheckoutPlan, - x.HasContractPlan, x.PersonnelCount, x.Price)).ToList(); + x.HasContractPlan, x.HasContractPlanInPerson,x.HasInsurancePlan,x.HasInsurancePlanInPerson,x.PersonnelCount, x.Price)).ToList(); var financialStatement = new FinancialStatment(contractingParty.id, contractingPartyFullName);