diff --git a/CompanyManagment.EFCore/Repository/CheckoutRepository.cs b/CompanyManagment.EFCore/Repository/CheckoutRepository.cs index cef202ba..9da33ea6 100644 --- a/CompanyManagment.EFCore/Repository/CheckoutRepository.cs +++ b/CompanyManagment.EFCore/Repository/CheckoutRepository.cs @@ -2229,40 +2229,41 @@ public class CheckoutRepository : RepositoryBase, ICheckoutRepos if (!hasSearch && !hasEmployeeOrWorkshpSearch) { - + return checkouts.Select(x => new CheckoutViewModel() - { + { - Id = x.ch.id, - EmployeeFullName = x.ch.EmployeeFullName, - ContractStart = x.ch.ContractStart.ToFarsi(), - ContractEnd = x.ch.ContractEnd.ToFarsi(), - ContractStartGr = x.ch.ContractStart, - ContractEndGr = x.ch.ContractEnd, - PersonnelCode = x.ch.PersonnelCode, - PersonnelCodeInt = Convert.ToInt32(x.ch.PersonnelCode), - ArchiveCode = x.workshop.ArchiveCode, - SumOfWorkingDays = x.ch.SumOfWorkingDays, - WorkshopName = x.workshop.WorkshopName, - Month = x.ch.Month, - Year = x.ch.Year, - ContractNo = x.ch.ContractNo, - ContractId = x.ch.ContractId, - WorkshopId = x.ch.WorkshopId, - EmployeeId = x.ch.EmployeeId, - EmployerId = x.workshopEmployer.EmployerId, - IsActiveString = x.ch.IsActiveString, - Signature = x.ch.Signature, - CreationDate = x.ch.CreationDate, - EmployerName = $"{x.workshopEmployer.Employer.FName} {x.workshopEmployer.Employer.LName}", - IsBlockCantracingParty = x.contractingParty.IsBlock, - HasSignCheckout = x.option != null ? x.option.SignCheckout : x.workshop.SignCheckout + Id = x.ch.id, + EmployeeFullName = x.ch.EmployeeFullName, + ContractStart = x.ch.ContractStart.ToFarsi(), + ContractEnd = x.ch.ContractEnd.ToFarsi(), + ContractStartGr = x.ch.ContractStart, + ContractEndGr = x.ch.ContractEnd, + PersonnelCode = x.ch.PersonnelCode, + PersonnelCodeInt = Convert.ToInt32(x.ch.PersonnelCode), + ArchiveCode = x.workshop.ArchiveCode, + SumOfWorkingDays = x.ch.SumOfWorkingDays, + WorkshopName = x.workshop.WorkshopName, + Month = x.ch.Month, + Year = x.ch.Year, + ContractNo = x.ch.ContractNo, + ContractId = x.ch.ContractId, + WorkshopId = x.ch.WorkshopId, + EmployeeId = x.ch.EmployeeId, + EmployerId = x.workshopEmployer.EmployerId, + IsActiveString = x.ch.IsActiveString, + Signature = x.ch.Signature, + CreationDate = x.ch.CreationDate, + EmployerName = $"{x.workshopEmployer.Employer.FName} {x.workshopEmployer.Employer.LName}", + IsBlockCantracingParty = x.contractingParty.IsBlock, + HasSignCheckout = x.option != null ? x.option.SignCheckout : x.workshop.SignCheckout - }).OrderByDescending(x => x.Id).ThenByDescending(x => x.Year).ThenBy(x => x.PersonnelCodeInt).Take(200) - .GroupBy(x => x.Id) - .Select(x => x.First()).ToList() - .OrderByDescending(x => x.Id).ThenByDescending(x => x.Year).ThenBy(x => x.PersonnelCodeInt).Take(50).ToList(); + }).OrderByDescending(x=>x.Id).Take(3000).ToList().DistinctBy(x => x.Id) + .OrderByDescending(x => x.Id).ThenByDescending(x => x.Year) + .ThenBy(x => x.PersonnelCodeInt) + .Take(50).ToList(); + } else if (hasSearch && !hasEmployeeOrWorkshpSearch) {