diff --git a/Company.Domain/CheckoutAgg/ICheckoutRepository.cs b/Company.Domain/CheckoutAgg/ICheckoutRepository.cs index edb34ef8..d0cf8066 100644 --- a/Company.Domain/CheckoutAgg/ICheckoutRepository.cs +++ b/Company.Domain/CheckoutAgg/ICheckoutRepository.cs @@ -12,7 +12,7 @@ public interface ICheckoutRepository : IRepository { EditCheckout GetDetails(long id); - void CreateCkeckout(Checkout command); + Task CreateCkeckout(Checkout command); Task> Search(CheckoutSearchModel searchModel); diff --git a/CompanyManagment.Application/CheckoutApplication.cs b/CompanyManagment.Application/CheckoutApplication.cs index 0e753f3a..00143832 100644 --- a/CompanyManagment.Application/CheckoutApplication.cs +++ b/CompanyManagment.Application/CheckoutApplication.cs @@ -184,7 +184,7 @@ public class CheckoutApplication : ICheckoutApplication , command.OvertimePay, command.NightworkPay, command.FridayPay, 0, command.ShiftPay, familyAllowance, bunos, years, command.LeavePay, insuranceDeduction, 0, 0, 0, command.AbsenceDeduction, sumOfWorkingDays, command.ArchiveCode, command.PersonnelCode, totalClaims, totalDeductions, totalPayment, command.Signature,marriedAllowance,command.LeaveCheckout,command.CreditLeaves,command.AbsencePeriod,command.AverageHoursPerDay,command.HasRollCall,command.OverTimeWorkValue,command.OverNightWorkValue ,command.FridayWorkValue, command.RotatingShiftValue,command.AbsenceValue,command.TotalDayOfLeaveCompute,command.TotalDayOfYearsCompute,command.TotalDayOfBunosesCompute); - _checkoutRepository.CreateCkeckout(checkout); + _checkoutRepository.CreateCkeckout(checkout).GetAwaiter().GetResult(); //_checkoutRepository.SaveChanges(); //var employeeFullName = new SqlParameter("@EmployeeFullName", SqlDbType.NVarChar, 50); diff --git a/CompanyManagment.EFCore/Repository/CheckoutRepository.cs b/CompanyManagment.EFCore/Repository/CheckoutRepository.cs index de84fb74..97305a1a 100644 --- a/CompanyManagment.EFCore/Repository/CheckoutRepository.cs +++ b/CompanyManagment.EFCore/Repository/CheckoutRepository.cs @@ -94,14 +94,19 @@ public class CheckoutRepository : RepositoryBase, ICheckoutRepos .FirstOrDefault(x => x.Id == id); } - public void CreateCkeckout(Checkout command) + public async Task CreateCkeckout(Checkout command) { var creationDates = DateTime.Now; //var result = await _context.Database.ExecuteSqlInterpolatedAsync($"EXEC InsertQuery_Checkout {id},{employeeFullName},{isActiveString},{signature},{fathersName},{nationalCode},{dateOfBirth},{employeeId},{workshopName},{workshopId},{contractNo},{contractStart},{contractEnd},{month},{year},{contractId},{workingHoursId},{monthlySalary},{baseYearsPay},{consumableItems},{housingAllowance},{overtimePay},{nightworkPay},{fridayPay},{missionPay},{shiftPay},{familyAllowance},{bonusesPay},{yearsPay},{leavePay},{insuranceDeduction},{taxDeducation},{installmentDeduction},{salaryAidDeduction},{absenceDeduction},{creationDate},{archiveCode},{personnelCode},{sumOfWorkingDays},{totalClaims},{taxDeducation},{totalPayment}"); - var result = _context.Database.ExecuteSqlInterpolated( - $"EXEC InsertQuery_CreateChekoute {command.EmployeeFullName},{"true"},{command.Signature},{command.FathersName},{command.NationalCode},{command.DateOfBirth},{command.EmployeeId},{command.WorkshopName},{command.WorkshopId},{command.ContractNo},{command.ContractStart},{command.ContractEnd},{command.Month},{command.Year},{command.ContractId},{command.WorkingHoursId},{command.MonthlySalary},{command.BaseYearsPay},{command.ConsumableItems},{command.HousingAllowance},{command.OvertimePay},{command.NightworkPay},{command.FridayPay},{command.MissionPay},{command.ShiftPay},{command.FamilyAllowance},{command.BonusesPay},{command.YearsPay},{command.LeavePay},{command.InsuranceDeduction},{command.TaxDeducation},{command.InstallmentDeduction},{command.SalaryAidDeduction},{command.AbsenceDeduction},{creationDates},{command.ArchiveCode},{command.PersonnelCode},{command.SumOfWorkingDays},{command.TotalClaims},{command.TotalDeductions},{command.TotalPayment},{0},{command.MarriedAllowance},{command.AbsencePeriod},{command.AverageHoursPerDay},{command.CreditLeaves},{command.LeaveCheckout},{command.HasRollCall},{command.OverTimeWorkValue},{command.OverNightWorkValue},{command.FridayWorkValue},{command.RotatingShiftValue},{command.AbsenceValue}, {command.TotalDayOfLeaveCompute},{command.TotalDayOfYearsCompute},{command.TotalDayOfBunosesCompute}"); + var result = ( _context.Database + .SqlQuery( + $"EXEC InsertQuery_CreateChekoute {command.EmployeeFullName},{"true"},{command.Signature},{command.FathersName},{command.NationalCode},{command.DateOfBirth},{command.EmployeeId},{command.WorkshopName},{command.WorkshopId},{command.ContractNo},{command.ContractStart},{command.ContractEnd},{command.Month},{command.Year},{command.ContractId},{command.WorkingHoursId},{command.MonthlySalary},{command.BaseYearsPay},{command.ConsumableItems},{command.HousingAllowance},{command.OvertimePay},{command.NightworkPay},{command.FridayPay},{command.MissionPay},{command.ShiftPay},{command.FamilyAllowance},{command.BonusesPay},{command.YearsPay},{command.LeavePay},{command.InsuranceDeduction},{command.TaxDeducation},{command.InstallmentDeduction},{command.SalaryAidDeduction},{command.AbsenceDeduction},{creationDates},{command.ArchiveCode},{command.PersonnelCode},{command.SumOfWorkingDays},{command.TotalClaims},{command.TotalDeductions},{command.TotalPayment},{0},{command.MarriedAllowance},{command.AbsencePeriod},{command.AverageHoursPerDay},{command.CreditLeaves},{command.LeaveCheckout},{command.HasRollCall},{command.OverTimeWorkValue},{command.OverNightWorkValue},{command.FridayWorkValue},{command.RotatingShiftValue},{command.AbsenceValue}, {command.TotalDayOfLeaveCompute},{command.TotalDayOfYearsCompute},{command.TotalDayOfBunosesCompute}") + .AsEnumerable())// این قسمت مهمه! + .FirstOrDefault(); + Console.WriteLine(result); + }