|
|
|
|
@@ -1,23 +1,24 @@
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using _0_Framework.Application;
|
|
|
|
|
using _0_Framework.Application;
|
|
|
|
|
using _0_Framework.Application.Enums;
|
|
|
|
|
using _0_Framework.Exceptions;
|
|
|
|
|
using _0_Framework.InfraStructure;
|
|
|
|
|
using Company.Domain.ClientEmployeeWorkshopAgg;
|
|
|
|
|
using Company.Domain.EmployeeAccountAgg;
|
|
|
|
|
using Company.Domain.EmployeeAgg;
|
|
|
|
|
using CompanyManagment.App.Contracts.Employee;
|
|
|
|
|
using Company.Domain.EmployeeInsuranceRecordAgg;
|
|
|
|
|
using Company.Domain.InsuranceListAgg;
|
|
|
|
|
using CompanyManagment.App.Contracts.Employee;
|
|
|
|
|
using CompanyManagment.App.Contracts.Employee.DTO;
|
|
|
|
|
using CompanyManagment.App.Contracts.EmployeeInsuranceRecord;
|
|
|
|
|
using CompanyManagment.App.Contracts.LeftWorkTemp;
|
|
|
|
|
using Microsoft.Data.SqlClient;
|
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
|
using Microsoft.Extensions.Configuration;
|
|
|
|
|
using CompanyManagment.App.Contracts.Employee.DTO;
|
|
|
|
|
using CompanyManagment.App.Contracts.LeftWorkTemp;
|
|
|
|
|
using _0_Framework.Application.Enums;
|
|
|
|
|
using _0_Framework.Exceptions;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace CompanyManagment.EFCore.Repository;
|
|
|
|
|
|
|
|
|
|
@@ -33,7 +34,7 @@ public class EmployeeRepository : RepositoryBase<long, Employee>, IEmployeeRepos
|
|
|
|
|
public bool city = true;
|
|
|
|
|
public DateTime initial = new DateTime(1922, 01, 01, 00, 00, 00, 0000000);
|
|
|
|
|
private readonly IAuthHelper _authHelper;
|
|
|
|
|
public EmployeeRepository(CompanyContext context, IConfiguration configuration, IAuthHelper authHelper) :base(context)
|
|
|
|
|
public EmployeeRepository(CompanyContext context, IConfiguration configuration, IAuthHelper authHelper) : base(context)
|
|
|
|
|
{
|
|
|
|
|
_context = context;
|
|
|
|
|
_configuration = configuration;
|
|
|
|
|
@@ -42,13 +43,13 @@ public class EmployeeRepository : RepositoryBase<long, Employee>, IEmployeeRepos
|
|
|
|
|
|
|
|
|
|
public List<EmployeeViewModel> GetEmployee()
|
|
|
|
|
{
|
|
|
|
|
return _context.Employees.Where(x=>x.IsActive).Select(x => new EmployeeViewModel
|
|
|
|
|
return _context.Employees.Where(x => x.IsActive).Select(x => new EmployeeViewModel
|
|
|
|
|
{
|
|
|
|
|
Id = x.id,
|
|
|
|
|
FName = x.FName,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LName = x.LName,
|
|
|
|
|
EmployeeFullName = x.FName +" "+x.LName,
|
|
|
|
|
EmployeeFullName = x.FName + " " + x.LName,
|
|
|
|
|
FatherName = x.FatherName,
|
|
|
|
|
NationalCode = x.NationalCode,
|
|
|
|
|
IdNumber = x.IdNumber,
|
|
|
|
|
@@ -61,48 +62,48 @@ public class EmployeeRepository : RepositoryBase<long, Employee>, IEmployeeRepos
|
|
|
|
|
public EditEmployee GetDetails(long id)
|
|
|
|
|
{
|
|
|
|
|
return _context.Employees.Select(x => new EditEmployee
|
|
|
|
|
{
|
|
|
|
|
Id = x.id,
|
|
|
|
|
FName = x.FName,
|
|
|
|
|
LName = x.LName,
|
|
|
|
|
Gender = x.Gender,
|
|
|
|
|
NationalCode = x.NationalCode,
|
|
|
|
|
IdNumber = x.IdNumber,
|
|
|
|
|
Nationality = x.Nationality,
|
|
|
|
|
FatherName = x.FatherName,
|
|
|
|
|
DateOfBirth = x.DateOfBirth == initial ? "" : x.DateOfBirth.ToFarsi(),
|
|
|
|
|
DateOfIssue = x.DateOfIssue == initial ? "" : x.DateOfIssue.ToFarsi(),
|
|
|
|
|
PlaceOfIssue = x.PlaceOfIssue,
|
|
|
|
|
Phone = x.Phone,
|
|
|
|
|
Address = x.Address,
|
|
|
|
|
State = x.State,
|
|
|
|
|
City = x.City,
|
|
|
|
|
MaritalStatus = x.MaritalStatus,
|
|
|
|
|
MilitaryService = x.MilitaryService,
|
|
|
|
|
LevelOfEducation = x.LevelOfEducation,
|
|
|
|
|
FieldOfStudy = x.FieldOfStudy,
|
|
|
|
|
BankCardNumber = x.BankCardNumber,
|
|
|
|
|
BankBranch = x.BankBranch,
|
|
|
|
|
InsuranceCode = x.InsuranceCode,
|
|
|
|
|
InsuranceHistoryByYear = x.InsuranceHistoryByYear,
|
|
|
|
|
InsuranceHistoryByMonth = x.InsuranceHistoryByMonth,
|
|
|
|
|
NumberOfChildren = x.NumberOfChildren,
|
|
|
|
|
OfficePhone = x.OfficePhone,
|
|
|
|
|
EmployeeFullName = x.FName + " " + x.LName,
|
|
|
|
|
MclsUserName =x.MclsUserName,
|
|
|
|
|
MclsPassword = x.MclsPassword,
|
|
|
|
|
EserviceUserName = x.EserviceUserName,
|
|
|
|
|
EservicePassword = x.EservicePassword,
|
|
|
|
|
TaxOfficeUserName = x.TaxOfficeUserName,
|
|
|
|
|
TaxOfficepassword = x.TaxOfficepassword,
|
|
|
|
|
SanaUserName = x.SanaUserName,
|
|
|
|
|
SanaPassword = x.SanaPassword,
|
|
|
|
|
{
|
|
|
|
|
Id = x.id,
|
|
|
|
|
FName = x.FName,
|
|
|
|
|
LName = x.LName,
|
|
|
|
|
Gender = x.Gender,
|
|
|
|
|
NationalCode = x.NationalCode,
|
|
|
|
|
IdNumber = x.IdNumber,
|
|
|
|
|
Nationality = x.Nationality,
|
|
|
|
|
FatherName = x.FatherName,
|
|
|
|
|
DateOfBirth = x.DateOfBirth == initial ? "" : x.DateOfBirth.ToFarsi(),
|
|
|
|
|
DateOfIssue = x.DateOfIssue == initial ? "" : x.DateOfIssue.ToFarsi(),
|
|
|
|
|
PlaceOfIssue = x.PlaceOfIssue,
|
|
|
|
|
Phone = x.Phone,
|
|
|
|
|
Address = x.Address,
|
|
|
|
|
State = x.State,
|
|
|
|
|
City = x.City,
|
|
|
|
|
MaritalStatus = x.MaritalStatus,
|
|
|
|
|
MilitaryService = x.MilitaryService,
|
|
|
|
|
LevelOfEducation = x.LevelOfEducation,
|
|
|
|
|
FieldOfStudy = x.FieldOfStudy,
|
|
|
|
|
BankCardNumber = x.BankCardNumber,
|
|
|
|
|
BankBranch = x.BankBranch,
|
|
|
|
|
InsuranceCode = x.InsuranceCode,
|
|
|
|
|
InsuranceHistoryByYear = x.InsuranceHistoryByYear,
|
|
|
|
|
InsuranceHistoryByMonth = x.InsuranceHistoryByMonth,
|
|
|
|
|
NumberOfChildren = x.NumberOfChildren,
|
|
|
|
|
OfficePhone = x.OfficePhone,
|
|
|
|
|
EmployeeFullName = x.FName + " " + x.LName,
|
|
|
|
|
MclsUserName = x.MclsUserName,
|
|
|
|
|
MclsPassword = x.MclsPassword,
|
|
|
|
|
EserviceUserName = x.EserviceUserName,
|
|
|
|
|
EservicePassword = x.EservicePassword,
|
|
|
|
|
TaxOfficeUserName = x.TaxOfficeUserName,
|
|
|
|
|
TaxOfficepassword = x.TaxOfficepassword,
|
|
|
|
|
SanaUserName = x.SanaUserName,
|
|
|
|
|
SanaPassword = x.SanaPassword,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
.FirstOrDefault(x => x.Id == id);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async Task<List<EmployeeViewModel>> Search(EmployeeSearchModel searchModel)
|
|
|
|
|
@@ -182,10 +183,10 @@ public class EmployeeRepository : RepositoryBase<long, Employee>, IEmployeeRepos
|
|
|
|
|
return query.OrderByDescending(x => x.Id).Take(100).ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async Task<List<EmployeeSelectListViewModel>> GetEmployeeToList()
|
|
|
|
|
public async Task<List<EmployeeSelectListViewModel>> GetEmployeeToList()
|
|
|
|
|
{
|
|
|
|
|
var watch = System.Diagnostics.Stopwatch.StartNew();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<EmployeeSelectListViewModel> result = null;
|
|
|
|
|
var connection = _configuration.GetConnectionString("MesbahDb");
|
|
|
|
|
using (var conn = new SqlConnection(connection))
|
|
|
|
|
@@ -195,7 +196,7 @@ public class EmployeeRepository : RepositoryBase<long, Employee>, IEmployeeRepos
|
|
|
|
|
var command = new SqlCommand("EmployeeFullNameId", conn);
|
|
|
|
|
command.CommandType = CommandType.StoredProcedure;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
using (var reader = await command.ExecuteReaderAsync())
|
|
|
|
|
{
|
|
|
|
|
@@ -273,45 +274,45 @@ public class EmployeeRepository : RepositoryBase<long, Employee>, IEmployeeRepos
|
|
|
|
|
public EditEmployee GetDetailsByADDate(long id)
|
|
|
|
|
{
|
|
|
|
|
return _context.Employees.Select(x => new EditEmployee
|
|
|
|
|
{
|
|
|
|
|
Id = x.id,
|
|
|
|
|
FName = x.FName,
|
|
|
|
|
LName = x.LName,
|
|
|
|
|
Gender = x.Gender,
|
|
|
|
|
NationalCode = x.NationalCode,
|
|
|
|
|
IdNumber = x.IdNumber,
|
|
|
|
|
Nationality = x.Nationality,
|
|
|
|
|
FatherName = x.FatherName,
|
|
|
|
|
DateOfBirthGr = x.DateOfBirth ,
|
|
|
|
|
DateOfIssueGr = x.DateOfIssue ,
|
|
|
|
|
DateOfBirth = x.DateOfBirth.ToFarsi(),
|
|
|
|
|
DateOfIssue = x.DateOfIssue.ToFarsi(),
|
|
|
|
|
PlaceOfIssue = x.PlaceOfIssue,
|
|
|
|
|
Phone = x.Phone,
|
|
|
|
|
Address = x.Address,
|
|
|
|
|
State = x.State,
|
|
|
|
|
City = x.City,
|
|
|
|
|
MaritalStatus = x.MaritalStatus,
|
|
|
|
|
MilitaryService = x.MilitaryService,
|
|
|
|
|
LevelOfEducation = x.LevelOfEducation,
|
|
|
|
|
FieldOfStudy = x.FieldOfStudy,
|
|
|
|
|
BankCardNumber = x.BankCardNumber,
|
|
|
|
|
BankBranch = x.BankBranch,
|
|
|
|
|
InsuranceCode = x.InsuranceCode,
|
|
|
|
|
InsuranceHistoryByYear = x.InsuranceHistoryByYear,
|
|
|
|
|
InsuranceHistoryByMonth = x.InsuranceHistoryByMonth,
|
|
|
|
|
NumberOfChildren = x.NumberOfChildren,
|
|
|
|
|
OfficePhone = x.OfficePhone,
|
|
|
|
|
EmployeeFullName = x.FName + " " + x.LName,
|
|
|
|
|
MclsUserName = x.MclsUserName,
|
|
|
|
|
MclsPassword = x.MclsPassword,
|
|
|
|
|
EserviceUserName = x.EserviceUserName,
|
|
|
|
|
EservicePassword = x.EservicePassword,
|
|
|
|
|
TaxOfficeUserName = x.TaxOfficeUserName,
|
|
|
|
|
TaxOfficepassword = x.TaxOfficepassword,
|
|
|
|
|
SanaUserName = x.SanaUserName,
|
|
|
|
|
SanaPassword = x.SanaPassword,
|
|
|
|
|
})
|
|
|
|
|
{
|
|
|
|
|
Id = x.id,
|
|
|
|
|
FName = x.FName,
|
|
|
|
|
LName = x.LName,
|
|
|
|
|
Gender = x.Gender,
|
|
|
|
|
NationalCode = x.NationalCode,
|
|
|
|
|
IdNumber = x.IdNumber,
|
|
|
|
|
Nationality = x.Nationality,
|
|
|
|
|
FatherName = x.FatherName,
|
|
|
|
|
DateOfBirthGr = x.DateOfBirth,
|
|
|
|
|
DateOfIssueGr = x.DateOfIssue,
|
|
|
|
|
DateOfBirth = x.DateOfBirth.ToFarsi(),
|
|
|
|
|
DateOfIssue = x.DateOfIssue.ToFarsi(),
|
|
|
|
|
PlaceOfIssue = x.PlaceOfIssue,
|
|
|
|
|
Phone = x.Phone,
|
|
|
|
|
Address = x.Address,
|
|
|
|
|
State = x.State,
|
|
|
|
|
City = x.City,
|
|
|
|
|
MaritalStatus = x.MaritalStatus,
|
|
|
|
|
MilitaryService = x.MilitaryService,
|
|
|
|
|
LevelOfEducation = x.LevelOfEducation,
|
|
|
|
|
FieldOfStudy = x.FieldOfStudy,
|
|
|
|
|
BankCardNumber = x.BankCardNumber,
|
|
|
|
|
BankBranch = x.BankBranch,
|
|
|
|
|
InsuranceCode = x.InsuranceCode,
|
|
|
|
|
InsuranceHistoryByYear = x.InsuranceHistoryByYear,
|
|
|
|
|
InsuranceHistoryByMonth = x.InsuranceHistoryByMonth,
|
|
|
|
|
NumberOfChildren = x.NumberOfChildren,
|
|
|
|
|
OfficePhone = x.OfficePhone,
|
|
|
|
|
EmployeeFullName = x.FName + " " + x.LName,
|
|
|
|
|
MclsUserName = x.MclsUserName,
|
|
|
|
|
MclsPassword = x.MclsPassword,
|
|
|
|
|
EserviceUserName = x.EserviceUserName,
|
|
|
|
|
EservicePassword = x.EservicePassword,
|
|
|
|
|
TaxOfficeUserName = x.TaxOfficeUserName,
|
|
|
|
|
TaxOfficepassword = x.TaxOfficepassword,
|
|
|
|
|
SanaUserName = x.SanaUserName,
|
|
|
|
|
SanaPassword = x.SanaPassword,
|
|
|
|
|
})
|
|
|
|
|
.FirstOrDefault(x => x.Id == id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -324,7 +325,7 @@ public class EmployeeRepository : RepositoryBase<long, Employee>, IEmployeeRepos
|
|
|
|
|
EmployeeFullName = x.FName + " " + x.LName,
|
|
|
|
|
IsActive = x.IsActive
|
|
|
|
|
|
|
|
|
|
}).Where(x=>x.IsActive).ToList();
|
|
|
|
|
}).Where(x => x.IsActive).ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region Client
|
|
|
|
|
@@ -452,7 +453,7 @@ public class EmployeeRepository : RepositoryBase<long, Employee>, IEmployeeRepos
|
|
|
|
|
|
|
|
|
|
var employeeData = new Employee(command.FName, command.LName, command.FatherName, dateOfBirth,
|
|
|
|
|
dateOfIssue,
|
|
|
|
|
command.PlaceOfIssue, command.NationalCode, command.IdNumber, command.Gender, command.Nationality,command.IdNumberSerial,command.IdNumberSeri,
|
|
|
|
|
command.PlaceOfIssue, command.NationalCode, command.IdNumber, command.Gender, command.Nationality, command.IdNumberSerial, command.IdNumberSeri,
|
|
|
|
|
command.Phone, command.Address,
|
|
|
|
|
command.State, command.City, command.MaritalStatus, command.MilitaryService, command.LevelOfEducation,
|
|
|
|
|
command.FieldOfStudy, command.BankCardNumber,
|
|
|
|
|
@@ -706,20 +707,20 @@ public class EmployeeRepository : RepositoryBase<long, Employee>, IEmployeeRepos
|
|
|
|
|
{
|
|
|
|
|
case null:
|
|
|
|
|
case "":
|
|
|
|
|
query = query.Where(x => x.IsActive == true).ToList();
|
|
|
|
|
break;
|
|
|
|
|
query = query.Where(x => x.IsActive == true).ToList();
|
|
|
|
|
break;
|
|
|
|
|
case "false":
|
|
|
|
|
query = query.Where(x => x.IsActive == false).ToList();
|
|
|
|
|
hasSearch = true;
|
|
|
|
|
break;
|
|
|
|
|
query = query.Where(x => x.IsActive == false).ToList();
|
|
|
|
|
hasSearch = true;
|
|
|
|
|
break;
|
|
|
|
|
case "both":
|
|
|
|
|
query = query.Where(x => x.IsActive == true || x.IsActive == false).ToList();
|
|
|
|
|
hasSearch = true;
|
|
|
|
|
break;
|
|
|
|
|
query = query.Where(x => x.IsActive == true || x.IsActive == false).ToList();
|
|
|
|
|
hasSearch = true;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (hasSearch)
|
|
|
|
|
{
|
|
|
|
|
return query.OrderByDescending(x => x.Id).ToList();
|
|
|
|
|
@@ -816,11 +817,11 @@ public class EmployeeRepository : RepositoryBase<long, Employee>, IEmployeeRepos
|
|
|
|
|
var employeesQuery = _context.Employees.Where(x =>
|
|
|
|
|
workshopActiveLeftWorksQuery.Any(y => y.EmployeeId == x.id) ||
|
|
|
|
|
workshopActiveInsuranceLeftWorksQuery.Any(y => y.EmployeeId == x.id)).Select(x => new
|
|
|
|
|
{
|
|
|
|
|
leftWork = workshopActiveLeftWorksQuery.Where(l => l.EmployeeId == x.id).OrderByDescending(i => i.StartWorkDate).FirstOrDefault(),
|
|
|
|
|
insuranceLeftWork = workshopActiveInsuranceLeftWorksQuery.Where(i => i.EmployeeId == x.id).OrderByDescending(i => i.StartWorkDate).FirstOrDefault(),
|
|
|
|
|
Employee = x
|
|
|
|
|
});
|
|
|
|
|
{
|
|
|
|
|
leftWork = workshopActiveLeftWorksQuery.Where(l => l.EmployeeId == x.id).OrderByDescending(i => i.StartWorkDate).FirstOrDefault(),
|
|
|
|
|
insuranceLeftWork = workshopActiveInsuranceLeftWorksQuery.Where(i => i.EmployeeId == x.id).OrderByDescending(i => i.StartWorkDate).FirstOrDefault(),
|
|
|
|
|
Employee = x
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -878,7 +879,7 @@ public class EmployeeRepository : RepositoryBase<long, Employee>, IEmployeeRepos
|
|
|
|
|
}).ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public async Task<GetEditEmployeeInEmployeeDocumentViewModel> GetEmployeeEditInEmployeeDocumentWorkFlow(long employeeId, long workshopId)
|
|
|
|
|
{
|
|
|
|
|
var employee = await _context.Employees.Where(x => x.id == employeeId).Select(x => new GetEditEmployeeInEmployeeDocumentViewModel()
|
|
|
|
|
@@ -946,13 +947,13 @@ public class EmployeeRepository : RepositoryBase<long, Employee>, IEmployeeRepos
|
|
|
|
|
}).ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region Api
|
|
|
|
|
#region Api
|
|
|
|
|
|
|
|
|
|
public async Task<List<EmployeeSelectListViewModel>> GetSelectList(string searchText,long id)
|
|
|
|
|
{
|
|
|
|
|
var query = _context.Employees.AsQueryable();
|
|
|
|
|
public async Task<List<EmployeeSelectListViewModel>> GetSelectList(string searchText, long id)
|
|
|
|
|
{
|
|
|
|
|
var query = _context.Employees.AsQueryable();
|
|
|
|
|
EmployeeSelectListViewModel idSelected = null;
|
|
|
|
|
if (id > 0)
|
|
|
|
|
{
|
|
|
|
|
@@ -963,133 +964,316 @@ public class EmployeeRepository : RepositoryBase<long, Employee>, IEmployeeRepos
|
|
|
|
|
}).FirstOrDefaultAsync(x => x.Id == id);
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(searchText))
|
|
|
|
|
{
|
|
|
|
|
query = query.Where(x => (x.FName + " " + x.LName).Contains(searchText));
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
query = query.Where(x => (x.FName + " " + x.LName).Contains(searchText));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var list = await query.Take(100).Select(x => new EmployeeSelectListViewModel()
|
|
|
|
|
{
|
|
|
|
|
Id = x.id,
|
|
|
|
|
EmployeeFullName = x.FName + " " + x.LName
|
|
|
|
|
}).ToListAsync();
|
|
|
|
|
var list = await query.Take(100).Select(x => new EmployeeSelectListViewModel()
|
|
|
|
|
{
|
|
|
|
|
Id = x.id,
|
|
|
|
|
EmployeeFullName = x.FName + " " + x.LName
|
|
|
|
|
}).ToListAsync();
|
|
|
|
|
|
|
|
|
|
if (idSelected != null)
|
|
|
|
|
list.Add(idSelected);
|
|
|
|
|
|
|
|
|
|
return list.DistinctBy(x=>x.Id).ToList();
|
|
|
|
|
return list.DistinctBy(x => x.Id).ToList();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async Task<List<GetEmployeeListViewModel>> GetList(GetEmployeeListSearchModel searchModel)
|
|
|
|
|
{
|
|
|
|
|
var query = _context.Employees.Include(x => x.LeftWorks).Include(x => x.LeftWorkInsurances).AsQueryable();
|
|
|
|
|
public async Task<List<GetEmployeeListViewModel>> GetList(GetEmployeeListSearchModel searchModel)
|
|
|
|
|
{
|
|
|
|
|
var query = _context.Employees.Include(x => x.LeftWorks).Include(x => x.LeftWorkInsurances).AsQueryable();
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(searchModel.NationalCode))
|
|
|
|
|
{
|
|
|
|
|
query = query.Where(x => x.NationalCode.Contains(searchModel.NationalCode));
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(searchModel.NationalCode))
|
|
|
|
|
{
|
|
|
|
|
query = query.Where(x => x.NationalCode.Contains(searchModel.NationalCode));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (searchModel.EmployeeId > 0)
|
|
|
|
|
{
|
|
|
|
|
query = query.Where(x => x.id == searchModel.EmployeeId);
|
|
|
|
|
}
|
|
|
|
|
if (searchModel.EmployeeId > 0)
|
|
|
|
|
{
|
|
|
|
|
query = query.Where(x => x.id == searchModel.EmployeeId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (searchModel.WorkshopId > 0)
|
|
|
|
|
{
|
|
|
|
|
query = query.Where(x => x.LeftWorks.Any(l => l.WorkshopId == searchModel.WorkshopId) || x.LeftWorkInsurances.Any(l => l.WorkshopId == searchModel.WorkshopId));
|
|
|
|
|
}
|
|
|
|
|
if (searchModel.WorkshopId > 0)
|
|
|
|
|
{
|
|
|
|
|
query = query.Where(x => x.LeftWorks.Any(l => l.WorkshopId == searchModel.WorkshopId) || x.LeftWorkInsurances.Any(l => l.WorkshopId == searchModel.WorkshopId));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region employer
|
|
|
|
|
#region employer
|
|
|
|
|
|
|
|
|
|
if (searchModel.EmployerId > 0)
|
|
|
|
|
{
|
|
|
|
|
if (searchModel.EmployerId > 0)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var workshopIdsByEmployer = _context.WorkshopEmployers.Where(x => x.EmployerId == searchModel.EmployerId)
|
|
|
|
|
.Include(x => x.Workshop).Select(x => x.Workshop.id).AsQueryable();
|
|
|
|
|
var workshopIdsByEmployer = _context.WorkshopEmployers.Where(x => x.EmployerId == searchModel.EmployerId)
|
|
|
|
|
.Include(x => x.Workshop).Select(x => x.Workshop.id).AsQueryable();
|
|
|
|
|
|
|
|
|
|
query = query.Where(x =>
|
|
|
|
|
x.LeftWorks.Any(l => workshopIdsByEmployer.Contains(l.WorkshopId)) ||
|
|
|
|
|
x.LeftWorkInsurances.Any(l => workshopIdsByEmployer.Contains(l.WorkshopId)));
|
|
|
|
|
query = query.Where(x =>
|
|
|
|
|
x.LeftWorks.Any(l => workshopIdsByEmployer.Contains(l.WorkshopId)) ||
|
|
|
|
|
x.LeftWorkInsurances.Any(l => workshopIdsByEmployer.Contains(l.WorkshopId)));
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(searchModel.InsuranceCode))
|
|
|
|
|
{
|
|
|
|
|
query = query.Where(x => x.InsuranceCode.Contains(searchModel.InsuranceCode));
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrEmpty(searchModel.InsuranceCode))
|
|
|
|
|
{
|
|
|
|
|
query = query.Where(x => x.InsuranceCode.Contains(searchModel.InsuranceCode));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (searchModel.EmployeeStatus != ActivationStatus.None)
|
|
|
|
|
{
|
|
|
|
|
var status = searchModel.EmployeeStatus switch
|
|
|
|
|
{
|
|
|
|
|
ActivationStatus.Active => true,
|
|
|
|
|
ActivationStatus.DeActive => false,
|
|
|
|
|
_ => throw new BadRequestException("پارامتر جستجو نامعتبر است")
|
|
|
|
|
};
|
|
|
|
|
query = query.Where(x => x.IsActiveString == status.ToString() || x.IsActive == status);
|
|
|
|
|
}
|
|
|
|
|
if (searchModel.EmployeeStatus != ActivationStatus.None)
|
|
|
|
|
{
|
|
|
|
|
var status = searchModel.EmployeeStatus switch
|
|
|
|
|
{
|
|
|
|
|
ActivationStatus.Active => true,
|
|
|
|
|
ActivationStatus.DeActive => false,
|
|
|
|
|
_ => throw new BadRequestException("پارامتر جستجو نامعتبر است")
|
|
|
|
|
};
|
|
|
|
|
query = query.Where(x => x.IsActiveString == status.ToString() || x.IsActive == status);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var list = await query.Skip(searchModel.PageIndex).Take(30).ToListAsync();
|
|
|
|
|
var list = await query.Skip(searchModel.PageIndex).Take(30).ToListAsync();
|
|
|
|
|
|
|
|
|
|
var employeeIds = list.Select(x => x.id);
|
|
|
|
|
var employeeIds = list.Select(x => x.id);
|
|
|
|
|
|
|
|
|
|
var children = await _context.EmployeeChildrenSet.Where(x => employeeIds.Contains(x.EmployeeId)).ToListAsync();
|
|
|
|
|
var children = await _context.EmployeeChildrenSet.Where(x => employeeIds.Contains(x.EmployeeId)).ToListAsync();
|
|
|
|
|
|
|
|
|
|
var result = list.Select(x => new GetEmployeeListViewModel()
|
|
|
|
|
{
|
|
|
|
|
BirthDate = x.DateOfBirth.ToFarsi(),
|
|
|
|
|
ChildrenCount = children.Count(c => c.EmployeeId == x.id).ToString(),
|
|
|
|
|
EmployeeFullName = x.FullName,
|
|
|
|
|
EmployeeStatus = x.IsActive switch
|
|
|
|
|
{
|
|
|
|
|
true => ActivationStatus.Active,
|
|
|
|
|
false => ActivationStatus.DeActive
|
|
|
|
|
},
|
|
|
|
|
Gender = x.Gender switch
|
|
|
|
|
{
|
|
|
|
|
"مرد" => Gender.Male,
|
|
|
|
|
"زن" => Gender.Female,
|
|
|
|
|
_ => Gender.None
|
|
|
|
|
},
|
|
|
|
|
Id = x.id,
|
|
|
|
|
InsuranceCode = x.InsuranceCode,
|
|
|
|
|
NationalCode = x.NationalCode
|
|
|
|
|
}).ToList();
|
|
|
|
|
var result = list.Select(x => new GetEmployeeListViewModel()
|
|
|
|
|
{
|
|
|
|
|
BirthDate = x.DateOfBirth.ToFarsi(),
|
|
|
|
|
ChildrenCount = children.Count(c => c.EmployeeId == x.id).ToString(),
|
|
|
|
|
EmployeeFullName = x.FullName,
|
|
|
|
|
EmployeeStatus = x.IsActive switch
|
|
|
|
|
{
|
|
|
|
|
true => ActivationStatus.Active,
|
|
|
|
|
false => ActivationStatus.DeActive
|
|
|
|
|
},
|
|
|
|
|
Gender = x.Gender switch
|
|
|
|
|
{
|
|
|
|
|
"مرد" => Gender.Male,
|
|
|
|
|
"زن" => Gender.Female,
|
|
|
|
|
_ => Gender.None
|
|
|
|
|
},
|
|
|
|
|
Id = x.id,
|
|
|
|
|
InsuranceCode = x.InsuranceCode,
|
|
|
|
|
NationalCode = x.NationalCode
|
|
|
|
|
}).ToList();
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
return result;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Task<List<GetClientEmployeeListViewModel>> GetClientEmployeeList(GetClientEmployeeListSearchModel searchModel, long workshopId)
|
|
|
|
|
{
|
|
|
|
|
// var leftDate = Tools.GetUndefinedDateTime();
|
|
|
|
|
//
|
|
|
|
|
// var personnelCodes = _context.PersonnelCodeSet.Include(x => x.Employee)
|
|
|
|
|
// .ThenInclude(x => x.EmployeeChildrenList).IgnoreQueryFilters().Where(x => x.WorkshopId == workshopId).ToList();
|
|
|
|
|
//
|
|
|
|
|
// var contractLeftWork =
|
|
|
|
|
// _context.LeftWorkList.Where(x => x.WorkshopId == workshopId)
|
|
|
|
|
// .GroupBy(x => x.EmployeeId).Select(x => x.OrderByDescending(y => y.LeftWork).First()).ToList();
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
// var insuranceLeftWork = _context.LeftWorkInsuranceList.Where(x => x.WorkshopId == workshopId).Select(x => new
|
|
|
|
|
// {
|
|
|
|
|
// EmployeeId = x.EmployeeId,
|
|
|
|
|
// FullName = x.EmployeeFullName,
|
|
|
|
|
// PersonnelCode = 0,
|
|
|
|
|
// InsurancePerson = true,
|
|
|
|
|
// InsuranceLeft = x.LeftWorkDate != null,
|
|
|
|
|
// StartWork = x.StartWorkDate,
|
|
|
|
|
// LeftWork = x.LeftWorkDate ?? leftDate,
|
|
|
|
|
// LastStartInsuranceWork = x.StartWorkDate.ToFarsi(),
|
|
|
|
|
// LastLeftInsuranceWork = x.LeftWorkDate != null ? x.LeftWorkDate.ToFarsi() : "-",
|
|
|
|
|
// LastStartContractWork = "-",
|
|
|
|
|
// LastLeftContractWork = "-"
|
|
|
|
|
// }).GroupBy(x => x.EmployeeId)
|
|
|
|
|
// .Select(x => x.OrderByDescending(y => y.LeftWork).First()).ToList();
|
|
|
|
|
//
|
|
|
|
|
// var leftWorkTemp = _context.LeftWorkTemps.Where(x => x.WorkshopId == workshopId).Select(x => new
|
|
|
|
|
// {
|
|
|
|
|
// WorkshopId = x.WorkshopId,
|
|
|
|
|
// EmployeeId = x.EmployeeId,
|
|
|
|
|
// PersonnelCode = 0,
|
|
|
|
|
// ContractPerson = true,
|
|
|
|
|
// ContractLeft = x.LeftWork != leftDate,
|
|
|
|
|
// StartWork = x.StartWork,
|
|
|
|
|
// LeftWork = x.LeftWork,
|
|
|
|
|
// LastStartContractWork = x.StartWork.ToFarsi(),
|
|
|
|
|
// LastLeftContractWork = x.LeftWork != leftDate ? x.LeftWork.ToFarsi() : "-",
|
|
|
|
|
// LastStartInsuranceWork = "-",
|
|
|
|
|
// LastLeftInsuranceWork = "-",
|
|
|
|
|
// LefWorkTemp = x.LeftWorkType == LeftWorkTempType.LeftWork,
|
|
|
|
|
// CreatedByClient = x.LeftWorkType == LeftWorkTempType.StartWork
|
|
|
|
|
// }).ToList();
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
// var employeeClientTemp = _context.EmployeeClientTemps.Where(x => x.WorkshopId == workshopId).Select(x => new
|
|
|
|
|
// {
|
|
|
|
|
// WorkshopId = x.WorkshopId,
|
|
|
|
|
// EmployeeId = x.EmployeeId,
|
|
|
|
|
// PersonnelCode = 0,
|
|
|
|
|
// CreatedByClient = true,
|
|
|
|
|
// ContractPerson = true
|
|
|
|
|
// }).ToList();
|
|
|
|
|
//
|
|
|
|
|
// var resultTemp = employeeClientTemp.Concat(leftWorkTemp).ToList().GroupBy(x => x.EmployeeId);
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
// var result = contractLeftWork.Concat(insuranceLeftWork).GroupBy(x => x.EmployeeId).ToList();
|
|
|
|
|
//
|
|
|
|
|
// result = result.Concat(resultTemp).GroupBy(x => x.First().EmployeeId).Select(x => x.First()).ToList();
|
|
|
|
|
//
|
|
|
|
|
// var employeeClientTempList = employeeClientTemp.ToList();
|
|
|
|
|
// var startWorkTempsForWorkshop = leftWorkTemp.Where(x => x.CreatedByClient).ToList();
|
|
|
|
|
// var leftWorkTempsForWorkshop = leftWorkTemp.Where(x => x.LefWorkTemp).ToList();
|
|
|
|
|
//
|
|
|
|
|
// return result.Select(x =>
|
|
|
|
|
// {
|
|
|
|
|
// var insurance = x.FirstOrDefault(y => y.InsurancePerson);
|
|
|
|
|
// var contract = x.FirstOrDefault(y => y.ContractPerson);
|
|
|
|
|
// var personnelCode = personnelCodes.FirstOrDefault(y => y.EmployeeId == x.Key);
|
|
|
|
|
// var employee = personnelCode.Employee;
|
|
|
|
|
// var employeeClient = employeeClientTempList.FirstOrDefault(t => t.EmployeeId == x.First().EmployeeId);
|
|
|
|
|
// var startWorkTemp = startWorkTempsForWorkshop.FirstOrDefault(s => s.EmployeeId == x.First().EmployeeId);
|
|
|
|
|
// var leftWorkTemp = leftWorkTempsForWorkshop.FirstOrDefault(s => s.EmployeeId == x.First().EmployeeId);
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
// return new GetClientEmployeeListViewModel()
|
|
|
|
|
// {
|
|
|
|
|
// EmployeeId = x.Key,
|
|
|
|
|
// FullName = employee.FullName,
|
|
|
|
|
// PersonnelCode = personnelCode?.PersonnelCode ?? 0,
|
|
|
|
|
// HasContractLeftWork = insurance != null,
|
|
|
|
|
// HasInsuranceLeftWork = contract != null,
|
|
|
|
|
//
|
|
|
|
|
// LeftWorkCompletely = (insurance?.InsuranceLeft ?? false) && (contract?.ContractLeft ?? false),
|
|
|
|
|
//
|
|
|
|
|
// LastStartInsuranceWork = insurance != null ? insurance.LastStartInsuranceWork : "-",
|
|
|
|
|
// LastLeftInsuranceWork = insurance != null ? insurance.LastLeftInsuranceWork : "-",
|
|
|
|
|
// LastStartContractWork = contract != null ? contract.LastStartContractWork : "-",
|
|
|
|
|
// LastLeftContractWork = contract != null ? contract.LastLeftContractWork : "-",
|
|
|
|
|
//
|
|
|
|
|
// NationalCode = employee.NationalCode,
|
|
|
|
|
// IdNumber = employee.IdNumber,
|
|
|
|
|
// MaritalStatus = employee.MaritalStatus,
|
|
|
|
|
// DateOfBirthFa = employee.DateOfBirth.ToFarsi(),
|
|
|
|
|
// FatherName = employee.FatherName,
|
|
|
|
|
// ChildrenCount = employee.EmployeeChildrenList.Count,
|
|
|
|
|
//
|
|
|
|
|
// PendingStartWork = employeeClient != null || startWorkTemp != null,
|
|
|
|
|
// PendingLeftWork = leftWorkTemp != null,
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
// };
|
|
|
|
|
// }).OrderByDescending(x => x.StartWork).ToList();
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async Task<List<EmployeeSelectListViewModel>> GetWorkingEmployeesSelectList(long workshopId)
|
|
|
|
|
|
|
|
|
|
public async Task<List<EmployeeListDto>> ListOfAllEmployees(EmployeeSearchModelDto searchModel, long workshopId)
|
|
|
|
|
{
|
|
|
|
|
var dateNow = DateTime.Now.Date;
|
|
|
|
|
var hasNotStoppedWorkingYet = Tools.GetUndefinedDateTime();
|
|
|
|
|
|
|
|
|
|
var baseQuery = await
|
|
|
|
|
(
|
|
|
|
|
from personnelCode in _context.PersonnelCodeSet
|
|
|
|
|
join employee in _context.Employees
|
|
|
|
|
on personnelCode.EmployeeId equals employee.id
|
|
|
|
|
where personnelCode.WorkshopId == workshopId
|
|
|
|
|
select new
|
|
|
|
|
{
|
|
|
|
|
Employee = employee,
|
|
|
|
|
PersonnelCode = personnelCode
|
|
|
|
|
}
|
|
|
|
|
).ToListAsync();
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(searchModel.EmployeeFullName))
|
|
|
|
|
baseQuery = baseQuery.Where(x => x.Employee.FullName.Contains(searchModel.EmployeeFullName)).ToList();
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(searchModel.NationalCode))
|
|
|
|
|
baseQuery = baseQuery.Where(x => x.Employee.NationalCode.Contains(searchModel.NationalCode)).ToList();
|
|
|
|
|
|
|
|
|
|
var employeeIds = baseQuery.Select(x => x.Employee.id).ToList();
|
|
|
|
|
|
|
|
|
|
var leftWorks = await _context.LeftWorkList
|
|
|
|
|
.Where(x => x.WorkshopId == workshopId && employeeIds.Contains(x.EmployeeId))
|
|
|
|
|
.ToListAsync();
|
|
|
|
|
|
|
|
|
|
var insuranceLeftWorks = await _context.LeftWorkInsuranceList
|
|
|
|
|
.Where(x => x.WorkshopId == workshopId && employeeIds.Contains(x.EmployeeId))
|
|
|
|
|
.ToListAsync();
|
|
|
|
|
|
|
|
|
|
var children = await _context.EmployeeChildrenSet.Where(x => employeeIds.Contains(x.EmployeeId)).ToListAsync();
|
|
|
|
|
|
|
|
|
|
var clientTemp = await _context.EmployeeClientTemps.Where(x => x.WorkshopId == workshopId)
|
|
|
|
|
.Select(x => x.EmployeeId).ToListAsync();
|
|
|
|
|
var leftWorkTempData = await _context.LeftWorkTemps.Where(x => x.WorkshopId == workshopId).ToListAsync();
|
|
|
|
|
var startWorkTemp = leftWorkTempData.Where(x => x.LeftWorkType == LeftWorkTempType.StartWork).ToList();
|
|
|
|
|
var leftWorkTemp = leftWorkTempData.Where(x => x.LeftWorkType == LeftWorkTempType.LeftWork).ToList();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var workshopActiveLeftWorksQuery = _context.LeftWorkList.Where(x => x.WorkshopId == workshopId &&
|
|
|
|
|
x.StartWorkDate <= dateNow && x.LeftWorkDate > dateNow);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var workshopActiveInsuranceLeftWorksQuery = _context.LeftWorkInsuranceList.Where(x => x.WorkshopId == workshopId &&
|
|
|
|
|
x.StartWorkDate <= dateNow && (x.LeftWorkDate > dateNow || x.LeftWorkDate == null));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var employeesQuery = _context.Employees.Where(x => workshopActiveLeftWorksQuery.Any(y => y.EmployeeId == x.id) ||
|
|
|
|
|
workshopActiveInsuranceLeftWorksQuery.Any(y => y.EmployeeId == x.id));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return await employeesQuery.Select(x => new EmployeeSelectListViewModel()
|
|
|
|
|
var result = baseQuery.Select(x =>
|
|
|
|
|
{
|
|
|
|
|
Id = x.id,
|
|
|
|
|
EmployeeFullName = x.FullName
|
|
|
|
|
}).ToListAsync();
|
|
|
|
|
}
|
|
|
|
|
var left = leftWorks
|
|
|
|
|
.Where(l => l.EmployeeId == x.Employee.id)
|
|
|
|
|
.MaxBy(l => l.StartWorkDate);
|
|
|
|
|
|
|
|
|
|
var insuranceLeftWork = insuranceLeftWorks
|
|
|
|
|
.Where(l => l.EmployeeId == x.Employee.id).MaxBy(l => l.StartWorkDate);
|
|
|
|
|
|
|
|
|
|
var contractStart = left != null ? left.StartWorkDate.ToFarsi() : "";
|
|
|
|
|
var contractLeft = left != null
|
|
|
|
|
? left.LeftWorkDate != hasNotStoppedWorkingYet ? left.LeftWorkDate.ToFarsi() : ""
|
|
|
|
|
: "";
|
|
|
|
|
|
|
|
|
|
var insuranceStart = insuranceLeftWork != null ? insuranceLeftWork.StartWorkDate.ToFarsi() : "";
|
|
|
|
|
var insuranceLeft = insuranceLeftWork != null
|
|
|
|
|
? insuranceLeftWork.LeftWorkDate != null ? insuranceLeftWork.LeftWorkDate.ToFarsi() : ""
|
|
|
|
|
: "";
|
|
|
|
|
int personnelCode = Convert.ToInt32($"{x.PersonnelCode.PersonnelCode}");
|
|
|
|
|
|
|
|
|
|
int numberOfChildren = children.Count(ch => ch.EmployeeId == x.Employee.id);
|
|
|
|
|
|
|
|
|
|
bool employeeHasLeft =
|
|
|
|
|
(!string.IsNullOrWhiteSpace(insuranceLeft) && !string.IsNullOrWhiteSpace(contractLeft))
|
|
|
|
|
|| (left == null && !string.IsNullOrWhiteSpace(insuranceLeft))
|
|
|
|
|
|| (insuranceLeftWork == null && !string.IsNullOrWhiteSpace(contractLeft));
|
|
|
|
|
bool hasClientTemp = clientTemp.Any(c => c == x.Employee.id);
|
|
|
|
|
bool hasStartWorkTemp = startWorkTemp.Any(st => st.EmployeeId == x.Employee.id);
|
|
|
|
|
bool hasLeftWorkTemp = leftWorkTemp.Any(lf => lf.EmployeeId == x.Employee.id);
|
|
|
|
|
return new EmployeeListDto
|
|
|
|
|
{
|
|
|
|
|
Id = x.Employee.id,
|
|
|
|
|
EmployeeFullName = x.Employee.FullName,
|
|
|
|
|
PersonnelCode = personnelCode,
|
|
|
|
|
MaritalStatus = x.Employee.MaritalStatus,
|
|
|
|
|
NationalCode = x.Employee.NationalCode,
|
|
|
|
|
IdNumber = x.Employee.IdNumber,
|
|
|
|
|
DateOfBirth = x.Employee.DateOfBirth.ToFarsi(),
|
|
|
|
|
FatherName = x.Employee.FatherName,
|
|
|
|
|
NumberOfChildren = $"{numberOfChildren}",
|
|
|
|
|
LatestContractStartDate = contractStart,
|
|
|
|
|
ContractLeftDate = contractLeft,
|
|
|
|
|
LatestInsuranceStartDate = insuranceStart,
|
|
|
|
|
InsuranceLeftDate = insuranceLeft,
|
|
|
|
|
HasContract = !string.IsNullOrWhiteSpace(contractStart),
|
|
|
|
|
HasInsurance = !string.IsNullOrWhiteSpace(insuranceStart),
|
|
|
|
|
EmployeeStatusInWorkshop =
|
|
|
|
|
hasClientTemp || hasStartWorkTemp ? EmployeeStatusInWorkshop.CreatedByClient :
|
|
|
|
|
hasLeftWorkTemp ? EmployeeStatusInWorkshop.LefWorkTemp :
|
|
|
|
|
employeeHasLeft ? EmployeeStatusInWorkshop.HasLeft : EmployeeStatusInWorkshop.Working,
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
}).OrderBy(x => x.EmployeeStatusInWorkshop).ThenBy(x => x.PersonnelCode).ToList();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
}
|