add employee by client to orginal part 1
This commit is contained in:
@@ -21,11 +21,13 @@ public class Employee : EntityBase
|
||||
public Employee(string fName, string lName, string fatherName,
|
||||
DateTime dateOfBirth, DateTime dateOfIssue, string placeOfIssue,
|
||||
string nationalCode, string idNumber, string gender, string nationality,
|
||||
string phone, string address, string state, string city,
|
||||
string maritalStatus, string militaryService, string levelOfEducation, string fieldOfStudy,
|
||||
string bankCardNumber, string bankBranch, string insuranceCode, string insuranceHistoryByYear,
|
||||
string insuranceHistoryByMonth, string numberOfChildren,string officePhone,
|
||||
string mclsUserName, string mclsPassword, string eserviceUserName, string eservicePassword, string taxOfficeUserName, string taxOfficepassword, string sanaUserName, string sanaPassword)
|
||||
string phone = null, string address = null, string state = null, string city = null,
|
||||
string maritalStatus = null, string militaryService = null, string levelOfEducation = null, string fieldOfStudy = null,
|
||||
string bankCardNumber = null, string bankBranch = null, string insuranceCode = null, string insuranceHistoryByYear = null,
|
||||
string insuranceHistoryByMonth = null, string numberOfChildren = null, string officePhone = null,
|
||||
string mclsUserName = null, string mclsPassword = null,
|
||||
string eserviceUserName = null, string eservicePassword = null,
|
||||
string taxOfficeUserName = null, string taxOfficepassword = null, string sanaUserName = null, string sanaPassword = null)
|
||||
{
|
||||
FName = fName;
|
||||
LName = lName;
|
||||
@@ -135,7 +137,16 @@ public class Employee : EntityBase
|
||||
#region Pooya
|
||||
public List<EmployeeDocuments> EmployeeDocuments { get; set; }
|
||||
public EmployeeDocumentsAdminSelection EmployeeDocumentsAdminSelection { get; set; }
|
||||
public List<EmployeeBankInformation> EmployeeBankInformationList { get; set; }
|
||||
public List<EmployeeBankInformation> EmployeeBankInformationList { get; set; }
|
||||
#endregion
|
||||
|
||||
#region Mahan
|
||||
|
||||
/// <summary>
|
||||
/// آیا پرسنل احراز هویت شده است
|
||||
/// </summary>
|
||||
public bool IsAuthorized { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
//public List<Checkout> Checkouts { get; set; }
|
||||
@@ -211,4 +222,13 @@ public class Employee : EntityBase
|
||||
this.IsActive = false;
|
||||
this.IsActiveString = "false";
|
||||
}
|
||||
|
||||
#region Mahan
|
||||
|
||||
public void Authorized()
|
||||
{
|
||||
IsAuthorized = true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -4,6 +4,7 @@ using System.Threading.Tasks;
|
||||
using _0_Framework.Domain;
|
||||
using Company.Domain.EmployeeInsuranceRecordAgg;
|
||||
using CompanyManagment.App.Contracts.Employee;
|
||||
using CompanyManagment.App.Contracts.Employee.DTO;
|
||||
using CompanyManagment.App.Contracts.EmployeeInsuranceRecord;
|
||||
|
||||
namespace Company.Domain.EmployeeAgg;
|
||||
@@ -47,6 +48,14 @@ public interface IEmployeeRepository : IRepository<long, Employee>
|
||||
Employee GetByNationalCode(string nationalCode);
|
||||
List<EmployeeViewModel> GetBy(List<long> employeeIds);
|
||||
|
||||
Employee GetByNationalCodeIgnoreQueryFilter(string nationalCode);
|
||||
Task<ICollection<ClientStartedWorkEmployeesDto>> GetClientEmployeesStartWork(long workshopId);
|
||||
Task<ICollection<ClientLeftWorkWorkEmployeesDto>> GetEmployeesForLeftWorkTemp(long workshopId);
|
||||
|
||||
Employee GetIgnoreQueryFilter(long id);
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Pooya
|
||||
@@ -55,6 +64,10 @@ public interface IEmployeeRepository : IRepository<long, Employee>
|
||||
List<EmployeeViewModel> GetWorkingEmployeesByWorkshopId(long workshopId);
|
||||
|
||||
List<(long Id, string Name)> SimpleGetRangeByIds(IEnumerable<long> newEmployeeIds);
|
||||
Task<GetEditEmployeeInEmployeeDocumentViewModel> GetEmployeeEditInEmployeeDocumentWorkFlow(long employeeId,
|
||||
long workshopId);
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
}
|
||||
31
Company.Domain/EmployeeClientTempAgg/EmployeeClientTemp.cs
Normal file
31
Company.Domain/EmployeeClientTempAgg/EmployeeClientTemp.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using _0_Framework.Domain;
|
||||
using Company.Domain.EmployeeAgg;
|
||||
|
||||
namespace Company.Domain.EmployeeClientTempAgg;
|
||||
|
||||
public class EmployeeClientTemp : EntityBase
|
||||
{
|
||||
public EmployeeClientTemp(long workshopId, DateTime startWorkDate, long employeeId, string maritalStatus,
|
||||
string employeeFullName)
|
||||
{
|
||||
StartWorkDate = startWorkDate;
|
||||
WorkshopId = workshopId;
|
||||
EmployeeId = employeeId;
|
||||
MaritalStatus = maritalStatus;
|
||||
EmployeeFullName = employeeFullName;
|
||||
}
|
||||
|
||||
public string EmployeeFullName { get; private set; }
|
||||
public long WorkshopId { get; private set; }
|
||||
public long EmployeeId { get; private set; }
|
||||
public DateTime StartWorkDate { get; private set; }
|
||||
|
||||
public string MaritalStatus { get; private set; }
|
||||
|
||||
public void Edit(string maritalStatus)
|
||||
{
|
||||
|
||||
MaritalStatus = maritalStatus;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
using _0_Framework.Domain;
|
||||
using CompanyManagment.App.Contracts.EmployeeClientTemp;
|
||||
|
||||
namespace Company.Domain.EmployeeClientTempAgg;
|
||||
|
||||
public interface IEmployeeClientTempRepository : IRepository<long, EmployeeClientTemp>
|
||||
{
|
||||
EmployeeClientTemp GetByEmployeeIdAndWorkshopId(long employeeId, long commandWorkshopId);
|
||||
EmployeeClientTempGetDetailsViewModel GetDetails(long employeeId, long workshopId);
|
||||
void Remove(EmployeeClientTemp entity);
|
||||
}
|
||||
@@ -26,9 +26,9 @@ namespace Company.Domain.EmployeeDocumentsAgg
|
||||
|
||||
List<WorkshopWithEmployeeDocumentsViewModel> GetWorkshopsWithDocumentsAwaitingReviewForAdminWorkFlow(List<long> workshops);
|
||||
List<EmployeeDocumentsViewModel> GetByWorkshopIdWithItemsForAdminWorkFlow(long workshopId);
|
||||
int GetCheckerWorkFlowCount();
|
||||
//int GetAdminWorkFlowCountForNewEmployees(List<long> workshopIds);
|
||||
int GetAdminWorkFlowCountForSubmittedAndRejectedDocuments(List<long> workshopIds);
|
||||
Task<int> GetCheckerWorkFlowCount();
|
||||
Task<int> GetAdminWorkFlowCountForNewEmployees(List<long> workshopIds);
|
||||
Task<int> GetAdminWorkFlowCountForSubmittedAndRejectedDocuments(List<long> workshopIds);
|
||||
List<EmployeeDocumentsViewModel> GetDocumentsAwaitingReviewByWorkshopIdForCheckerWorkFlow(long workshopId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,8 @@ public interface ILeftWorkRepository : IRepository<long, LeftWork>
|
||||
/// <returns>یک کلاس از جنس اطلاعات ترک کار</returns>
|
||||
LeftWorkViewModel GetByDateAndWorkshopIdAndEmployeeId(long workshopId, long employeeId, DateTime dateTime);
|
||||
List<long> GetAllEmployeeIdsInWorkshop(long workshopId);
|
||||
LeftWork GetLastLeftWorkByEmployeeIdAndWorkshopId(long workshopId, long employeeId);
|
||||
|
||||
|
||||
#endregion
|
||||
List<LeftWorkViewModel> GetLeftPersonelByWorkshopId(List<long> workshopIds);
|
||||
|
||||
17
Company.Domain/LeftWorkTempAgg/ILeftWorkTempRepository.cs
Normal file
17
Company.Domain/LeftWorkTempAgg/ILeftWorkTempRepository.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System.Threading.Tasks;
|
||||
using _0_Framework.Domain;
|
||||
using CompanyManagment.App.Contracts.LeftWorkTemp;
|
||||
|
||||
namespace Company.Domain.LeftWorkTempAgg;
|
||||
|
||||
public interface ILeftWorkTempRepository:IRepository<long,LeftWorkTemp>
|
||||
{
|
||||
/// <summary>
|
||||
/// گرفتن اطلاعات برای مودال جزئیات شروع به کار موقت یا ترک کار موقت
|
||||
/// </summary>
|
||||
/// <param name="employeeId"></param>
|
||||
/// <param name="workshopId"></param>
|
||||
/// <returns></returns>
|
||||
Task<GetStartWorkTempDetails> GetStartAndLeftWorkDetails(long employeeId, long workshopId);
|
||||
void Remove(LeftWorkTemp entity);
|
||||
}
|
||||
65
Company.Domain/LeftWorkTempAgg/LeftWorkTemp.cs
Normal file
65
Company.Domain/LeftWorkTempAgg/LeftWorkTemp.cs
Normal file
@@ -0,0 +1,65 @@
|
||||
using System;
|
||||
using _0_Framework.Domain;
|
||||
using Company.Domain.LeftWorkAgg;
|
||||
using CompanyManagment.App.Contracts.LeftWorkTemp;
|
||||
|
||||
namespace Company.Domain.LeftWorkTempAgg;
|
||||
|
||||
public class LeftWorkTemp:EntityBase
|
||||
{
|
||||
private LeftWorkTemp()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// برای ایجاد ترک کار موقت
|
||||
/// </summary>
|
||||
/// <param name="leftWorkId"></param>
|
||||
/// <param name="startWorkDate"></param>
|
||||
/// <param name="leftWork"></param>
|
||||
/// <param name="lastDayStanding"></param>
|
||||
/// <param name="workshopId"></param>
|
||||
/// <param name="employeeId"></param>
|
||||
/// <param name="jobId"></param>
|
||||
public static LeftWorkTemp CreateLeftWork(long leftWorkId, DateTime startWorkDate, DateTime leftWork, DateTime lastDayStanding, long workshopId, long employeeId,long jobId)
|
||||
{
|
||||
var leftWorkTemp = new LeftWorkTemp
|
||||
{
|
||||
LeftWorkId = leftWorkId,
|
||||
LeftWork = leftWork,
|
||||
LastDayStanding = lastDayStanding,
|
||||
WorkshopId = workshopId,
|
||||
EmployeeId = employeeId,
|
||||
StartWork = startWorkDate,
|
||||
LeftWorkType = LeftWorkTempType.LeftWork,
|
||||
JobId = jobId
|
||||
};
|
||||
|
||||
return leftWorkTemp;
|
||||
}
|
||||
|
||||
|
||||
public static LeftWorkTemp CreateStartWork(long workshopId, long employeeId, DateTime startDate,long jobId)
|
||||
{
|
||||
var leftWorkTemp = new LeftWorkTemp
|
||||
{
|
||||
StartWork = startDate,
|
||||
WorkshopId = workshopId,
|
||||
EmployeeId = employeeId,
|
||||
JobId = jobId,
|
||||
LeftWorkType = LeftWorkTempType.StartWork
|
||||
};
|
||||
return leftWorkTemp;
|
||||
}
|
||||
|
||||
public long LeftWorkId { get; private set; }
|
||||
public DateTime StartWork { get; private set; }
|
||||
public DateTime LeftWork { get; private set; }
|
||||
public DateTime LastDayStanding { get; private set; }
|
||||
public long WorkshopId { get; private set; }
|
||||
public long EmployeeId { get; private set; }
|
||||
public long JobId { get; private set; }
|
||||
public LeftWorkTempType LeftWorkType { get; private set; }
|
||||
}
|
||||
|
||||
@@ -18,4 +18,11 @@ public interface IPersonnelCodeRepository : IRepository<long, PersonnelCodeDomai
|
||||
|
||||
long GetPSCodeByWorkshopIdAndEmployeeId(long workshopId, long employeeId);
|
||||
long GetEmployeeIdByPersonelCode(long personleCode, long workshopId);
|
||||
|
||||
#region Mahan
|
||||
|
||||
long GetLastPersonnelCodeByWorkshop(long workshopId);
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -28,6 +28,8 @@ public interface IRollCallEmployeeRepository : IRepository<long, RollCallEmploye
|
||||
|
||||
bool HasEmployees(long workshopId);
|
||||
(int activeEmployees, int deActiveEmployees) GetActiveAndDeActiveRollCallEmployees(long workshopId);
|
||||
RollCallEmployee GetBy(long employeeId, long workshopId);
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
using System.Collections.Generic;
|
||||
using _0_Framework.Application;
|
||||
using CompanyManagment.App.Contracts.CustomizeWorkshopSettings;
|
||||
using CompanyManagment.App.Contracts.EmployeeBankInformation;
|
||||
using CompanyManagment.App.Contracts.EmployeeDocuments;
|
||||
using CompanyManagment.App.Contracts.RollCallEmployee;
|
||||
using CompanyManagment.App.Contracts.RollCallEmployeeStatus;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.Employee;
|
||||
|
||||
public class CreateEmployeeByClient
|
||||
{
|
||||
public string NationalCode { get; set; }
|
||||
public string Nationality { get; set; }
|
||||
public string Gender { get; set; }
|
||||
public string FirstName { get; set; }
|
||||
public string LastName { get; set; }
|
||||
public string MaritalStatus { get; set; }
|
||||
public long WorkshopId { get; set; }
|
||||
public string StartLeftWork { get; set; }
|
||||
public RollCallUploadEmployeePicture RollCallUploadEmployeePicture { get; set; }
|
||||
public EditCustomizeEmployeeSettings CreateCustomizeEmployeeSettings { get; set; }
|
||||
public ICollection<CreateEmployeeInformation> EmployeeBankInfos { get; set; }
|
||||
public bool HasBankInformation { get; set; }
|
||||
public string PersonnelCode { get; set; }
|
||||
public long JobId { get; set; }
|
||||
public List<AddEmployeeDocumentItem> EmployeeDocumentItems { get; set; }
|
||||
public bool HasEmployeeDocument { get; set; }
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public record RollCallUploadEmployeePicture
|
||||
{
|
||||
public string Picture1 { get; set; }
|
||||
public string Picture2 { get; set; }
|
||||
public string EmployeeFullName { get; set; }
|
||||
public string IsActiveString { get; set; }
|
||||
public string HasUploadedImage { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
namespace CompanyManagment.App.Contracts.Employee;
|
||||
|
||||
public class ClientLeftWorkWorkEmployeesDto
|
||||
{
|
||||
public long EmployeeId { get; set; }
|
||||
|
||||
public long WorkshopId { get; set; }
|
||||
|
||||
public string EmployeeName { get; set; } = string.Empty;
|
||||
|
||||
public string LeftWorkDateTime { get; set; } = string.Empty;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
namespace CompanyManagment.App.Contracts.Employee.DTO;
|
||||
|
||||
/// <summary>
|
||||
/// پرسنل هایی که درسمت ادمین شروع به کار کرده اند
|
||||
/// </summary>
|
||||
public class ClientStartedWorkEmployeesDto
|
||||
{
|
||||
public long EmployeeId { get; set; }
|
||||
|
||||
public long WorkshopId { get; set; }
|
||||
|
||||
public string EmployeeName { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// آیا آپلود مدارک اصلی رو انجام داده یا نه
|
||||
/// </summary>
|
||||
public bool HasCompleteEmployeeDocument { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
namespace CompanyManagment.App.Contracts.Employee;
|
||||
|
||||
public class EditEmployeeInEmployeeDocument
|
||||
{
|
||||
public long EmployeeId { get; set; }
|
||||
public long WorkshopId { get; set; }
|
||||
public string FName { get; set; } = string.Empty;
|
||||
public string LName { get; set; } = string.Empty;
|
||||
public string NationalCode { get; set; } = string.Empty;
|
||||
public string IdNumber { get; set; } = string.Empty;
|
||||
public string FatherName { get; set; } = string.Empty;
|
||||
public string BirthDate { get; set; } = string.Empty;
|
||||
public string MaritalStatus { get; set; } = string.Empty;
|
||||
public string MilitaryService { get; set; } = string.Empty;
|
||||
public string Nationality { get; set; } = string.Empty;
|
||||
public string Gender { get; set; } = string.Empty;
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Security.Cryptography;
|
||||
using CompanyManagment.App.Contracts.EmployeeDocuments;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.Employee;
|
||||
|
||||
public record EmployeeByNationalCodeInWorkshopViewModel
|
||||
{
|
||||
public string EmployeeFName { get; set; }
|
||||
public string EmployeeLName { get; set; }
|
||||
public string Nationality { get; set; }
|
||||
public string Gender { get; set; }
|
||||
public string MaritalStatus { get; set; }
|
||||
public long EmployeeId { get; set; }
|
||||
public string Picture1 { get; set; }
|
||||
public string Picture2 { get; set; }
|
||||
public long PersonnelCode { get; set; }
|
||||
public List<EmployeeByNationalCodeEmployeeBankInfoViewModel> EmployeeBankInfos { get; set; }
|
||||
public EmployeeByNationalCodeEmployeeDocumentViewModel EmployeeDocument { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class EmployeeByNationalCodeEmployeeDocumentViewModel
|
||||
{
|
||||
//عکس پرسنل
|
||||
public EmployeeDocumentItemViewModel EmployeePicture { get; set; }
|
||||
|
||||
//شناسنامه
|
||||
public EmployeeDocumentItemViewModel IdCardPage1 { get; set; }
|
||||
public EmployeeDocumentItemViewModel IdCardPage2 { get; set; }
|
||||
public EmployeeDocumentItemViewModel IdCardPage3 { get; set; }
|
||||
public EmployeeDocumentItemViewModel IdCardPage4 { get; set; }
|
||||
|
||||
//کارت ملی
|
||||
public EmployeeDocumentItemViewModel NationalCardFront { get; set; }
|
||||
|
||||
public EmployeeDocumentItemViewModel NationalCardRear { get; set; }
|
||||
//مدرک تحصیلی
|
||||
public EmployeeDocumentItemViewModel EducationalDegree { get; set; }
|
||||
|
||||
//کارت پایان خدمت
|
||||
public EmployeeDocumentItemViewModel MilitaryServiceCard { get; set; }
|
||||
}
|
||||
|
||||
public class EmployeeByNationalCodeEmployeeBankInfoViewModel
|
||||
{
|
||||
public string BankName { get; set; }
|
||||
public string BankLogoPath { get; set; }
|
||||
public string CardNumber { get; set; }
|
||||
public string ShebaNumber { get; set; }
|
||||
public string BankAccountNumber { get; set; }
|
||||
public bool IsDefault { get; set; }
|
||||
public long BankId { get; set; }
|
||||
public long BankLogoMediaId { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
namespace CompanyManagment.App.Contracts.Employee;
|
||||
|
||||
public class GetEditEmployeeInEmployeeDocumentViewModel
|
||||
{
|
||||
public long EmployeeId { get; set; }
|
||||
public string FName { get; set; } = string.Empty;
|
||||
public string LName { get; set; } = string.Empty;
|
||||
public string NationalCode { get; set; } = string.Empty;
|
||||
public string IdNumber { get; set; } = string.Empty;
|
||||
public string FatherName { get; set; } = string.Empty;
|
||||
public string BirthDate { get; set; } = string.Empty;
|
||||
public string MaritalStatus { get; set; } = string.Empty;
|
||||
public string MilitaryService { get; set; } = string.Empty;
|
||||
public string Nationality { get; set; } = string.Empty;
|
||||
public string Gender { get; set; } = string.Empty;
|
||||
public bool IsAuthorized { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.EmployeeClientTemp;
|
||||
|
||||
public class CreateEmployeeClientTemp
|
||||
{
|
||||
public string FName { get; set; }
|
||||
public string LName { get; set; }
|
||||
public string NationalCode { get; set; }
|
||||
public string Nationality { get; set; }
|
||||
public string MaritalStatus { get; set; }
|
||||
public long WorkshopId { get; set; }
|
||||
public long EmployeeId { get; set; }
|
||||
public DateTime StartWorkTime { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using _0_Framework_b.Application;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.EmployeeClientTemp;
|
||||
|
||||
public interface IEmployeeClientTempApplication
|
||||
{
|
||||
OperationResult Create(CreateEmployeeClientTemp command);
|
||||
|
||||
EmployeeClientTempGetDetailsViewModel GetDetails(long employeeId, long workshopId);
|
||||
|
||||
}
|
||||
|
||||
public class EmployeeClientTempGetDetailsViewModel
|
||||
{
|
||||
public long WorkshopId { get; set; }
|
||||
public long EmployeeId { get; set; }
|
||||
public string StartWorkDate { get; set; }
|
||||
public string FName { get; set; }
|
||||
public string LName { get; set; }
|
||||
|
||||
public string FullName => $"{FName} {LName}";
|
||||
public string NationalCode { get; set; }
|
||||
public string Nationality { get; set; }
|
||||
|
||||
}
|
||||
@@ -49,10 +49,10 @@ namespace CompanyManagment.App.Contracts.EmployeeDocuments
|
||||
List<EmployeeDocumentsViewModel> GetByWorkshopIdWithItemsForAdminWorkFlow(long workshopId);
|
||||
|
||||
List<EmployeeDocumentsViewModel> GetDocumentsAwaitingReviewByWorkshopIdForCheckerWorkFlow(long workshopId);
|
||||
int GetAdminWorkFlowCountForSubmittedAndRejectedDocuments(List<long> workshopIds);
|
||||
//int GetAdminWorkFlowCountForNewEmployees(List<long> workshopIds);
|
||||
Task<int> GetAdminWorkFlowCountForSubmittedAndRejectedDocuments(List<long> workshopIds);
|
||||
Task<int> GetAdminWorkFlowCountForNewEmployees(List<long> workshopIds);
|
||||
OperationResult RemoveByAdmin(long documentItemId);
|
||||
int GetCheckerWorkFlowCount();
|
||||
Task<int> GetCheckerWorkFlowCount();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.LeftWorkTemp;
|
||||
|
||||
public class CreateLeftWorkTemp
|
||||
{
|
||||
public List<long> EmployeeIds { get; set; }
|
||||
public long WorkshopId { get; set; }
|
||||
public string LeftWorkTime { get; set; }
|
||||
public string LastDayStanding { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.LeftWorkTemp;
|
||||
|
||||
public class CreateLeftWorkTempSingleViewModel
|
||||
{
|
||||
public string EmployeeFullName { get; set; }
|
||||
public List<long> EmployeeIds { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using _0_Framework.Application;
|
||||
using CompanyManagment.App.Contracts.LeftWork;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.LeftWorkTemp;
|
||||
|
||||
public interface ILeftWorkTempApplication
|
||||
{
|
||||
Task<OperationResult> Create(CreateLeftWorkTemp command);
|
||||
|
||||
/// <summary>
|
||||
/// گرفتن اطلاعات برای مودال جزئیات شروع به کار موقت یا ترک کار موقت
|
||||
/// </summary>
|
||||
/// <param name="employeeId"></param>
|
||||
/// <param name="workshopId"></param>
|
||||
/// <returns></returns>
|
||||
Task<GetStartWorkTempDetails> GetStartAndLeftWorkDetails(long employeeId,long workshopId);
|
||||
|
||||
/// <summary>
|
||||
/// تایید شروع به کار موقت
|
||||
/// </summary>
|
||||
/// <param name="command"></param>
|
||||
/// <returns></returns>
|
||||
Task<OperationResult> AcceptStartWork(AcceptStartWorkTemp command);
|
||||
|
||||
/// <summary>
|
||||
/// تایید ترک کار موقت
|
||||
/// </summary>
|
||||
/// <param name="command"></param>
|
||||
/// <returns></returns>
|
||||
Task<OperationResult> AcceptLeftWork(AcceptLeftWorkTemp command);
|
||||
}
|
||||
|
||||
public class AcceptLeftWorkTemp
|
||||
{
|
||||
public long LeftWorkTempId { get; set; }
|
||||
public string LeftWorkTime { get; set; }
|
||||
public string LastDayStanding { get; set; }
|
||||
}
|
||||
|
||||
public class AcceptStartWorkTemp
|
||||
{
|
||||
public long LeftWorkTempId { get; set; }
|
||||
public string StartDateTime { get; set; }
|
||||
public long JobId { get; set; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public class GetStartWorkTempDetails
|
||||
{
|
||||
public LeftWorkTempDetailsViewModel LeftWorkTemp { get; set; }
|
||||
public List<LeftWorkTempDetailsViewModel> PreviousLeftWorks { get; set; }
|
||||
public long JobId { get; set; }
|
||||
public string JobName { get; set; }
|
||||
public long WorkshopId { get; set; }
|
||||
public string WorkshopFullName { get; set; }
|
||||
public string EmployeeFullName { get; set; }
|
||||
public long EmployeeId { get; set; }
|
||||
public long PersonnelCode { get; set; }
|
||||
}
|
||||
|
||||
public class LeftWorkTempDetailsViewModel
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public string StartWork { get; set; }
|
||||
public string LeftWork { get; set; }
|
||||
public string LastDayStanding { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
namespace CompanyManagment.App.Contracts.LeftWorkTemp;
|
||||
|
||||
public enum LeftWorkTempType
|
||||
{
|
||||
/// <summary>
|
||||
/// شروع به کار کرده
|
||||
/// </summary>
|
||||
StartWork,
|
||||
|
||||
/// <summary>
|
||||
/// ترک کار کرده
|
||||
/// </summary>
|
||||
LeftWork
|
||||
}
|
||||
@@ -396,7 +396,12 @@ public class CustomizeWorkshopSettingsApplication(ICustomizeWorkshopSettingsRepo
|
||||
|
||||
if (previousEnd != new DateTime())
|
||||
{
|
||||
if (newShift.start <= previousEnd)
|
||||
if (newShift.start == previousEnd)
|
||||
{
|
||||
return op.Failed("در شیفت منظم پایان شیفت نمیتواند با شروع شیفت بعدی برابر باشد");
|
||||
}
|
||||
|
||||
if (newShift.start <= previousEnd)
|
||||
{
|
||||
newShift.start = newShift.start.AddDays(1);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using _0_Framework.InfraStructure;
|
||||
using Company.Domain.EmployeeAgg;
|
||||
@@ -10,6 +11,24 @@ using Company.Domain.EmployeeInsuranceRecordAgg;
|
||||
using Company.Domain.WorkshopAgg;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Company.Domain.PersonnelCodeAgg;
|
||||
using CompanyManagment.App.Contracts.CustomizeWorkshopSettings;
|
||||
using CompanyManagment.App.Contracts.EmployeeBankInformation;
|
||||
using CompanyManagment.App.Contracts.EmployeeDocuments;
|
||||
using CompanyManagment.App.Contracts.RollCallEmployeeStatus;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using System.IO;
|
||||
using System.Transactions;
|
||||
using Company.Domain.EmployeeClientTempAgg;
|
||||
using Company.Domain.LeftWorkTempAgg;
|
||||
using CompanyManagment.App.Contracts.LeftWorkTemp;
|
||||
using _0_Framework.Application.UID;
|
||||
using Company.Domain.CustomizeWorkshopEmployeeSettingsAgg;
|
||||
using Company.Domain.EmployeeDocumentsAgg;
|
||||
using Company.Domain.RollCallEmployeeAgg;
|
||||
using Company.Domain.CustomizeWorkshopGroupSettingsAgg;
|
||||
using Company.Domain.LeftWorkAgg;
|
||||
using CompanyManagment.App.Contracts.Employee.DTO;
|
||||
|
||||
namespace CompanyManagment.Application;
|
||||
|
||||
@@ -25,11 +44,39 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
||||
public bool StatCity = true;
|
||||
public bool city = true;
|
||||
public bool address = true;
|
||||
private readonly IWebHostEnvironment _webHostEnvironment;
|
||||
private readonly IRollCallEmployeeStatusApplication _rollCallEmployeeStatusApplication;
|
||||
private readonly IRollCallEmployeeRepository _rollCallEmployeeRepository;
|
||||
private readonly ICustomizeWorkshopSettingsApplication _customizeWorkshopSettingsApplication;
|
||||
private readonly IEmployeeDocumentsApplication _employeeDocumentsApplication;
|
||||
private readonly IEmployeeDocumentsRepository _employeeDocumentsRepository;
|
||||
private readonly IEmployeeBankInformationApplication _employeeBankInformationApplication;
|
||||
private readonly ILeftWorkTempRepository _leftWorkTempRepository;
|
||||
private readonly IUidService _uidService;
|
||||
private readonly ICustomizeWorkshopEmployeeSettingsRepository _customizeWorkshopEmployeeSettingsRepository;
|
||||
private readonly ILeftWorkRepository _leftWorkRepository;
|
||||
private readonly IPersonnelCodeRepository _personnelCodeRepository;
|
||||
private readonly IEmployeeClientTempRepository _employeeClientTempRepository;
|
||||
private readonly ICustomizeWorkshopGroupSettingsRepository _customizeWorkshopGroupSettingsRepository;
|
||||
|
||||
public EmployeeAplication(IEmployeeRepository employeeRepository, CompanyContext context, IWorkshopRepository workShopRepository) : base(context)
|
||||
public EmployeeAplication(IEmployeeRepository employeeRepository, CompanyContext context, IWorkshopRepository workShopRepository, IWebHostEnvironment webHostEnvironment, IRollCallEmployeeStatusApplication rollCallEmployeeStatusApplication, IRollCallEmployeeRepository rollCallEmployeeRepository, ICustomizeWorkshopSettingsApplication customizeWorkshopSettingsApplication, IEmployeeDocumentsApplication employeeDocumentsApplication, IEmployeeDocumentsRepository employeeDocumentsRepository, IEmployeeBankInformationApplication employeeBankInformationApplication, ILeftWorkTempRepository leftWorkTempRepository, IUidService uidService, ICustomizeWorkshopEmployeeSettingsRepository customizeWorkshopEmployeeSettingsRepository, IPersonnelCodeRepository personnelCodeRepository, IEmployeeClientTempRepository employeeClientTempRepository, ICustomizeWorkshopGroupSettingsRepository customizeWorkshopGroupSettingsRepository, ILeftWorkRepository leftWorkRepository) : base(context)
|
||||
{
|
||||
_context = context;
|
||||
_WorkShopRepository = workShopRepository;
|
||||
_webHostEnvironment = webHostEnvironment;
|
||||
_rollCallEmployeeStatusApplication = rollCallEmployeeStatusApplication;
|
||||
_rollCallEmployeeRepository = rollCallEmployeeRepository;
|
||||
_customizeWorkshopSettingsApplication = customizeWorkshopSettingsApplication;
|
||||
_employeeDocumentsApplication = employeeDocumentsApplication;
|
||||
_employeeDocumentsRepository = employeeDocumentsRepository;
|
||||
_employeeBankInformationApplication = employeeBankInformationApplication;
|
||||
_leftWorkTempRepository = leftWorkTempRepository;
|
||||
_uidService = uidService;
|
||||
_customizeWorkshopEmployeeSettingsRepository = customizeWorkshopEmployeeSettingsRepository;
|
||||
_personnelCodeRepository = personnelCodeRepository;
|
||||
_employeeClientTempRepository = employeeClientTempRepository;
|
||||
_customizeWorkshopGroupSettingsRepository = customizeWorkshopGroupSettingsRepository;
|
||||
_leftWorkRepository = leftWorkRepository;
|
||||
_EmployeeRepository = employeeRepository;
|
||||
}
|
||||
|
||||
@@ -902,4 +949,541 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Mahan
|
||||
public OperationResult CreateEmployeeByClient(CreateEmployeeByClient command)
|
||||
{
|
||||
OperationResult op = new();
|
||||
|
||||
if (command.Gender != "مرد" && command.Gender != "زن")
|
||||
return op.Failed("جنسیت را انتخاب کنید");
|
||||
|
||||
if (string.IsNullOrWhiteSpace(command.FirstName) || string.IsNullOrWhiteSpace(command.LastName))
|
||||
return op.Failed("نام نمی تواند خالی باشد");
|
||||
|
||||
if (command.MaritalStatus != "مجرد" && command.MaritalStatus != "متاهل")
|
||||
return op.Failed("وضعیت تاهل نمی تواند خالی باشد");
|
||||
|
||||
bool isNationalCardValid = command.NationalCode?.NationalCodeValid() == "valid";
|
||||
if (isNationalCardValid == false)
|
||||
return op.Failed("کد ملی وارد شده معتبر نمی باشد");
|
||||
|
||||
if (command.Nationality != "ایرانی")
|
||||
return op.Failed("خطای سیستمی");
|
||||
|
||||
if (!_WorkShopRepository.Exists(x => x.id == command.WorkshopId))
|
||||
{
|
||||
return op.Failed("کارگاه نامعتبر است");
|
||||
}
|
||||
|
||||
using var transaction = new TransactionScope();
|
||||
|
||||
//if (_EmployeeRepository.ExistsIgnoreQueryFilter(x => x.NationalCode == command.NationalCode && x.EmployeeType == EmployeeType.CreatedByClient))
|
||||
//{
|
||||
// return op.Failed("این پرسنل قبلا افزوده شده است و در انتظار تایید میباشد");
|
||||
//}
|
||||
|
||||
var employee = _EmployeeRepository.GetByNationalCodeIgnoreQueryFilter(command.NationalCode);
|
||||
var workshop = _WorkShopRepository.GetDetails(command.WorkshopId);
|
||||
if (employee == null)
|
||||
{
|
||||
return op.Failed("خطای سیستمی. لطفا دوباره تلاش کنید . درصورت تکرار این مشکل با تیم پشتیبان تماس بگیرید");
|
||||
}
|
||||
|
||||
if (_leftWorkTempRepository.Exists(x =>
|
||||
x.EmployeeId == employee.id && x.WorkshopId == command.WorkshopId && x.LeftWorkType == LeftWorkTempType.StartWork))
|
||||
{
|
||||
return op.Failed("این پرسنل در کارگاه شما قبلا افزوده شده است و در انتظار تایید میباشد");
|
||||
}
|
||||
|
||||
var startLeftWork = command.StartLeftWork.ToGeorgianDateTime();
|
||||
|
||||
var leftWorkViewModel = _leftWorkRepository.GetLastLeftWorkByEmployeeIdAndWorkshopId(command.WorkshopId, employee.id);
|
||||
PersonnelCodeDomain personnelCode = null;
|
||||
if (leftWorkViewModel != null)
|
||||
{
|
||||
if (leftWorkViewModel.HasLeft == false && leftWorkViewModel.LeftWorkDate > DateTime.Now)
|
||||
{
|
||||
return op.Failed("شما نمیتوانید پرسنلی که در کارگاه شما در حال کار است را ایجاد کنید");
|
||||
}
|
||||
|
||||
if (leftWorkViewModel.LeftWorkDate > startLeftWork)
|
||||
{
|
||||
return op.Failed("شما نمیتوانید قبل از بازه ترک کار قبلی پرسنل شروع به کاری ثبت کنید");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var lastPersonnelCodeByWorkshop = _personnelCodeRepository.GetLastPersonnelCodeByWorkshop(command.WorkshopId);
|
||||
|
||||
personnelCode = new PersonnelCodeDomain(command.WorkshopId,
|
||||
employee.id, lastPersonnelCodeByWorkshop + 1);
|
||||
}
|
||||
|
||||
var leftWorkTemp = LeftWorkTemp.CreateStartWork(command.WorkshopId, employee.id, startLeftWork, command.JobId);
|
||||
_leftWorkTempRepository.Create(leftWorkTemp);
|
||||
_leftWorkTempRepository.SaveChanges();
|
||||
|
||||
|
||||
if (personnelCode != null)
|
||||
{
|
||||
_personnelCodeRepository.Create(personnelCode);
|
||||
_personnelCodeRepository.SaveChanges();
|
||||
}
|
||||
|
||||
|
||||
if (string.IsNullOrWhiteSpace(command.RollCallUploadEmployeePicture?.Picture1) == false &&
|
||||
string.IsNullOrWhiteSpace(command.RollCallUploadEmployeePicture?.Picture2) == false)
|
||||
{
|
||||
var directoryPath = $"{_webHostEnvironment.ContentRootPath}\\Faces\\{command.WorkshopId}\\{employee.id}";
|
||||
if (!Directory.Exists(directoryPath))
|
||||
Directory.CreateDirectory(directoryPath);
|
||||
|
||||
var filePath1 = Path.Combine(directoryPath) + $@"\1.jpg";
|
||||
if (System.IO.File.Exists(filePath1))
|
||||
{
|
||||
CreateImageFromBase64(command.RollCallUploadEmployeePicture.Picture1, filePath1);
|
||||
}
|
||||
|
||||
var filePath2 = Path.Combine(directoryPath) + $@"\2.jpg";
|
||||
if (System.IO.File.Exists(filePath2))
|
||||
{
|
||||
CreateImageFromBase64(command.RollCallUploadEmployeePicture.Picture2, filePath2);
|
||||
}
|
||||
|
||||
|
||||
var rollCallEmployee =
|
||||
_rollCallEmployeeRepository.GetBy(employee.id, command.WorkshopId);
|
||||
|
||||
if (rollCallEmployee == null)
|
||||
{
|
||||
if (_employeeClientTempRepository.Exists(x =>
|
||||
x.EmployeeId == employee.id && x.WorkshopId == command.WorkshopId))
|
||||
{
|
||||
//var employeeTemp =
|
||||
// _employeeClientTempRepository.GetByEmployeeIdAndWorkshopId(employee.id, command.WorkshopId);
|
||||
|
||||
rollCallEmployee = new RollCallEmployee(command.WorkshopId, employee.id, employee.FName,
|
||||
employee.LName);
|
||||
}
|
||||
else
|
||||
{
|
||||
rollCallEmployee =
|
||||
new RollCallEmployee(command.WorkshopId, employee.id, employee.FName, employee.LName);
|
||||
}
|
||||
|
||||
rollCallEmployee.HasImage();
|
||||
_rollCallEmployeeRepository.Create(rollCallEmployee);
|
||||
_rollCallEmployeeRepository.SaveChanges();
|
||||
|
||||
}
|
||||
|
||||
var rollCallEmployeeStatusResult = _rollCallEmployeeStatusApplication.Create(
|
||||
new CreateRollCallEmployeeStatus() { RollCallEmployeeId = rollCallEmployee.id });
|
||||
|
||||
if (rollCallEmployeeStatusResult.IsSuccedded == false)
|
||||
{
|
||||
return rollCallEmployeeStatusResult;
|
||||
}
|
||||
|
||||
if (command.CreateCustomizeEmployeeSettings.GroupId > 0)
|
||||
{
|
||||
if (_customizeWorkshopEmployeeSettingsRepository
|
||||
.Exists(x => x.WorkshopId == workshop.Id && x.EmployeeId == employee.id) == false)
|
||||
{
|
||||
command.CreateCustomizeEmployeeSettings.EmployeeIds = [employee.id];
|
||||
command.CreateCustomizeEmployeeSettings.WorkshopId = command.WorkshopId;
|
||||
var resultCreateEmployeeSettings =
|
||||
_customizeWorkshopSettingsApplication.CreateEmployeesSettingsAndSetChanges(
|
||||
command.CreateCustomizeEmployeeSettings);
|
||||
if (resultCreateEmployeeSettings.IsSuccedded == false)
|
||||
{
|
||||
return resultCreateEmployeeSettings;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (command.CreateCustomizeEmployeeSettings.GroupId > 0)
|
||||
{
|
||||
if (_customizeWorkshopEmployeeSettingsRepository
|
||||
.Exists(x => x.WorkshopId == workshop.Id && x.EmployeeId == employee.id) == false)
|
||||
{
|
||||
command.CreateCustomizeEmployeeSettings.EmployeeIds = [employee.id];
|
||||
command.CreateCustomizeEmployeeSettings.WorkshopId = command.WorkshopId;
|
||||
var resultCreateEmployeeSettings =
|
||||
_customizeWorkshopSettingsApplication.CreateEmployeesSettingsAndSetChanges(
|
||||
command.CreateCustomizeEmployeeSettings);
|
||||
if (resultCreateEmployeeSettings.IsSuccedded == false)
|
||||
{
|
||||
return resultCreateEmployeeSettings;
|
||||
}
|
||||
}
|
||||
|
||||
var rollCallEmployee =
|
||||
_rollCallEmployeeRepository.GetBy(employee.id, command.WorkshopId);
|
||||
|
||||
if (rollCallEmployee == null)
|
||||
{
|
||||
if (_employeeClientTempRepository.Exists(x =>
|
||||
x.EmployeeId == employee.id && x.WorkshopId == command.WorkshopId))
|
||||
{
|
||||
|
||||
rollCallEmployee = new RollCallEmployee(command.WorkshopId, employee.id, employee.FName,
|
||||
employee.LName);
|
||||
}
|
||||
else
|
||||
{
|
||||
rollCallEmployee =
|
||||
new RollCallEmployee(command.WorkshopId, employee.id, employee.FName, employee.LName);
|
||||
}
|
||||
_rollCallEmployeeRepository.Create(rollCallEmployee);
|
||||
_rollCallEmployeeRepository.SaveChanges();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
command.EmployeeDocumentItems = command.EmployeeDocumentItems ?? [];
|
||||
|
||||
var employeeDocumentResult = _employeeDocumentsApplication.AddRangeEmployeeDocumentItems(command.WorkshopId,
|
||||
employee.id, command.EmployeeDocumentItems);
|
||||
|
||||
if (employeeDocumentResult.IsSuccedded == false)
|
||||
{
|
||||
return employeeDocumentResult;
|
||||
}
|
||||
|
||||
|
||||
var employeeTemp = new EmployeeClientTemp(command.WorkshopId, startLeftWork, employee.id,
|
||||
command.MaritalStatus, employee.FullName);
|
||||
|
||||
_employeeClientTempRepository.Create(employeeTemp);
|
||||
_employeeClientTempRepository.SaveChanges();
|
||||
|
||||
if (command.HasBankInformation)
|
||||
{
|
||||
|
||||
var employeeBankInfos = command.EmployeeBankInfos.Select(x => new CreateEmployeeInformation
|
||||
{
|
||||
WorkshopId = command.WorkshopId,
|
||||
BankAccountNumber = x.BankAccountNumber,
|
||||
BankId = x.BankId,
|
||||
CardNumber = x.CardNumber,
|
||||
EmployeeId = employee.id,
|
||||
EmployeeName = employee.FullName,
|
||||
ShebaNumber = x.ShebaNumber
|
||||
}).ToList();
|
||||
|
||||
var employeeBankInformationResult =
|
||||
_employeeBankInformationApplication.GroupCreate(command.WorkshopId, employeeBankInfos);
|
||||
|
||||
if (employeeBankInformationResult.IsSuccedded == false)
|
||||
{
|
||||
return employeeBankInformationResult;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
transaction.Complete();
|
||||
return op.Succcedded(employee.id);
|
||||
}
|
||||
|
||||
private void CreateImageFromBase64(string picture, string filePath)
|
||||
{
|
||||
var subBase64 = picture.Substring(picture.LastIndexOf(',') + 1);
|
||||
byte[] bytes = Convert.FromBase64String(subBase64);
|
||||
System.IO.File.WriteAllBytes(filePath, bytes);
|
||||
}
|
||||
|
||||
public async Task<OperationResult<EmployeeByNationalCodeInWorkshopViewModel>>
|
||||
ValidateCreateEmployeeClientByNationalCodeAndWorkshopId(string nationalCode, string birthDate, long workshopId)
|
||||
{
|
||||
var op = new OperationResult<EmployeeByNationalCodeInWorkshopViewModel>();
|
||||
|
||||
if (nationalCode.NationalCodeValid() != "valid")
|
||||
{
|
||||
return op.Failed("کد ملی معتبر نمیباشد");
|
||||
}
|
||||
|
||||
if (birthDate.TryToGeorgianDateTime(out _) == false)
|
||||
{
|
||||
return op.Failed("تاریخ تولد معتبر نمیباشد");
|
||||
}
|
||||
|
||||
var employee = _EmployeeRepository.GetByNationalCodeIgnoreQueryFilter(nationalCode);
|
||||
|
||||
if (employee == null)
|
||||
{
|
||||
var personalInfo = await _uidService.GetPersonalInfo(nationalCode, birthDate);
|
||||
if (personalInfo.ResponseContext.Status.Code != 0)
|
||||
{
|
||||
return op.Failed("کد ملی و تاریخ تولد با هم همخانی ندارند");
|
||||
}
|
||||
|
||||
var basicInfo = personalInfo.BasicInformation;
|
||||
var identityInfo = personalInfo.IdentificationInformation;
|
||||
DateTime apiBirthDate = identityInfo.BirthDate.ToGeorgianDateTime();
|
||||
|
||||
var dateOfIssue = new DateTime(1922, 1, 1);
|
||||
|
||||
var gender = basicInfo.GenderEnum switch
|
||||
{
|
||||
Gender.Female => "زن",
|
||||
Gender.Male => "مرد",
|
||||
_ => throw new AggregateException()
|
||||
};
|
||||
|
||||
var idNumber = identityInfo.ShenasnamehNumber == "0" ? identityInfo.NationalId : identityInfo.ShenasnamehNumber;
|
||||
|
||||
var newEmployee = new Employee(basicInfo.FirstName, basicInfo.LastName, basicInfo.FatherName, apiBirthDate,
|
||||
dateOfIssue, null, identityInfo.NationalId, idNumber, gender, "ایرانی");
|
||||
newEmployee.Authorized();
|
||||
await _EmployeeRepository.CreateAsync(newEmployee);
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
return op.Succcedded(new EmployeeByNationalCodeInWorkshopViewModel()
|
||||
{
|
||||
EmployeeId = newEmployee.id,
|
||||
EmployeeFName = newEmployee.FName,
|
||||
Gender = newEmployee.Gender,
|
||||
Nationality = newEmployee.Nationality,
|
||||
EmployeeLName = newEmployee.LName
|
||||
});
|
||||
}
|
||||
|
||||
if (_leftWorkTempRepository.ExistsIgnoreQueryFilter(x =>
|
||||
x.EmployeeId == employee.id && x.WorkshopId == workshopId && x.LeftWorkType == LeftWorkTempType.StartWork))
|
||||
{
|
||||
return op.Failed("این پرسنل در کارگاه شما قبلا افزوده شده است و در انتظار تایید میباشد");
|
||||
}
|
||||
|
||||
if (employee.IsAuthorized == false)
|
||||
{
|
||||
var personalInfoResponse = await _uidService.GetPersonalInfo(nationalCode, birthDate);
|
||||
|
||||
if (personalInfoResponse.ResponseContext.Status.Code == 0)
|
||||
{
|
||||
var basicInfo = personalInfoResponse.BasicInformation;
|
||||
var identityInfo = personalInfoResponse.IdentificationInformation;
|
||||
var apiBirthDate = identityInfo.BirthDate.ToGeorgianDateTime();
|
||||
|
||||
var dateOfIssue = new DateTime(1922, 1, 1);
|
||||
|
||||
var gender = basicInfo.GenderEnum switch
|
||||
{
|
||||
Gender.Female => "زن",
|
||||
Gender.Male => "مرد",
|
||||
_ => throw new AggregateException()
|
||||
};
|
||||
|
||||
var idNumber = identityInfo.ShenasnamehNumber == "0" ? identityInfo.NationalId : identityInfo.ShenasnamehNumber;
|
||||
|
||||
|
||||
employee.Edit(basicInfo.FirstName, basicInfo.LastName, basicInfo.FatherName, apiBirthDate,
|
||||
dateOfIssue, employee.PlaceOfIssue, identityInfo.NationalId, idNumber,
|
||||
gender, "ایرانی", employee.Phone, employee.Address, employee.State, employee.City,
|
||||
employee.MaritalStatus, employee.MilitaryService, employee.LevelOfEducation,
|
||||
employee.FieldOfStudy, employee.BankCardNumber, employee.BankBranch, employee.InsuranceCode, employee.InsuranceHistoryByYear,
|
||||
employee.InsuranceHistoryByMonth, employee.NumberOfChildren,
|
||||
employee.OfficePhone, employee.MclsUserName, employee.MclsPassword,
|
||||
employee.EserviceUserName, employee.EservicePassword, employee.TaxOfficeUserName,
|
||||
employee.TaxOfficepassword, employee.SanaUserName, employee.SanaPassword);
|
||||
|
||||
employee.Authorized();
|
||||
|
||||
await _EmployeeRepository.SaveChangesAsync();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
return op.Failed("کد ملی با تاریخ تولد وارد شده مطابقت ندارد");
|
||||
}
|
||||
}
|
||||
|
||||
var leftWorkViewModel = _leftWorkRepository.GetLastLeftWorkByEmployeeIdAndWorkshopId(workshopId, employee.id);
|
||||
if (leftWorkViewModel == null)
|
||||
{
|
||||
return op.Succcedded(new EmployeeByNationalCodeInWorkshopViewModel()
|
||||
{
|
||||
EmployeeId = employee.id,
|
||||
EmployeeFName = employee.FName,
|
||||
Gender = employee.Gender,
|
||||
Nationality = employee.Nationality,
|
||||
EmployeeLName = employee.LName
|
||||
}); ;
|
||||
}
|
||||
|
||||
if (leftWorkViewModel.LeftWorkDate >= DateTime.Now || !leftWorkViewModel.HasLeft)
|
||||
return op.Failed("این پرسنل در کارگاه شما در حال کار است");
|
||||
|
||||
var rollCallEmployee = _rollCallEmployeeRepository.GetBy(employee.id, workshopId);
|
||||
|
||||
string picture1 = string.Empty;
|
||||
string picture2 = string.Empty;
|
||||
|
||||
if (rollCallEmployee != null)
|
||||
{
|
||||
var directoryPath = $"{_webHostEnvironment.ContentRootPath}\\Faces\\{workshopId}\\{employee.id}";
|
||||
if (Directory.Exists(directoryPath))
|
||||
{
|
||||
var filePath1 = Path.Combine(directoryPath, @"1.jpg");
|
||||
var filePath2 = Path.Combine(directoryPath, @"2.jpg");
|
||||
|
||||
if (System.IO.File.Exists(filePath1))
|
||||
{
|
||||
byte[] imageBytes1 = await System.IO.File.ReadAllBytesAsync(filePath1);
|
||||
picture1 = Convert.ToBase64String(imageBytes1);
|
||||
}
|
||||
|
||||
if (System.IO.File.Exists(filePath2))
|
||||
{
|
||||
byte[] imageBytes2 = await System.IO.File.ReadAllBytesAsync(filePath2);
|
||||
picture2 = Convert.ToBase64String(imageBytes2);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
var personnelCode = _personnelCodeRepository.GetPSCodeByWorkshopIdAndEmployeeId(workshopId, employee.id);
|
||||
|
||||
var bankInformationViewModel = _employeeBankInformationApplication.GetByEmployeeId(workshopId, employee.id);
|
||||
|
||||
var employeeDocumentsViewModel = _employeeDocumentsApplication.GetDetailsForClient(employee.id, workshopId);
|
||||
|
||||
|
||||
return op.Succcedded(new EmployeeByNationalCodeInWorkshopViewModel
|
||||
{
|
||||
EmployeeId = employee.id,
|
||||
EmployeeFName = employee.FName,
|
||||
EmployeeLName = employee.LName,
|
||||
Nationality = employee.Nationality,
|
||||
MaritalStatus = employee.MaritalStatus,
|
||||
Gender = employee.Gender,
|
||||
Picture1 = picture1,
|
||||
Picture2 = picture2,
|
||||
PersonnelCode = personnelCode,
|
||||
EmployeeBankInfos = bankInformationViewModel.BankInformation.Select(x => new EmployeeByNationalCodeEmployeeBankInfoViewModel
|
||||
{
|
||||
ShebaNumber = x.ShebaNumber,
|
||||
IsDefault = x.IsDefault,
|
||||
CardNumber = x.CardNumber,
|
||||
BankAccountNumber = x.BankAccountNumber,
|
||||
BankId = x.BankId,
|
||||
BankLogoMediaId = x.BankLogoMediaId,
|
||||
BankLogoPath = x.BankLogoPath,
|
||||
BankName = x.BankName
|
||||
}).ToList(),
|
||||
EmployeeDocument = new EmployeeByNationalCodeEmployeeDocumentViewModel
|
||||
{
|
||||
EducationalDegree = employeeDocumentsViewModel.EducationalDegree,
|
||||
EmployeePicture = employeeDocumentsViewModel.EmployeePicture,
|
||||
IdCardPage1 = employeeDocumentsViewModel.IdCardPage1,
|
||||
IdCardPage2 = employeeDocumentsViewModel.IdCardPage2,
|
||||
IdCardPage3 = employeeDocumentsViewModel.IdCardPage3,
|
||||
IdCardPage4 = employeeDocumentsViewModel.IdCardPage4,
|
||||
MilitaryServiceCard = employeeDocumentsViewModel.MilitaryServiceCard,
|
||||
NationalCardFront = employeeDocumentsViewModel.NationalCardFront,
|
||||
NationalCardRear = employeeDocumentsViewModel.NationalCardRear
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public async Task<ICollection<ClientStartedWorkEmployeesDto>> GetClientEmployeesStartWork(long workshopId)
|
||||
{
|
||||
return await _EmployeeRepository.GetClientEmployeesStartWork(workshopId);
|
||||
}
|
||||
|
||||
public async Task<ICollection<ClientLeftWorkWorkEmployeesDto>> GetEmployeesForLeftWorkTemp(long workshopId)
|
||||
{
|
||||
return await _EmployeeRepository.GetEmployeesForLeftWorkTemp(workshopId);
|
||||
}
|
||||
|
||||
public async Task<GetEditEmployeeInEmployeeDocumentViewModel> GetEmployeeEditInEmployeeDocumentWorkFlow(
|
||||
long employeeId,
|
||||
long workshopId)
|
||||
{
|
||||
return await _EmployeeRepository.GetEmployeeEditInEmployeeDocumentWorkFlow(employeeId, workshopId);
|
||||
}
|
||||
|
||||
public async Task<OperationResult> EditEmployeeInEmployeeDocumentWorkFlow(EditEmployeeInEmployeeDocument command)
|
||||
{
|
||||
var op = new OperationResult();
|
||||
|
||||
if (command.MaritalStatus is not ("مجرد" or "متاهل"))
|
||||
{
|
||||
return op.Failed("وضعیت تاهل وارد شده نامعتبر میباشد");
|
||||
}
|
||||
|
||||
var employee = _EmployeeRepository.Get(command.EmployeeId);
|
||||
if (employee == null)
|
||||
{
|
||||
return op.Failed("پرسنل مورد نظر یافت نشد");
|
||||
}
|
||||
|
||||
if (!employee.IsAuthorized)
|
||||
{
|
||||
if (command.Gender is not ("مرد" or "زن"))
|
||||
{
|
||||
return op.Failed("جنسیت وارد شده نامعتبر است");
|
||||
}
|
||||
if (command.BirthDate.TryToGeorgianDateTime(out var birthDateGr) == false)
|
||||
{
|
||||
return op.Failed("تاریخ تولد وارد شده نامعتبر است");
|
||||
}
|
||||
|
||||
if (command.Nationality is not ("غیر ایرانی" or "ایرانی"))
|
||||
{
|
||||
return op.Failed("ملیت وارد شده نامعتبر است");
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(command.FName))
|
||||
{
|
||||
return op.Failed("لطفا نام پرسنل را وارد کنید");
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(command.LName))
|
||||
{
|
||||
return op.Failed("لطفا نام خانوادگی پرسنل را وارد کنید");
|
||||
}
|
||||
|
||||
if (command.NationalCode.NationalCodeValid() != "valid")
|
||||
{
|
||||
return op.Failed("کد ملی وارد شده نامعتبر است");
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(command.IdNumber))
|
||||
{
|
||||
return op.Failed("لطفا شماره شناسنامه را وارد کنید");
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(command.FatherName))
|
||||
{
|
||||
return op.Failed("لطفا نام پدر را وارد کنید");
|
||||
}
|
||||
}
|
||||
|
||||
var employeeClientTemp = _employeeClientTempRepository.GetByEmployeeIdAndWorkshopId(command.EmployeeId, command.WorkshopId);
|
||||
|
||||
employeeClientTemp?.Edit(command.MaritalStatus);
|
||||
|
||||
if (!employee.IsAuthorized)
|
||||
{
|
||||
employee.Edit(command.FName, command.LName, command.FatherName, command.BirthDate.ToGeorgianDateTime(),
|
||||
employee.DateOfIssue, employee.PlaceOfIssue, command.NationalCode, command.IdNumber, command.Gender,
|
||||
command.Nationality,
|
||||
employee.Phone, employee.Address, employee.State, employee.City, employee.MaritalStatus,
|
||||
employee.MilitaryService,
|
||||
employee.LevelOfEducation, employee.FieldOfStudy, employee.BankCardNumber, employee.BankBranch,
|
||||
employee.InsuranceCode, employee.InsuranceHistoryByYear, employee.InsuranceHistoryByMonth,
|
||||
employee.NumberOfChildren, employee.OfficePhone, employee.MclsUserName, employee.MclsPassword,
|
||||
employee.EserviceUserName, employee.EservicePassword, employee.TaxOfficeUserName,
|
||||
employee.TaxOfficepassword, employee.SanaUserName, employee.SanaPassword);
|
||||
}
|
||||
await _EmployeeRepository.SaveChangesAsync();
|
||||
|
||||
return op.Succcedded();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
using _0_Framework_b.Application;
|
||||
using Company.Domain.EmployeeClientTempAgg;
|
||||
using CompanyManagment.App.Contracts.EmployeeClientTemp;
|
||||
|
||||
namespace CompanyManagment.Application;
|
||||
|
||||
public class EmployeeClientTempApplication : IEmployeeClientTempApplication
|
||||
{
|
||||
private readonly IEmployeeClientTempRepository _employeeClientTempRepository;
|
||||
|
||||
public EmployeeClientTempApplication(IEmployeeClientTempRepository employeeClientTempRepository)
|
||||
{
|
||||
_employeeClientTempRepository = employeeClientTempRepository;
|
||||
}
|
||||
|
||||
public OperationResult Create(CreateEmployeeClientTemp command)
|
||||
{
|
||||
var op = new OperationResult();
|
||||
var fullName = $"{command.FName} {command.LName}";
|
||||
var employeeClientTemp = new EmployeeClientTemp(command.WorkshopId, command.StartWorkTime, command.EmployeeId, command.MaritalStatus, fullName);
|
||||
|
||||
_employeeClientTempRepository.Create(employeeClientTemp);
|
||||
_employeeClientTempRepository.SaveChanges();
|
||||
|
||||
return op.Succcedded();
|
||||
}
|
||||
|
||||
public EmployeeClientTempGetDetailsViewModel GetDetails(long employeeId, long workshopId)
|
||||
{
|
||||
return _employeeClientTempRepository.GetDetails(employeeId, workshopId);
|
||||
}
|
||||
}
|
||||
@@ -1152,12 +1152,15 @@ namespace CompanyManagment.Application
|
||||
return op.Succcedded();
|
||||
}
|
||||
|
||||
public int GetAdminWorkFlowCountForSubmittedAndRejectedDocuments(List<long> workshopIds)
|
||||
public async Task<int> GetAdminWorkFlowCountForSubmittedAndRejectedDocuments(List<long> workshopIds)
|
||||
{
|
||||
return _employeeDocumentsRepository.GetAdminWorkFlowCountForSubmittedAndRejectedDocuments(workshopIds);
|
||||
return await _employeeDocumentsRepository.GetAdminWorkFlowCountForSubmittedAndRejectedDocuments(workshopIds);
|
||||
}
|
||||
public async Task<int> GetAdminWorkFlowCountForNewEmployees(List<long> workshopIds)
|
||||
{
|
||||
return await _employeeDocumentsRepository.GetAdminWorkFlowCountForNewEmployees(workshopIds);
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Checker Only Methods
|
||||
@@ -1360,9 +1363,9 @@ namespace CompanyManagment.Application
|
||||
return result;
|
||||
}
|
||||
|
||||
public int GetCheckerWorkFlowCount()
|
||||
public async Task<int> GetCheckerWorkFlowCount()
|
||||
{
|
||||
return _employeeDocumentsRepository.GetCheckerWorkFlowCount();
|
||||
return await _employeeDocumentsRepository.GetCheckerWorkFlowCount();
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
215
CompanyManagment.Application/LeftWorkTempApplication.cs
Normal file
215
CompanyManagment.Application/LeftWorkTempApplication.cs
Normal file
@@ -0,0 +1,215 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework_b.Application;
|
||||
using Company.Domain.CheckoutAgg;
|
||||
using Company.Domain.ContractAgg;
|
||||
using Company.Domain.EmployeeAgg;
|
||||
using Company.Domain.JobAgg;
|
||||
using Company.Domain.LeftWorkAgg;
|
||||
using Company.Domain.LeftWorkTempAgg;
|
||||
using Company.Domain.WorkshopAgg;
|
||||
using CompanyManagment.App.Contracts.Checkout;
|
||||
using CompanyManagment.App.Contracts.Contract;
|
||||
using CompanyManagment.App.Contracts.LeftWork;
|
||||
using CompanyManagment.App.Contracts.LeftWorkTemp;
|
||||
using CompanyManagment.App.Contracts.ReportClient;
|
||||
using OperationResult = _0_Framework.Application.OperationResult;
|
||||
using Tools = _0_Framework.Application.Tools;
|
||||
|
||||
namespace CompanyManagment.Application;
|
||||
|
||||
public class LeftWorkTempApplication : ILeftWorkTempApplication
|
||||
{
|
||||
private readonly ILeftWorkTempRepository _leftWorkTempRepository;
|
||||
private readonly ILeftWorkRepository _leftWorkRepository;
|
||||
private readonly IWorkshopRepository _workshopRepository;
|
||||
private readonly IEmployeeRepository _employeeRepository;
|
||||
private readonly IJobRepository _jobRepository;
|
||||
private readonly ICheckoutRepository _checkoutRepository;
|
||||
private readonly IContractRepository _contractRepository;
|
||||
|
||||
|
||||
public LeftWorkTempApplication(ILeftWorkTempRepository leftWorkTempRepository, ILeftWorkRepository leftWorkRepository, IWorkshopRepository workshopRepository, IEmployeeRepository employeeRepository, IJobRepository jobRepository, ICheckoutRepository checkoutRepository, IContractRepository contractRepository)
|
||||
{
|
||||
_leftWorkTempRepository = leftWorkTempRepository;
|
||||
_leftWorkRepository = leftWorkRepository;
|
||||
_workshopRepository = workshopRepository;
|
||||
_employeeRepository = employeeRepository;
|
||||
_jobRepository = jobRepository;
|
||||
_checkoutRepository = checkoutRepository;
|
||||
_contractRepository = contractRepository;
|
||||
}
|
||||
|
||||
public async Task<OperationResult> Create(CreateLeftWorkTemp command)
|
||||
{
|
||||
var op = new OperationResult();
|
||||
|
||||
foreach (var employee in command.EmployeeIds)
|
||||
{
|
||||
var leftWork = _leftWorkRepository.GetByDateAndWorkshopIdAndEmployeeId(command.WorkshopId, employee, Tools.ToGeorgianDateTime(command.LastDayStanding));
|
||||
#region Validation
|
||||
|
||||
if (command.LeftWorkTime.TryToGeorgianDateTime(out var leftWorkDateGr) == false)
|
||||
{
|
||||
return op.Failed("تاریخ شروع به کار وارد شده نامعتبر است");
|
||||
}
|
||||
if (command.LastDayStanding.TryToGeorgianDateTime(out var lastDayStandingDateGr) == false)
|
||||
{
|
||||
return op.Failed("تاریخ شروع به کار وارد شده نامعتبر است");
|
||||
}
|
||||
|
||||
if (lastDayStandingDateGr.AddDays(1).Date != leftWorkDateGr)
|
||||
{
|
||||
return op.Failed("تاریخ آخرین روز کاری با تاریخ ترک کار یک روز اختلاف ندارند");
|
||||
}
|
||||
|
||||
if (leftWork == null)
|
||||
{
|
||||
return op.Failed("شروع به کار پرسنل یافت نشد");
|
||||
}
|
||||
|
||||
if (leftWork.WorkshopId != command.WorkshopId || leftWork.EmployeeId != employee)
|
||||
{
|
||||
return op.Failed("اطلاعات وارد شده نامعتبر است");
|
||||
}
|
||||
|
||||
|
||||
|
||||
//if (leftWork.StartWorkDate >= leftWorkDateGr)
|
||||
//{
|
||||
// return op.Failed("ترک کار نمیتواند کوچک تر یا مساوی شروع به کار باشد");
|
||||
//}
|
||||
|
||||
//if (_checkoutRepository.Exists(x => x.EmployeeId == leftWorkTemp.EmployeeId &&
|
||||
// x.WorkshopId == leftWorkTemp.WorkshopId &&
|
||||
// x.ContractStart <= lastDayStandingGr && x.ContractEnd >= lastDayStandingGr))
|
||||
//{
|
||||
// return op.Failed("این پرسنل در تاریخ ترک کار وارد شده دارای فیش حقوقی میباشد. ابتدا فیش حقوقی پرسنل را حذف کنید ");
|
||||
//}
|
||||
|
||||
//if (_contractRepository.Exists(x => x.EmployeeId == leftWorkTemp.EmployeeId &&
|
||||
// x.WorkshopIds == leftWorkTemp.WorkshopId &&
|
||||
// x.ContarctStart <= lastDayStandingGr && x.ContractEnd >= lastDayStandingGr))
|
||||
//{
|
||||
// return op.Failed("این پرسنل در تاریخ ترک کار وارد شده دارای قرارداد میباشد");
|
||||
//}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
var leftWorkTemp = LeftWorkTemp.CreateLeftWork(leftWork.Id, leftWork.StartWorkDateGr, leftWorkDateGr, lastDayStandingDateGr,
|
||||
command.WorkshopId, employee, leftWork.JobId);
|
||||
|
||||
await _leftWorkTempRepository.CreateAsync(leftWorkTemp);
|
||||
}
|
||||
|
||||
await _leftWorkTempRepository.SaveChangesAsync();
|
||||
return op.Succcedded();
|
||||
}
|
||||
|
||||
public Task<GetStartWorkTempDetails> GetStartAndLeftWorkDetails(long employeeId, long workshopId)
|
||||
{
|
||||
return _leftWorkTempRepository.GetStartAndLeftWorkDetails(employeeId, workshopId);
|
||||
}
|
||||
|
||||
public async Task<OperationResult> AcceptStartWork(AcceptStartWorkTemp command)
|
||||
{
|
||||
var op = new OperationResult();
|
||||
if (command.StartDateTime.TryToGeorgianDateTime(out var startDateGr) == false)
|
||||
{
|
||||
return op.Failed("تاریخ شروع به کار وارد شده نامعتبر است");
|
||||
}
|
||||
|
||||
var leftWorkTemp = _leftWorkTempRepository.Get(command.LeftWorkTempId);
|
||||
|
||||
if (leftWorkTemp.LeftWorkType != LeftWorkTempType.StartWork)
|
||||
{
|
||||
return op.Failed("اطلاعات وارد شده نامعتبر است");
|
||||
}
|
||||
|
||||
if (_leftWorkRepository.Exists(x => x.WorkshopId == leftWorkTemp.WorkshopId && x.EmployeeId == leftWorkTemp.EmployeeId && x.LeftWorkDate >= startDateGr))
|
||||
{
|
||||
return op.Failed("شروع به کار وارد شده با ترک کار های قبلی تداخل دارد");
|
||||
}
|
||||
|
||||
|
||||
if (_jobRepository.Exists(x => x.id == command.JobId) == false)
|
||||
{
|
||||
return op.Failed("سمت وارد شده نامعتبر است");
|
||||
}
|
||||
|
||||
var defaultTime = new DateTime(2121, 03, 21);
|
||||
|
||||
var workshop = _workshopRepository.Get(leftWorkTemp.WorkshopId);
|
||||
var employee = _employeeRepository.Get(leftWorkTemp.EmployeeId);
|
||||
|
||||
var newLeftWork = new LeftWork(defaultTime, startDateGr, leftWorkTemp.WorkshopId, leftWorkTemp.EmployeeId,
|
||||
employee.FullName, workshop.WorkshopFullName, command.JobId, false, false, false, false, "", "");
|
||||
|
||||
await _leftWorkRepository.CreateAsync(newLeftWork);
|
||||
_leftWorkTempRepository.Remove(leftWorkTemp);
|
||||
await _leftWorkRepository.SaveChangesAsync();
|
||||
await _leftWorkTempRepository.SaveChangesAsync();
|
||||
return op.Succcedded();
|
||||
}
|
||||
|
||||
public async Task<OperationResult> AcceptLeftWork(AcceptLeftWorkTemp command)
|
||||
{
|
||||
var op = new OperationResult();
|
||||
if (command.LeftWorkTime.TryToGeorgianDateTime(out var leftWorkDateGr) == false)
|
||||
{
|
||||
return op.Failed("تاریخ ترک کار وارد شده نامعتبر است");
|
||||
}
|
||||
|
||||
if (command.LastDayStanding.TryToGeorgianDateTime(out var lastDayStandingGr) == false)
|
||||
{
|
||||
return op.Failed("تاریخ آخرین روز کاری وارد شده نامعتبر است");
|
||||
}
|
||||
|
||||
if (lastDayStandingGr.AddDays(1).Date != leftWorkDateGr)
|
||||
{
|
||||
return op.Failed("تاریخ آخرین روز کاری با تاریخ ترک کار یک روز اختلاف ندارند");
|
||||
}
|
||||
|
||||
var leftWorkTemp = _leftWorkTempRepository.Get(command.LeftWorkTempId);
|
||||
|
||||
if (leftWorkTemp == null)
|
||||
{
|
||||
return op.Failed("ترک کار وارد شده یافت نشد");
|
||||
}
|
||||
|
||||
|
||||
if (leftWorkTemp.LeftWorkType != LeftWorkTempType.LeftWork)
|
||||
{
|
||||
return op.Failed("اطلاعات وارد شده نامعتبر است");
|
||||
}
|
||||
|
||||
var leftWork = _leftWorkRepository.Get(leftWorkTemp.LeftWorkId);
|
||||
|
||||
|
||||
if (leftWork == null)
|
||||
return op.Failed("شروع به کار پرسنل یافت نشد");
|
||||
|
||||
if (leftWork.StartWorkDate >= leftWorkDateGr)
|
||||
{
|
||||
return op.Failed("ترک کار نمیتواند کوچک تر یا مساوی شروع به کار باشد");
|
||||
}
|
||||
|
||||
if (_checkoutRepository.Exists(x => x.EmployeeId == leftWorkTemp.EmployeeId &&
|
||||
x.WorkshopId == leftWorkTemp.WorkshopId &&
|
||||
x.ContractStart <= lastDayStandingGr && x.ContractEnd >= lastDayStandingGr))
|
||||
{
|
||||
return op.Failed("این پرسنل در تاریخ ترک کار وارد شده دارای فیش حقوقی میباشد. ابتدا فیش حقوقی پرسنل را حذف کنید ");
|
||||
}
|
||||
|
||||
leftWork.Edit(leftWorkDateGr, leftWork.StartWorkDate, leftWork.WorkshopId, leftWork.EmployeeId, leftWork.JobId,
|
||||
leftWork.IncludeStatus, leftWork.AddBonusesPay, leftWork.AddYearsPay, leftWork.AddLeavePay);
|
||||
|
||||
_leftWorkTempRepository.Remove(leftWorkTemp);
|
||||
await _leftWorkRepository.SaveChangesAsync();
|
||||
await _leftWorkTempRepository.SaveChangesAsync();
|
||||
|
||||
return op.Succcedded();
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,9 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Company.Domain.RollCallServiceAgg;
|
||||
using Company.Domain.LeftWorkTempAgg;
|
||||
using Company.Domain.LeftWorkInsuranceAgg;
|
||||
using CompanyManagment.App.Contracts.LeftWorkTemp;
|
||||
|
||||
|
||||
namespace CompanyManagment.Application
|
||||
@@ -17,14 +20,19 @@ namespace CompanyManagment.Application
|
||||
private readonly IRollCallEmployeeRepository _rollCallEmployeeRepository;
|
||||
private readonly ILeftWorkRepository _leftWorkRepository;
|
||||
private readonly IRollCallServiceRepository _rollCallServiceRepository;
|
||||
private readonly ILeftWorkTempRepository _leftWorkTempRepository;
|
||||
private readonly ILeftWorkInsuranceRepository _leftWorkInsuranceRepository;
|
||||
|
||||
|
||||
public RollCallEmployeeStatusApplication(IRollCallEmployeeStatusRepository employeeStatusRepository, IRollCallEmployeeRepository rollCallEmployeeRepository, ILeftWorkRepository leftWorkRepository, IRollCallServiceRepository rollCallServiceRepository)
|
||||
|
||||
public RollCallEmployeeStatusApplication(IRollCallEmployeeStatusRepository employeeStatusRepository, IRollCallEmployeeRepository rollCallEmployeeRepository, ILeftWorkRepository leftWorkRepository, IRollCallServiceRepository rollCallServiceRepository, ILeftWorkTempRepository leftWorkTempRepository, ILeftWorkInsuranceRepository leftWorkInsuranceRepository)
|
||||
{
|
||||
_employeeRollCallStatusRepository = employeeStatusRepository;
|
||||
_rollCallEmployeeRepository = rollCallEmployeeRepository;
|
||||
_leftWorkRepository = leftWorkRepository;
|
||||
_rollCallServiceRepository = rollCallServiceRepository;
|
||||
_leftWorkTempRepository = leftWorkTempRepository;
|
||||
_leftWorkInsuranceRepository = leftWorkInsuranceRepository;
|
||||
}
|
||||
|
||||
public OperationResult Create(CreateRollCallEmployeeStatus cmd)
|
||||
@@ -34,9 +42,18 @@ namespace CompanyManagment.Application
|
||||
if (rollCallEmployee == null)
|
||||
return op.Failed("کارمند مجاز نیست");
|
||||
|
||||
if (!_leftWorkRepository.Exists(x => x.EmployeeId == rollCallEmployee.EmployeeId && x.WorkshopId == rollCallEmployee.WorkshopId &&
|
||||
x.LeftWorkDate.Date > DateTime.Now.Date && x.StartWorkDate.Date <= DateTime.Now.Date))
|
||||
return op.Failed("کارمند در کارگاه شروع به کار نکرده است");
|
||||
if (!_leftWorkRepository.Exists(x =>
|
||||
x.EmployeeId == rollCallEmployee.EmployeeId && x.WorkshopId == rollCallEmployee.WorkshopId &&
|
||||
x.StartWorkDate <= DateTime.Now && x.LeftWorkDate > DateTime.Now) &&
|
||||
!_leftWorkInsuranceRepository.Exists(x =>
|
||||
x.EmployeeId == rollCallEmployee.EmployeeId && x.WorkshopId == rollCallEmployee.WorkshopId &&
|
||||
x.StartWorkDate <= DateTime.Now && (x.LeftWorkDate > DateTime.Now || x.LeftWorkDate == null)) &&
|
||||
!_leftWorkTempRepository.Exists(x =>
|
||||
x.EmployeeId == rollCallEmployee.EmployeeId && x.WorkshopId == rollCallEmployee.WorkshopId &&
|
||||
x.LeftWorkType == LeftWorkTempType.StartWork))
|
||||
{
|
||||
return op.Failed("کارمند شروع به کار ندارد");
|
||||
}
|
||||
|
||||
if (_employeeRollCallStatusRepository.Exists(y =>
|
||||
rollCallEmployee.id == y.RollCallEmployeeId && y.EndDate.Date > DateTime.Now.Date))
|
||||
|
||||
@@ -25,6 +25,7 @@ using Company.Domain.EmployeeAccountAgg;
|
||||
using Company.Domain.EmployeeAgg;
|
||||
using Company.Domain.EmployeeBankInformationAgg;
|
||||
using Company.Domain.EmployeeChildrenAgg;
|
||||
using Company.Domain.EmployeeClientTempAgg;
|
||||
using Company.Domain.EmployeeComputeOptionsAgg;
|
||||
using Company.Domain.EmployeeDocumentItemAgg;
|
||||
using Company.Domain.EmployeeDocumentsAgg;
|
||||
@@ -63,6 +64,7 @@ using Company.Domain.JobAgg;
|
||||
using Company.Domain.LeaveAgg;
|
||||
using Company.Domain.LeftWorkAgg;
|
||||
using Company.Domain.LeftWorkInsuranceAgg;
|
||||
using Company.Domain.LeftWorkTempAgg;
|
||||
using Company.Domain.LoanAgg.Entities;
|
||||
using Company.Domain.MandatoryHoursAgg;
|
||||
using Company.Domain.MasterPenaltyTitle;
|
||||
@@ -168,6 +170,9 @@ public class CompanyContext : DbContext
|
||||
|
||||
public DbSet<AndroidApkVersion> AndroidApkVersions { get; set; }
|
||||
|
||||
public DbSet<EmployeeClientTemp> EmployeeClientTemps { get; set; }
|
||||
public DbSet<LeftWorkTemp> LeftWorkTemps { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Pooya
|
||||
|
||||
@@ -394,17 +394,19 @@ public class EmployeeDocumentsRepository : RepositoryBase<long, EmployeeDocument
|
||||
{
|
||||
var activeEmployees = _companyContext.LeftWorkList
|
||||
.Where(x => workshops.Contains(x.WorkshopId) && x.LeftWorkDate.AddDays(-1) >= DateTime.Now)
|
||||
.Select(x=>new{x.WorkshopId,x.EmployeeId});
|
||||
.Select(x => new { x.WorkshopId, x.EmployeeId });
|
||||
|
||||
var employeeClientTemp = _companyContext.EmployeeClientTemps.Where(x => workshops.Contains(x.WorkshopId));
|
||||
|
||||
var query = _companyContext.EmployeeDocuments
|
||||
.Where(x=> workshops.Contains(x.WorkshopId) &&
|
||||
activeEmployees.Any(y=>y.WorkshopId == x.WorkshopId && y.EmployeeId==x.EmployeeId))
|
||||
.Include(x=>x.Workshop).Include(x => x.EmployeeDocumentItemCollection)
|
||||
.Where(x=> x.IsSentToChecker == false &&
|
||||
(x.EmployeeDocumentItemCollection.Any(y =>
|
||||
y.DocumentStatus == DocumentStatus.SubmittedByClient)) || x.HasRejectedItems)
|
||||
.GroupBy(x=>x.WorkshopId).Select(x => new WorkshopWithEmployeeDocumentsViewModel()
|
||||
.Where(x => workshops.Contains(x.WorkshopId) &&
|
||||
(activeEmployees.Any(y => y.WorkshopId == x.WorkshopId && y.EmployeeId == x.EmployeeId) ||
|
||||
employeeClientTemp.Any(temp => x.EmployeeId == temp.EmployeeId && temp.WorkshopId == x.WorkshopId)) && x.IsConfirmed == false)
|
||||
.Include(x => x.Workshop).Include(x => x.EmployeeDocumentItemCollection)
|
||||
.Where(x => x.IsSentToChecker == false &&
|
||||
(x.EmployeeDocumentItemCollection.Any(y =>
|
||||
y.DocumentStatus == DocumentStatus.SubmittedByClient) || employeeClientTemp.Any(temp => x.EmployeeId == temp.EmployeeId && temp.WorkshopId == x.WorkshopId) || x.HasRejectedItems))
|
||||
.GroupBy(x => x.WorkshopId).Select(x => new WorkshopWithEmployeeDocumentsViewModel()
|
||||
{
|
||||
WorkshopId = x.Key,
|
||||
WorkshopFullName = x.FirstOrDefault().Workshop.WorkshopName,
|
||||
@@ -414,7 +416,7 @@ public class EmployeeDocumentsRepository : RepositoryBase<long, EmployeeDocument
|
||||
|
||||
|
||||
var workshopEmployers = _companyContext.WorkshopEmployers.Include(x => x.Employer)
|
||||
.Where(x => query.Any(y=>y.WorkshopId==x.WorkshopId))
|
||||
.Where(x => query.Any(y => y.WorkshopId == x.WorkshopId))
|
||||
.GroupBy(x => x.WorkshopId).Select(x => x.FirstOrDefault()).ToList();
|
||||
|
||||
|
||||
@@ -422,24 +424,27 @@ public class EmployeeDocumentsRepository : RepositoryBase<long, EmployeeDocument
|
||||
|
||||
var result = query.ToList();
|
||||
|
||||
|
||||
|
||||
result.ForEach(x =>
|
||||
{
|
||||
var employer = workshopEmployers.FirstOrDefault(y => y.WorkshopId == x.WorkshopId)?.Employer;
|
||||
x.EmployerName = employer.FullName;
|
||||
|
||||
|
||||
//x.SubmittedItems.ForEach(y=>y.PicturePath= medias.FirstOrDefault(z=>z.id == y.MediaId)?.Path ?? "");
|
||||
});
|
||||
|
||||
return result.Where(x=>x.EmployeesWithoutDocumentCount > 0).OrderByDescending(x => x.EmployeesWithoutDocumentCount).ToList();
|
||||
return result.Where(x => x.EmployeesWithoutDocumentCount > 0).OrderByDescending(x => x.EmployeesWithoutDocumentCount).ToList();
|
||||
}
|
||||
|
||||
|
||||
|
||||
//ToDo آپلود مدارک و افزودن پرسنل
|
||||
//public List<WorkshopWithEmployeeDocumentsViewModel> GetWorkshopsWithNewEmployeesWithoutDocuments(List<long> workshops)
|
||||
//{
|
||||
// var newEmployees = _companyContext.LeftWorkTemps.Where(x => workshops.Contains(x.WorkshopId))
|
||||
// .Select(x => new { x.WorkshopId, x.EmployeeId });
|
||||
|
||||
|
||||
|
||||
// var query = _companyContext.EmployeeDocuments
|
||||
// .Where(x => workshops.Contains(x.WorkshopId) &&
|
||||
// newEmployees.Any(y => y.WorkshopId == x.WorkshopId && y.EmployeeId == x.EmployeeId))
|
||||
@@ -472,62 +477,88 @@ public class EmployeeDocumentsRepository : RepositoryBase<long, EmployeeDocument
|
||||
{
|
||||
var activeEmployeesInWorkshop = _companyContext.LeftWorkList
|
||||
.Where(x => workshopId == x.WorkshopId && x.LeftWorkDate.AddDays(-1) >= DateTime.Today)
|
||||
.Include(x=>x.Employee).ThenInclude(x=>x.EmployeeDocuments)
|
||||
.Select(x => new {x.EmployeeId ,FullName= x.Employee.FName +" " +x.Employee.LName,x.Employee.Gender});
|
||||
.Include(x => x.Employee).ThenInclude(x => x.EmployeeDocuments)
|
||||
.Select(x => new { x.EmployeeId, FullName = x.Employee.FName + " " + x.Employee.LName, x.Employee.Gender });
|
||||
|
||||
|
||||
|
||||
|
||||
var EDItemsList = _companyContext.EmployeeDocumentItems
|
||||
.Where(x => x.WorkshopId == workshopId && x.DocumentStatus != DocumentStatus.Unsubmitted &&
|
||||
activeEmployeesInWorkshop.Any(y => y.EmployeeId == x.EmployeeId))
|
||||
.Include(x => x.EmployeeDocuments).Where(x=> x.EmployeeDocuments.IsSentToChecker == false &&
|
||||
( (x.DocumentStatus == DocumentStatus.SubmittedByClient) || x.EmployeeDocuments.HasRejectedItems) )
|
||||
.Include(x => x.EmployeeDocuments)
|
||||
.Where(x => x.EmployeeDocuments.IsSentToChecker == false &&
|
||||
((x.DocumentStatus == DocumentStatus.SubmittedByClient) ||
|
||||
x.EmployeeDocuments.HasRejectedItems))
|
||||
.GroupBy(x => new { x.EmployeeId, x.DocumentLabel })
|
||||
.Select(x =>
|
||||
x.Select(y => new
|
||||
{
|
||||
y.EmployeeDocumentId,
|
||||
Id = y.id,
|
||||
y.EmployeeDocuments.Gender,
|
||||
y.DocumentLabel,
|
||||
y.DocumentStatus,
|
||||
y.MediaId,
|
||||
y.RejectionReason,
|
||||
y.EmployeeId,
|
||||
y.CreationDate,
|
||||
IsSentToChecker = y.EmployeeDocuments.IsSentToChecker,
|
||||
y.EmployeeDocuments.IsConfirmed
|
||||
})
|
||||
.OrderByDescending(y => y.CreationDate).First())
|
||||
{
|
||||
y.EmployeeDocumentId,
|
||||
Id = y.id,
|
||||
y.EmployeeDocuments.Gender,
|
||||
y.DocumentLabel,
|
||||
y.DocumentStatus,
|
||||
y.MediaId,
|
||||
y.RejectionReason,
|
||||
y.EmployeeId,
|
||||
y.CreationDate,
|
||||
IsSentToChecker = y.EmployeeDocuments.IsSentToChecker,
|
||||
y.EmployeeDocuments.IsConfirmed
|
||||
}).OrderByDescending(y => y.CreationDate).First()).ToList();
|
||||
|
||||
var employeeClientTemp = _companyContext.EmployeeClientTemps.Where(x => x.WorkshopId == workshopId);
|
||||
var tempEmployees = _companyContext.Employees.Where(x => employeeClientTemp.Any(a => a.EmployeeId == x.id))
|
||||
.Select(x => new { EmployeeId = x.id, FullName = x.FName + " " + x.LName, x.Gender }).ToList();
|
||||
|
||||
var tempEmployeeDocuments = _companyContext.EmployeeDocuments
|
||||
.Where(x => x.WorkshopId == workshopId && employeeClientTemp.Any(e => e.EmployeeId == x.EmployeeId) &&
|
||||
x.IsSentToChecker == false && x.IsConfirmed == false)
|
||||
.SelectMany(x => x.EmployeeDocumentItemCollection.DefaultIfEmpty(), // اگر خالی بود، مقدار پیشفرض ایجاد کن
|
||||
(documents, y) => new
|
||||
{
|
||||
EmployeeDocumentId = documents.id, // اگر null بود مقدار نداشته باشد
|
||||
Id = y != null ? y.id : 0,
|
||||
documents.Gender,
|
||||
DocumentLabel = y != null ? y.DocumentLabel : default,
|
||||
DocumentStatus = y != null ? y.DocumentStatus : default,
|
||||
MediaId = y != null ? y.MediaId : 0,
|
||||
RejectionReason = y != null ? y.RejectionReason : default,
|
||||
EmployeeId = y != null ? y.EmployeeId : documents.EmployeeId, // اگر مقدار نداشت از EmployeeDocuments پر کن
|
||||
CreationDate = y != null ? y.CreationDate : documents.CreationDate,
|
||||
IsSentToChecker = documents.IsSentToChecker,
|
||||
IsConfirmed = documents.IsConfirmed
|
||||
})
|
||||
.ToList();
|
||||
|
||||
|
||||
|
||||
var activeEmployeesInWorkshopList = activeEmployeesInWorkshop.ToList();
|
||||
var enumerable = EDItemsList.Concat(tempEmployeeDocuments);
|
||||
var activeEmployeesInWorkshopList = activeEmployeesInWorkshop.ToList().Concat(tempEmployees);
|
||||
|
||||
//get medias for current documents of employees
|
||||
var mediaIds = EDItemsList.Select(x => x.MediaId).ToList();
|
||||
var mediaIds = enumerable.Select(x => x.MediaId).ToList();
|
||||
var mediasList = _accountContext.Medias.Where(x => mediaIds.Contains(x.id))
|
||||
.Select(x => new MediaViewModel() { Id= x.id, Path = x.Path }).ToList();
|
||||
.Select(x => new MediaViewModel() { Id = x.id, Path = x.Path }).ToList();
|
||||
|
||||
|
||||
|
||||
return EDItemsList.GroupBy(x=>x.EmployeeId)
|
||||
var result = enumerable.GroupBy(x => x.EmployeeId)
|
||||
.Select(x =>
|
||||
{
|
||||
//var requiredDocs = EmployeeDocumentRequiredItems.GetByGender(x.Gender);
|
||||
var employeeLatestConfirmedDocuments = x
|
||||
|
||||
.Where(y => y.EmployeeId == x.Key &&(y.DocumentStatus == DocumentStatus.SubmittedByClient || y.DocumentStatus == DocumentStatus.SubmittedByAdmin || y.DocumentStatus == DocumentStatus.Rejected))
|
||||
.Select(y=>new EmployeeDocumentItemViewModel()
|
||||
{
|
||||
Status = y.DocumentStatus,
|
||||
MediaId = y.MediaId,
|
||||
DocumentItemLabel = y.DocumentLabel,
|
||||
Id = y.Id,
|
||||
RejectionMessage = y.RejectionReason,
|
||||
StatusString = y.DocumentStatus.ToString()
|
||||
}).ToList();
|
||||
|
||||
.Where(y => y.EmployeeId == x.Key && (y.DocumentStatus == DocumentStatus.SubmittedByClient || y.DocumentStatus == DocumentStatus.SubmittedByAdmin || y.DocumentStatus == DocumentStatus.Rejected))
|
||||
.Select(y => new EmployeeDocumentItemViewModel()
|
||||
{
|
||||
Status = y.DocumentStatus,
|
||||
MediaId = y.MediaId,
|
||||
DocumentItemLabel = y.DocumentLabel,
|
||||
Id = y.Id,
|
||||
RejectionMessage = y.RejectionReason,
|
||||
StatusString = y.DocumentStatus.ToString()
|
||||
}).ToList();
|
||||
|
||||
|
||||
//var requiredItemsUploaded = employeeLatestConfirmedDocuments
|
||||
@@ -542,7 +573,7 @@ public class EmployeeDocumentsRepository : RepositoryBase<long, EmployeeDocument
|
||||
IdCardPage3 = GetByLabelAndLoadMedia(employeeLatestConfirmedDocuments, mediasList, DocumentItemLabel.IdCardPage3),
|
||||
IdCardPage4 = GetByLabelAndLoadMedia(employeeLatestConfirmedDocuments, mediasList, DocumentItemLabel.IdCardPage4),
|
||||
EducationalDegree = GetByLabelAndLoadMedia(employeeLatestConfirmedDocuments, mediasList, DocumentItemLabel.EducationalDegree),
|
||||
EmployeeFullName = activeEmployeesInWorkshopList.First(y=>y.EmployeeId==x.Key).FullName,
|
||||
EmployeeFullName = activeEmployeesInWorkshopList.First(y => y.EmployeeId == x.Key).FullName,
|
||||
NationalCardFront = GetByLabelAndLoadMedia(employeeLatestConfirmedDocuments, mediasList, DocumentItemLabel.NationalCardFront),
|
||||
NationalCardRear = GetByLabelAndLoadMedia(employeeLatestConfirmedDocuments, mediasList, DocumentItemLabel.NationalCardRear),
|
||||
MilitaryServiceCard = GetByLabelAndLoadMedia(employeeLatestConfirmedDocuments, mediasList, DocumentItemLabel.MilitaryServiceCard),
|
||||
@@ -552,6 +583,8 @@ public class EmployeeDocumentsRepository : RepositoryBase<long, EmployeeDocument
|
||||
};
|
||||
}).ToList();
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -717,30 +750,30 @@ public class EmployeeDocumentsRepository : RepositoryBase<long, EmployeeDocument
|
||||
|
||||
|
||||
|
||||
public int GetCheckerWorkFlowCount()
|
||||
public async Task<int> GetCheckerWorkFlowCount()
|
||||
{
|
||||
return _companyContext.EmployeeDocumentItems.Include(x => x.EmployeeDocuments)
|
||||
.Count(x => x.DocumentStatus == DocumentStatus.SubmittedByAdmin);
|
||||
return await _companyContext.EmployeeDocumentItems.Include(x => x.EmployeeDocuments)
|
||||
.CountAsync(x => x.DocumentStatus == DocumentStatus.SubmittedByAdmin);
|
||||
}
|
||||
|
||||
//ToDo آپلود مدارک و افزدن پرسنل
|
||||
//public int GetAdminWorkFlowCountForNewEmployees(List<long> workshopIds)
|
||||
//{
|
||||
// //New employees created by client should have their documents uploaded or confirmed
|
||||
// var newEmployeesInWorkshop = _companyContext.LeftWorkTemps.Where(x => workshopIds.Contains(x.WorkshopId));
|
||||
|
||||
// var duty = _companyContext.EmployeeDocuments
|
||||
// .Count(x => workshopIds.Contains(x.WorkshopId) &&
|
||||
// newEmployeesInWorkshop.Any(y =>
|
||||
// y.EmployeeId == x.EmployeeId)
|
||||
// && x.IsSentToChecker == false && x.IsConfirmed == false);
|
||||
public async Task<int> GetAdminWorkFlowCountForNewEmployees(List<long> workshopIds)
|
||||
{
|
||||
//New employees created by client should have their documents uploaded or confirmed
|
||||
var newEmployeesInWorkshop = _companyContext.EmployeeClientTemps.Where(x => workshopIds.Contains(x.WorkshopId));
|
||||
|
||||
var duty = _companyContext.EmployeeDocuments
|
||||
.CountAsync(x => workshopIds.Contains(x.WorkshopId) &&
|
||||
newEmployeesInWorkshop.Any(y =>
|
||||
y.EmployeeId == x.EmployeeId)
|
||||
&& x.IsSentToChecker == false && x.IsConfirmed == false);
|
||||
|
||||
|
||||
|
||||
// return duty;
|
||||
//}
|
||||
return await duty;
|
||||
}
|
||||
|
||||
public int GetAdminWorkFlowCountForSubmittedAndRejectedDocuments(List<long> workshopIds)
|
||||
public async Task<int> GetAdminWorkFlowCountForSubmittedAndRejectedDocuments(List<long> workshopIds)
|
||||
{
|
||||
|
||||
|
||||
@@ -748,12 +781,12 @@ public class EmployeeDocumentsRepository : RepositoryBase<long, EmployeeDocument
|
||||
var activeEmployeesInWorkshop = _companyContext.LeftWorkList
|
||||
.Where(x => workshopIds.Contains(x.WorkshopId) && x.LeftWorkDate.AddDays(-1) >= DateTime.Today);
|
||||
var dutyCount = _companyContext.EmployeeDocuments
|
||||
.Count(x => workshopIds.Contains(x.WorkshopId) &&
|
||||
activeEmployeesInWorkshop.Any(y => y.EmployeeId == x.EmployeeId) &&
|
||||
x.IsSentToChecker == false &&
|
||||
(x.EmployeeDocumentItemCollection.Any(y => y.DocumentStatus == DocumentStatus.SubmittedByClient) || x.HasRejectedItems));
|
||||
.CountAsync(x => workshopIds.Contains(x.WorkshopId) &&
|
||||
activeEmployeesInWorkshop.Any(y => y.EmployeeId == x.EmployeeId) &&
|
||||
x.IsSentToChecker == false &&
|
||||
(x.EmployeeDocumentItemCollection.Any(y => y.DocumentStatus == DocumentStatus.SubmittedByClient) || x.HasRejectedItems));
|
||||
|
||||
return dutyCount;
|
||||
return await dutyCount;
|
||||
}
|
||||
|
||||
public List<EmployeeDocumentsViewModel> GetDocumentsAwaitingReviewByWorkshopIdForCheckerWorkFlow(long workshopId)
|
||||
|
||||
@@ -14,6 +14,8 @@ using CompanyManagment.App.Contracts.EmployeeInsuranceRecord;
|
||||
using Microsoft.Data.SqlClient;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using CompanyManagment.App.Contracts.Employee.DTO;
|
||||
using CompanyManagment.App.Contracts.LeftWorkTemp;
|
||||
|
||||
namespace CompanyManagment.EFCore.Repository;
|
||||
|
||||
@@ -742,6 +744,64 @@ public class EmployeeRepository : RepositoryBase<long, Employee>, IEmployeeRepos
|
||||
EmployeeFullName = x.FullName
|
||||
}).ToList();
|
||||
}
|
||||
public Employee GetByNationalCodeIgnoreQueryFilter(string nationalCode)
|
||||
{
|
||||
return _context.Employees.IgnoreQueryFilters().FirstOrDefault(x => x.NationalCode == nationalCode);
|
||||
}
|
||||
|
||||
public async Task<ICollection<ClientStartedWorkEmployeesDto>> GetClientEmployeesStartWork(long workshopId)
|
||||
{
|
||||
var res = await _context.Employees
|
||||
.GroupJoin(_context.LeftWorkTemps.Where(x => x.WorkshopId == workshopId && x.LeftWorkType == LeftWorkTempType.StartWork),
|
||||
employees => employees.id,
|
||||
leftWorkTemp => leftWorkTemp.EmployeeId,
|
||||
(employee, leftWorkTemps) => new { employee, leftWorkTemps })
|
||||
.GroupJoin(_context.EmployeeDocuments.Where(x => x.WorkshopId == workshopId),
|
||||
(query) => query.employee.id,
|
||||
(employeeDoc) => employeeDoc.EmployeeId,
|
||||
(query, employeeDoc) => new
|
||||
{ query, employeeDoc }).SelectMany(x => x.employeeDoc.DefaultIfEmpty(),
|
||||
(q, doc) => new
|
||||
{
|
||||
q.query,
|
||||
EmployeeDoc = doc
|
||||
}).Where(x => x.query.leftWorkTemps.Any(l => l.WorkshopId == workshopId && l.LeftWorkType == LeftWorkTempType.StartWork)).Select(
|
||||
x => new ClientStartedWorkEmployeesDto()
|
||||
{
|
||||
WorkshopId = workshopId,
|
||||
EmployeeId = x.query.employee.id,
|
||||
EmployeeName = x.query.employee.FName + " " + x.query.employee.LName,
|
||||
// ReSharper disable once SimplifyConditionalTernaryExpression
|
||||
HasCompleteEmployeeDocument = x.EmployeeDoc == null ? false : x.EmployeeDoc.IsConfirmed
|
||||
}).ToListAsync();
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
public async Task<ICollection<ClientLeftWorkWorkEmployeesDto>> GetEmployeesForLeftWorkTemp(long workshopId)
|
||||
{
|
||||
var res = await _context.Employees
|
||||
.Join(_context.LeftWorkTemps.Where(x => x.WorkshopId == workshopId && x.LeftWorkType == LeftWorkTempType.LeftWork),
|
||||
employees => employees.id,
|
||||
leftWorkTemp => leftWorkTemp.EmployeeId,
|
||||
(employee, leftWorkTemps) => new { employee, leftWorkTemps })
|
||||
.Select(
|
||||
x => new ClientLeftWorkWorkEmployeesDto()
|
||||
{
|
||||
WorkshopId = workshopId,
|
||||
EmployeeId = x.employee.id,
|
||||
EmployeeName = x.employee.FName + " " + x.employee.LName,
|
||||
LeftWorkDateTime = x.leftWorkTemps.LeftWork.ToFarsi()
|
||||
}).ToListAsync();
|
||||
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
public Employee GetIgnoreQueryFilter(long id)
|
||||
{
|
||||
return _context.Employees.IgnoreQueryFilters().FirstOrDefault(x => x.id == id);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Pooya
|
||||
@@ -776,6 +836,37 @@ 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()
|
||||
{
|
||||
EmployeeId = x.id,
|
||||
LName = x.LName,
|
||||
BirthDate = x.DateOfBirth.ToFarsi(),
|
||||
FName = x.FName,
|
||||
FatherName = x.FatherName,
|
||||
MaritalStatus = x.MaritalStatus,
|
||||
MilitaryService = x.MilitaryService,
|
||||
NationalCode = x.NationalCode,
|
||||
IdNumber = x.IdNumber,
|
||||
Nationality = x.Nationality,
|
||||
Gender = x.Gender,
|
||||
IsAuthorized = x.IsAuthorized
|
||||
}).FirstOrDefaultAsync();
|
||||
|
||||
var employeeClientTemp =
|
||||
await _context.EmployeeClientTemps.FirstOrDefaultAsync(x =>
|
||||
x.EmployeeId == employeeId && x.WorkshopId == workshopId);
|
||||
|
||||
if (employeeClientTemp != null)
|
||||
{
|
||||
employee.MaritalStatus = employeeClientTemp.MaritalStatus;
|
||||
}
|
||||
|
||||
return employee;
|
||||
}
|
||||
|
||||
|
||||
public List<(long Id, string Name)> SimpleGetRangeByIds(IEnumerable<long> newEmployeeIds)
|
||||
{
|
||||
return _context.Employees.Where(x => newEmployeeIds.Contains(x.id)).Select(x => new
|
||||
|
||||
@@ -207,6 +207,8 @@ public class LeftWorkRepository : RepositoryBase<long, LeftWork>, ILeftWorkRepos
|
||||
return leftWorks.Concat(insuranceLeftWork).Distinct().ToList();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public List<LeftWorkViewModel> GetLeftPersonelByWorkshopId(List<long> workshopIds)
|
||||
{
|
||||
return _context.LeftWorkList.Select(x => new LeftWorkViewModel()
|
||||
@@ -626,6 +628,12 @@ public class LeftWorkRepository : RepositoryBase<long, LeftWork>, ILeftWorkRepos
|
||||
HasLeft = entity.HasLeft
|
||||
};
|
||||
}
|
||||
public LeftWork GetLastLeftWorkByEmployeeIdAndWorkshopId(long workshopId, long employeeId)
|
||||
{
|
||||
return _context.LeftWorkList.Where(x => x.WorkshopId == workshopId && x.EmployeeId == employeeId)
|
||||
.OrderByDescending(x => x.StartWorkDate).FirstOrDefault();
|
||||
}
|
||||
|
||||
|
||||
private bool HasActiveRollCallStatus(long workshopId, long employeeId)
|
||||
{
|
||||
|
||||
@@ -90,4 +90,12 @@ public class PersonnelCodeRepository : RepositoryBase<long, PersonnelCodeDomain>
|
||||
return res.EmployeeId;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#region Mahan
|
||||
public long GetLastPersonnelCodeByWorkshop(long workshopId)
|
||||
{
|
||||
return _context.PersonnelCodeSet.Where(x => x.WorkshopId == workshopId).Max(x => x.PersonnelCode);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -244,19 +244,6 @@ public class RollCallEmployeeRepository : RepositoryBase<long, RollCallEmployee>
|
||||
;
|
||||
}
|
||||
|
||||
public bool HasEmployees(long workshopId)
|
||||
{
|
||||
var dateNow = DateTime.Now;
|
||||
return _context.Employees.Include(x => x.LeftWorks).Include(x => x.LeftWorkInsurances)
|
||||
.Any(x => x.LeftWorks.Any(y =>
|
||||
y.WorkshopId == workshopId && y.StartWorkDate <= dateNow &&
|
||||
y.LeftWorkDate > dateNow) ||
|
||||
x.LeftWorkInsurances.Any(y =>
|
||||
y.WorkshopId == workshopId && y.StartWorkDate <= dateNow &&
|
||||
(y.LeftWorkDate > dateNow || y.LeftWorkDate == null)));
|
||||
|
||||
}
|
||||
|
||||
public List<RollCallEmployeeViewModel> GetActivePersonnelByWorkshopId(long workshopId)
|
||||
{
|
||||
var dateNow = DateTime.Now.Date;
|
||||
@@ -333,46 +320,14 @@ public class RollCallEmployeeRepository : RepositoryBase<long, RollCallEmployee>
|
||||
return new();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Farokhi&Mahan
|
||||
|
||||
public (int activeEmployees, int deActiveEmployees) GetActiveAndDeActiveRollCallEmployees(long workshopId)
|
||||
{
|
||||
var dateNow = DateTime.Now;
|
||||
//var employeeQuery = _context.Employees.AsQueryable();
|
||||
|
||||
|
||||
//var rawQuery = employeeQuery.Include(x => x.LeftWorks).Include(x => x.LeftWorkInsurances)
|
||||
// .Where(x => x.LeftWorks.Any(y =>
|
||||
// y.WorkshopId == command.WorkshopId && y.StartWorkDate <= dateNow &&
|
||||
// y.LeftWorkDate > dateNow) ||
|
||||
// x.LeftWorkInsurances.Any(y =>
|
||||
// y.WorkshopId == command.WorkshopId && y.StartWorkDate <= dateNow &&
|
||||
// (y.LeftWorkDate > dateNow || y.LeftWorkDate == null))).OrderByDescending(x => x.id)
|
||||
// .Select(x => new
|
||||
// {
|
||||
// Id = x.id,
|
||||
// x.FullName,
|
||||
// x.NationalCode,
|
||||
|
||||
// }).AsSplitQuery();
|
||||
|
||||
|
||||
|
||||
//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()
|
||||
// select new RollCallEmployeeViewModel()
|
||||
// {
|
||||
// WorkshopId = command.WorkshopId,
|
||||
// EmployeeId = employee.Id,
|
||||
// Id = joinedRollCall == null ? 0 : joinedRollCall.id,
|
||||
// EmployeeFullName = joinedRollCall == null ? employee.FullName : joinedRollCall.EmployeeFullName,
|
||||
// NationalCode = employee.NationalCode,
|
||||
// IsActiveString = joinedRollCall == null ? "false" : joinedRollCall.IsActiveString,
|
||||
// HasUploadedImage = joinedRollCall == null ? "false" : joinedRollCall.HasUploadedImage
|
||||
// };
|
||||
var rawQuery = _context.Employees.Include(x => x.LeftWorks).Include(x => x.LeftWorkInsurances)
|
||||
.Where(x => x.LeftWorks.Any(y =>
|
||||
y.WorkshopId == workshopId && y.StartWorkDate <= dateNow &&
|
||||
@@ -385,20 +340,41 @@ public class RollCallEmployeeRepository : RepositoryBase<long, RollCallEmployee>
|
||||
Id = x.id,
|
||||
}).Distinct();
|
||||
|
||||
var rollCallEmployees = _context.RollCallEmployees.Where(x => x.WorkshopId == workshopId);
|
||||
var rollCallEmployees = _context.RollCallEmployees.Include(x => x.EmployeesStatus).Where(x => x.WorkshopId == workshopId);
|
||||
|
||||
var joinedQuery = from employee in rawQuery
|
||||
join rollCallEmployee in rollCallEmployees
|
||||
on employee.Id equals rollCallEmployee.EmployeeId into grp
|
||||
from joinedRollCall in grp.DefaultIfEmpty()
|
||||
select new RollCallEmployeeViewModel()
|
||||
{
|
||||
IsActiveString = joinedRollCall == null ? "false" : joinedRollCall.IsActiveString,
|
||||
};
|
||||
join rollCallEmployee in rollCallEmployees
|
||||
on employee.Id equals rollCallEmployee.EmployeeId into grp
|
||||
from joinedRollCall in grp.DefaultIfEmpty()
|
||||
select new RollCallEmployeeViewModel()
|
||||
{
|
||||
IsActiveString = joinedRollCall.EmployeesStatus.Any(y => y.StartDate.Date <= dateNow.Date && y.EndDate.Date > dateNow.Date) ? "true" : "false",
|
||||
|
||||
};
|
||||
var deActiveCount = joinedQuery.Count(x => x.IsActiveString == "false");
|
||||
var ActiveCount = joinedQuery.Count(x => x.IsActiveString == "true");
|
||||
return (ActiveCount, deActiveCount);
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
public bool HasEmployees(long workshopId)
|
||||
{
|
||||
var dateNow = DateTime.Now;
|
||||
return _context.Employees.Include(x => x.LeftWorks).Include(x => x.LeftWorkInsurances)
|
||||
.Any(x => x.LeftWorks.Any(y =>
|
||||
y.WorkshopId == workshopId && y.StartWorkDate <= dateNow &&
|
||||
y.LeftWorkDate > dateNow) ||
|
||||
x.LeftWorkInsurances.Any(y =>
|
||||
y.WorkshopId == workshopId && y.StartWorkDate <= dateNow &&
|
||||
(y.LeftWorkDate > dateNow || y.LeftWorkDate == null)));
|
||||
|
||||
}
|
||||
|
||||
public RollCallEmployee GetBy(long employeeId, long workshopId)
|
||||
{
|
||||
return _context.RollCallEmployees.FirstOrDefault(x => x.EmployeeId == employeeId && x.WorkshopId == workshopId);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
@@ -3,6 +3,9 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using _0_Framework.Application;
|
||||
using CompanyManagment.App.Contracts.Employee;
|
||||
|
||||
namespace WorkFlow.Application.Contracts.AdminWorkFlow;
|
||||
|
||||
public interface IAdminWorkFlowApplication
|
||||
@@ -25,19 +28,39 @@ public interface IAdminWorkFlowApplication
|
||||
/// </summary>
|
||||
/// <param name="accountId"></param>
|
||||
/// <returns></returns>
|
||||
// Task<ICollection<WorkshopWithStartedWorkWorkFlowViewModel>> GetWorkshopsForEmployeeStartWork(long accountId);
|
||||
Task<ICollection<WorkshopWithStartedWorkWorkFlowViewModel>> GetWorkshopsForEmployeeStartWork(long accountId);
|
||||
|
||||
/// <summary>
|
||||
/// تعداد کارگاه هایی که از کلاینت پرسنلی را شروع به کار زدند
|
||||
/// </summary>
|
||||
/// <param name="accountId"></param>
|
||||
/// <returns></returns>
|
||||
Task<int> GetWorkshopsForEmployeeStartWorkCount(long accountId);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// لیست پرسنل هایی که از سمت کلاینت شروع به کار خوردند
|
||||
/// </summary>
|
||||
/// <param name="workshopId"></param>
|
||||
/// <returns></returns>
|
||||
//Task<ICollection<ClientStartedWorkEmployeesWorkFlowViewModel>> GetClientEmployeesStartWork(long workshopId);
|
||||
Task<ICollection<ClientStartedWorkEmployeesWorkFlowViewModel>> GetClientEmployeesStartWork(long workshopId);
|
||||
|
||||
/// <summary>
|
||||
/// اطلاعات پرسنل برای ویرایش در مودال ادمین آپلود مدارک در هنگام رد شدن مدرک توسط ناظر
|
||||
/// </summary>
|
||||
/// <param name="employeeId"></param>
|
||||
/// <param name="workshopId"></param>
|
||||
/// <returns></returns>
|
||||
Task<GetEditEmployeeInEmployeeDocumentViewModel> GetEmployeeEditInEmployeeDocumentWorkFlow(long employeeId,
|
||||
long workshopId);
|
||||
|
||||
Task<OperationResult> EditEmployeeInEmployeeDocumentWorkFlow(EditEmployeeInEmployeeDocument command);
|
||||
|
||||
#endregion
|
||||
|
||||
AdminWorkFlowNumbersViewModel GetWorkFlowCountsForAdmin(List<long> workshopIds);
|
||||
int GetWorkFlowCountForChecker();
|
||||
Task<int> GetEmployeeDocumentWorkFlowCountsForAdmin(List<long> workshopIds);
|
||||
Task<int> GetWorkFlowCountsForAdmin(List<long> workshopIds, long accountId);
|
||||
Task<int> GetWorkFlowCountForChecker();
|
||||
|
||||
|
||||
#region ترک کار موقت
|
||||
@@ -47,7 +70,7 @@ public interface IAdminWorkFlowApplication
|
||||
/// </summary>
|
||||
/// <param name="accountId"></param>
|
||||
/// <returns></returns>
|
||||
//Task<ICollection<WorkshopWithLeftWorkWorkFlowViewModel>> GetWorkshopsForLeftWorkTemp(long accountId);
|
||||
Task<ICollection<WorkshopWithLeftWorkWorkFlowViewModel>> GetWorkshopsForLeftWorkTemp(long accountId);
|
||||
|
||||
|
||||
|
||||
@@ -56,11 +79,12 @@ public interface IAdminWorkFlowApplication
|
||||
/// </summary>
|
||||
/// <param name="workshopId"></param>
|
||||
/// <returns></returns>
|
||||
// Task<ICollection<ClientLeftWorkEmployeesWorkFlowViewModel>> GetEmployeesForLeftWorkTemp(long workshopId);
|
||||
Task<ICollection<ClientLeftWorkEmployeesWorkFlowViewModel>> GetEmployeesForLeftWorkTemp(long workshopId);
|
||||
|
||||
Task<int> GetWorkshopsForLeftWorkTempCount(long accountId);
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\0_Framework\0_Framework.csproj" />
|
||||
<ProjectReference Include="..\..\..\CompanyManagment.App.Contracts\CompanyManagment.App.Contracts.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using WorkFlow.Application.Contracts.AdminWorkFlow;
|
||||
using CompanyManagment.App.Contracts.Employee;
|
||||
using WorkFlow.Application.Contracts.AdminWorkFlow;
|
||||
|
||||
using WorkFlow.Infrastructure.ACL.EmployeeDocuments;
|
||||
|
||||
@@ -26,26 +27,22 @@ namespace WorkFlow.Application
|
||||
return _workFlowEmployeeDocumentsACL.GetWorkshopDocumentsAwaitingReviewForChecker(workshops);
|
||||
}
|
||||
|
||||
public AdminWorkFlowNumbersViewModel GetWorkFlowCountsForAdmin(List<long> workshopIds)
|
||||
public async Task<int> GetEmployeeDocumentWorkFlowCountsForAdmin(List<long> workshopIds)
|
||||
{
|
||||
var submittedDocumentsByClient = _workFlowEmployeeDocumentsACL.GetAdminWorkFlowCountForSubmittedDocuments(workshopIds);
|
||||
var submittedDocumentsByClient = await _workFlowEmployeeDocumentsACL.GetAdminWorkFlowCountForSubmittedDocuments(workshopIds);
|
||||
|
||||
//var newEmployees = _workFlowEmployeeDocumentsACL.GetAdminWorkFlowCountForNewEmployees(workshopIds);
|
||||
var newEmployees = await _workFlowEmployeeDocumentsACL.GetAdminWorkFlowCountForNewEmployees(workshopIds);
|
||||
|
||||
return new AdminWorkFlowNumbersViewModel()
|
||||
{
|
||||
EmployeeDocumentsAwaitingSubmit = submittedDocumentsByClient,
|
||||
//NewEmployeesAwaitingUpload = newEmployees
|
||||
};
|
||||
|
||||
return submittedDocumentsByClient + newEmployees;
|
||||
}
|
||||
|
||||
public int GetWorkFlowCountForChecker()
|
||||
public async Task<int> GetWorkFlowCountForChecker()
|
||||
{
|
||||
return _workFlowEmployeeDocumentsACL.GetCheckerWorkFlowCount();
|
||||
return await _workFlowEmployeeDocumentsACL.GetCheckerWorkFlowCount();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public List<WorkshopWithDocumentsViewModelForWorkFlow> GetWorkshopsWithDocumentsAwaitingUploadForAdmin(List<long> workshops)
|
||||
{
|
||||
@@ -57,28 +54,52 @@ namespace WorkFlow.Application
|
||||
#region Mahan
|
||||
|
||||
#region شروع به کار پرسنل افزوده شده
|
||||
//public async Task<ICollection<WorkshopWithStartedWorkWorkFlowViewModel>> GetWorkshopsForEmployeeStartWork(long accountId)
|
||||
//{
|
||||
// return await _workFlowWorkshopACL.GetWorkshopsForEmployeeStartWork(accountId);
|
||||
//}
|
||||
public async Task<ICollection<WorkshopWithStartedWorkWorkFlowViewModel>> GetWorkshopsForEmployeeStartWork(long accountId)
|
||||
{
|
||||
return await _workFlowWorkshopACL.GetWorkshopsForEmployeeStartWork(accountId);
|
||||
}
|
||||
|
||||
public async Task<int> GetWorkshopsForEmployeeStartWorkCount(long accountId)
|
||||
{
|
||||
return await _workFlowWorkshopACL.GetWorkshopsForEmployeeStartWorkCount(accountId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public async Task<ICollection<ClientStartedWorkEmployeesWorkFlowViewModel>> GetClientEmployeesStartWork(long workshopId)
|
||||
{
|
||||
return await _workFlowEmployeeACL.GetClientEmployeesStartWork(workshopId);
|
||||
}
|
||||
|
||||
public async Task<GetEditEmployeeInEmployeeDocumentViewModel> GetEmployeeEditInEmployeeDocumentWorkFlow(long employeeId, long workshopId)
|
||||
{
|
||||
return await _workFlowEmployeeACL.GetEmployeeEditInEmployeeDocumentWorkFlow(employeeId, workshopId);
|
||||
}
|
||||
|
||||
public async Task<OperationResult> EditEmployeeInEmployeeDocumentWorkFlow(
|
||||
EditEmployeeInEmployeeDocument command)
|
||||
{
|
||||
return await _workFlowEmployeeACL.EditEmployeeInEmployeeDocumentWorkFlow(command);
|
||||
}
|
||||
|
||||
//public async Task<ICollection<ClientStartedWorkEmployeesWorkFlowViewModel>> GetClientEmployeesStartWork(long workshopId)
|
||||
//{
|
||||
// return await _workFlowEmployeeACL.GetClientEmployeesStartWork(workshopId);
|
||||
//}
|
||||
#endregion
|
||||
|
||||
#region ترک کار موقت
|
||||
|
||||
//public async Task<ICollection<WorkshopWithLeftWorkWorkFlowViewModel>> GetWorkshopsForLeftWorkTemp(long accountId)
|
||||
//{
|
||||
// return await _workFlowWorkshopACL.GetWorkshopsForLeftWorkTemp(accountId);
|
||||
//}
|
||||
public async Task<ICollection<WorkshopWithLeftWorkWorkFlowViewModel>> GetWorkshopsForLeftWorkTemp(long accountId)
|
||||
{
|
||||
return await _workFlowWorkshopACL.GetWorkshopsForLeftWorkTemp(accountId);
|
||||
}
|
||||
public async Task<int> GetWorkshopsForLeftWorkTempCount(long accountId)
|
||||
{
|
||||
return await _workFlowWorkshopACL.GetWorkshopsForLeftWorkTempCount(accountId);
|
||||
}
|
||||
|
||||
//public async Task<ICollection<ClientLeftWorkEmployeesWorkFlowViewModel>> GetEmployeesForLeftWorkTemp(long workshopId)
|
||||
//{
|
||||
// return await _workFlowEmployeeACL.GetEmployeesForLeftWorkTemp(workshopId);
|
||||
//}
|
||||
public async Task<ICollection<ClientLeftWorkEmployeesWorkFlowViewModel>> GetEmployeesForLeftWorkTemp(long workshopId)
|
||||
{
|
||||
return await _workFlowEmployeeACL.GetEmployeesForLeftWorkTemp(workshopId);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -8,9 +8,10 @@ namespace WorkFlow.Infrastructure.ACL.EmployeeDocuments
|
||||
List<WorkshopWithDocumentsViewModelForWorkFlow> GetWorkshopDocumentsAwaitingReviewForChecker(List<long> workshops);
|
||||
List<WorkshopWithDocumentsViewModelForWorkFlow> GetWorkshopsWithDocumentsAwaitingUploadForAdmin(List<long> workshops);
|
||||
|
||||
int GetAdminWorkFlowCountForSubmittedDocuments(List<long> workshopIds);
|
||||
//int GetAdminWorkFlowCountForNewEmployees(List<long> workshopIds);
|
||||
int GetCheckerWorkFlowCount();
|
||||
|
||||
Task<int> GetAdminWorkFlowCountForSubmittedDocuments(List<long> workshopIds);
|
||||
Task<int> GetAdminWorkFlowCountForNewEmployees(List<long> workshopIds);
|
||||
Task<int> GetCheckerWorkFlowCount();
|
||||
}
|
||||
|
||||
public class WorkFlowEmployeeDocumentsACL : IWorkFlowEmployeeDocumentsACL
|
||||
@@ -34,17 +35,17 @@ namespace WorkFlow.Infrastructure.ACL.EmployeeDocuments
|
||||
}).ToList();
|
||||
}
|
||||
|
||||
public int GetAdminWorkFlowCountForSubmittedDocuments(List<long> workshopIds)
|
||||
public async Task<int> GetAdminWorkFlowCountForSubmittedDocuments(List<long> workshopIds)
|
||||
{
|
||||
return _employeeDocumentsApplication.GetAdminWorkFlowCountForSubmittedAndRejectedDocuments(workshopIds);
|
||||
return await _employeeDocumentsApplication.GetAdminWorkFlowCountForSubmittedAndRejectedDocuments(workshopIds);
|
||||
}
|
||||
//public int GetAdminWorkFlowCountForNewEmployees(List<long> workshopIds)
|
||||
//{
|
||||
// return _employeeDocumentsApplication.GetAdminWorkFlowCountForNewEmployees(workshopIds);
|
||||
//}
|
||||
public int GetCheckerWorkFlowCount()
|
||||
public async Task<int> GetAdminWorkFlowCountForNewEmployees(List<long> workshopIds)
|
||||
{
|
||||
return _employeeDocumentsApplication.GetCheckerWorkFlowCount();
|
||||
return await _employeeDocumentsApplication.GetAdminWorkFlowCountForNewEmployees(workshopIds);
|
||||
}
|
||||
public async Task<int> GetCheckerWorkFlowCount()
|
||||
{
|
||||
return await _employeeDocumentsApplication.GetCheckerWorkFlowCount();
|
||||
}
|
||||
|
||||
public List<WorkshopWithDocumentsViewModelForWorkFlow> GetWorkshopDocumentsAwaitingReviewForChecker(List<long> workshops)
|
||||
|
||||
Reference in New Issue
Block a user