diff --git a/CompanyManagment.EFCore/Repository/PersonnelCodeRepository.cs b/CompanyManagment.EFCore/Repository/PersonnelCodeRepository.cs index 48adbbe5..57e27cdc 100644 --- a/CompanyManagment.EFCore/Repository/PersonnelCodeRepository.cs +++ b/CompanyManagment.EFCore/Repository/PersonnelCodeRepository.cs @@ -94,7 +94,14 @@ public class PersonnelCodeRepository : RepositoryBase #region Mahan public long GetLastPersonnelCodeByWorkshop(long workshopId) { - return _context.PersonnelCodeSet.Where(x => x.WorkshopId == workshopId).Max(x => x.PersonnelCode); + var codes = _context.PersonnelCodeSet.Where(x => x.WorkshopId == workshopId); + + if (!codes.Any()) + { + return 0; // مقدار پیش‌فرض یا هندل خاص تو این حالت + } + + return codes.Max(x => x.PersonnelCode); } #endregion diff --git a/ServiceHost/Areas/Client/Pages/Company/SalaryAid/Index.cshtml.cs b/ServiceHost/Areas/Client/Pages/Company/SalaryAid/Index.cshtml.cs index 52c064d4..3f32b709 100644 --- a/ServiceHost/Areas/Client/Pages/Company/SalaryAid/Index.cshtml.cs +++ b/ServiceHost/Areas/Client/Pages/Company/SalaryAid/Index.cshtml.cs @@ -251,7 +251,7 @@ namespace ServiceHost.Areas.Client.Pages.Company.SalaryAid data = result }); } - public IActionResult OnGetCheckoutExists(string calculationDate, string employeeIds) + public IActionResult OnPostCheckoutExists(string calculationDate, string employeeIds) { var extractNumbers = employeeIds.ExtractNumbers(); var calculationDateGr = calculationDate.ToGeorgianDateTime(); diff --git a/ServiceHost/wwwroot/AssetsClient/pages/SalaryAid/js/ModalCreateNewSalaryAid.js b/ServiceHost/wwwroot/AssetsClient/pages/SalaryAid/js/ModalCreateNewSalaryAid.js index e65888e9..f8cb1055 100644 --- a/ServiceHost/wwwroot/AssetsClient/pages/SalaryAid/js/ModalCreateNewSalaryAid.js +++ b/ServiceHost/wwwroot/AssetsClient/pages/SalaryAid/js/ModalCreateNewSalaryAid.js @@ -333,7 +333,7 @@ function CheckExistAjax() { $.ajax({ async: false, dataType: 'json', - type: 'GET', + type: 'POST', url: checkoutExistsAjaxUrl, headers: { "RequestVerificationToken": antiForgeryToken }, traditional: true, diff --git a/ServiceHost/wwwroot/AssetsClient/pages/SalaryAid/js/ModalEditSalaryAid.js b/ServiceHost/wwwroot/AssetsClient/pages/SalaryAid/js/ModalEditSalaryAid.js index be9900b8..0832fb43 100644 --- a/ServiceHost/wwwroot/AssetsClient/pages/SalaryAid/js/ModalEditSalaryAid.js +++ b/ServiceHost/wwwroot/AssetsClient/pages/SalaryAid/js/ModalEditSalaryAid.js @@ -263,7 +263,7 @@ function CheckExistAjax() { $.ajax({ async: false, dataType: 'json', - type: 'GET', + type: 'POST', url: checkoutExistsAjaxUrl, headers: { "RequestVerificationToken": antiForgeryToken }, traditional: true, diff --git a/ServiceHost/wwwroot/AssetsClient/pages/SalaryAid/js/ModalImportExcel.js b/ServiceHost/wwwroot/AssetsClient/pages/SalaryAid/js/ModalImportExcel.js index e304bc92..1afcba7f 100644 --- a/ServiceHost/wwwroot/AssetsClient/pages/SalaryAid/js/ModalImportExcel.js +++ b/ServiceHost/wwwroot/AssetsClient/pages/SalaryAid/js/ModalImportExcel.js @@ -753,7 +753,7 @@ function CheckExistAjax() { $.ajax({ async: false, dataType: 'json', - type: 'GET', + type: 'POST', url: checkoutExistsAjaxUrl, headers: { "RequestVerificationToken": antiForgeryToken }, traditional: true,