change thumbnails for list

This commit is contained in:
2025-06-01 19:00:57 +03:30
parent 5bebec3fde
commit de52a0be98

View File

@@ -1173,7 +1173,17 @@ public class EmployeeDocumentsRepository : RepositoryBase<long, EmployeeDocument
//RequiredDocuments = requiredDocs
};
}).ToList();
result.ForEach(x =>
{
x.EmployeePicture.PicturePath = GetThumbnailPathFromFilePath(x.EmployeePicture.PicturePath);
x.IdCardPage1.PicturePath = GetThumbnailPathFromFilePath(x.IdCardPage1.PicturePath);
x.IdCardPage2.PicturePath = GetThumbnailPathFromFilePath(x.IdCardPage2.PicturePath);
x.IdCardPage3.PicturePath = GetThumbnailPathFromFilePath(x.IdCardPage3.PicturePath);
x.IdCardPage4.PicturePath = GetThumbnailPathFromFilePath(x.IdCardPage4.PicturePath);
x.NationalCardFront.PicturePath = GetThumbnailPathFromFilePath(x.NationalCardFront.PicturePath);
x.NationalCardRear.PicturePath = GetThumbnailPathFromFilePath(x.NationalCardRear.PicturePath);
x.MilitaryServiceCard.PicturePath = GetThumbnailPathFromFilePath(x.MilitaryServiceCard.PicturePath);
});
return result;
}
@@ -1194,7 +1204,7 @@ public class EmployeeDocumentsRepository : RepositoryBase<long, EmployeeDocument
.GroupBy(x => x.WorkshopId).Select(x => new WorkshopWithEmployeeDocumentsViewModel()
{
WorkshopId = x.Key,
WorkshopFullName = x.FirstOrDefault().Workshop.WorkshopName,
WorkshopFullName = x.FirstOrDefault().Workshop.WorkshopFullName,
EmployeesWithoutDocumentCount = x.Count()
});
@@ -1301,7 +1311,19 @@ public class EmployeeDocumentsRepository : RepositoryBase<long, EmployeeDocument
};
}).ToList();
return result;
result.ForEach(x =>
{
x.EmployeePicture.PicturePath = GetThumbnailPathFromFilePath(x.EmployeePicture.PicturePath);
x.IdCardPage1.PicturePath = GetThumbnailPathFromFilePath(x.IdCardPage1.PicturePath);
x.IdCardPage2.PicturePath = GetThumbnailPathFromFilePath(x.IdCardPage2.PicturePath);
x.IdCardPage3.PicturePath = GetThumbnailPathFromFilePath(x.IdCardPage3.PicturePath);
x.IdCardPage4.PicturePath = GetThumbnailPathFromFilePath(x.IdCardPage4.PicturePath);
x.NationalCardFront.PicturePath = GetThumbnailPathFromFilePath(x.NationalCardFront.PicturePath);
x.NationalCardRear.PicturePath = GetThumbnailPathFromFilePath(x.NationalCardRear.PicturePath);
x.MilitaryServiceCard.PicturePath = GetThumbnailPathFromFilePath(x.MilitaryServiceCard.PicturePath);
});
return result;
}
public async Task<List<WorkshopWithEmployeeDocumentsViewModel>> GetClientRejectedDocumentWorkshopsForAdmin(List<long> workshops, long roleId)
@@ -1463,9 +1485,19 @@ public class EmployeeDocumentsRepository : RepositoryBase<long, EmployeeDocument
//RequiredDocuments = requiredDocs
};
}).ToList();
result.ForEach(x =>
{
x.EmployeePicture.PicturePath = GetThumbnailPathFromFilePath(x.EmployeePicture.PicturePath);
x.IdCardPage1.PicturePath = GetThumbnailPathFromFilePath(x.IdCardPage1.PicturePath);
x.IdCardPage2.PicturePath = GetThumbnailPathFromFilePath(x.IdCardPage2.PicturePath);
x.IdCardPage3.PicturePath = GetThumbnailPathFromFilePath(x.IdCardPage3.PicturePath);
x.IdCardPage4.PicturePath = GetThumbnailPathFromFilePath(x.IdCardPage4.PicturePath);
x.NationalCardFront.PicturePath = GetThumbnailPathFromFilePath(x.NationalCardFront.PicturePath);
x.NationalCardRear.PicturePath = GetThumbnailPathFromFilePath(x.NationalCardRear.PicturePath);
x.MilitaryServiceCard.PicturePath = GetThumbnailPathFromFilePath(x.MilitaryServiceCard.PicturePath);
});
return result;
return result;
}
public async Task<List<EmployeeDocumentsViewModel>> GetClientRejectedDocumentForClient(long workshopId, long accountId)
@@ -1568,8 +1600,18 @@ public class EmployeeDocumentsRepository : RepositoryBase<long, EmployeeDocument
//RequiredDocuments = requiredDocs
};
}).ToList();
return result;
result.ForEach(x =>
{
x.EmployeePicture.PicturePath = GetThumbnailPathFromFilePath(x.EmployeePicture.PicturePath);
x.IdCardPage1.PicturePath = GetThumbnailPathFromFilePath(x.IdCardPage1.PicturePath);
x.IdCardPage2.PicturePath = GetThumbnailPathFromFilePath(x.IdCardPage2.PicturePath);
x.IdCardPage3.PicturePath = GetThumbnailPathFromFilePath(x.IdCardPage3.PicturePath);
x.IdCardPage4.PicturePath = GetThumbnailPathFromFilePath(x.IdCardPage4.PicturePath);
x.NationalCardFront.PicturePath = GetThumbnailPathFromFilePath(x.NationalCardFront.PicturePath);
x.NationalCardRear.PicturePath = GetThumbnailPathFromFilePath(x.NationalCardRear.PicturePath);
x.MilitaryServiceCard.PicturePath = GetThumbnailPathFromFilePath(x.MilitaryServiceCard.PicturePath);
});
return result;
}
//ToDo آپلود مدارک و افزودن پرسنل
@@ -1646,8 +1688,12 @@ public class EmployeeDocumentsRepository : RepositoryBase<long, EmployeeDocument
};
}
private static string GetThumbnailPathFromFilePath(string filePath)
{
return string.IsNullOrWhiteSpace(filePath) ? string.Empty : Path.Combine(Path.GetDirectoryName(filePath)!, Path.GetFileNameWithoutExtension(filePath) + $"-thumbnail{Path.GetExtension(filePath)}");
}
private static EmployeeDocumentItemViewModel GetByLabelAndLoadMedia(List<EmployeeDocumentItemViewModel> items,
private static EmployeeDocumentItemViewModel GetByLabelAndLoadMedia(List<EmployeeDocumentItemViewModel> items,
List<MediaViewModel> medias, DocumentItemLabel label)
{
if (items == null || items.Count == 0)