finish employee unauthorized

This commit is contained in:
2025-06-22 15:05:38 +03:30
parent a6c25ec8e8
commit b2cb3ae173
2 changed files with 16 additions and 1 deletions

View File

@@ -29,6 +29,7 @@ public class CreateEmployeeByClient
public bool HasEmployeeDocument { get; set; } public bool HasEmployeeDocument { get; set; }
public bool HasRollCallService { get; set; } public bool HasRollCallService { get; set; }
public bool CanceledAuthorize { get; set; } public bool CanceledAuthorize { get; set; }
public string BirthDate { get; set; }
} }

View File

@@ -995,10 +995,24 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
//{ //{
// return op.Failed("این پرسنل قبلا افزوده شده است و در انتظار تایید میباشد"); // return op.Failed("این پرسنل قبلا افزوده شده است و در انتظار تایید میباشد");
//} //}
var employee = _EmployeeRepository.GetByNationalCodeIgnoreQueryFilter(command.NationalCode); var employee = _EmployeeRepository.GetByNationalCodeIgnoreQueryFilter(command.NationalCode);
var workshop = _WorkShopRepository.GetDetails(command.WorkshopId); 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("خطای سیستمی. لطفا دوباره تلاش کنید . درصورت تکرار این مشکل با تیم پشتیبان تماس بگیرید"); return op.Failed("خطای سیستمی. لطفا دوباره تلاش کنید . درصورت تکرار این مشکل با تیم پشتیبان تماس بگیرید");
} }