From b2cb3ae173112233601d4d6130b8491c57629e90 Mon Sep 17 00:00:00 2001 From: mahan Date: Sun, 22 Jun 2025 15:05:38 +0330 Subject: [PATCH] finish employee unauthorized --- .../Employee/CreateEmployeeByClient.cs | 1 + .../EmployeeAplication.cs | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) 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("خطای سیستمی. لطفا دوباره تلاش کنید . درصورت تکرار این مشکل با تیم پشتیبان تماس بگیرید"); }