diff --git a/CompanyManagment.App.Contracts/Employee/CreateEmployeeByClient.cs b/CompanyManagment.App.Contracts/Employee/CreateEmployeeByClient.cs index e9ed7c25..1918c115 100644 --- a/CompanyManagment.App.Contracts/Employee/CreateEmployeeByClient.cs +++ b/CompanyManagment.App.Contracts/Employee/CreateEmployeeByClient.cs @@ -29,6 +29,7 @@ public class CreateEmployeeByClient public bool HasEmployeeDocument { get; set; } public bool HasRollCallService { get; set; } public bool CanceledAuthorize { get; set; } + public string BirthDate { get; set; } } diff --git a/CompanyManagment.Application/EmployeeAplication.cs b/CompanyManagment.Application/EmployeeAplication.cs index 8d1f9e59..01c7ffba 100644 --- a/CompanyManagment.Application/EmployeeAplication.cs +++ b/CompanyManagment.Application/EmployeeAplication.cs @@ -995,10 +995,24 @@ public class EmployeeAplication : RepositoryBase, IEmployeeAppli //{ // return op.Failed("این پرسنل قبلا افزوده شده است و در انتظار تایید میباشد"); //} + var employee = _EmployeeRepository.GetByNationalCodeIgnoreQueryFilter(command.NationalCode); + var workshop = _WorkShopRepository.GetDetails(command.WorkshopId); - if (employee == null) + + if (employee == null && command.CanceledAuthorize) + { + var birthDate = command.BirthDate.ToGeorgianDateTime(); + var dateOfIssue = new DateTime(1922, 1, 1); + + employee = new Employee(command.FirstName, command.LastName, null, birthDate, + dateOfIssue, null, command.NationalCode, null, command.Gender, "ایرانی", null, null); + _EmployeeRepository.Create(employee); + _EmployeeRepository.SaveChanges(); + + } + if (employee == null) { return op.Failed("خطای سیستمی. لطفا دوباره تلاش کنید . درصورت تکرار این مشکل با تیم پشتیبان تماس بگیرید"); }