From c6a7e0a0bd6e18085ce8da58a8eb2dbb87062522 Mon Sep 17 00:00:00 2001 From: mahan Date: Wed, 29 Oct 2025 15:08:14 +0330 Subject: [PATCH] feat: add workshop response handling to institution contract amendment payment response --- ...itutionContractAmendmentPaymentResponse.cs | 16 +++++++++ .../InstitutionContractRepository.cs | 35 +++++++++++++++++++ 2 files changed, 51 insertions(+) diff --git a/CompanyManagment.App.Contracts/InstitutionContract/InsitutionContractAmendmentPaymentResponse.cs b/CompanyManagment.App.Contracts/InstitutionContract/InsitutionContractAmendmentPaymentResponse.cs index f6a90dc4..5b12d501 100644 --- a/CompanyManagment.App.Contracts/InstitutionContract/InsitutionContractAmendmentPaymentResponse.cs +++ b/CompanyManagment.App.Contracts/InstitutionContract/InsitutionContractAmendmentPaymentResponse.cs @@ -1,11 +1,27 @@ +using System.Collections.Generic; + namespace CompanyManagment.App.Contracts.InstitutionContract; public class InsitutionContractAmendmentPaymentResponse { + public List workshops { get; set; } public InstitutionContractPaymentOneTimeViewModel OneTime { get; set; } public InstitutionContractPaymentMonthlyViewModel Monthly { get; set; } public string ContractStart { get; set; } public string ContractEnd { get; set; } public string OneMonthAmount { get; set; } public string TotalAmount { get; set; } +} + +public class InsitutionContractAmendmentPaymentWorkshopResponse +{ + public WorkshopServicesViewModel OldServices { get; set; } + public WorkshopServicesViewModel NewServices { get; set; } + + public bool IsNewWorkshop { get; set; } + + public int PrevPersonnelCount { get; set; } + public int NewPersonnelCount { get; set; } + + public double Price { get; set; } } \ No newline at end of file diff --git a/CompanyManagment.EFCore/Repository/InstitutionContractRepository.cs b/CompanyManagment.EFCore/Repository/InstitutionContractRepository.cs index faa9c3a1..ccac90d3 100644 --- a/CompanyManagment.EFCore/Repository/InstitutionContractRepository.cs +++ b/CompanyManagment.EFCore/Repository/InstitutionContractRepository.cs @@ -2464,6 +2464,7 @@ public class InstitutionContractRepository : RepositoryBase + { + var prevWorkshop = institutionContractAmendmentTemp.PrevWorkshops + .FirstOrDefault(w=> w.Id == x.Id); + var isNewWorkshop = prevWorkshop == null; + return new InsitutionContractAmendmentPaymentWorkshopResponse() + { + IsNewWorkshop = isNewWorkshop, + NewPersonnelCount = x.CountPerson, + PrevPersonnelCount = prevWorkshop?.CountPerson??0, + Price = x.PriceDifference, + OldServices = prevWorkshop != null? new WorkshopServicesViewModel() + { + Contract = prevWorkshop.ContractAndCheckout, + ContractInPerson = prevWorkshop.ContractAndCheckoutInPerson, + CustomizeCheckout = prevWorkshop.CustomizeCheckout, + Insurance = prevWorkshop.Insurance, + InsuranceInPerson = prevWorkshop.InsuranceInPerson, + RollCall = prevWorkshop.RollCall, + RollCallInPerson = prevWorkshop.RollCallInPerson, + }: new WorkshopServicesViewModel(), + NewServices = new WorkshopServicesViewModel() + { + Contract = x.ContractAndCheckout, + ContractInPerson = x.ContractAndCheckoutInPerson, + CustomizeCheckout = x.CustomizeCheckout, + Insurance = x.Insurance, + InsuranceInPerson = x.InsuranceInPerson, + RollCall = x.RollCall, + RollCallInPerson = x.RollCallInPerson, + }, + }; + }).ToList() }; res.OneTime = new InstitutionContractPaymentOneTimeViewModel()