|
|
|
|
@@ -64,33 +64,49 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
|
|
|
|
private readonly ILeftWorkInsuranceRepository _leftWorkInsuranceRepository;
|
|
|
|
|
private readonly IFaceEmbeddingService _faceEmbeddingService;
|
|
|
|
|
|
|
|
|
|
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, IEmployeeAuthorizeTempRepository employeeAuthorizeTempRepository, ILeftWorkInsuranceRepository leftWorkInsuranceRepository, IFaceEmbeddingService faceEmbeddingService) : base(context)
|
|
|
|
|
{
|
|
|
|
|
_context = context;
|
|
|
|
|
_WorkShopRepository = workShopRepository;
|
|
|
|
|
_webHostEnvironment = webHostEnvironment;
|
|
|
|
|
_rollCallEmployeeStatusApplication = rollCallEmployeeStatusApplication;
|
|
|
|
|
_rollCallEmployeeRepository = rollCallEmployeeRepository;
|
|
|
|
|
_customizeWorkshopSettingsApplication = customizeWorkshopSettingsApplication;
|
|
|
|
|
_employeeDocumentsApplication = employeeDocumentsApplication;
|
|
|
|
|
_employeeBankInformationApplication = employeeBankInformationApplication;
|
|
|
|
|
_leftWorkTempRepository = leftWorkTempRepository;
|
|
|
|
|
_uidService = uidService;
|
|
|
|
|
_customizeWorkshopEmployeeSettingsRepository = customizeWorkshopEmployeeSettingsRepository;
|
|
|
|
|
_personnelCodeRepository = personnelCodeRepository;
|
|
|
|
|
_employeeClientTempRepository = employeeClientTempRepository;
|
|
|
|
|
_leftWorkRepository = leftWorkRepository;
|
|
|
|
|
_employeeAuthorizeTempRepository = employeeAuthorizeTempRepository;
|
|
|
|
|
_leftWorkInsuranceRepository = leftWorkInsuranceRepository;
|
|
|
|
|
_EmployeeRepository = employeeRepository;
|
|
|
|
|
_faceEmbeddingService = faceEmbeddingService;
|
|
|
|
|
}
|
|
|
|
|
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, IEmployeeAuthorizeTempRepository employeeAuthorizeTempRepository,
|
|
|
|
|
ILeftWorkInsuranceRepository leftWorkInsuranceRepository,
|
|
|
|
|
IFaceEmbeddingService faceEmbeddingService) : base(context)
|
|
|
|
|
{
|
|
|
|
|
_context = context;
|
|
|
|
|
_WorkShopRepository = workShopRepository;
|
|
|
|
|
_webHostEnvironment = webHostEnvironment;
|
|
|
|
|
_rollCallEmployeeStatusApplication = rollCallEmployeeStatusApplication;
|
|
|
|
|
_rollCallEmployeeRepository = rollCallEmployeeRepository;
|
|
|
|
|
_customizeWorkshopSettingsApplication = customizeWorkshopSettingsApplication;
|
|
|
|
|
_employeeDocumentsApplication = employeeDocumentsApplication;
|
|
|
|
|
_employeeBankInformationApplication = employeeBankInformationApplication;
|
|
|
|
|
_leftWorkTempRepository = leftWorkTempRepository;
|
|
|
|
|
_uidService = uidService;
|
|
|
|
|
_customizeWorkshopEmployeeSettingsRepository = customizeWorkshopEmployeeSettingsRepository;
|
|
|
|
|
_personnelCodeRepository = personnelCodeRepository;
|
|
|
|
|
_employeeClientTempRepository = employeeClientTempRepository;
|
|
|
|
|
_leftWorkRepository = leftWorkRepository;
|
|
|
|
|
_employeeAuthorizeTempRepository = employeeAuthorizeTempRepository;
|
|
|
|
|
_leftWorkInsuranceRepository = leftWorkInsuranceRepository;
|
|
|
|
|
_EmployeeRepository = employeeRepository;
|
|
|
|
|
_faceEmbeddingService = faceEmbeddingService;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public OperationResult Create(CreateEmployee command)
|
|
|
|
|
public OperationResult Create(CreateEmployee command)
|
|
|
|
|
{
|
|
|
|
|
var opration = new OperationResult();
|
|
|
|
|
if (_EmployeeRepository.Exists(x =>
|
|
|
|
|
x.LName == command.LName && x.NationalCode == command.NationalCode && !string.IsNullOrWhiteSpace(command.NationalCode) && x.NationalCode != null && x.IsActiveString == "true"))
|
|
|
|
|
x.LName == command.LName && x.NationalCode == command.NationalCode &&
|
|
|
|
|
!string.IsNullOrWhiteSpace(command.NationalCode) && x.NationalCode != null &&
|
|
|
|
|
x.IsActiveString == "true"))
|
|
|
|
|
return opration.Failed("امکان ثبت رکورد تکراری وجود ندارد");
|
|
|
|
|
|
|
|
|
|
//if (_EmployeeRepository.Exists(x => x.IdNumber == command.IdNumber && x.IdNumber !=null))
|
|
|
|
|
@@ -182,13 +198,13 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
nationalCodValid = false;
|
|
|
|
|
return opration.Failed("کد ملی وارد شده نا معتبر است");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
nationalCodValid = false;
|
|
|
|
|
return opration.Failed("کد ملی وارد شده نا معتبر است");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception)
|
|
|
|
|
@@ -198,6 +214,7 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
|
|
|
|
return opration.Failed("لطفا کد ملی 10 رقمی وارد کنید");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (_EmployeeRepository.Exists(x => x.NationalCode == command.NationalCode))
|
|
|
|
|
{
|
|
|
|
|
nationalcodeIsOk = false;
|
|
|
|
|
@@ -210,24 +227,31 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string initial = "1300/10/11";
|
|
|
|
|
var dateOfBirth = command.DateOfBirth != null ? command.DateOfBirth.ToGeorgianDateTime() : initial.ToGeorgianDateTime();
|
|
|
|
|
var dateOfIssue = command.DateOfIssue != null ? command.DateOfIssue.ToGeorgianDateTime() : initial.ToGeorgianDateTime();
|
|
|
|
|
var dateOfBirth = command.DateOfBirth != null
|
|
|
|
|
? command.DateOfBirth.ToGeorgianDateTime()
|
|
|
|
|
: initial.ToGeorgianDateTime();
|
|
|
|
|
var dateOfIssue = command.DateOfIssue != null
|
|
|
|
|
? command.DateOfIssue.ToGeorgianDateTime()
|
|
|
|
|
: initial.ToGeorgianDateTime();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var employeeData = new Employee(command.FName, command.LName, command.FatherName, dateOfBirth,
|
|
|
|
|
dateOfIssue,
|
|
|
|
|
command.PlaceOfIssue, command.NationalCode, command.IdNumber, command.Gender, command.Nationality, command.IdNumberSerial, command.IdNumberSeri,
|
|
|
|
|
command.PlaceOfIssue, command.NationalCode, command.IdNumber, command.Gender, command.Nationality,
|
|
|
|
|
command.IdNumberSerial, command.IdNumberSeri,
|
|
|
|
|
command.Phone, command.Address,
|
|
|
|
|
command.State, command.City, command.MaritalStatus, command.MilitaryService, command.LevelOfEducation,
|
|
|
|
|
command.FieldOfStudy, command.BankCardNumber,
|
|
|
|
|
command.BankBranch, command.InsuranceCode, command.InsuranceHistoryByYear,
|
|
|
|
|
command.InsuranceHistoryByMonth, command.NumberOfChildren, command.OfficePhone, command.MclsUserName, command.MclsPassword, command.EserviceUserName, command.EservicePassword,
|
|
|
|
|
command.InsuranceHistoryByMonth, command.NumberOfChildren, command.OfficePhone, command.MclsUserName,
|
|
|
|
|
command.MclsPassword, command.EserviceUserName, command.EservicePassword,
|
|
|
|
|
command.TaxOfficeUserName, command.TaxOfficepassword, command.SanaUserName, command.SanaPassword);
|
|
|
|
|
|
|
|
|
|
if (command.IsAuthorized)
|
|
|
|
|
{
|
|
|
|
|
employeeData.Authorized();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_EmployeeRepository.Create(employeeData);
|
|
|
|
|
_EmployeeRepository.SaveChanges();
|
|
|
|
|
|
|
|
|
|
@@ -244,7 +268,8 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
|
|
|
|
return opration.Failed("رکورد مورد نظر یافت نشد");
|
|
|
|
|
|
|
|
|
|
if (_EmployeeRepository.Exists(x =>
|
|
|
|
|
x.LName == command.LName && x.NationalCode == command.NationalCode && !string.IsNullOrWhiteSpace(command.NationalCode) && x.id != command.Id && x.IsActiveString == "true"))
|
|
|
|
|
x.LName == command.LName && x.NationalCode == command.NationalCode &&
|
|
|
|
|
!string.IsNullOrWhiteSpace(command.NationalCode) && x.id != command.Id && x.IsActiveString == "true"))
|
|
|
|
|
return opration.Failed("امکان ثبت رکورد تکراری وجود ندارد");
|
|
|
|
|
//if (_EmployeeRepository.Exists(x => x.IdNumber == command.IdNumber && x.IdNumber != null && x.id != command.Id))
|
|
|
|
|
// return opration.Failed("شماره شناسنامه وارد شده تکراری است");
|
|
|
|
|
@@ -339,6 +364,7 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
|
|
|
|
return opration.Failed("لطفا کد ملی 10 رقمی وارد کنید");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (_EmployeeRepository.Exists(x => x.NationalCode == command.NationalCode && x.id != command.Id))
|
|
|
|
|
{
|
|
|
|
|
nationalcodeIsOk = false;
|
|
|
|
|
@@ -349,8 +375,12 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string initial = "1300/10/11";
|
|
|
|
|
var dateOfBirth = command.DateOfBirth != null ? command.DateOfBirth.ToGeorgianDateTime() : initial.ToGeorgianDateTime();
|
|
|
|
|
var dateOfIssue = command.DateOfIssue != null ? command.DateOfIssue.ToGeorgianDateTime() : initial.ToGeorgianDateTime();
|
|
|
|
|
var dateOfBirth = command.DateOfBirth != null
|
|
|
|
|
? command.DateOfBirth.ToGeorgianDateTime()
|
|
|
|
|
: initial.ToGeorgianDateTime();
|
|
|
|
|
var dateOfIssue = command.DateOfIssue != null
|
|
|
|
|
? command.DateOfIssue.ToGeorgianDateTime()
|
|
|
|
|
: initial.ToGeorgianDateTime();
|
|
|
|
|
employee.Edit(command.FName, command.LName, command.FatherName, dateOfBirth,
|
|
|
|
|
dateOfIssue,
|
|
|
|
|
command.PlaceOfIssue, command.NationalCode, command.IdNumber, command.Gender, command.Nationality,
|
|
|
|
|
@@ -435,7 +465,8 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
|
|
|
|
{
|
|
|
|
|
var opration = new OperationResult();
|
|
|
|
|
|
|
|
|
|
var employeeData = new EmployeeInsuranceRecord(command.EmployeeId, command.WorkShopId, command.DateOfStart, command.DateOfEnd);
|
|
|
|
|
var employeeData = new EmployeeInsuranceRecord(command.EmployeeId, command.WorkShopId, command.DateOfStart,
|
|
|
|
|
command.DateOfEnd);
|
|
|
|
|
|
|
|
|
|
_EmployeeRepository.CreateEmployeeInsuranceRecord(employeeData);
|
|
|
|
|
_EmployeeRepository.SaveChanges();
|
|
|
|
|
@@ -444,6 +475,7 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public OperationResult EditEmployeeInsuranceRecord(EditEmployeeInsuranceRecord command)
|
|
|
|
|
{
|
|
|
|
|
var opration = new OperationResult();
|
|
|
|
|
@@ -455,6 +487,7 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void RemoveEmployeeInsuranceRecord(long Id)
|
|
|
|
|
{
|
|
|
|
|
_EmployeeRepository.RemoveEmployeeInsuranceRecord(Id);
|
|
|
|
|
@@ -468,12 +501,14 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
|
|
|
|
return opration.Failed("خطا در انتخاب کارگاه");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var ws = _WorkShopRepository.GetDetails(eir.WorkShopId);
|
|
|
|
|
if (string.IsNullOrWhiteSpace(eir.DateOfStart))
|
|
|
|
|
{
|
|
|
|
|
return opration.Failed("تاریخ شروع نمی تواند خالی باشد - " + ws.WorkshopFullName);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(eir.DateOfEnd))
|
|
|
|
|
{
|
|
|
|
|
if (eir.DateOfEnd.ToGeorgianDateTime() < eir.DateOfStart.ToGeorgianDateTime())
|
|
|
|
|
@@ -490,6 +525,7 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
|
|
|
|
|
|
|
|
|
return opration.Succcedded();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public OperationResult ValidationEmployeeInsuranceRecord(List<CreateEmployeeInsuranceRecord> eir_lst)
|
|
|
|
|
{
|
|
|
|
|
var opration = new OperationResult();
|
|
|
|
|
@@ -509,16 +545,19 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
|
|
|
|
{
|
|
|
|
|
return opration.Failed("خطا در تداخل تاریخ - " + wshop.WorkshopFullName);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrEmpty(q[i].DateOfEnd.ToString()))
|
|
|
|
|
{
|
|
|
|
|
count++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (count > 1)
|
|
|
|
|
{
|
|
|
|
|
return opration.Failed("تاریخ ترک کار را وارد نمایید ");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return opration.Succcedded();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -532,11 +571,13 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
|
|
|
|
{
|
|
|
|
|
return opration.Failed("خطا در انتخاب پرسنل");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var employee = _EmployeeRepository.GetDetails(employeeId);
|
|
|
|
|
if (string.IsNullOrWhiteSpace(employee.FName))
|
|
|
|
|
{
|
|
|
|
|
error += "(نام)" + Environment.NewLine;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrWhiteSpace(employee.LName))
|
|
|
|
|
{
|
|
|
|
|
error += "(نام خانوادگی)" + Environment.NewLine;
|
|
|
|
|
@@ -546,22 +587,27 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
|
|
|
|
{
|
|
|
|
|
error += "(کد ملی)" + Environment.NewLine;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrWhiteSpace(employee.PlaceOfIssue))
|
|
|
|
|
{
|
|
|
|
|
error += "(شهر محل تولد)" + Environment.NewLine;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrWhiteSpace(employee.DateOfBirth))
|
|
|
|
|
{
|
|
|
|
|
error += "(تاریخ تولد)" + Environment.NewLine;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrWhiteSpace(employee.IdNumber))
|
|
|
|
|
{
|
|
|
|
|
error += "(شماره شناسنامه)" + Environment.NewLine;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrWhiteSpace(employee.InsuranceCode))
|
|
|
|
|
{
|
|
|
|
|
error += "(شماره بیمه)" + Environment.NewLine;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(error))
|
|
|
|
|
{
|
|
|
|
|
var note = "آیتم های زیر برای ثبت سابقه الزامی می باشد" + Environment.NewLine + error;
|
|
|
|
|
@@ -610,7 +656,8 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
|
|
|
|
InsuranceCode = x.InsuranceCode,
|
|
|
|
|
IsActiveString = x.IsActiveString,
|
|
|
|
|
IsActive = x.IsActive,
|
|
|
|
|
PersonnelCode = _context.PersonnelCodeSet.FirstOrDefault(p => p.EmployeeId == x.Id && p.WorkshopId == searchModel.WorkshopId)?.PersonnelCode
|
|
|
|
|
PersonnelCode = _context.PersonnelCodeSet
|
|
|
|
|
.FirstOrDefault(p => p.EmployeeId == x.Id && p.WorkshopId == searchModel.WorkshopId)?.PersonnelCode
|
|
|
|
|
}).ToList();
|
|
|
|
|
//w2.Stop();
|
|
|
|
|
//Console.WriteLine("efore :" + w2.ElapsedMilliseconds);
|
|
|
|
|
@@ -619,6 +666,7 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -663,6 +711,7 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
|
|
|
|
if (_EmployeeRepository.ExistsEmployeeWorkshopNationalCode(command.NationalCode, command.WorkshopId))
|
|
|
|
|
return opration.Failed("کد ملی وارد شده تکراری است");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (_EmployeeRepository.Exists(x => x.InsuranceCode == command.InsuranceCode && x.InsuranceCode != null))
|
|
|
|
|
{
|
|
|
|
|
if (_EmployeeRepository.ExistsEmployeeWorkshoppInsuranceCode(command.InsuranceCode, command.WorkshopId))
|
|
|
|
|
@@ -789,13 +838,17 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
|
|
|
|
if (_EmployeeRepository.Exists(x => x.NationalCode == command.NationalCode && x.id != command.Id))
|
|
|
|
|
{
|
|
|
|
|
nationalcodeIsOk = false;
|
|
|
|
|
if (_EmployeeRepository.ExistsEmployeeWorkshopNationalCodeEmployeeId(command.NationalCode, command.WorkshopId, command.Id))
|
|
|
|
|
if (_EmployeeRepository.ExistsEmployeeWorkshopNationalCodeEmployeeId(command.NationalCode,
|
|
|
|
|
command.WorkshopId, command.Id))
|
|
|
|
|
return opration.Failed("کد ملی وارد شده تکراری است");
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrEmpty(command.InsuranceCode) && _EmployeeRepository.Exists(x => x.InsuranceCode == command.InsuranceCode && x.id != command.Id))
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(command.InsuranceCode) &&
|
|
|
|
|
_EmployeeRepository.Exists(x => x.InsuranceCode == command.InsuranceCode && x.id != command.Id))
|
|
|
|
|
{
|
|
|
|
|
nationalcodeIsOk = false;
|
|
|
|
|
if (_EmployeeRepository.ExistsEmployeeWorkshopInsuranceCodeEmployeeId(command.InsuranceCode, command.WorkshopId, command.Id))
|
|
|
|
|
if (_EmployeeRepository.ExistsEmployeeWorkshopInsuranceCodeEmployeeId(command.InsuranceCode,
|
|
|
|
|
command.WorkshopId, command.Id))
|
|
|
|
|
return opration.Failed("کد بیمه وارد شده تکراری است");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -877,8 +930,12 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string initial = "1300/10/11";
|
|
|
|
|
var dateOfBirth = command.DateOfBirth != null ? command.DateOfBirth.ToGeorgianDateTime() : initial.ToGeorgianDateTime();
|
|
|
|
|
var dateOfIssue = command.DateOfIssue != null ? command.DateOfIssue.ToGeorgianDateTime() : initial.ToGeorgianDateTime();
|
|
|
|
|
var dateOfBirth = command.DateOfBirth != null
|
|
|
|
|
? command.DateOfBirth.ToGeorgianDateTime()
|
|
|
|
|
: initial.ToGeorgianDateTime();
|
|
|
|
|
var dateOfIssue = command.DateOfIssue != null
|
|
|
|
|
? command.DateOfIssue.ToGeorgianDateTime()
|
|
|
|
|
: initial.ToGeorgianDateTime();
|
|
|
|
|
employee.Edit(command.FName, command.LName, command.FatherName, dateOfBirth,
|
|
|
|
|
dateOfIssue,
|
|
|
|
|
command.PlaceOfIssue, command.NationalCode, command.IdNumber, command.Gender, command.Nationality,
|
|
|
|
|
@@ -898,14 +955,17 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public EditEmployee GetDetailsForClient(long id, long workshopId)
|
|
|
|
|
{
|
|
|
|
|
var employee = _EmployeeRepository.GetDetails(id);
|
|
|
|
|
employee.PersonelCode = _context.PersonnelCodeSet.FirstOrDefault(p => p.EmployeeId == id && p.WorkshopId == workshopId)?.PersonnelCode;
|
|
|
|
|
employee.PersonelCode = _context.PersonnelCodeSet
|
|
|
|
|
.FirstOrDefault(p => p.EmployeeId == id && p.WorkshopId == workshopId)?.PersonnelCode;
|
|
|
|
|
return employee;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region NewByHeydari
|
|
|
|
|
|
|
|
|
|
public List<EmployeeViewModel> SearchForMain(EmployeeSearchModel searchModel)
|
|
|
|
|
{
|
|
|
|
|
var res = _EmployeeRepository.SearchForMain(searchModel);
|
|
|
|
|
@@ -917,6 +977,7 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
|
|
|
|
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -926,7 +987,9 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
|
|
|
|
{
|
|
|
|
|
if (nationalCode.NationalCodeValid() != "valid")
|
|
|
|
|
return new();
|
|
|
|
|
var workshopEmployeesWithLeftWork = _EmployeeRepository.GetWorkingEmployeesByWorkshopIdsAndNationalCodeAndDate(workshopIds, nationalCode, DateTime.Now.Date);
|
|
|
|
|
var workshopEmployeesWithLeftWork =
|
|
|
|
|
_EmployeeRepository.GetWorkingEmployeesByWorkshopIdsAndNationalCodeAndDate(workshopIds, nationalCode,
|
|
|
|
|
DateTime.Now.Date);
|
|
|
|
|
return workshopEmployeesWithLeftWork.FirstOrDefault();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -934,9 +997,12 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
|
|
|
|
{
|
|
|
|
|
if (nationalCode.NationalCodeValid() != "valid")
|
|
|
|
|
return new();
|
|
|
|
|
var workshopEmployeesWithLeftWork = _EmployeeRepository.GetWorkedEmployeesByWorkshopIdsAndNationalCodeAndDate(workshopIds, nationalCode, DateTime.Now.Date);
|
|
|
|
|
var workshopEmployeesWithLeftWork =
|
|
|
|
|
_EmployeeRepository.GetWorkedEmployeesByWorkshopIdsAndNationalCodeAndDate(workshopIds, nationalCode,
|
|
|
|
|
DateTime.Now.Date);
|
|
|
|
|
return workshopEmployeesWithLeftWork.FirstOrDefault();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public List<EmployeeViewModel> GetWorkingEmployeesByWorkshopId(long workshopId)
|
|
|
|
|
{
|
|
|
|
|
return _EmployeeRepository.GetWorkingEmployeesByWorkshopId(workshopId);
|
|
|
|
|
@@ -980,6 +1046,7 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region Mahan
|
|
|
|
|
|
|
|
|
|
public OperationResult CreateEmployeeByClient(CreateEmployeeByClient command)
|
|
|
|
|
{
|
|
|
|
|
OperationResult op = new();
|
|
|
|
|
@@ -1028,20 +1095,23 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
|
|
|
|
_EmployeeRepository.SaveChanges();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (employee == null)
|
|
|
|
|
{
|
|
|
|
|
return op.Failed("خطای سیستمی. لطفا دوباره تلاش کنید . درصورت تکرار این مشکل با تیم پشتیبان تماس بگیرید");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (_leftWorkTempRepository.Exists(x =>
|
|
|
|
|
x.EmployeeId == employee.id && x.WorkshopId == command.WorkshopId && x.LeftWorkType == LeftWorkTempType.StartWork))
|
|
|
|
|
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);
|
|
|
|
|
var leftWorkViewModel =
|
|
|
|
|
_leftWorkRepository.GetLastLeftWorkByEmployeeIdAndWorkshopId(command.WorkshopId, employee.id);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PersonnelCodeDomain personnelCode = null;
|
|
|
|
|
@@ -1125,8 +1195,10 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
|
|
|
|
rollCallEmployee.HasImage();
|
|
|
|
|
_rollCallEmployeeRepository.Create(rollCallEmployee);
|
|
|
|
|
_rollCallEmployeeRepository.SaveChanges();
|
|
|
|
|
string employeeFullName = employee.FName + " " + employee.LName;
|
|
|
|
|
var res = _faceEmbeddingService.GenerateEmbeddingsAsync(employee.id,command.WorkshopId,employeeFullName, filePath1,filePath2).GetAwaiter().GetResult();
|
|
|
|
|
string employeeFullName = employee.FName + " " + employee.LName;
|
|
|
|
|
var res = _faceEmbeddingService
|
|
|
|
|
.GenerateEmbeddingsAsync(employee.id, command.WorkshopId, employeeFullName, filePath1, filePath2)
|
|
|
|
|
.GetAwaiter().GetResult();
|
|
|
|
|
if (!res.IsSuccedded)
|
|
|
|
|
{
|
|
|
|
|
return op.Failed(res.Message);
|
|
|
|
|
@@ -1212,7 +1284,8 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
|
|
|
|
|
|
|
|
|
command.EmployeeDocumentItems = command.EmployeeDocumentItems ?? [];
|
|
|
|
|
|
|
|
|
|
var employeeDocumentResult = _employeeDocumentsApplication.AddRangeEmployeeDocumentItemsByClient(command.WorkshopId,
|
|
|
|
|
var employeeDocumentResult = _employeeDocumentsApplication.AddRangeEmployeeDocumentItemsByClient(
|
|
|
|
|
command.WorkshopId,
|
|
|
|
|
employee.id, command.EmployeeDocumentItems);
|
|
|
|
|
|
|
|
|
|
if (employeeDocumentResult.IsSuccedded == false)
|
|
|
|
|
@@ -1262,6 +1335,7 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
|
|
|
|
byte[] bytes = Convert.FromBase64String(subBase64);
|
|
|
|
|
System.IO.File.WriteAllBytes(filePath, bytes);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async Task<OperationResult<EmployeeByNationalCodeInWorkshopViewModel>>
|
|
|
|
|
ValidateCreateEmployeeClientByNationalCodeAndWorkshopId(string nationalCode, string birthDate, long workshopId)
|
|
|
|
|
{
|
|
|
|
|
@@ -1285,8 +1359,10 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
|
|
|
|
|
|
|
|
|
if (personalInfo.ResponseContext.Status.Code == 14)
|
|
|
|
|
{
|
|
|
|
|
return op.Failed("سامانه احراز هویت در دسترس نمیباشد لطفا اطلاعات پرسنل را به صورت دستی وارد کنید", new EmployeeByNationalCodeInWorkshopViewModel() { AuthorizedCanceled = true });
|
|
|
|
|
return op.Failed("سامانه احراز هویت در دسترس نمیباشد لطفا اطلاعات پرسنل را به صورت دستی وارد کنید",
|
|
|
|
|
new EmployeeByNationalCodeInWorkshopViewModel() { AuthorizedCanceled = true });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (personalInfo.ResponseContext.Status.Code != 0)
|
|
|
|
|
{
|
|
|
|
|
return op.Failed("کد ملی و تاریخ تولد با هم همخانی ندارند");
|
|
|
|
|
@@ -1305,10 +1381,13 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
|
|
|
|
_ => throw new AggregateException()
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var idNumber = identityInfo.ShenasnamehNumber == "0" ? identityInfo.NationalId : identityInfo.ShenasnamehNumber;
|
|
|
|
|
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, "ایرانی", identityInfo.ShenasnameSerial, identityInfo.ShenasnameSeri);
|
|
|
|
|
dateOfIssue, null, identityInfo.NationalId, idNumber, gender, "ایرانی", identityInfo.ShenasnameSerial,
|
|
|
|
|
identityInfo.ShenasnameSeri);
|
|
|
|
|
newEmployee.Authorized();
|
|
|
|
|
await _EmployeeRepository.CreateAsync(newEmployee);
|
|
|
|
|
await _EmployeeRepository.SaveChangesAsync();
|
|
|
|
|
@@ -1324,7 +1403,8 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (_leftWorkTempRepository.ExistsIgnoreQueryFilter(x =>
|
|
|
|
|
x.EmployeeId == employee.id && x.WorkshopId == workshopId && x.LeftWorkType == LeftWorkTempType.StartWork))
|
|
|
|
|
x.EmployeeId == employee.id && x.WorkshopId == workshopId &&
|
|
|
|
|
x.LeftWorkType == LeftWorkTempType.StartWork))
|
|
|
|
|
{
|
|
|
|
|
return op.Failed("این پرسنل در کارگاه شما قبلا افزوده شده است و در انتظار تایید میباشد");
|
|
|
|
|
}
|
|
|
|
|
@@ -1346,14 +1426,17 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
|
|
|
|
_ => throw new AggregateException()
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var idNumber = identityInfo.ShenasnamehNumber == "0" ? identityInfo.NationalId : identityInfo.ShenasnamehNumber;
|
|
|
|
|
var idNumber = identityInfo.ShenasnamehNumber == "0"
|
|
|
|
|
? identityInfo.NationalId
|
|
|
|
|
: identityInfo.ShenasnamehNumber;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
employee.Edit(basicInfo.FirstName, basicInfo.LastName, basicInfo.FatherName, apiBirthDate,
|
|
|
|
|
employee.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.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,
|
|
|
|
|
@@ -1384,7 +1467,8 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
|
|
|
|
Gender = employee.Gender,
|
|
|
|
|
Nationality = employee.Nationality,
|
|
|
|
|
EmployeeLName = employee.LName
|
|
|
|
|
}); ;
|
|
|
|
|
});
|
|
|
|
|
;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (leftWorkViewModel.LeftWorkDate >= DateTime.Now || !leftWorkViewModel.HasLeft)
|
|
|
|
|
@@ -1436,17 +1520,18 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
|
|
|
|
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(),
|
|
|
|
|
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,
|
|
|
|
|
@@ -1500,6 +1585,7 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
|
|
|
|
{
|
|
|
|
|
return op.Failed("جنسیت وارد شده نامعتبر است");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (command.BirthDate.TryToGeorgianDateTime(out var birthDateGr) == false)
|
|
|
|
|
{
|
|
|
|
|
return op.Failed("تاریخ تولد وارد شده نامعتبر است");
|
|
|
|
|
@@ -1536,7 +1622,8 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var employeeClientTemp = _employeeClientTempRepository.GetByEmployeeIdAndWorkshopId(command.EmployeeId, command.WorkshopId);
|
|
|
|
|
var employeeClientTemp =
|
|
|
|
|
_employeeClientTempRepository.GetByEmployeeIdAndWorkshopId(command.EmployeeId, command.WorkshopId);
|
|
|
|
|
|
|
|
|
|
employeeClientTemp?.Edit(command.MaritalStatus);
|
|
|
|
|
|
|
|
|
|
@@ -1563,6 +1650,7 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
|
|
|
|
employee.EserviceUserName, employee.EservicePassword, employee.TaxOfficeUserName,
|
|
|
|
|
employee.TaxOfficepassword, employee.SanaUserName, employee.SanaPassword);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
await _EmployeeRepository.SaveChangesAsync();
|
|
|
|
|
|
|
|
|
|
return op.Succcedded();
|
|
|
|
|
@@ -1573,7 +1661,8 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
|
|
|
|
return await _EmployeeRepository.WorkedEmployeesInWorkshopSelectList(workshopId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async Task<OperationResult<EmployeeDataFromApiViewModel>> GetEmployeeDataFromApi(string nationalCode, string birthDate)
|
|
|
|
|
public async Task<OperationResult<EmployeeDataFromApiViewModel>> GetEmployeeDataFromApi(string nationalCode,
|
|
|
|
|
string birthDate)
|
|
|
|
|
{
|
|
|
|
|
var op = new OperationResult<EmployeeDataFromApiViewModel>();
|
|
|
|
|
var birthDateGr = birthDate.ToGeorgianDateTime();
|
|
|
|
|
@@ -1585,20 +1674,23 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
|
|
|
|
if (employee.IsAuthorized == false)
|
|
|
|
|
{
|
|
|
|
|
var apiResult = await _uidService.GetPersonalInfo(nationalCode, birthDate);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (apiResult == null)
|
|
|
|
|
{
|
|
|
|
|
return op.Failed("این پرسنل در بانک اطلاعات موجود میباشد");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (apiResult.ResponseContext.Status.Code is 14 or 3)
|
|
|
|
|
{
|
|
|
|
|
return op.Failed("این پرسنل در بانک اطلاعات موجود میباشد");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (apiResult.ResponseContext.Status.Code != 0)
|
|
|
|
|
{
|
|
|
|
|
return op.Failed("کد ملی و تاریخ تولد با هم همخانی ندارند");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var basicInfo = apiResult.BasicInformation;
|
|
|
|
|
var identityInfo = apiResult.IdentificationInformation;
|
|
|
|
|
|
|
|
|
|
@@ -1609,12 +1701,15 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
|
|
|
|
_ => throw new AggregateException()
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var idNumber = identityInfo.ShenasnamehNumber == "0" ? identityInfo.NationalId : identityInfo.ShenasnamehNumber;
|
|
|
|
|
var idNumber = identityInfo.ShenasnamehNumber == "0"
|
|
|
|
|
? identityInfo.NationalId
|
|
|
|
|
: identityInfo.ShenasnamehNumber;
|
|
|
|
|
employee.Edit(basicInfo.FirstName, basicInfo.LastName, basicInfo.FatherName, birthDateGr,
|
|
|
|
|
employee.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.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,
|
|
|
|
|
@@ -1649,15 +1744,18 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
|
|
|
|
};
|
|
|
|
|
return op.Succcedded(data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var apiResult = await _uidService.GetPersonalInfo(nationalCode, birthDate);
|
|
|
|
|
if (apiResult == null)
|
|
|
|
|
{
|
|
|
|
|
return op.Failed("سامانه احراز هویت در دسترس نمیباشد لطفا اطلاعات پرسنل را به صورت دستی وارد کنید", new EmployeeDataFromApiViewModel() { AuthorizedCanceled = true });
|
|
|
|
|
return op.Failed("سامانه احراز هویت در دسترس نمیباشد لطفا اطلاعات پرسنل را به صورت دستی وارد کنید",
|
|
|
|
|
new EmployeeDataFromApiViewModel() { AuthorizedCanceled = true });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (apiResult.ResponseContext.Status.Code is 14 or 3)
|
|
|
|
|
{
|
|
|
|
|
return op.Failed("سامانه احراز هویت در دسترس نمیباشد لطفا اطلاعات پرسنل را به صورت دستی وارد کنید", new EmployeeDataFromApiViewModel() { AuthorizedCanceled = true });
|
|
|
|
|
return op.Failed("سامانه احراز هویت در دسترس نمیباشد لطفا اطلاعات پرسنل را به صورت دستی وارد کنید",
|
|
|
|
|
new EmployeeDataFromApiViewModel() { AuthorizedCanceled = true });
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -1665,10 +1763,12 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
|
|
|
|
{
|
|
|
|
|
return op.Failed("کد ملی و تاریخ تولد با هم همخانی ندارند");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (apiResult.ResponseContext.Status.Code != 0)
|
|
|
|
|
{
|
|
|
|
|
return op.Failed("اطلاعات وارد شده نامعتبر میباشد");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var basicInfo = apiResult.BasicInformation;
|
|
|
|
|
var identityInfo = apiResult.IdentificationInformation;
|
|
|
|
|
|
|
|
|
|
@@ -1676,7 +1776,9 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
|
|
|
|
{
|
|
|
|
|
BirthDate = identityInfo.BirthDate,
|
|
|
|
|
NationalCode = identityInfo.NationalId,
|
|
|
|
|
IdNumber = identityInfo.ShenasnamehNumber == "0" ? identityInfo.NationalId : identityInfo.ShenasnamehNumber,
|
|
|
|
|
IdNumber = identityInfo.ShenasnamehNumber == "0"
|
|
|
|
|
? identityInfo.NationalId
|
|
|
|
|
: identityInfo.ShenasnamehNumber,
|
|
|
|
|
FatherName = basicInfo.FatherName,
|
|
|
|
|
FName = basicInfo.FirstName,
|
|
|
|
|
Gender = basicInfo.GenderEnum,
|
|
|
|
|
@@ -1685,7 +1787,8 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
|
|
|
|
IdNumberSerial = identityInfo.ShenasnameSerial
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var newAuthorizeTemp = new EmployeeAuthorizeTemp(data.Gender, data.FName, data.LName, data.FatherName, birthDateGr, data.NationalCode, data.IdNumber, data.IdNumberSerial, data.IdNumberSeri);
|
|
|
|
|
var newAuthorizeTemp = new EmployeeAuthorizeTemp(data.Gender, data.FName, data.LName, data.FatherName,
|
|
|
|
|
birthDateGr, data.NationalCode, data.IdNumber, data.IdNumberSerial, data.IdNumberSeri);
|
|
|
|
|
await _employeeAuthorizeTempRepository.CreateAsync(newAuthorizeTemp);
|
|
|
|
|
await _employeeAuthorizeTempRepository.SaveChangesAsync();
|
|
|
|
|
|
|
|
|
|
@@ -1700,9 +1803,9 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
|
|
|
|
|
|
|
|
|
#region Api
|
|
|
|
|
|
|
|
|
|
public async Task<List<EmployeeSelectListViewModel>> GetSelectList(string searchText,long id)
|
|
|
|
|
public async Task<List<EmployeeSelectListViewModel>> GetSelectList(string searchText, long id)
|
|
|
|
|
{
|
|
|
|
|
return await _EmployeeRepository.GetSelectList(searchText,id );
|
|
|
|
|
return await _EmployeeRepository.GetSelectList(searchText, id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async Task<List<GetEmployeeListViewModel>> GetList(GetEmployeeListSearchModel searchModel)
|
|
|
|
|
@@ -1710,5 +1813,10 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
|
|
|
|
return await _EmployeeRepository.GetList(searchModel);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
public Task<List<GetEmployeeClientListViewModel>> GetEmployeeClientList(GetEmployeeClientListSearchModel searchModel,long workshopId)
|
|
|
|
|
{
|
|
|
|
|
return _EmployeeRepository.GetEmployeeClientList(searchModel, workshopId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
}
|