RollCallEmployeeUploadPicture fixed bug

This commit is contained in:
SamSys
2024-11-27 19:19:45 +03:30
parent 26b361a494
commit 45fa25457d

View File

@@ -81,18 +81,18 @@ public class RollCallEmployeeRepository : RepositoryBase<long, RollCallEmployee>
var dateNow = DateTime.Now;
var employeeQuery = _context.Employees.AsQueryable();
if (!string.IsNullOrWhiteSpace(command.Name))
{
var rollCallNames = _context.RollCallEmployees.Where(x => command.WorkshopId == x.WorkshopId &&
x.EmployeeFullName.Contains(command.Name)).Select(
x => new
{
x.EmployeeId,
x.EmployeeFullName
});
//if (!string.IsNullOrWhiteSpace(command.Name))
//{
// var rollCallNames = _context.RollCallEmployees.Where(x => command.WorkshopId == x.WorkshopId &&
// x.EmployeeFullName.Contains(command.Name)).Select(
// x => new
// {
// x.EmployeeId,
// x.EmployeeFullName
// });
employeeQuery = employeeQuery.Where(x => rollCallNames.Any(y => y.EmployeeId == x.id));
}
// employeeQuery = employeeQuery.Where(x => rollCallNames.Any(y => y.EmployeeId == x.id));
//}
var rawQuery = employeeQuery.Include(x => x.LeftWorks).Include(x => x.LeftWorkInsurances)
.Where(x => x.LeftWorks.Any(y =>
@@ -104,7 +104,7 @@ public class RollCallEmployeeRepository : RepositoryBase<long, RollCallEmployee>
.Select(x => new
{
Id = x.id,
x.FullName,
FullName =x.FName +" "+x.LName,
x.NationalCode,
}).AsSplitQuery();
@@ -112,12 +112,12 @@ public class RollCallEmployeeRepository : RepositoryBase<long, RollCallEmployee>
var rollCallEmployees = _context.RollCallEmployees.Where(x => x.WorkshopId == command.WorkshopId);
var joinedQuery = from employee in rawQuery
join rollCallEmployee in rollCallEmployees
on employee.Id equals rollCallEmployee.EmployeeId into grp
from joinedRollCall in grp.DefaultIfEmpty()
from joinedRollCall in grp.DefaultIfEmpty()
select new RollCallEmployeeViewModel()
{
WorkshopId = command.WorkshopId,
@@ -130,7 +130,14 @@ public class RollCallEmployeeRepository : RepositoryBase<long, RollCallEmployee>
};
if (!string.IsNullOrWhiteSpace(command.Name))
{
joinedQuery = joinedQuery.Where(x => x.EmployeeFullName.Contains(command.Name));
}
var firstlist = joinedQuery.AsSplitQuery();
var list = firstlist.OrderByDescending(x => x.IsActiveString == "true" ? 1 : 0)
.ThenByDescending(x => x.HasUploadedImage == "true" ? 1 : 0)
.Skip(command.PageIndex).Take(30).ToList();