add employer controller
This commit is contained in:
@@ -1,8 +0,0 @@
|
||||
namespace _0_Framework.Application.Enums;
|
||||
|
||||
public enum Gender
|
||||
{
|
||||
None,
|
||||
Male,
|
||||
Female
|
||||
}
|
||||
@@ -56,6 +56,16 @@ public interface IEmployerRepository : IRepository<long, Employer>
|
||||
|
||||
#endregion
|
||||
|
||||
#region Api
|
||||
Task<List<GetEmployerListViewModel>> GetEmployerList(GetEmployerSearchModel searchModel);
|
||||
|
||||
Task<GetLegalEmployerDetailViewModel> GetLegalEmployerDetail(long id);
|
||||
Task<GetRealEmployerDetailViewModel> GetRealEmployerDetail(long id);
|
||||
//Task<List<EmployerSelectListViewModel>> GetSelectList(string search);
|
||||
Task<OperationResult<string>> DeactivateWithSubordinates(long id);
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Application.Enums;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.Employer;
|
||||
|
||||
/// <summary>
|
||||
/// ایجاد کارفرمای حقیقی
|
||||
/// </summary>
|
||||
public class CreateLegalEmployer
|
||||
{
|
||||
/// <summary>
|
||||
/// آیدی طرف حساب
|
||||
/// </summary>
|
||||
[Required]
|
||||
public long ContractingPartyId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نام شرکت
|
||||
/// </summary>
|
||||
public string CompanyName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// شناسه ملی
|
||||
/// </summary>
|
||||
public string NationalId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// شماره ثبت
|
||||
/// </summary>
|
||||
public string RegisterId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// شماره تلفن همراه
|
||||
/// </summary>
|
||||
public string PhoneNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// شماره تلفن ثابت
|
||||
/// </summary>
|
||||
public string TelephoneNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نام مدیر عامل
|
||||
/// </summary>
|
||||
public string EmployerFName { get; set; }
|
||||
/// <summary>
|
||||
/// نام خانوادگی مدیر عامل
|
||||
/// </summary>
|
||||
public string EmployerLName { get; set; }
|
||||
/// <summary>
|
||||
/// جنسیت مدیر عامل
|
||||
/// </summary>
|
||||
public Gender EmployerGender { get; set; }
|
||||
/// <summary>
|
||||
/// کد ملی مدیر عامل
|
||||
/// </summary>
|
||||
public string EmployerNationalCode { get; set; }
|
||||
/// <summary>
|
||||
/// شماره شناسنامه مدیر عامل
|
||||
/// </summary>
|
||||
public string EmployerIdNumber { get; set; }
|
||||
/// <summary>
|
||||
/// نام پدر مدیر عامل
|
||||
/// </summary>
|
||||
public string EmployerFatherName { get; set; }
|
||||
/// <summary>
|
||||
/// تاریخ تولد مدیر عامل
|
||||
/// </summary>
|
||||
public string EmployerDateOfBirth { get; set; }
|
||||
/// <summary>
|
||||
/// تاریخ صدور شناسنامه مدیر عامل
|
||||
/// </summary>
|
||||
public string EmployerDateOfIssue { get; set; }
|
||||
/// <summary>
|
||||
/// محل صدور شناسنامه مدیر عامل
|
||||
/// </summary>
|
||||
public string EmployerPlaceOfIssue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// اطلاعات سامانه ای
|
||||
/// </summary>
|
||||
public GovernmentSystemInfo GovernmentSystemInfo { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Application.Enums;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.Employer;
|
||||
|
||||
/// <summary>
|
||||
/// ایجاد کارفرما حقیقی
|
||||
/// </summary>
|
||||
public class CreateRealEmployer
|
||||
{
|
||||
/// <summary>
|
||||
/// آیدی طرف حساب
|
||||
/// </summary>
|
||||
[Required]
|
||||
public long ContractingPartyId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// جنسیت
|
||||
/// </summary>
|
||||
[Required]
|
||||
public Gender Gender { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نام
|
||||
/// </summary>
|
||||
[Required]
|
||||
public string FName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///نام خانوادگی
|
||||
/// </summary>
|
||||
[Required]
|
||||
public string LName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// کد ملی
|
||||
/// </summary>
|
||||
public string NationalCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// شماره شناسنامه
|
||||
/// </summary>
|
||||
public string IdNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// شماره تلفن همراه
|
||||
/// </summary>
|
||||
public string PhoneNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// شماره تلفن ثابت
|
||||
/// </summary>
|
||||
public string Telephone { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// تاریخ صدور شناسنامه
|
||||
/// </summary>
|
||||
public string DateOfIssue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// محل صدور شناسنامه
|
||||
/// </summary>
|
||||
public string PlaceOfIssue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// تاریخ تولد
|
||||
/// </summary>
|
||||
public string DateOfBirth { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نام پدر
|
||||
/// </summary>
|
||||
public string FatherName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// اطلاعات سامانه ای
|
||||
/// </summary>
|
||||
public GovernmentSystemInfo GovernmentSystemInfo { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace CompanyManagment.App.Contracts.Employer;
|
||||
|
||||
public class EditLegalEmployer: CreateLegalEmployer
|
||||
{
|
||||
/// <summary>
|
||||
/// آیدی کارفرما
|
||||
/// </summary>
|
||||
public long Id { get; set; }
|
||||
}
|
||||
12
CompanyManagment.App.Contracts/Employer/EditRealEmployer.cs
Normal file
12
CompanyManagment.App.Contracts/Employer/EditRealEmployer.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
namespace CompanyManagment.App.Contracts.Employer;
|
||||
|
||||
/// <summary>
|
||||
/// ویرایش کارفرما حقیقی
|
||||
/// </summary>
|
||||
public class EditRealEmployer:CreateRealEmployer
|
||||
{
|
||||
/// <summary>
|
||||
/// آیدی کارفرما
|
||||
/// </summary>
|
||||
public long Id { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
using System.Collections.Generic;
|
||||
using _0_Framework.Application.Enums;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.Employer;
|
||||
|
||||
/// <summary>
|
||||
/// مدل برای گرفتن لیست کارفرما
|
||||
/// </summary>
|
||||
public class GetEmployerListViewModel
|
||||
{
|
||||
/// <summary>
|
||||
/// آیدی کارفرما
|
||||
/// </summary>
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// کدملی / شناسه ملی
|
||||
/// </summary>
|
||||
public string NationalCodeOrNationalId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نام کارفرما
|
||||
/// </summary>
|
||||
public string FullName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نام های کارگاه
|
||||
/// </summary>
|
||||
public ICollection<string> WorkshopNames { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// دارای طرف حساب
|
||||
/// </summary>
|
||||
public bool HasContractingParty { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// طرف حساب بلاک شده یا نه
|
||||
/// </summary>
|
||||
public bool HasBlockContractingParty { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نوع کارفرما
|
||||
/// </summary>
|
||||
public LegalType LegalType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// وضعیت کارفرما
|
||||
/// </summary>
|
||||
public ActivationStatus EmployerStatus { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
using _0_Framework.Application.Enums;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.Employer;
|
||||
|
||||
/// <summary>
|
||||
/// مدل جستجوی لیست کارفرما
|
||||
/// </summary>
|
||||
public class GetEmployerSearchModel
|
||||
{
|
||||
/// <summary>
|
||||
/// نام شرکت / نام و نام خانوادگی
|
||||
/// </summary>
|
||||
public string FullNameOrCompanyName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// کدملی/ شناسه ملی
|
||||
/// </summary>
|
||||
public string NationalCodeOrNationalId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// شماره شناسنامه یا شماره ثبت
|
||||
/// </summary>
|
||||
public string IdNumberOrRegisterId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نام طرف حساب
|
||||
/// </summary>
|
||||
public string ContractingPartyName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// وضعیت کارفرما
|
||||
/// </summary>
|
||||
public ActivationStatus EmployerStatus { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نوع کارفرما
|
||||
/// </summary>
|
||||
public LegalType EmployerType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// پیج ایندکس برای دسته بندی سی تایی
|
||||
/// </summary>
|
||||
public int PageIndex { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Application.Enums;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.Employer;
|
||||
|
||||
/// <summary>
|
||||
/// اطلاعات کارفرمای حقوقی
|
||||
/// </summary>
|
||||
public class GetLegalEmployerDetailViewModel
|
||||
{
|
||||
/// <summary>
|
||||
/// آیدی کارفرما
|
||||
/// </summary>
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نام شرکت
|
||||
/// </summary>
|
||||
public string CompanyName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// شناسه ملی
|
||||
/// </summary>
|
||||
public string NationalId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// شماره ثبت
|
||||
/// </summary>
|
||||
public string RegisterId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// شماره تلفن همراه
|
||||
/// </summary>
|
||||
public string PhoneNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// شماره تلفن ثابت
|
||||
/// </summary>
|
||||
public string TelephoneNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// کد کارفرما
|
||||
/// </summary>
|
||||
public string EmployerNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نام کارفرما
|
||||
/// </summary>
|
||||
public string ContractingPartyName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نام کارفرما
|
||||
/// </summary>
|
||||
public long ContractingPartyId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نام و خانوادگی مدیر عامل
|
||||
/// </summary>
|
||||
public string CeoFullName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نام و خانوادگی مدیر عامل
|
||||
/// </summary>
|
||||
public string CeoFName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نام و خانوادگی مدیر عامل
|
||||
/// </summary>
|
||||
public string CeoLName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// جنسیت مدیر عامل
|
||||
/// </summary>
|
||||
public Gender Gender { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// جنیست
|
||||
/// </summary>
|
||||
public string GenderStr { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// ملیت
|
||||
/// </summary>
|
||||
public string Nationality { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نام پدر
|
||||
/// </summary>
|
||||
public string FatherName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// کد ملی
|
||||
/// </summary>
|
||||
public string NationalCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// شماره شناسنامه
|
||||
/// </summary>
|
||||
public string IdNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// تاریخ تولد
|
||||
/// </summary>
|
||||
public string DateOfBirth { get; set; }
|
||||
/// <summary>
|
||||
/// تاریخ صدور شناسنامه
|
||||
/// </summary>
|
||||
public string DateOfIssue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// محل صدور شناسنامه
|
||||
/// </summary>
|
||||
public string PlaceOfIssue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// اطلاعات سامانه های دولتی
|
||||
/// </summary>
|
||||
public GovernmentSystemInfo GovernmentSystemInfo { get; set; }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Application.Enums;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.Employer;
|
||||
|
||||
/// <summary>
|
||||
/// اطلاعات کارفرمای حقوقی
|
||||
/// </summary>
|
||||
public class GetRealEmployerDetailViewModel
|
||||
{
|
||||
/// <summary>
|
||||
/// آیدی کارفرما
|
||||
/// </summary>
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نام و نام خانوادگی
|
||||
/// </summary>
|
||||
public string FullName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نام
|
||||
/// </summary>
|
||||
public string FName{ get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نام خانوادگی
|
||||
/// </summary>
|
||||
public string LName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// کدملی
|
||||
/// </summary>
|
||||
public string NationalCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// جنسیت فارسی
|
||||
/// </summary>
|
||||
public string GenderStr { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// جنسیت
|
||||
/// </summary>
|
||||
public Gender Gender { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// ملیت
|
||||
/// </summary>
|
||||
public string Nationality { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// شماره تلفن همراه
|
||||
/// </summary>
|
||||
public string PhoneNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نام پدر
|
||||
/// </summary>
|
||||
public string FatherName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// شماره شناسنامه
|
||||
/// </summary>
|
||||
public string IdNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// تاریخ تولد
|
||||
/// </summary>
|
||||
public string DateOfBirth { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نام طرف حساب
|
||||
/// </summary>
|
||||
public string ContractingPartyName { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// آیدی طرف حساب
|
||||
/// </summary>
|
||||
public long ContractingPartyId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// کد کارفرما
|
||||
/// </summary>
|
||||
public string EmployerNo { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// شماره تلفن ثابت
|
||||
/// </summary>
|
||||
public string TelephoneNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// تاریخ صدور شناسنامه
|
||||
/// </summary>
|
||||
public string DateOfIssue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// محل صدور شناسنامه
|
||||
/// </summary>
|
||||
public string PlaceOfIssue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// اطلاعات سامانه های دولتی
|
||||
/// </summary>
|
||||
public GovernmentSystemInfo GovernmentSystemInfo { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
using System;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.Employer;
|
||||
|
||||
/// <summary>
|
||||
/// اطلاعات سامانه های دولتی
|
||||
/// </summary>
|
||||
public class GovernmentSystemInfo
|
||||
{
|
||||
#region MCL
|
||||
/// <summary>
|
||||
/// نام کاربری اداره کار
|
||||
/// </summary>
|
||||
public string MclUsername { get; set; }
|
||||
/// <summary>
|
||||
/// رمز عبور اداره کار
|
||||
/// </summary>
|
||||
public string MclPassword { get; set; }
|
||||
#endregion
|
||||
|
||||
#region E-Service تامین اجتماعی
|
||||
/// <summary>
|
||||
/// نام کاربری سازمان تامین اجتماعی
|
||||
/// </summary>
|
||||
public string EServiceUsername { get; set; }
|
||||
/// <summary>
|
||||
/// رمز عبور سازمان تامین اجتماعی
|
||||
/// </summary>
|
||||
public string EServicePassword { get; set; }
|
||||
#endregion
|
||||
|
||||
#region Tax سامانه مالیاتی
|
||||
/// <summary>
|
||||
/// نام کاربری سامانه مالیاتی
|
||||
/// </summary>
|
||||
public string TaxUsername { get; set; }
|
||||
/// <summary>
|
||||
/// رمز عبور سامانه مالیاتی
|
||||
/// </summary>
|
||||
public string TaxPassword { get; set; }
|
||||
#endregion
|
||||
|
||||
#region Sana سامانه ثنا
|
||||
/// <summary>
|
||||
/// نام کاربری ثنا
|
||||
/// </summary>
|
||||
public string SanaUsername { get; set; }
|
||||
/// <summary>
|
||||
/// رمز عبور ثنا
|
||||
/// </summary>
|
||||
public string SanaPassword { get; set; }
|
||||
#endregion
|
||||
|
||||
}
|
||||
@@ -55,4 +55,71 @@ public interface IEmployerApplication
|
||||
|
||||
#endregion
|
||||
|
||||
#region Api
|
||||
|
||||
/// <summary>
|
||||
/// لیست کارفرما ها
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<List<GetEmployerListViewModel>> GetEmployerList(GetEmployerSearchModel searchModel);
|
||||
|
||||
/// <summary>
|
||||
/// جزئیات کارفرما حقوقی
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
Task<GetLegalEmployerDetailViewModel> GetLegalEmployerDetail(long id);
|
||||
|
||||
/// <summary>
|
||||
/// جزئیات کارفرما حقیقی
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
Task<GetRealEmployerDetailViewModel> GetRealEmployerDetail(long id);
|
||||
|
||||
/// <summary>
|
||||
/// ایجاد کارفرمای حقیقی
|
||||
/// </summary>
|
||||
/// <param name="command"></param>
|
||||
/// <returns></returns>
|
||||
Task<OperationResult> CreateReal(CreateRealEmployer command);
|
||||
|
||||
/// <summary>
|
||||
/// ایجاد کارفرمای حقوقی
|
||||
/// </summary>
|
||||
/// <param name="command"></param>
|
||||
/// <returns></returns>
|
||||
Task<OperationResult> CreateLegal(CreateLegalEmployer command);
|
||||
|
||||
/// <summary>
|
||||
/// ویرایش کارفرمای حقیقی
|
||||
/// </summary>
|
||||
/// <param name="command"></param>
|
||||
/// <returns></returns>
|
||||
Task<OperationResult> EditReal(EditRealEmployer command);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// ویرایش کارفرمای حقوقی
|
||||
/// </summary>
|
||||
/// <param name="command"></param>
|
||||
/// <returns></returns>
|
||||
Task<OperationResult> EditLegal(EditLegalEmployer command);
|
||||
|
||||
///// <summary>
|
||||
///// لیست نام کارفرما ها برای جستجو
|
||||
///// </summary>
|
||||
///// <param name="search"></param>
|
||||
///// <returns></returns>
|
||||
//public Task<List<EmployerSelectListViewModel>> GetSelectList(string search);
|
||||
|
||||
/// <summary>
|
||||
/// حذف کارفرما - درصورت داشتن کارگاه کارفرما غیرفعال میشود
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public Task<OperationResult<string>> RemoveApi(long id);
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Exceptions;
|
||||
using Company.Domain.empolyerAgg;
|
||||
using Company.Domain.WorkshopAgg;
|
||||
using CompanyManagment.App.Contracts.Checkout;
|
||||
@@ -957,4 +958,256 @@ public class EmployerApplication : IEmployerApplication
|
||||
}
|
||||
|
||||
#endregion
|
||||
#region Api
|
||||
public async Task<List<GetEmployerListViewModel>> GetEmployerList(GetEmployerSearchModel searchModel)
|
||||
{
|
||||
return await _EmployerRepository.GetEmployerList(searchModel);
|
||||
}
|
||||
public async Task<GetLegalEmployerDetailViewModel> GetLegalEmployerDetail(long id)
|
||||
{
|
||||
var employer = await _EmployerRepository.GetLegalEmployerDetail(id);
|
||||
if (employer == null)
|
||||
{
|
||||
throw new NotFoundException("کارفرمای مورد نطر یافت نشد");
|
||||
}
|
||||
return employer;
|
||||
|
||||
}
|
||||
|
||||
public async Task<GetRealEmployerDetailViewModel> GetRealEmployerDetail(long id)
|
||||
{
|
||||
var employer = await _EmployerRepository.GetRealEmployerDetail(id);
|
||||
if (employer == null)
|
||||
{
|
||||
throw new NotFoundException("کارفرمای مورد نطر یافت نشد");
|
||||
}
|
||||
return employer;
|
||||
}
|
||||
|
||||
public async Task<OperationResult> CreateReal(CreateRealEmployer command)
|
||||
{
|
||||
var opration = new OperationResult();
|
||||
if (_EmployerRepository.Exists(x =>
|
||||
(x.FName == command.FName && x.LName == command.LName) && x.Nationalcode == command.NationalCode && x.Nationalcode != null))
|
||||
return opration.Failed("امکان ثبت رکورد تکراری وجود ندارد");
|
||||
|
||||
if (string.IsNullOrWhiteSpace(command.FName))
|
||||
return opration.Failed("لطفا نام را وارد کنید");
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(command.NationalCode))
|
||||
{
|
||||
if (command.NationalCode.NationalCodeValid() != "valid")
|
||||
{
|
||||
return opration.Failed("کدملی وارد شده نامعتبر است");
|
||||
}
|
||||
if (_EmployerRepository.Exists(x => x.Nationalcode == command.NationalCode && !string.IsNullOrWhiteSpace(command.NationalCode)))
|
||||
{
|
||||
return opration.Failed("کد ملی وارد شده تکراری است");
|
||||
}
|
||||
}
|
||||
string initial = "1300/10/11";
|
||||
var dateOfBirth = command.DateOfBirth?.ToGeorgianDateTime() ?? initial.ToGeorgianDateTime();
|
||||
var dateOfIssue = command.DateOfIssue?.ToGeorgianDateTime() ?? initial.ToGeorgianDateTime();
|
||||
|
||||
var gender = command.Gender switch
|
||||
{
|
||||
Gender.Male => "مرد",
|
||||
Gender.Female => "زن",
|
||||
Gender.None => null,
|
||||
_ => throw new BadRequestException("جنسیت وارد شده نامعتبر است")
|
||||
};
|
||||
|
||||
var employerData = new Employer(command.FName, command.LName, command.ContractingPartyId, gender,
|
||||
command.NationalCode, command.IdNumber, "ایرانی", command.FatherName, dateOfBirth,
|
||||
dateOfIssue, command.PlaceOfIssue, "*", "*", "*", "حقیقی", command.PhoneNumber,
|
||||
command.Telephone, "true", command.GovernmentSystemInfo.MclUsername, command.GovernmentSystemInfo.MclPassword, command.GovernmentSystemInfo.EServiceUsername, command.GovernmentSystemInfo.EServicePassword,
|
||||
command.GovernmentSystemInfo.TaxUsername, command.GovernmentSystemInfo.TaxPassword, command.GovernmentSystemInfo.SanaUsername, command.GovernmentSystemInfo.SanaPassword);
|
||||
|
||||
await _EmployerRepository.CreateAsync(employerData);
|
||||
await _EmployerRepository.SaveChangesAsync();
|
||||
|
||||
return opration.Succcedded();
|
||||
}
|
||||
|
||||
public async Task<OperationResult> CreateLegal(CreateLegalEmployer command)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(command.EmployerLName))
|
||||
command.EmployerLName = "#";
|
||||
var opration = new OperationResult();
|
||||
if (_EmployerRepository.Exists(x =>
|
||||
x.LName == command.CompanyName && x.NationalId == command.NationalId && x.EmployerLName == command.EmployerLName))
|
||||
return opration.Failed("امکان ثبت رکورد تکراری وجود ندارد");
|
||||
|
||||
if (_EmployerRepository.Exists(x => x.NationalId == command.NationalId && !string.IsNullOrWhiteSpace(command.NationalId) && x.NationalId != null))
|
||||
{
|
||||
return opration.Failed(" شناسه ملی وارد شده تکراری است");
|
||||
}
|
||||
if (_EmployerRepository.Exists(x => x.LName == command.CompanyName))
|
||||
{
|
||||
return opration.Failed("نام شرکت وارد شده تکراری است");
|
||||
}
|
||||
if (_EmployerRepository.Exists(x => x.RegisterId == command.RegisterId && !string.IsNullOrWhiteSpace(command.RegisterId) && x.RegisterId != null))
|
||||
{
|
||||
return opration.Failed(" شماره ثبت وارد شده تکراری است");
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(command.NationalId) && command.NationalId.Length != 11)
|
||||
{
|
||||
return opration.Failed(" شناسه ملی باید 11 رقم باشد");
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(command.EmployerNationalCode))
|
||||
{
|
||||
if (command.EmployerNationalCode.NationalCodeValid() != "valid")
|
||||
{
|
||||
return opration.Failed("کد ملی وارد شده نا معتبر است");
|
||||
}
|
||||
}
|
||||
|
||||
string initial = "1300/10/11";
|
||||
var dateOfBirth = command.EmployerDateOfBirth?.ToGeorgianDateTime() ?? initial.ToGeorgianDateTime();
|
||||
var dateOfIssue = command.EmployerDateOfIssue?.ToGeorgianDateTime() ?? initial.ToGeorgianDateTime();
|
||||
|
||||
var gender = command.EmployerGender switch
|
||||
{
|
||||
Gender.Male => "مرد",
|
||||
Gender.Female => "زن",
|
||||
Gender.None => null,
|
||||
_ => throw new BadRequestException("جنسیت وارد شده نامعتبر است")
|
||||
};
|
||||
|
||||
|
||||
var legalEmployerData = new Employer(command.EmployerFName, command.CompanyName, command.ContractingPartyId, gender,
|
||||
command.EmployerNationalCode, command.EmployerIdNumber, "ایرانی", command.EmployerFatherName, dateOfBirth,
|
||||
dateOfIssue, command.EmployerPlaceOfIssue, command.RegisterId, command.NationalId, command.EmployerLName, "حقوقی", command.PhoneNumber,
|
||||
command.TelephoneNumber, "true", command.GovernmentSystemInfo.MclUsername, command.GovernmentSystemInfo.MclPassword,
|
||||
command.GovernmentSystemInfo.EServiceUsername, command.GovernmentSystemInfo.EServicePassword,
|
||||
command.GovernmentSystemInfo.TaxUsername, command.GovernmentSystemInfo.TaxPassword, command.GovernmentSystemInfo.SanaUsername, command.GovernmentSystemInfo.SanaPassword);
|
||||
|
||||
await _EmployerRepository.CreateAsync(legalEmployerData);
|
||||
await _EmployerRepository.SaveChangesAsync();
|
||||
|
||||
return opration.Succcedded();
|
||||
}
|
||||
|
||||
public async Task<OperationResult> EditReal(EditRealEmployer command)
|
||||
{
|
||||
var opration = new OperationResult();
|
||||
var employer = _EmployerRepository.Get(command.Id);
|
||||
if (employer == null)
|
||||
return opration.Failed("رکورد مورد نظر یافت نشد");
|
||||
|
||||
if (_EmployerRepository.Exists(x =>
|
||||
(x.FName == command.FName && x.LName == command.LName) && x.Nationalcode == command.NationalCode && x.id != command.Id))
|
||||
return opration.Failed("امکان ثبت رکورد تکراری وجود ندارد");
|
||||
if (!string.IsNullOrWhiteSpace(command.NationalCode))
|
||||
{
|
||||
if (command.NationalCode.NationalCodeValid() != "valid")
|
||||
{
|
||||
return opration.Failed("کد ملی وارد شده نا معتبر است");
|
||||
}
|
||||
}
|
||||
|
||||
if (_EmployerRepository.Exists(x => x.Nationalcode == command.NationalCode && !string.IsNullOrWhiteSpace(command.NationalCode) && x.id != command.Id))
|
||||
{
|
||||
|
||||
return opration.Failed(" کد ملی وارد شده تکراری است");
|
||||
}
|
||||
|
||||
|
||||
|
||||
string initial = "1300/10/11";
|
||||
|
||||
var dateOfBirth = command.DateOfBirth?.ToGeorgianDateTime() ?? initial.ToGeorgianDateTime();
|
||||
var dateOfIssue = command.DateOfIssue?.ToGeorgianDateTime() ?? initial.ToGeorgianDateTime();
|
||||
|
||||
var gender = command.Gender switch
|
||||
{
|
||||
Gender.Male => "مرد",
|
||||
Gender.Female => "زن",
|
||||
Gender.None => null,
|
||||
_ => throw new BadRequestException("جنسیت وارد شده نامعتبر است")
|
||||
};
|
||||
|
||||
employer.Edit(command.FName, command.LName, command.ContractingPartyId,
|
||||
gender, command.NationalCode, command.IdNumber, "ایرانی", command.FatherName,
|
||||
dateOfBirth, dateOfIssue, command.PlaceOfIssue, command.PhoneNumber, command.Telephone,
|
||||
command.GovernmentSystemInfo.MclUsername, command.GovernmentSystemInfo.MclPassword, command.GovernmentSystemInfo.EServiceUsername, command.GovernmentSystemInfo.EServicePassword,
|
||||
command.GovernmentSystemInfo.TaxUsername, command.GovernmentSystemInfo.TaxPassword, command.GovernmentSystemInfo.SanaUsername, command.GovernmentSystemInfo.SanaPassword, null);
|
||||
|
||||
await _EmployerRepository.SaveChangesAsync();
|
||||
return opration.Succcedded();
|
||||
}
|
||||
|
||||
public async Task<OperationResult> EditLegal(EditLegalEmployer command)
|
||||
{
|
||||
var opration = new OperationResult();
|
||||
var legalEmployer = _EmployerRepository.Get(command.Id);
|
||||
if (legalEmployer == null)
|
||||
return opration.Failed("رکورد مورد نظر یافت نشد");
|
||||
|
||||
if (_EmployerRepository.Exists(x =>
|
||||
x.LName == command.CompanyName && x.NationalId == command.NationalId && !string.IsNullOrWhiteSpace(command.NationalId) && x.id != command.Id))
|
||||
return opration.Failed("امکان ثبت رکورد تکراری وجود ندارد");
|
||||
|
||||
|
||||
if (!string.IsNullOrEmpty(command.NationalId) && command.NationalId.Length != 11)
|
||||
{
|
||||
return opration.Failed(" شناسه ملی باید 11 رقم باشد");
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(command.EmployerNationalCode))
|
||||
{
|
||||
if (command.EmployerNationalCode.NationalCodeValid() != "valid")
|
||||
{
|
||||
return opration.Failed("کد ملی وارد شده نا معتبر است");
|
||||
}
|
||||
}
|
||||
|
||||
var gender = command.EmployerGender switch
|
||||
{
|
||||
Gender.Male => "مرد",
|
||||
Gender.Female => "زن",
|
||||
Gender.None => null,
|
||||
_ => throw new BadRequestException("جنسیت وارد شده نامعتبر است")
|
||||
};
|
||||
|
||||
string initial = "1300/10/11";
|
||||
var dateOfBirth = command.EmployerDateOfBirth?.ToGeorgianDateTime() ?? initial.ToGeorgianDateTime();
|
||||
var dateOfIssue = command.EmployerDateOfIssue?.ToGeorgianDateTime() ?? initial.ToGeorgianDateTime();
|
||||
legalEmployer.EditLegal(command.EmployerFName, command.CompanyName, command.ContractingPartyId, gender,
|
||||
command.EmployerNationalCode, command.EmployerIdNumber, "ایرانی", command.EmployerFatherName, dateOfBirth,
|
||||
dateOfIssue, command.EmployerPlaceOfIssue, command.RegisterId, command.NationalId, command.EmployerLName,
|
||||
command.PhoneNumber, command.TelephoneNumber, command.GovernmentSystemInfo.MclUsername, command.GovernmentSystemInfo.MclUsername, command.GovernmentSystemInfo.EServiceUsername, command.GovernmentSystemInfo.EServicePassword,
|
||||
command.GovernmentSystemInfo.TaxUsername, command.GovernmentSystemInfo.TaxPassword, command.GovernmentSystemInfo.SanaUsername, command.GovernmentSystemInfo.SanaPassword, null);
|
||||
|
||||
await _EmployerRepository.SaveChangesAsync();
|
||||
return opration.Succcedded();
|
||||
}
|
||||
|
||||
//public async Task<List<EmployerSelectListViewModel>> GetSelectList(string search)
|
||||
//{
|
||||
// return await _EmployerRepository.GetSelectList(search);
|
||||
//}
|
||||
|
||||
async Task<OperationResult<string>> IEmployerApplication.RemoveApi(long id)
|
||||
{
|
||||
var employer = _EmployerRepository.Get(id);
|
||||
if (employer == null)
|
||||
throw new NotFoundException("دیتای مورد نظر یافت نشد");
|
||||
|
||||
var workshops = _workshopRepository.GetWorkshopsByEmployerId([id]);
|
||||
|
||||
if (workshops.Any())
|
||||
{
|
||||
return await _EmployerRepository.DeactivateWithSubordinates(id);
|
||||
}
|
||||
|
||||
_EmployerRepository.Remove(id);
|
||||
|
||||
return new OperationResult<string>().Succcedded("Deleted");
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
123
ServiceHost/Areas/Admin/Controllers/EmployerController.cs
Normal file
123
ServiceHost/Areas/Admin/Controllers/EmployerController.cs
Normal file
@@ -0,0 +1,123 @@
|
||||
using _0_Framework.Application;
|
||||
using CompanyManagment.App.Contracts.Employer;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ServiceHost.BaseControllers;
|
||||
|
||||
namespace ServiceHost.Areas.Admin.Controllers;
|
||||
|
||||
public class EmployerController : AdminController
|
||||
{
|
||||
private readonly IEmployerApplication _employerApplication;
|
||||
|
||||
public EmployerController(IEmployerApplication employerApplication)
|
||||
{
|
||||
_employerApplication = employerApplication;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// لیست کارفرما
|
||||
/// </summary>
|
||||
/// <param name="searchModel"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<ActionResult<List<GetEmployerListViewModel>>> GetList(GetEmployerSearchModel searchModel)
|
||||
{
|
||||
return await _employerApplication.GetEmployerList(searchModel);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// جزئیات کارفرمای حقوقی
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("legal/{id}")]
|
||||
public async Task<ActionResult<GetLegalEmployerDetailViewModel>> GetLegalEmployer(long id)
|
||||
{
|
||||
var employerDetail = await _employerApplication.GetLegalEmployerDetail(id);
|
||||
return employerDetail;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// جزئیات کارفرمای حقیقی
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("real/{id}")]
|
||||
public async Task<ActionResult<GetRealEmployerDetailViewModel>> GetRealEmployer(long id)
|
||||
{
|
||||
var employerDetail = await _employerApplication.GetRealEmployerDetail(id);
|
||||
return employerDetail;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ایجاد کارفرمای حقیقی
|
||||
/// </summary>
|
||||
/// <param name="command"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("real")]
|
||||
public async Task<ActionResult<OperationResult>> CreateRealEmployer([FromBody] CreateRealEmployer command)
|
||||
{
|
||||
var result = await _employerApplication.CreateReal(command);
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ایجاد کارفرما حقوقی
|
||||
/// </summary>
|
||||
/// <param name="command"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("legal")]
|
||||
public async Task<ActionResult<OperationResult>> CreateLegalEmployer([FromBody] CreateLegalEmployer command)
|
||||
{
|
||||
var result = await _employerApplication.CreateLegal(command);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ویرایش کارفرما حقیقی
|
||||
/// </summary>
|
||||
/// <param name="command"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPut("real")]
|
||||
public async Task<ActionResult<OperationResult>> EditRealEmployer([FromBody] EditRealEmployer command)
|
||||
{
|
||||
var result = await _employerApplication.EditReal(command);
|
||||
return result;
|
||||
}
|
||||
/// <summary>
|
||||
/// ویرایش کارفرما حقوقی
|
||||
/// </summary>
|
||||
/// <param name="command"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPut("legal")]
|
||||
public async Task<ActionResult<OperationResult>> EditLegalEmployer([FromBody] EditLegalEmployer command)
|
||||
{
|
||||
var result = await _employerApplication.EditLegal(command);
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// حذف کارفرما - درصورت داشتن کارگاه، کارفرما غیرفعال میشود
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpDelete("{id}")]
|
||||
public async Task<ActionResult<OperationResult<string>>> Remove(long id)
|
||||
{
|
||||
var result = await _employerApplication.RemoveApi(id);
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// سلکت لیست کارفرما برای جستجو
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("select_list")]
|
||||
public async Task<List<EmployerSelectListViewModel>> GetSelectList(string search)
|
||||
{
|
||||
return await _employerApplication.GetSelectList(search);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user