feat: remove payment model parameter from GetTotalPaymentAndWorkshopList method

This commit is contained in:
MahanCh
2025-08-25 14:42:27 +03:30
parent 859f8ea8ca
commit 33a736ab5d
4 changed files with 57 additions and 45 deletions

View File

@@ -74,7 +74,7 @@ public interface ITemporaryClientRegistrationApplication
/// <returns></returns>
Task<ReviewAndPaymentViewModel> GetTotalPaymentAndWorkshopList(long contractingPartyTempId,
List<WorkshopTempViewModel> workshopList,
InstitutionContractDuration duration = InstitutionContractDuration.TwelveMonths, string paymentModel = "OneTime", string contractStartType = "currentMonth");
InstitutionContractDuration duration = InstitutionContractDuration.TwelveMonths, string contractStartType = "currentMonth");
/// <summary>
/// ایجاد یا ویرایش قرارداد موقت

View File

@@ -514,8 +514,7 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
}
public async Task<ReviewAndPaymentViewModel> GetTotalPaymentAndWorkshopList(long contractingPartyTempId,
List<WorkshopTempViewModel> workshops, InstitutionContractDuration duration = InstitutionContractDuration.TwelveMonths,
string paymentModel = "OneTime", string contractStartType = "currentMonth")
List<WorkshopTempViewModel> 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;

View File

@@ -58,7 +58,7 @@ public class WorkshopAppliction : IWorkshopApplication
bool createPlanValidations = false;
var accountIds = new List<long>();
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)
{

View File

@@ -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,