fix not found bug in customize checkout

This commit is contained in:
2025-03-30 13:18:33 +03:30
parent 4b0c700b3e
commit 6526aefbbf
4 changed files with 10 additions and 7 deletions

View File

@@ -106,7 +106,7 @@ namespace CompanyManagment.EFCore.Repository
var employeePicMediaIdInEmployeeDoc = _companyContext.EmployeeDocumentItems.Where(x => customizeCheckoutsQuery
.Any(y => y.WorkshopId == x.WorkshopId && y.EmployeeId == x.EmployeeId) &&
x.DocumentLabel == DocumentItemLabel.EmployeePicture &&
x.DocumentStatus == DocumentStatus.Confirmed)
x.DocumentStatus == DocumentStatus.Confirmed)
?.Select(x => new { x.EmployeeId, x.MediaId }).ToList();
var mediasInEmployeeDoc = _accountContext.Medias.Where(x => employeePicMediaIdInEmployeeDoc.Select(y => y.MediaId).Contains(x.id)).ToList();
@@ -128,14 +128,13 @@ namespace CompanyManagment.EFCore.Repository
var employeeIds = customizeCheckoutsQuery.Select(x => x.EmployeeId).ToList()
.Where(x => !employeePictures.Select(e => e.Id).Contains(x)).ToList();
foreach (var employeeId in employeeIds)
{
var directoryPath = $"{_webHostEnvironment.ContentRootPath}\\Faces\\{workshopId}\\{employeeId}";
var directoryPath = $"{_webHostEnvironment.ContentRootPath}\\Faces\\{workshopId}\\{employeeId}\\1.jpg";
if (!Directory.Exists(directoryPath))
continue;
if (!System.IO.File.Exists(directoryPath))
throw new FileNotFoundException("فایل مورد نظر یافت نشد.", directoryPath);
continue;
byte[] fileBytes = System.IO.File.ReadAllBytes(directoryPath);
var base64 = Convert.ToBase64String(fileBytes);
@@ -222,11 +221,12 @@ namespace CompanyManagment.EFCore.Repository
SalaryAidDateTimeGe = s.SalaryAidDateTime
}).ToList(),
LateToWorkValue = x.LateToWorkValue == TimeSpan.Zero ? "-" : $"{(int)x.LateToWorkValue.TotalHours}:{x.LateToWorkValue.Minutes:D2}",
LateToWorkValue = x.LateToWorkValue == TimeSpan.Zero ? "-" : $"{(int)x.LateToWorkValue.TotalHours}:{Convert.ToInt32(x.LateToWorkValue.TotalMinutes % 60):00}",
SettingSalary = x.SettingSalary.ToMoney(),
DailyWage = x.DailyWage.ToMoney(),
ShiftStatus = x.ShiftStatus,
EmployeePicture = employeePictures.FirstOrDefault(p => p.Id == x.EmployeeId).Picture ?? "",
}).ToList();
List<WorkshopViewModel> workshopsList = workshopsQuery.Select(x => new WorkshopViewModel
@@ -279,6 +279,9 @@ namespace CompanyManagment.EFCore.Repository
foreach (var checkout in customizeCheckoutsList)
{
checkout.EmployeePicture =
employeePictures.FirstOrDefault(p => p.Id == checkout.EmployeeId).Picture ?? "";
checkout.PrintCounter = counter++;
//var leftwork = leftWorksList.FirstOrDefault(x => checkout.WorkshopId == x.WorkshopId && x.EmployeeId == checkout.EmployeeId);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 196 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 195 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB