From 33a736ab5d5b3d22b42021be79dbfc8b89980482 Mon Sep 17 00:00:00 2001 From: MahanCh Date: Mon, 25 Aug 2025 14:42:27 +0330 Subject: [PATCH] feat: remove payment model parameter from GetTotalPaymentAndWorkshopList method --- ...ITemporaryClientRegistrationApplication.cs | 2 +- .../TemporaryClientRegistrationApplication.cs | 4 +- .../WorkshopAppliction.cs | 94 +++++++++++-------- .../institutionContractController.cs | 2 +- 4 files changed, 57 insertions(+), 45 deletions(-) diff --git a/CompanyManagment.App.Contracts/TemporaryClientRegistration/ITemporaryClientRegistrationApplication.cs b/CompanyManagment.App.Contracts/TemporaryClientRegistration/ITemporaryClientRegistrationApplication.cs index c9c00ee4..92b42050 100644 --- a/CompanyManagment.App.Contracts/TemporaryClientRegistration/ITemporaryClientRegistrationApplication.cs +++ b/CompanyManagment.App.Contracts/TemporaryClientRegistration/ITemporaryClientRegistrationApplication.cs @@ -74,7 +74,7 @@ public interface ITemporaryClientRegistrationApplication /// Task GetTotalPaymentAndWorkshopList(long contractingPartyTempId, List workshopList, - InstitutionContractDuration duration = InstitutionContractDuration.TwelveMonths, string paymentModel = "OneTime", string contractStartType = "currentMonth"); + InstitutionContractDuration duration = InstitutionContractDuration.TwelveMonths, string contractStartType = "currentMonth"); /// /// ایجاد یا ویرایش قرارداد موقت diff --git a/CompanyManagment.Application/TemporaryClientRegistrationApplication.cs b/CompanyManagment.Application/TemporaryClientRegistrationApplication.cs index eddbc722..4f16de8e 100644 --- a/CompanyManagment.Application/TemporaryClientRegistrationApplication.cs +++ b/CompanyManagment.Application/TemporaryClientRegistrationApplication.cs @@ -514,8 +514,7 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati } public async Task GetTotalPaymentAndWorkshopList(long contractingPartyTempId, - List workshops, InstitutionContractDuration duration = InstitutionContractDuration.TwelveMonths, - string paymentModel = "OneTime", string contractStartType = "currentMonth") + List workshops, InstitutionContractDuration duration = InstitutionContractDuration.TwelveMonths, string contractStartType = "currentMonth") { //دریافت کارگاه ها @@ -543,7 +542,6 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati result.Duration = duration; - result.PaymentModel = paymentModel; var tenPercent = result.SumOfWorkshopsPaymentDouble * 10 / 100; diff --git a/CompanyManagment.Application/WorkshopAppliction.cs b/CompanyManagment.Application/WorkshopAppliction.cs index cf67fa00..ad306adc 100644 --- a/CompanyManagment.Application/WorkshopAppliction.cs +++ b/CompanyManagment.Application/WorkshopAppliction.cs @@ -58,7 +58,7 @@ public class WorkshopAppliction : IWorkshopApplication bool createPlanValidations = false; var accountIds = new List(); var operation = new OperationResult(); - if (command.EmployerIdList==null) + if (command.EmployerIdList == null) return operation.Failed("لطفا کارفرما را انتخاب نمایید"); var employer = command.EmployerIdList.ToList(); if (command.AccountIdsList != null) @@ -66,45 +66,49 @@ public class WorkshopAppliction : IWorkshopApplication accountIds = command.AccountIdsList.ToList(); } - if (!string.IsNullOrEmpty(command.TypeOfInsuranceSend) && command.TypeOfInsuranceSend != "false" && string.IsNullOrEmpty(command.InsuranceCode)) + if (!string.IsNullOrEmpty(command.TypeOfInsuranceSend) && command.TypeOfInsuranceSend != "false" && + string.IsNullOrEmpty(command.InsuranceCode)) return operation.Failed("لطفا کد بیمه کارگاه را وارد کنید"); if (string.IsNullOrEmpty(command.WorkshopName) || string.IsNullOrEmpty(command.ArchiveCode)) return operation.Failed("موارد اجباری را پر کنید"); - //if (_workshopRepository.Exists(x => x.WorkshopName == command.WorkshopName)) - // return operation.Failed("نام کارگاه تکراری است"); + //if (_workshopRepository.Exists(x => x.WorkshopName == command.WorkshopName)) + // return operation.Failed("نام کارگاه تکراری است"); - if (command.ContractTerm != "1" && command.ContractTerm != "ForEver" && (command.CutContractEndOfYear != IsActive.False && command.CutContractEndOfYear != IsActive.True)) - return operation.Failed("لطفا تیک قرداداد منتهی به پایان سال را تعیین وضعیت کنید"); + if (command.ContractTerm != "1" && command.ContractTerm != "ForEver" && + (command.CutContractEndOfYear != IsActive.False && command.CutContractEndOfYear != IsActive.True)) + return operation.Failed("لطفا تیک قرداداد منتهی به پایان سال را تعیین وضعیت کنید"); - if (command.ContractTerm == "1" && command.ContractTerm == "ForEver") - command.CutContractEndOfYear = IsActive.None; - if (!command.CreateContract) - { - command.SignContract = false; - command.CreateCheckout = false; - command.SignCheckout = false; - } + if (command.ContractTerm == "1" && command.ContractTerm == "ForEver") + command.CutContractEndOfYear = IsActive.None; + if (!command.CreateContract) + { + command.SignContract = false; + command.CreateCheckout = false; + command.SignCheckout = false; + } - if (!command.CreateCheckout) - { - command.SignCheckout = false; - } + if (!command.CreateCheckout) + { + command.SignCheckout = false; + } - if (_workshopRepository.Exists(x => !string.IsNullOrEmpty(x.InsuranceCode) && x.InsuranceCode == command.InsuranceCode)) + if (_workshopRepository.Exists(x => + !string.IsNullOrEmpty(x.InsuranceCode) && x.InsuranceCode == command.InsuranceCode)) return operation.Failed("کد بیمه کارگاه تکراری است"); if (!string.IsNullOrEmpty(command.Address) && string.IsNullOrEmpty(command.State)) return operation.Failed("لطفا استان و شهر را انتخاب کنید"); - if ((!string.IsNullOrEmpty(command.Address) && !string.IsNullOrEmpty(command.State)) && command.City == "شهرستان") + if ((!string.IsNullOrEmpty(command.Address) && !string.IsNullOrEmpty(command.State)) && + command.City == "شهرستان") return operation.Failed("لطفا شهر را انتخاب کنید"); if (string.IsNullOrEmpty(command.Address) && !string.IsNullOrEmpty(command.State)) return operation.Failed("لطفا آدرس را وارد کنید"); - + if (command.FixedSalary) { if (command.InsuranceJobId == 0 || command.InsuranceJobId == null) @@ -115,12 +119,14 @@ public class WorkshopAppliction : IWorkshopApplication if (command.IsClassified) { - if (string.IsNullOrWhiteSpace(command.CreatePlan.ExecutionDateFa) || command.CreatePlan.ExecutionDateFa.Length < 10) + if (string.IsNullOrWhiteSpace(command.CreatePlan.ExecutionDateFa) || + command.CreatePlan.ExecutionDateFa.Length < 10) return operation.Failed("تاریخ اجرای طرح را بصورت صحیح وارد کنید"); - if(string.IsNullOrWhiteSpace(command.CreatePlan.IncludingDateFa) || command.CreatePlan.IncludingDateFa.Length <10) + if (string.IsNullOrWhiteSpace(command.CreatePlan.IncludingDateFa) || + command.CreatePlan.IncludingDateFa.Length < 10) return operation.Failed("تاریخ شمول طرح را بصورت صحیح وارد کنید"); var groupCounter = 0; - // var planEmployeeCounter = command.CreatePlan.EditWorkshopPlanEmployeeList == null ? 0 : command.CreatePlan.EditWorkshopPlanEmployeeList.Count; + // var planEmployeeCounter = command.CreatePlan.EditWorkshopPlanEmployeeList == null ? 0 : command.CreatePlan.EditWorkshopPlanEmployeeList.Count; for (int i = 0; i <= command.CreatePlan.EditGroupPlanlist.Count - 1; i++) { if (!string.IsNullOrWhiteSpace(command.CreatePlan.EditGroupPlanlist[i].AnnualSalaryStr) @@ -136,7 +142,7 @@ public class WorkshopAppliction : IWorkshopApplication if (groupCounter >= 1) { createPlanValidations = true; - + } else { @@ -144,31 +150,38 @@ public class WorkshopAppliction : IWorkshopApplication return operation.Failed("وارد کردن اطلاعات تمامی گروه ها الزامی است"); } } + //if (string.IsNullOrWhiteSpace(command.TypeOfInsuranceSend)) // return operation.Failed("لطفا نوع ارسال لیست بیمه را مشخص کنید"); var account = new AccountViewModel(); var institutionContract = new InstitutionContract(); - + if (command.HasRollCallFreeVip == "true") { - institutionContract = _institutionContractRepository.InstitutionContractByEmployerId(employer.FirstOrDefault()); + institutionContract = + _institutionContractRepository.InstitutionContractByEmployerId(employer.FirstOrDefault()); if (institutionContract == null) return operation.Failed("بدلیل نداشتن قرار داد مالی نمیتوانید سرویس حضور غیاب را فعال کنید"); - account = _personalContractingPartyRepository.GetAccountByPersonalContractingParty(institutionContract.ContractingPartyId); - if(account == null || account.ClientAreaPermission != "true") + account = _personalContractingPartyRepository.GetAccountByPersonalContractingParty(institutionContract + .ContractingPartyId); + if (account == null || account.ClientAreaPermission != "true") return operation.Failed("بدلیل نداشتن حساب کاربری کلاینت نمیتوانید سرویس حضور غیاب را فعال کنید"); - + } - var workshop = new Workshop(command.WorkshopName, command.WorkshopSureName, command.InsuranceCode, + + var workshop = new Workshop(command.WorkshopName, command.WorkshopSureName, command.InsuranceCode, command.TypeOfOwnership, command.ArchiveCode, command.AgentName, command.AgentPhone, command.State, command.City, command.Address, - command.TypeOfInsuranceSend, command.TypeOfContract,command.ContractTerm,command.AgreementNumber - ,command.FixedSalary, command.Population,command.InsuranceJobId,command.ZoneName,command.AddBonusesPay, - command.AddYearsPay,command.AddLeavePay,command.TotalPaymentHide,command.IsClassified,command.ComputeOptions, - command.BonusesOptions,command.YearsOptions,command.HasRollCallFreeVip,command.WorkshopHolidayWorking, - command.InsuranceCheckoutOvertime, command.InsuranceCheckoutFamilyAllowance, command.CreateContract, command.SignContract, - command.CreateCheckout, command.SignCheckout, command.CutContractEndOfYear,command.RotatingShiftCompute, command.IsStaticCheckout,institutionContract.ContractingPartyId); + command.TypeOfInsuranceSend, command.TypeOfContract, command.ContractTerm, command.AgreementNumber + , command.FixedSalary, command.Population, command.InsuranceJobId, command.ZoneName, command.AddBonusesPay, + command.AddYearsPay, command.AddLeavePay, command.TotalPaymentHide, command.IsClassified, + command.ComputeOptions, + command.BonusesOptions, command.YearsOptions, command.HasRollCallFreeVip, command.WorkshopHolidayWorking, + command.InsuranceCheckoutOvertime, command.InsuranceCheckoutFamilyAllowance, command.CreateContract, + command.SignContract, + command.CreateCheckout, command.SignCheckout, command.CutContractEndOfYear, command.RotatingShiftCompute, + command.IsStaticCheckout, institutionContract.ContractingPartyId); _workshopRepository.Create(workshop); _workshopRepository.SaveChanges(); @@ -185,19 +198,20 @@ public class WorkshopAppliction : IWorkshopApplication Duration = "12", HasCustomizeCheckoutService = command.HasCustomizeCheckoutService - }; + }; _rollCallServiceApplication.Create(commandSave); - + } + //مشاغل مقطوع if (createPlanValidations) { command.CreatePlan.WorkshopId = workshop.id; var creatPlan = _workshopPlanApplication.CreateWorkshopPlan(command.CreatePlan); } - + foreach (var e in employer) { diff --git a/ServiceHost/Areas/Admin/Controllers/institutionContractController.cs b/ServiceHost/Areas/Admin/Controllers/institutionContractController.cs index 864b410b..3d0b8e2f 100644 --- a/ServiceHost/Areas/Admin/Controllers/institutionContractController.cs +++ b/ServiceHost/Areas/Admin/Controllers/institutionContractController.cs @@ -610,7 +610,7 @@ public class institutionContractController : AdminBaseController [FromBody] InstitutionPlanCalculatorRequest request) { var res = await _temporaryClientRegistration.GetTotalPaymentAndWorkshopList(0, - request.workshopList, paymentModel: request.PaymentModel, contractStartType: request.ContractStartType,duration:request.Duration); + request.workshopList, contractStartType: request.ContractStartType,duration:request.Duration); var response = new InstitutionPlanCalculatorResponse { Installments = res.MonthlyInstallments,