GetContractToCreateCheckout change

This commit is contained in:
gozareshgir
2026-01-22 12:37:28 +03:30
parent 7a79343b2f
commit d3dacceab1

View File

@@ -22,6 +22,7 @@ using CompanyManagment.App.Contracts.WorkingHoursTemp;
using CompanyManagment.App.Contracts.Workshop;
using CompanyManagment.EFCore.Migrations;
using CompanyManagment.EFCore.Repository;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
@@ -46,13 +47,13 @@ public class CheckoutApplication : ICheckoutApplication
private readonly IHolidayItemApplication _holidayItemApplication;
private readonly IWorkingHoursTempRepository _workingHoursTempRepository;
private readonly IWorkshopRepository _workshopRepository;
private readonly IAuthHelper _authHelper;
public CheckoutApplication(ICheckoutRepository checkoutRepository, IYearlySalaryRepository yearlySalaryRepository,
ILeftWorkRepository leftWorkRepository,
IEmployerRepository employerRepository, IPersonalContractingPartyApp contractingPartyApp, ILeaveApplication leaveApplication, IMandatoryHoursApplication mandatoryHoursApplication, IRollCallMandatoryRepository rollCallMandatoryRepository, IRollCallRepository rollCallRepository, IHolidayItemApplication holidayItemApplication, IWorkingHoursTempRepository workingHoursTempRepository, IWorkshopRepository workshopRepository)
IEmployerRepository employerRepository, IPersonalContractingPartyApp contractingPartyApp, ILeaveApplication leaveApplication, IMandatoryHoursApplication mandatoryHoursApplication, IRollCallMandatoryRepository rollCallMandatoryRepository, IRollCallRepository rollCallRepository, IHolidayItemApplication holidayItemApplication, IWorkingHoursTempRepository workingHoursTempRepository, IWorkshopRepository workshopRepository, IAuthHelper authHelper)
{
_checkoutRepository = checkoutRepository;
_yearlySalaryRepository = yearlySalaryRepository;
@@ -66,6 +67,7 @@ public class CheckoutApplication : ICheckoutApplication
_holidayItemApplication = holidayItemApplication;
_workingHoursTempRepository = workingHoursTempRepository;
_workshopRepository = workshopRepository;
_authHelper = authHelper;
}
[SuppressMessage("ReSharper.DPA", "DPA0007: Large number of DB records", MessageId = "count: 241")]
@@ -751,8 +753,19 @@ public class CheckoutApplication : ICheckoutApplication
var op = new OperationResult<List<ContractsListToCreateCheckoutDto>>();
if (workshopId < 1)
return op.Failed("کارگاه را انتخاب کنید");
if (string.IsNullOrWhiteSpace(year) || string.IsNullOrWhiteSpace(month))
return op.Failed("سال و ماه را انتخاب کنید");
if (!string.IsNullOrWhiteSpace(year) && string.IsNullOrWhiteSpace(month))
return op.Failed("ماه را انتخاب کنید");
if (string.IsNullOrWhiteSpace(year) && !string.IsNullOrWhiteSpace(month))
return op.Failed("سال را انتخاب کنید");
if (string.IsNullOrWhiteSpace(year) && string.IsNullOrWhiteSpace(month))
{
year = "0";
month = "0";
}
var result = await GetContractResultToCreateCheckout(workshopId, employeeId, year, month, null,
null);
if(result.CreateCheckoutList.Count == 0)
@@ -775,6 +788,49 @@ public class CheckoutApplication : ICheckoutApplication
return op.Succcedded(finalResult);
}
public async Task<OperationResult> CreateCheckoutApi(List<long> ContractsId, string ConvertYear, string ConvertMonth)
{
var op = new OperationResult();
//آی دی کاربر لاگین شده برای استفاده در signalR
var currentAcc = _authHelper.CurrentAccountId();
#region Validation
if (!string.IsNullOrWhiteSpace(ConvertYear) && string.IsNullOrWhiteSpace(ConvertMonth))
return op.Failed("ماه را انتخاب کنید");
if (string.IsNullOrWhiteSpace(ConvertYear) && !string.IsNullOrWhiteSpace(ConvertMonth))
return op.Failed("سال را انتخاب کنید");
if (string.IsNullOrWhiteSpace(ConvertYear) && string.IsNullOrWhiteSpace(ConvertMonth))
{
ConvertYear = "0";
ConvertMonth = "0";
var today = DateTime.Now;
var FaToday = today.ToFarsi();
var year = FaToday.Substring(0, 4);
var month = FaToday.Substring(5, 2);
ConvertYear = year;
ConvertMonth = month;
}
if (ContractsId.Count == 0)
return op.Failed("هیچ موردی انتخاب نشده اشت");
#endregion
#region GetInsuranceData
#endregion
return op.Succcedded();
}
#endregion