add entire teamwork api to original
This commit is contained in:
@@ -15,6 +15,8 @@
|
||||
<PackageReference Include="PersianTools.Core" Version="2.0.4" />
|
||||
<PackageReference Include="System.Drawing.Common" Version="9.0.0" />
|
||||
<PackageReference Include="MD.PersianDateTime.Standard" Version="2.5.0" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="7.2.0" />
|
||||
|
||||
|
||||
|
||||
</ItemGroup>
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
namespace _0_Framework.Application.Enums;
|
||||
|
||||
public enum Gender
|
||||
{
|
||||
None,
|
||||
Male,
|
||||
Female
|
||||
}
|
||||
76
0_Framework/Exceptions/Handler/CustomExceptionHandler.cs
Normal file
76
0_Framework/Exceptions/Handler/CustomExceptionHandler.cs
Normal file
@@ -0,0 +1,76 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Diagnostics;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
|
||||
namespace _0_Framework.Exceptions.Handler;
|
||||
|
||||
public class CustomExceptionHandler : IExceptionHandler
|
||||
{
|
||||
private readonly ILogger<CustomExceptionHandler> _logger;
|
||||
|
||||
public CustomExceptionHandler(ILogger<CustomExceptionHandler> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public async ValueTask<bool> TryHandleAsync(HttpContext context, Exception exception, CancellationToken cancellationToken)
|
||||
{
|
||||
_logger.LogError(
|
||||
"Error Message: {exceptionMessage}, Time of occurrence {time}",
|
||||
exception.Message, DateTime.UtcNow);
|
||||
|
||||
(string Detail, string Title, int StatusCode) details = exception switch
|
||||
{
|
||||
InternalServerException =>
|
||||
(
|
||||
exception.Message,
|
||||
exception.GetType().Name,
|
||||
context.Response.StatusCode = StatusCodes.Status500InternalServerError
|
||||
),
|
||||
BadRequestException =>
|
||||
(
|
||||
exception.Message,
|
||||
exception.GetType().Name,
|
||||
context.Response.StatusCode = StatusCodes.Status400BadRequest
|
||||
),
|
||||
NotFoundException =>
|
||||
(
|
||||
exception.Message,
|
||||
exception.GetType().Name,
|
||||
context.Response.StatusCode = StatusCodes.Status404NotFound
|
||||
),
|
||||
UnAuthorizeException =>
|
||||
(
|
||||
exception.Message,
|
||||
exception.GetType().Name,
|
||||
context.Response.StatusCode = StatusCodes.Status401Unauthorized
|
||||
),
|
||||
_ =>
|
||||
(
|
||||
exception.Message,
|
||||
exception.GetType().Name,
|
||||
context.Response.StatusCode = StatusCodes.Status500InternalServerError
|
||||
)
|
||||
};
|
||||
|
||||
var problemDetails = new ProblemDetails
|
||||
{
|
||||
Title = details.Title,
|
||||
Detail = details.Detail,
|
||||
Status = details.StatusCode,
|
||||
Instance = context.Request.Path
|
||||
};
|
||||
|
||||
problemDetails.Extensions.Add("traceId", context.TraceIdentifier);
|
||||
|
||||
|
||||
await context.Response.WriteAsJsonAsync(problemDetails, cancellationToken: cancellationToken);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
10
0_Framework/Exceptions/UnAuthorizeException.cs
Normal file
10
0_Framework/Exceptions/UnAuthorizeException.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using System;
|
||||
|
||||
namespace _0_Framework.Exceptions;
|
||||
|
||||
public class UnAuthorizeException:Exception
|
||||
{
|
||||
public UnAuthorizeException(string message) : base(message)
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -71,7 +71,12 @@ public interface IEmployeeRepository : IRepository<long, Employee>
|
||||
Task<GetEditEmployeeInEmployeeDocumentViewModel> GetEmployeeEditInEmployeeDocumentWorkFlow(long employeeId,
|
||||
long workshopId);
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region Api
|
||||
Task<List<EmployeeSelectListViewModel>> GetSelectList(string searchText);
|
||||
Task<List<GetEmployeeListViewModel>> GetList(GetEmployeeListSearchModel searchModel);
|
||||
#endregion
|
||||
|
||||
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Domain;
|
||||
using CompanyManagment.App.Contracts.PersonalContractingParty;
|
||||
@@ -20,4 +21,10 @@ public interface IRepresentativeRepository : IRepository<long, Representative>
|
||||
|
||||
#endregion
|
||||
|
||||
#region Api
|
||||
Task<ICollection<RepresentativeGetListViewModel>> GetList(RepresentativeGetListSearchModel searchModel);
|
||||
bool HasAnyContractingParty(long id);
|
||||
Task<List<GetSelectListRepresentativeViewModel>> GetSelectList();
|
||||
#endregion
|
||||
|
||||
}
|
||||
@@ -56,6 +56,17 @@ 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
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,17 +1,22 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="PersianTools.Core" Version="2.0.4" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="PersianTools.Core" Version="2.0.4" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\0_Framework\0_Framework.csproj" />
|
||||
<ProjectReference Include="..\AccountManagement.Application.Contracts\AccountManagement.Application.Contracts.csproj" />
|
||||
<ProjectReference Include="..\_0_Framework\_0_Framework_b.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\0_Framework\0_Framework.csproj" />
|
||||
<ProjectReference Include="..\AccountManagement.Application.Contracts\AccountManagement.Application.Contracts.csproj" />
|
||||
<ProjectReference Include="..\_0_Framework\_0_Framework_b.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="CopyDocs" AfterTargets="Build">
|
||||
<Copy SourceFiles="$(OutputPath)CompanyManagment.App.Contracts.xml" DestinationFolder="../ServiceHost\bin\Debug\net8.0\" />
|
||||
</Target>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
using _0_Framework.Application.Enums;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.Employee;
|
||||
|
||||
/// <summary>
|
||||
/// مدل جستجو در لیست پرسنل در ادمین
|
||||
/// </summary>
|
||||
public class GetEmployeeListSearchModel
|
||||
{
|
||||
/// <summary>
|
||||
/// آیدی کارفرما
|
||||
/// </summary>
|
||||
public long EmployerId { get; set; }
|
||||
/// <summary>
|
||||
/// آیدی کارگاه
|
||||
/// </summary>
|
||||
public long WorkshopId { get; set; }
|
||||
/// <summary>
|
||||
/// آیدی پرسنل
|
||||
/// </summary>
|
||||
public long EmployeeId { get; set; }
|
||||
/// <summary>
|
||||
/// کدملی
|
||||
/// </summary>
|
||||
public string NationalCode { get; set; }
|
||||
/// <summary>
|
||||
/// شماره بیمه
|
||||
/// </summary>
|
||||
public string InsuranceCode { get; set; }
|
||||
/// <summary>
|
||||
/// وضعیت پرسنل
|
||||
/// </summary>
|
||||
public ActivationStatus EmployeeStatus { get; set; }
|
||||
/// <summary>
|
||||
/// ایندکس جستجو
|
||||
/// </summary>
|
||||
public int PageIndex { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Application.Enums;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.Employee;
|
||||
|
||||
/// <summary>
|
||||
/// ویو مدل لیست پرسنل ادمین
|
||||
/// </summary>
|
||||
public class GetEmployeeListViewModel
|
||||
{
|
||||
/// <summary>
|
||||
/// آیدی پرسنل
|
||||
/// </summary>
|
||||
public long Id { get; set; }
|
||||
/// <summary>
|
||||
/// نام و نام خانوادگی پرسنل
|
||||
/// </summary>
|
||||
public string EmployeeFullName { get; set; }
|
||||
/// <summary>
|
||||
/// کدملی
|
||||
/// </summary>
|
||||
public string NationalCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// تعداد فرزندان
|
||||
/// </summary>
|
||||
public string ChildrenCount { get; set; }
|
||||
/// <summary>
|
||||
/// جنسیت
|
||||
/// </summary>
|
||||
public Gender Gender { get; set; }
|
||||
/// <summary>
|
||||
/// تاریخ تولد
|
||||
/// </summary>
|
||||
public string BirthDate { get; set; }
|
||||
/// <summary>
|
||||
/// شماره بیمه
|
||||
/// </summary>
|
||||
public string InsuranceCode { get; set; }
|
||||
/// <summary>
|
||||
/// وضعیت پرسنل
|
||||
/// </summary>
|
||||
public ActivationStatus EmployeeStatus { get; set; }
|
||||
}
|
||||
@@ -77,6 +77,23 @@ public interface IEmployeeApplication
|
||||
|
||||
Task<OperationResult<EmployeeDataFromApiViewModel>> GetEmployeeDataFromApi(string nationalCode, string birthDate);
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region Api
|
||||
|
||||
/// <summary>
|
||||
/// لیست پرسنل برای جستجو
|
||||
/// </summary>
|
||||
/// <param name="searchText"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<EmployeeSelectListViewModel>> GetSelectList(string searchText);
|
||||
|
||||
/// <summary>
|
||||
/// لیست کل پرسنل
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<List<GetEmployeeListViewModel>> GetList(GetEmployeeListSearchModel searchModel);
|
||||
|
||||
#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
|
||||
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
using System.Threading.Tasks;
|
||||
using _0_Framework.Application;
|
||||
using CompanyManagment.App.Contracts.Checkout;
|
||||
using CompanyManagment.App.Contracts.Employee;
|
||||
|
||||
|
||||
namespace CompanyManagment.App.Contracts.Employer;
|
||||
@@ -19,7 +20,7 @@ public interface IEmployerApplication
|
||||
|
||||
OperationResult Active(long id);
|
||||
OperationResult DeActive(long id);
|
||||
OperationResult Remove(long id);
|
||||
OperationResult Remove_Old(long id);
|
||||
|
||||
List<EmployerViewModel> GetEmployers();
|
||||
List<EmployerViewModel> Search(EmployerSearchModel searchModel);
|
||||
@@ -36,7 +37,13 @@ public interface IEmployerApplication
|
||||
#region Mahan
|
||||
|
||||
List<EmployerViewModel> GetEmployersHasWorkshop();
|
||||
Task<List<EmployerSelectListViewModel>> GetSelectList(string search);
|
||||
|
||||
/// <summary>
|
||||
/// لیست نام کارفرما ها برای جستجو
|
||||
/// </summary>
|
||||
/// <param name="search"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<EmployerSelectListViewModel>> GetSelectList(string search);
|
||||
|
||||
#endregion
|
||||
#region NewByHeydari
|
||||
@@ -53,6 +60,68 @@ public interface IEmployerApplication
|
||||
|
||||
(string employerName, bool isLegal) InsuranceEmployerByWorkshopId(long workshopId);
|
||||
|
||||
|
||||
|
||||
#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="id"></param>
|
||||
/// <returns></returns>
|
||||
public Task<OperationResult<string>> Remove(long id);
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.Representative;
|
||||
|
||||
public class CreateLegalRepresentative
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// نام حقوقی
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "این مقدار نمی تواند خالی باشد")]
|
||||
public string LegalName { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// شناسه ثبت
|
||||
/// </summary>
|
||||
[RegularExpression("^[0-9]*$", ErrorMessage = "لطفا فقط عدد وارد کنید")]
|
||||
public string RegisterId { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// شناسه ملی
|
||||
/// </summary>
|
||||
[RegularExpression("[0-9]{11}", ErrorMessage = "لطفا فقط عدد 11 رقمی وارد کنید")]
|
||||
public string NationalId { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// شماره تلفن
|
||||
/// </summary>
|
||||
[DataType(DataType.PhoneNumber)]
|
||||
[RegularExpression(@"^\(?([0-9]{4})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$", ErrorMessage = "لطفا شماره تلفن معتبر وارد کنید")]
|
||||
public string Phone { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// شماره تلفن نماینده
|
||||
/// </summary>
|
||||
[RegularExpression("^[0-9]*$", ErrorMessage = "لطفا فقط عدد وارد کنید")]
|
||||
public string AgentPhone { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// آدرس
|
||||
/// </summary>
|
||||
public string Address { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.Representative;
|
||||
|
||||
public class CreateRealRepresentative
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// نام کوچک
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "این مقدار نمی تواند خالی باشد")]
|
||||
public string FName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نام خانوادگی
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "این مقدار نمی تواند خالی باشد")]
|
||||
public string LName { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// کد ملی
|
||||
/// </summary>
|
||||
[RegularExpression("^[0-9]*$", ErrorMessage = "لطفا فقط عدد وارد کنید")]
|
||||
public string Nationalcode { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// شماره شناسنامه
|
||||
/// </summary>
|
||||
[MaxLength(12)]
|
||||
[MinLength(1)]
|
||||
[RegularExpression("^[0-9]*$", ErrorMessage = "لطفا فقط عدد وارد کنید")]
|
||||
public string IdNumber { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// شماره تلفن
|
||||
/// </summary>
|
||||
[DataType(DataType.PhoneNumber)]
|
||||
[RegularExpression(@"^\(?([0-9]{4})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$", ErrorMessage = "لطفا شماره تلفن معتبر وارد کنید")]
|
||||
public string Phone { get; set; }
|
||||
|
||||
|
||||
[RegularExpression("^[0-9]*$", ErrorMessage = "لطفا فقط عدد وارد کنید")]
|
||||
public string AgentPhone { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// آدرس
|
||||
/// </summary>
|
||||
public string Address { get; set; }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace CompanyManagment.App.Contracts.Representative;
|
||||
|
||||
public class EditLegalRepresentative : CreateLegalRepresentative
|
||||
{
|
||||
public long Id { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace CompanyManagment.App.Contracts.Representative;
|
||||
|
||||
public class EditRealRepresentative : CreateRealRepresentative
|
||||
{
|
||||
public long Id { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
namespace CompanyManagment.App.Contracts.Representative;
|
||||
|
||||
/// <summary>
|
||||
/// ویو مدل سلکت لیست برای معرف
|
||||
/// </summary>
|
||||
public class GetSelectListRepresentativeViewModel
|
||||
{
|
||||
/// <summary>
|
||||
/// آیدی
|
||||
/// </summary>
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نام معرف
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
}
|
||||
@@ -24,8 +24,27 @@ public interface IRepresentativeApplication
|
||||
OperationResult DeleteRepresentative(long id);
|
||||
OperationResult Active(long id);
|
||||
OperationResult DeActive(long id);
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region Api
|
||||
|
||||
Task<List<RepresentativeGetListViewModel>> GetList(RepresentativeGetListSearchModel searchModel);
|
||||
|
||||
bool HasAnyContractingParty(long id);
|
||||
|
||||
|
||||
OperationResult CreateReal(CreateRealRepresentative command);
|
||||
OperationResult CreateLegal(CreateLegalRepresentative command);
|
||||
OperationResult EditReal(EditRealRepresentative command);
|
||||
OperationResult EditLegal(EditLegalRepresentative command);
|
||||
|
||||
/// <summary>
|
||||
/// لیست نام های معرف برای سلکت لیست
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<List<GetSelectListRepresentativeViewModel>> GetSelectList();
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
using _0_Framework.Application.Enums;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.Representative;
|
||||
|
||||
public class RepresentativeGetListSearchModel
|
||||
{
|
||||
|
||||
public int PageIndex { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نام شرکت یا نام و نام خانوادگی
|
||||
/// </summary>
|
||||
public string CompanyNameOrFullName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// شناسه ملی یا کدملی
|
||||
/// </summary>
|
||||
public string NationalCodeOrNationalId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// شماره شناسنامه
|
||||
/// </summary>
|
||||
public string IdNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// آیدی طرف حساب
|
||||
/// </summary>
|
||||
public long ContractingPartyId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نوع معرف
|
||||
/// </summary>
|
||||
public LegalType RepresentativeType { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// وضعیت معرف
|
||||
/// </summary>
|
||||
public ActivationStatus RepresentativeStatus { get; set; }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
using _0_Framework.Application.Enums;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.Representative;
|
||||
|
||||
public class RepresentativeGetListViewModel
|
||||
{
|
||||
/// <summary>
|
||||
/// آیدی معرف
|
||||
/// </summary>
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// نام حقیقی یا نام حقوقی
|
||||
/// </summary>
|
||||
public string RealNameOrLegalName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// کدملی یا شناسه ملی
|
||||
/// </summary>
|
||||
public string NationalIdOrNationalCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// آیا این معرف طرف حسابی دارد؟
|
||||
/// </summary>
|
||||
public bool HasAnyContractingParty { get; set; }
|
||||
|
||||
public ActivationStatus RepresentativeStatus { get; set; }
|
||||
public LegalType RepresentativeType { get; set; }
|
||||
}
|
||||
@@ -1660,5 +1660,19 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region Api
|
||||
|
||||
public async Task<List<EmployeeSelectListViewModel>> GetSelectList(string searchText)
|
||||
{
|
||||
return await _EmployeeRepository.GetSelectList(searchText);
|
||||
}
|
||||
|
||||
public async Task<List<GetEmployeeListViewModel>> GetList(GetEmployeeListSearchModel searchModel)
|
||||
{
|
||||
return await _EmployeeRepository.GetList(searchModel);
|
||||
}
|
||||
|
||||
#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;
|
||||
@@ -239,7 +240,7 @@ public class EmployerApplication : IEmployerApplication
|
||||
return opration.Succcedded();
|
||||
}
|
||||
|
||||
public OperationResult Remove(long id)
|
||||
public OperationResult Remove_Old(long id)
|
||||
{
|
||||
var opration = new OperationResult();
|
||||
|
||||
@@ -894,10 +895,10 @@ public class EmployerApplication : IEmployerApplication
|
||||
return _EmployerRepository.GetEmployersHasWorkshop();
|
||||
}
|
||||
|
||||
public async Task<List<EmployerSelectListViewModel>> GetSelectList(string search)
|
||||
{
|
||||
return await _EmployerRepository.GetSelectList(search);
|
||||
}
|
||||
//public async Task<List<EmployerSelectListViewModel>> GetSelectList(string search)
|
||||
//{
|
||||
// return await _EmployerRepository.GetSelectList(search);
|
||||
//}
|
||||
#endregion
|
||||
|
||||
#region NewByHeydari
|
||||
@@ -957,4 +958,255 @@ 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.Remove(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
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using _0_Framework.Application;
|
||||
using Company.Domain.RepresentativeAgg;
|
||||
using CompanyManagment.App.Contracts.PersonalContractingParty;
|
||||
@@ -350,5 +352,290 @@ public class RepresentativeApplication : IRepresentativeApplication
|
||||
_representativeRepository.SaveChanges();
|
||||
return opration.Succcedded();
|
||||
}
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region Api
|
||||
public OperationResult CreateReal(CreateRealRepresentative command)
|
||||
{
|
||||
var nationalCode = string.Empty;
|
||||
var op = new OperationResult();
|
||||
if (_representativeRepository.Exists(x =>
|
||||
x.LName == command.LName && x.Nationalcode == command.Nationalcode))
|
||||
return op.Failed("امکان ثبت رکورد تکراری وجود ندارد");
|
||||
if (_representativeRepository.Exists(x => x.LName == command.LName))
|
||||
{
|
||||
|
||||
|
||||
return op.Failed("نام خانوادگی وارد شده تکراری است");
|
||||
|
||||
}
|
||||
if (_representativeRepository.Exists(x => x.Nationalcode == command.Nationalcode))
|
||||
{
|
||||
|
||||
|
||||
return op.Failed("کد ملی وارد شده تکراری است");
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(command.Nationalcode))
|
||||
{
|
||||
if (_representativeRepository.Exists(x => x.Nationalcode == command.Nationalcode))
|
||||
{
|
||||
|
||||
|
||||
return op.Failed("کد ملی وارد شده تکراری است");
|
||||
}
|
||||
try
|
||||
{
|
||||
|
||||
|
||||
char[] chArray = command.Nationalcode.ToCharArray();
|
||||
int[] numArray = new int[chArray.Length];
|
||||
var cunt = chArray.Length;
|
||||
for (int i = 0; i < chArray.Length; i++)
|
||||
{
|
||||
numArray[i] = (int)char.GetNumericValue(chArray[i]);
|
||||
}
|
||||
|
||||
int num2 = numArray[9];
|
||||
switch (command.Nationalcode)
|
||||
{
|
||||
case "0000000000":
|
||||
case "1111111111":
|
||||
case "22222222222":
|
||||
case "33333333333":
|
||||
case "4444444444":
|
||||
case "5555555555":
|
||||
case "6666666666":
|
||||
case "7777777777":
|
||||
case "8888888888":
|
||||
case "9999999999":
|
||||
|
||||
|
||||
|
||||
|
||||
return op.Failed("کد ملی وارد شده صحیح نمی باشد");
|
||||
|
||||
|
||||
}
|
||||
|
||||
int num3 =
|
||||
((((((((numArray[0] * 10) + (numArray[1] * 9)) + (numArray[2] * 8)) + (numArray[3] * 7)) +
|
||||
(numArray[4] * 6)) + (numArray[5] * 5)) + (numArray[6] * 4)) + (numArray[7] * 3)) +
|
||||
(numArray[8] * 2);
|
||||
int num4 = num3 - ((num3 / 11) * 11);
|
||||
if ((((num4 == 0) && (num2 == num4)) || ((num4 == 1) && (num2 == 1))) ||
|
||||
((num4 > 1) && (num2 == Math.Abs((int)(num4 - 11)))) && cunt <= 10)
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
nationalCode = command.Nationalcode;
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
return op.Failed("کد ملی وارد شده نا معتبر است");
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
return op.Failed("لطفا کد ملی 10 رقمی وارد کنید");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
nationalCode = "";
|
||||
}
|
||||
|
||||
var createReal = new Representative(command.FName, command.LName, "*",
|
||||
nationalCode, command.IdNumber, "*", "*",
|
||||
"false", command.Phone, command.AgentPhone, command.Address
|
||||
);
|
||||
|
||||
|
||||
_representativeRepository.Create(createReal);
|
||||
_representativeRepository.SaveChanges();
|
||||
|
||||
return op.Succcedded();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public OperationResult CreateLegal(CreateLegalRepresentative command)
|
||||
|
||||
{
|
||||
var op = new OperationResult();
|
||||
if (_representativeRepository.Exists(x =>
|
||||
x.LegalName == command.LegalName && x.RegisterId == command.RegisterId))
|
||||
return op.Failed("امکان ثبت رکورد تکراری وجود ندارد");
|
||||
if (_representativeRepository.Exists(x => x.LegalName == command.LegalName))
|
||||
{
|
||||
legalNameIsOk = false;
|
||||
return op.Failed("نام شرکت وارد شده تکراری است");
|
||||
}
|
||||
if (_representativeRepository.Exists(x => x.RegisterId == command.RegisterId))
|
||||
{
|
||||
|
||||
return op.Failed("شماره ثبت وارد شده تکراری است");
|
||||
|
||||
}
|
||||
if (_representativeRepository.Exists(x => x.NationalId == command.NationalId))
|
||||
{
|
||||
|
||||
return op.Failed("شناسه ملی وارد شده تکراری است");
|
||||
}
|
||||
var createLegal = new Representative("*", "*",
|
||||
command.LegalName, "*", "*", command.RegisterId, command.NationalId,
|
||||
"true",
|
||||
command.Phone, command.AgentPhone, command.Address);
|
||||
|
||||
|
||||
_representativeRepository.Create(createLegal);
|
||||
_representativeRepository.SaveChanges();
|
||||
|
||||
return op.Succcedded();
|
||||
|
||||
|
||||
}
|
||||
|
||||
public OperationResult EditReal(EditRealRepresentative command)
|
||||
{
|
||||
var nationalCode = string.Empty;
|
||||
var opration = new OperationResult();
|
||||
var representativeRealEdit = _representativeRepository.Get(command.Id);
|
||||
if (representativeRealEdit == null)
|
||||
return opration.Failed("رکورد مورد نظر یافت نشد");
|
||||
|
||||
if (_representativeRepository.Exists(x =>
|
||||
x.LName == command.LName && x.FName == command.FName && x.id != command.Id))
|
||||
return opration.Failed("امکان ثبت رکورد تکراری وجود ندارد");
|
||||
if (!string.IsNullOrWhiteSpace(command.Nationalcode))
|
||||
{
|
||||
if (_representativeRepository.Exists(x => x.Nationalcode == command.Nationalcode && x.id != command.Id))
|
||||
{
|
||||
|
||||
|
||||
return opration.Failed("کد ملی وارد شده تکراری است");
|
||||
}
|
||||
try
|
||||
{
|
||||
|
||||
|
||||
char[] chArray = command.Nationalcode.ToCharArray();
|
||||
int[] numArray = new int[chArray.Length];
|
||||
var cunt = chArray.Length;
|
||||
for (int i = 0; i < chArray.Length; i++)
|
||||
{
|
||||
numArray[i] = (int)char.GetNumericValue(chArray[i]);
|
||||
}
|
||||
|
||||
int num2 = numArray[9];
|
||||
switch (command.Nationalcode)
|
||||
{
|
||||
case "0000000000":
|
||||
case "1111111111":
|
||||
case "22222222222":
|
||||
case "33333333333":
|
||||
case "4444444444":
|
||||
case "5555555555":
|
||||
case "6666666666":
|
||||
case "7777777777":
|
||||
case "8888888888":
|
||||
case "9999999999":
|
||||
|
||||
|
||||
|
||||
|
||||
return opration.Failed("کد ملی وارد شده صحیح نمی باشد");
|
||||
|
||||
|
||||
}
|
||||
|
||||
int num3 =
|
||||
((((((((numArray[0] * 10) + (numArray[1] * 9)) + (numArray[2] * 8)) + (numArray[3] * 7)) +
|
||||
(numArray[4] * 6)) + (numArray[5] * 5)) + (numArray[6] * 4)) + (numArray[7] * 3)) +
|
||||
(numArray[8] * 2);
|
||||
int num4 = num3 - ((num3 / 11) * 11);
|
||||
if ((((num4 == 0) && (num2 == num4)) || ((num4 == 1) && (num2 == 1))) ||
|
||||
((num4 > 1) && (num2 == Math.Abs((int)(num4 - 11)))) && cunt <= 10)
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
nationalCode = command.Nationalcode;
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
return opration.Failed("کد ملی وارد شده نا معتبر است");
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
return opration.Failed("لطفا کد ملی 10 رقمی وارد کنید");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
nationalCode = "";
|
||||
}
|
||||
|
||||
representativeRealEdit.EditReal(command.FName, command.LName,
|
||||
nationalCode, command.IdNumber,
|
||||
command.Phone, command.AgentPhone, command.Address);
|
||||
|
||||
_representativeRepository.SaveChanges();
|
||||
return opration.Succcedded();
|
||||
|
||||
}
|
||||
public OperationResult EditLegal(EditLegalRepresentative command)
|
||||
{
|
||||
var opration = new OperationResult();
|
||||
var representativeLegalEdit = _representativeRepository.Get(command.Id);
|
||||
if (representativeLegalEdit == null)
|
||||
return opration.Failed("رکورد مورد نظر یافت نشد");
|
||||
|
||||
if (_representativeRepository.Exists(x =>
|
||||
x.LegalName == command.LegalName && x.RegisterId == command.RegisterId && x.id != command.Id))
|
||||
return opration.Failed("امکان ثبت رکورد تکراری وجود ندارد");
|
||||
|
||||
representativeLegalEdit.EditLegal(command.LegalName, command.RegisterId,
|
||||
command.NationalId,
|
||||
command.Phone, command.AgentPhone, command.Address);
|
||||
|
||||
_representativeRepository.SaveChanges();
|
||||
return opration.Succcedded();
|
||||
}
|
||||
|
||||
public async Task<List<GetSelectListRepresentativeViewModel>> GetSelectList()
|
||||
{
|
||||
return await _representativeRepository.GetSelectList();
|
||||
}
|
||||
|
||||
public async Task<List<RepresentativeGetListViewModel>> GetList(RepresentativeGetListSearchModel searchModel)
|
||||
{
|
||||
return (await _representativeRepository.GetList(searchModel)).ToList();
|
||||
}
|
||||
|
||||
public bool HasAnyContractingParty(long id)
|
||||
{
|
||||
return _representativeRepository.HasAnyContractingParty(id);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -16,6 +16,8 @@ using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using CompanyManagment.App.Contracts.Employee.DTO;
|
||||
using CompanyManagment.App.Contracts.LeftWorkTemp;
|
||||
using _0_Framework.Application.Enums;
|
||||
using _0_Framework.Exceptions;
|
||||
|
||||
namespace CompanyManagment.EFCore.Repository;
|
||||
|
||||
@@ -944,5 +946,108 @@ public class EmployeeRepository : RepositoryBase<long, Employee>, IEmployeeRepos
|
||||
}).ToList();
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region Api
|
||||
|
||||
public async Task<List<EmployeeSelectListViewModel>> GetSelectList(string searchText)
|
||||
{
|
||||
var query = _context.Employees.AsQueryable();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(searchText))
|
||||
{
|
||||
query = query.Where(x => (x.FName + " " + x.LName).Contains(searchText));
|
||||
}
|
||||
|
||||
return await query.Take(100).Select(x => new EmployeeSelectListViewModel()
|
||||
{
|
||||
Id = x.id,
|
||||
EmployeeFullName = x.FName + " " + x.LName
|
||||
}).ToListAsync();
|
||||
|
||||
}
|
||||
|
||||
public async Task<List<GetEmployeeListViewModel>> GetList(GetEmployeeListSearchModel searchModel)
|
||||
{
|
||||
var query = _context.Employees.Include(x => x.LeftWorks).Include(x => x.LeftWorkInsurances).AsQueryable();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(searchModel.NationalCode))
|
||||
{
|
||||
query = query.Where(x => x.NationalCode.Contains(searchModel.NationalCode));
|
||||
}
|
||||
|
||||
if (searchModel.EmployeeId > 0)
|
||||
{
|
||||
query = query.Where(x => x.id == searchModel.EmployeeId);
|
||||
}
|
||||
|
||||
if (searchModel.WorkshopId > 0)
|
||||
{
|
||||
query = query.Where(x => x.LeftWorks.Any(l => l.WorkshopId == searchModel.WorkshopId) || x.LeftWorkInsurances.Any(l => l.WorkshopId == searchModel.WorkshopId));
|
||||
}
|
||||
|
||||
|
||||
#region employer
|
||||
|
||||
if (searchModel.EmployerId > 0)
|
||||
{
|
||||
|
||||
var workshopIdsByEmployer = _context.WorkshopEmployers.Where(x => x.EmployerId == searchModel.EmployerId)
|
||||
.Include(x => x.Workshop).Select(x => x.Workshop.id).AsQueryable();
|
||||
|
||||
query = query.Where(x =>
|
||||
x.LeftWorks.Any(l => workshopIdsByEmployer.Contains(l.WorkshopId)) ||
|
||||
x.LeftWorkInsurances.Any(l => workshopIdsByEmployer.Contains(l.WorkshopId)));
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
if (!string.IsNullOrEmpty(searchModel.InsuranceCode))
|
||||
{
|
||||
query = query.Where(x => x.InsuranceCode.Contains(searchModel.InsuranceCode));
|
||||
}
|
||||
|
||||
if (searchModel.EmployeeStatus != ActivationStatus.None)
|
||||
{
|
||||
var status = searchModel.EmployeeStatus switch
|
||||
{
|
||||
ActivationStatus.Active => true,
|
||||
ActivationStatus.DeActive => false,
|
||||
_ => throw new BadRequestException("پارامتر جستجو نامعتبر است")
|
||||
};
|
||||
query = query.Where(x => x.IsActiveString == status.ToString() || x.IsActive == status);
|
||||
}
|
||||
|
||||
var list = await query.Skip(searchModel.PageIndex).Take(30).ToListAsync();
|
||||
|
||||
var employeeIds = list.Select(x => x.id);
|
||||
|
||||
var children = await _context.EmployeeChildrenSet.Where(x => employeeIds.Contains(x.EmployeeId)).ToListAsync();
|
||||
|
||||
var result = list.Select(x => new GetEmployeeListViewModel()
|
||||
{
|
||||
BirthDate = x.DateOfBirth.ToFarsi(),
|
||||
ChildrenCount = children.Count(c => c.EmployeeId == x.id).ToString(),
|
||||
EmployeeFullName = x.FullName,
|
||||
EmployeeStatus = x.IsActive switch
|
||||
{
|
||||
true => ActivationStatus.Active,
|
||||
false => ActivationStatus.DeActive
|
||||
},
|
||||
Gender = x.Gender switch
|
||||
{
|
||||
"مرد" => Gender.Male,
|
||||
"زن" => Gender.Female,
|
||||
_ => Gender.None
|
||||
},
|
||||
Id = x.id,
|
||||
InsuranceCode = x.InsuranceCode,
|
||||
NationalCode = x.NationalCode
|
||||
}).ToList();
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Application.Enums;
|
||||
using _0_Framework.InfraStructure;
|
||||
using Company.Domain.EmployerAccountAgg;
|
||||
using Company.Domain.empolyerAgg;
|
||||
@@ -786,4 +787,213 @@ public class EmployerRepository : RepositoryBase<long, Employer>, IEmployerRepos
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Api
|
||||
public async Task<List<GetEmployerListViewModel>> GetEmployerList(GetEmployerSearchModel searchModel)
|
||||
{
|
||||
var query = _context.Employers.Include(x => x.ContractingParty).Include(x => x.WorkshopEmployers).ThenInclude(x => x.Workshop).AsQueryable();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(searchModel.FullNameOrCompanyName))
|
||||
query = query.Where(x => x.FullName.Contains(searchModel.FullNameOrCompanyName));
|
||||
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(searchModel.NationalCodeOrNationalId))
|
||||
query = query.Where(x => x.Nationalcode.Contains(searchModel.NationalCodeOrNationalId) || x.NationalId.Contains(searchModel.NationalCodeOrNationalId));
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(searchModel.IdNumberOrRegisterId))
|
||||
query = query.Where(x => x.IdNumber.Contains(searchModel.IdNumberOrRegisterId) || x.RegisterId.Contains(searchModel.IdNumberOrRegisterId));
|
||||
|
||||
|
||||
if (searchModel.EmployerType != LegalType.None)
|
||||
{
|
||||
var type = searchModel.EmployerType switch
|
||||
{
|
||||
LegalType.Legal => "true",
|
||||
LegalType.Real => "false",
|
||||
_ => "",
|
||||
};
|
||||
|
||||
query = query.Where(x => x.IsLegal == type);
|
||||
}
|
||||
|
||||
if (searchModel.EmployerStatus != ActivationStatus.None)
|
||||
{
|
||||
var status = searchModel.EmployerStatus switch
|
||||
{
|
||||
ActivationStatus.Active => true,
|
||||
ActivationStatus.DeActive => false,
|
||||
_ => false
|
||||
};
|
||||
query = query.Where(x => x.IsActive == status);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(searchModel.ContractingPartyName))
|
||||
{
|
||||
query = query.Where(x =>
|
||||
x.ContractingParty.IsLegal == "true"
|
||||
? (x.ContractingParty.LName).Contains(searchModel.ContractingPartyName)
|
||||
: (x.ContractingParty.FName + " " + x.ContractingParty.LName).Contains(searchModel
|
||||
.ContractingPartyName));
|
||||
}
|
||||
|
||||
var employerList = await query.Select(x => new GetEmployerListViewModel()
|
||||
{
|
||||
Id = x.id,
|
||||
FullName = x.FullName,
|
||||
HasContractingParty = x.ContractingPartyId == 30428 && x.WorkshopEmployers.Any(),
|
||||
HasBlockContractingParty = x.ContractingParty.IsBlock == "true",
|
||||
NationalCodeOrNationalId = x.IsLegal == "true" ? x.NationalId : x.Nationalcode,
|
||||
WorkshopNames = x.WorkshopEmployers.Select(w => w.Workshop.WorkshopFullName).ToList(),
|
||||
LegalType = x.IsLegal == "حقیقی" ? LegalType.Real : LegalType.Legal,
|
||||
EmployerStatus = x.IsActive ? ActivationStatus.Active : ActivationStatus.DeActive,
|
||||
|
||||
}).Skip(searchModel.PageIndex).Take(30).ToListAsync();
|
||||
return employerList;
|
||||
}
|
||||
|
||||
public async Task<GetLegalEmployerDetailViewModel> GetLegalEmployerDetail(long id)
|
||||
{
|
||||
var employer = await _context.Employers.Where(x => x.IsLegal == "حقوقی").Include(x => x.ContractingParty).Select(x =>
|
||||
new GetLegalEmployerDetailViewModel()
|
||||
{
|
||||
Id = x.id,
|
||||
CompanyName = x.LName,
|
||||
ContractingPartyName = x.ContractingParty.FName + " " + x.ContractingParty.LName,
|
||||
DateOfBirth = x.DateOfBirth.ToFarsi(),
|
||||
DateOfIssue = x.DateOfIssue.ToFarsi(),
|
||||
CeoFullName = x.FName + " " + x.EmployerLName,
|
||||
EmployerNo = x.EmployerNo,
|
||||
FatherName = x.FatherName,
|
||||
GenderStr = x.Gender,
|
||||
Gender = string.IsNullOrWhiteSpace(x.Gender) ? Gender.None :
|
||||
x.Gender == "مرد" ?
|
||||
Gender.Male :
|
||||
Gender.Female,
|
||||
NationalCode = x.Nationalcode,
|
||||
IdNumber = x.IdNumber,
|
||||
NationalId = x.NationalId,
|
||||
Nationality = x.Nationality,
|
||||
PhoneNumber = x.Phone,
|
||||
PlaceOfIssue = x.PlaceOfIssue,
|
||||
RegisterId = x.RegisterId,
|
||||
TelephoneNumber = x.AgentPhone,
|
||||
CeoFName = x.FName,
|
||||
CeoLName = x.EmployerLName,
|
||||
GovernmentSystemInfo = new GovernmentSystemInfo
|
||||
{
|
||||
EServicePassword = x.EservicePassword,
|
||||
EServiceUsername = x.EservicePassword,
|
||||
MclPassword = x.MclsPassword,
|
||||
MclUsername = x.MclsUserName,
|
||||
SanaUsername = x.SanaUserName,
|
||||
SanaPassword = x.SanaPassword,
|
||||
TaxUsername = x.TaxOfficeUserName,
|
||||
TaxPassword = x.TaxOfficepassword
|
||||
},
|
||||
ContractingPartyId = x.ContractingPartyId
|
||||
}).FirstOrDefaultAsync(x => x.Id == id);
|
||||
|
||||
return employer;
|
||||
}
|
||||
|
||||
public async Task<GetRealEmployerDetailViewModel> GetRealEmployerDetail(long id)
|
||||
{
|
||||
var employer = await _context.Employers.Where(x => x.IsLegal == "حقیقی").Include(x => x.ContractingParty).Select(x =>
|
||||
new GetRealEmployerDetailViewModel()
|
||||
{
|
||||
Id = x.id,
|
||||
ContractingPartyName = x.ContractingParty.FName + " " + x.ContractingParty.LName,
|
||||
DateOfBirth = x.DateOfBirth.ToFarsi(),
|
||||
DateOfIssue = x.DateOfIssue.ToFarsi(),
|
||||
EmployerNo = x.EmployerNo,
|
||||
FatherName = x.FatherName,
|
||||
GenderStr = x.Gender,
|
||||
Gender = string.IsNullOrWhiteSpace(x.Gender) ? Gender.None :
|
||||
x.Gender == "مرد" ?
|
||||
Gender.Male :
|
||||
Gender.Female,
|
||||
NationalCode = x.Nationalcode,
|
||||
IdNumber = x.IdNumber,
|
||||
Nationality = x.Nationality,
|
||||
PhoneNumber = x.Phone,
|
||||
PlaceOfIssue = x.PlaceOfIssue,
|
||||
TelephoneNumber = x.AgentPhone,
|
||||
FullName = x.FullName,
|
||||
FName = x.FName,
|
||||
LName = x.LName,
|
||||
GovernmentSystemInfo = new GovernmentSystemInfo
|
||||
{
|
||||
EServicePassword = x.EservicePassword,
|
||||
EServiceUsername = x.EservicePassword,
|
||||
MclPassword = x.MclsPassword,
|
||||
MclUsername = x.MclsUserName,
|
||||
SanaUsername = x.SanaUserName,
|
||||
SanaPassword = x.SanaPassword,
|
||||
TaxUsername = x.TaxOfficeUserName,
|
||||
TaxPassword = x.TaxOfficepassword
|
||||
},
|
||||
ContractingPartyId = x.ContractingPartyId
|
||||
}).FirstOrDefaultAsync(x => x.Id == id);
|
||||
|
||||
return employer;
|
||||
}
|
||||
|
||||
|
||||
public async Task<OperationResult<string>> DeactivateWithSubordinates(long id)
|
||||
{
|
||||
var op = new OperationResult<string>();
|
||||
;
|
||||
using (var transaction = await _context.Database.BeginTransactionAsync())
|
||||
{
|
||||
try
|
||||
{
|
||||
var employer = await _context.Employers
|
||||
.Include(x => x.Contracts)
|
||||
.Include(x => x.WorkshopEmployers)
|
||||
.ThenInclude(x => x.Workshop)
|
||||
.ThenInclude(x => x.Checkouts).FirstOrDefaultAsync(x => x.id == id);
|
||||
if (employer == null)
|
||||
{
|
||||
return op.Failed("چنین آیتمی وجود ندارد");
|
||||
}
|
||||
|
||||
|
||||
var workshops = employer.WorkshopEmployers.Select(x => x.Workshop).ToList();
|
||||
|
||||
var contracts = employer.Contracts.ToList();
|
||||
|
||||
var checkouts = workshops.SelectMany(x => x.Checkouts).ToList();
|
||||
|
||||
|
||||
employer.DeActive();
|
||||
|
||||
foreach (var workshop in workshops)
|
||||
{
|
||||
workshop.DeActive(workshop.ArchiveCode);
|
||||
}
|
||||
|
||||
foreach (var contract in contracts)
|
||||
{
|
||||
contract.DeActive();
|
||||
}
|
||||
|
||||
foreach (var checkout in checkouts)
|
||||
{
|
||||
checkout.DeActive();
|
||||
}
|
||||
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
await transaction.CommitAsync();
|
||||
return op.Succcedded("DeActivate");
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
await transaction.RollbackAsync();
|
||||
return op.Failed("غیرفعال کردن کارفرما با خطا مواجه شد");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1,10 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using _0_Framework.Application.Enums;
|
||||
using System.Threading.Tasks;
|
||||
using _0_Framework.InfraStructure;
|
||||
using Company.Domain.RepresentativeAgg;
|
||||
using CompanyManagment.App.Contracts.PersonalContractingParty;
|
||||
using CompanyManagment.App.Contracts.Representative;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace CompanyManagment.EFCore.Repository;
|
||||
|
||||
@@ -213,5 +216,82 @@ public class RepresentativeRepository : RepositoryBase<long, Representative>, IR
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region Api
|
||||
public async Task<ICollection<RepresentativeGetListViewModel>> GetList(RepresentativeGetListSearchModel searchModel)
|
||||
{
|
||||
var query = _context.RepresentativeSet.Include(x => x.ContractingParties)
|
||||
.Where(x => x.FullName != "-");
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(searchModel.CompanyNameOrFullName))
|
||||
query = query.Where(x => x.FullName.Contains(searchModel.CompanyNameOrFullName));
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(searchModel.NationalCodeOrNationalId))
|
||||
query = query.Where(x => x.Nationalcode.Contains(searchModel.NationalCodeOrNationalId)
|
||||
|| x.NationalId.Contains(searchModel.NationalCodeOrNationalId));
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(searchModel.IdNumber))
|
||||
query = query.Where(x => x.IdNumber.Contains(searchModel.IdNumber));
|
||||
|
||||
|
||||
if (searchModel.ContractingPartyId > 0)
|
||||
{
|
||||
query = query.Where(x => x.ContractingParties.Any(c => c.id == searchModel.ContractingPartyId));
|
||||
}
|
||||
|
||||
if (searchModel.RepresentativeType != LegalType.None)
|
||||
{
|
||||
string isLegal = searchModel.RepresentativeType switch
|
||||
{
|
||||
LegalType.Real => "false",
|
||||
LegalType.Legal => "true",
|
||||
_ => ""
|
||||
};
|
||||
|
||||
query = query.Where(x => x.IsLegal == isLegal);
|
||||
}
|
||||
|
||||
if (searchModel.RepresentativeStatus != ActivationStatus.None)
|
||||
{
|
||||
string status = searchModel.RepresentativeStatus switch
|
||||
{
|
||||
ActivationStatus.Active => "true",
|
||||
ActivationStatus.DeActive => "false",
|
||||
_ => ""
|
||||
};
|
||||
query = query.Where(x => x.IsActive == status);
|
||||
}
|
||||
|
||||
var result = await query.Skip(searchModel.PageIndex).Take(30)
|
||||
.Select(x => new RepresentativeGetListViewModel()
|
||||
{
|
||||
Id = x.id,
|
||||
NationalIdOrNationalCode = x.IsLegal == "true" ? x.NationalId : x.Nationalcode,
|
||||
RealNameOrLegalName = x.FullName,
|
||||
HasAnyContractingParty = x.ContractingParties.Any(),
|
||||
RepresentativeStatus = x.IsActive == "false" ? ActivationStatus.DeActive : ActivationStatus.Active,
|
||||
RepresentativeType = x.IsLegal == "true" ? LegalType.Legal : LegalType.Real,
|
||||
}).ToListAsync();
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
public bool HasAnyContractingParty(long id)
|
||||
{
|
||||
return _context.RepresentativeSet.Where(x => x.id == id).Include(x => x.ContractingParties)
|
||||
.Any(x => x.ContractingParties.Any());
|
||||
}
|
||||
|
||||
public async Task<List<GetSelectListRepresentativeViewModel>> GetSelectList()
|
||||
{
|
||||
return await _context.RepresentativeSet.Select(x => new GetSelectListRepresentativeViewModel()
|
||||
{
|
||||
Id = x.id,
|
||||
Name = x.FullName
|
||||
}).ToListAsync();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
using _0_Framework.Application;
|
||||
using CompanyManagment.App.Contracts.AdminMonthlyOverview;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ServiceHost.BaseControllers;
|
||||
|
||||
namespace ServiceHost.Api.Areas.Admin.Controllers;
|
||||
|
||||
public class AdminMonthlyOverviewController:AdminController
|
||||
{
|
||||
|
||||
private readonly IAdminMonthlyOverviewApplication _adminMonthlyOverviewApplication;
|
||||
|
||||
public AdminMonthlyOverviewController(IAdminMonthlyOverviewApplication adminMonthlyOverviewApplication)
|
||||
{
|
||||
_adminMonthlyOverviewApplication = adminMonthlyOverviewApplication;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// لیست امور ماهیانه پرسنل
|
||||
/// </summary>
|
||||
/// <param name="searchModel"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("")]
|
||||
public async Task<ActionResult<List<AdminMonthlyOverviewListViewModel>>> GetList([FromQuery]AdminMonthlyOverviewSearchModel searchModel)
|
||||
{
|
||||
var result= await _adminMonthlyOverviewApplication.GetWorkshopListByStatus(searchModel);
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// مرحله بهدی
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("Next/{id}")]
|
||||
public async Task<ActionResult<OperationResult>> Next(long id)
|
||||
{
|
||||
var result = await _adminMonthlyOverviewApplication.Next(id);
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// مرحله قبلی
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("Back/{id}")]
|
||||
public async Task<ActionResult<OperationResult>> Back(long id)
|
||||
{
|
||||
var result = await _adminMonthlyOverviewApplication.Back(id);
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// تعداد امور ماهاینه
|
||||
/// </summary>
|
||||
/// <param name="year"></param>
|
||||
/// <param name="month"></param>
|
||||
/// <param name="accountId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("Counter")]
|
||||
public async Task<ActionResult<AdminMonthlyOverViewCounterVm>> Counter(int year,int month,int accountId)
|
||||
{
|
||||
var result = await _adminMonthlyOverviewApplication.GetCounter(year,month,accountId);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
40
ServiceHost/Areas/Admin/Controllers/EmployeesController.cs
Normal file
40
ServiceHost/Areas/Admin/Controllers/EmployeesController.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using _0_Framework.Application;
|
||||
using CompanyManagment.App.Contracts.Employee;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ServiceHost.BaseControllers;
|
||||
|
||||
namespace ServiceHost.Api.Areas.Admin.Controllers;
|
||||
|
||||
public class EmployeesController:AdminController
|
||||
{
|
||||
private readonly IEmployeeApplication _employeeApplication;
|
||||
private readonly IAuthHelper _authHelper;
|
||||
public EmployeesController(IEmployeeApplication employeeApplication, IAuthHelper authHelper)
|
||||
{
|
||||
_employeeApplication = employeeApplication;
|
||||
_authHelper = authHelper;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// لیست پرسنل برای جستجو
|
||||
/// </summary>
|
||||
/// <param name="searchText"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("select_list")]
|
||||
public async Task<ActionResult<List<EmployeeSelectListViewModel>>> GetSelectList(string searchText)
|
||||
{
|
||||
var data = await _employeeApplication.GetSelectList(searchText);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public async Task<ActionResult<List<GetEmployeeListViewModel>>> GetList(GetEmployeeListSearchModel searchModel)
|
||||
{
|
||||
var result = await _employeeApplication.GetList(searchModel);
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
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.Remove(id);
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// سلکت لیست کارفرما برای جستجو
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("select_list")]
|
||||
public async Task<List<EmployerSelectListViewModel>> GetSelectList(string search)
|
||||
{
|
||||
return await _employerApplication.GetSelectList(search);
|
||||
}
|
||||
|
||||
}
|
||||
151
ServiceHost/Areas/Admin/Controllers/RepresentativeController.cs
Normal file
151
ServiceHost/Areas/Admin/Controllers/RepresentativeController.cs
Normal file
@@ -0,0 +1,151 @@
|
||||
using _0_Framework.Application;
|
||||
using CompanyManagment.App.Contracts.PersonalContractingParty;
|
||||
using CompanyManagment.App.Contracts.Representative;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ServiceHost.BaseControllers;
|
||||
|
||||
namespace ServiceHost.Areas.Admin.Controllers;
|
||||
|
||||
public class RepresentativeController : AdminController
|
||||
{
|
||||
private readonly IRepresentativeApplication _representativeApplication;
|
||||
|
||||
public RepresentativeController(IRepresentativeApplication representativeApplication)
|
||||
{
|
||||
_representativeApplication = representativeApplication;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// گرفتن لیست معرف ها
|
||||
/// </summary>
|
||||
/// <param name="searchModel"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<ActionResult<List<RepresentativeGetListViewModel>>> Get(RepresentativeGetListSearchModel searchModel)
|
||||
{
|
||||
return await _representativeApplication.GetList(searchModel);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ایجاد معرف حقوقی
|
||||
/// </summary>
|
||||
/// <param name="command"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("legal")]
|
||||
public ActionResult<OperationResult> CreateLegal([FromBody] CreateLegalRepresentative command)
|
||||
{
|
||||
return _representativeApplication.CreateLegal(command);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ایجاد معرف حقیقی
|
||||
/// </summary>
|
||||
/// <param name="command"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("real")]
|
||||
public ActionResult<OperationResult> CreateReal([FromBody] CreateRealRepresentative command)
|
||||
{
|
||||
return _representativeApplication.CreateReal(command);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// گرفتن جزئیات معرف
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("{id}")]
|
||||
public ActionResult<EditRepresentative> GetDetails(long id)
|
||||
{
|
||||
return _representativeApplication.GetDetails(id);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ویرایش معرف حقوقی
|
||||
/// </summary>
|
||||
/// <param name="command"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPut("Legal")]
|
||||
public ActionResult<OperationResult> EditLegal([FromBody] EditLegalRepresentative command)
|
||||
{
|
||||
return _representativeApplication.EditLegal(command);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ویرایش معرف حقیقی
|
||||
/// </summary>
|
||||
/// <param name="command"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPut("Real")]
|
||||
public ActionResult<OperationResult> EditReal([FromBody] EditRealRepresentative command)
|
||||
{
|
||||
return _representativeApplication.EditReal(command);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// گرفتن لیست طرف حساب ها با آیدی معرف
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("contracting_parties/{id}")]
|
||||
public ActionResult<List<PersonalContractingPartyViewModel>> GetContractingParties(long id)
|
||||
{
|
||||
return _representativeApplication.GetContractingParties(id);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// حذف معرف
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpDelete]
|
||||
public ActionResult<OperationResult> Delete(long id)
|
||||
{
|
||||
return _representativeApplication.DeleteRepresentative(id);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// فعال کردن معرف
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("active/{id}")]
|
||||
public ActionResult<OperationResult> Active(long id)
|
||||
{
|
||||
return _representativeApplication.Active(id);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// غیرفعال کردن معرف
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("deactivate/{id}")]
|
||||
public ActionResult<OperationResult> DeActive(long id)
|
||||
{
|
||||
return _representativeApplication.DeActive(id);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// طرف حسابی دارد یا ندارد
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("has_any_contracting_party")]
|
||||
public ActionResult<bool> HasAnyContractingParty(long id)
|
||||
{
|
||||
return _representativeApplication.HasAnyContractingParty(id);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// سلکت لیست معرف برای سرچ
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("select_list")]
|
||||
public async Task<List<GetSelectListRepresentativeViewModel>> GetSelectList()
|
||||
{
|
||||
return await _representativeApplication.GetSelectList();
|
||||
}
|
||||
|
||||
}
|
||||
28
ServiceHost/Areas/Admin/Controllers/WorkshopController.cs
Normal file
28
ServiceHost/Areas/Admin/Controllers/WorkshopController.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using CompanyManagment.App.Contracts.Workshop;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ServiceHost.BaseControllers;
|
||||
|
||||
namespace ServiceHost.Areas.Admin.Controllers;
|
||||
|
||||
public class WorkshopController:AdminController
|
||||
{
|
||||
private readonly IWorkshopApplication _workshopApplication;
|
||||
|
||||
public WorkshopController(IWorkshopApplication workshopApplication)
|
||||
{
|
||||
_workshopApplication = workshopApplication;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// لیست کارگاه برای جستجو
|
||||
/// </summary>
|
||||
/// <param name="searchText"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("select_list")]
|
||||
public async Task<ActionResult<List<WorkshopSelectListViewModel>>> GetSelectList(string searchText)
|
||||
{
|
||||
var data = await _workshopApplication.GetSelectList(searchText);
|
||||
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using _0_Framework.Application.Sms;
|
||||
using _0_Framework.Application;
|
||||
using AccountManagement.Configuration;
|
||||
@@ -17,8 +18,11 @@ using ServiceHost.Hubs;
|
||||
using ServiceHost.MiddleWare;
|
||||
using WorkFlow.Infrastructure.Config;
|
||||
using _0_Framework.Application.UID;
|
||||
using _0_Framework.Exceptions.Handler;
|
||||
using Microsoft.OpenApi.Models;
|
||||
using ServiceHost.Test;
|
||||
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
builder.WebHost.ConfigureKestrel(serverOptions =>
|
||||
@@ -36,6 +40,17 @@ builder.Services.AddHttpContextAccessor();
|
||||
builder.Services.AddHttpClient("holidayApi", c => c.BaseAddress = new System.Uri("https://api.github.com"));
|
||||
var connectionString = builder.Configuration.GetConnectionString("MesbahDb");
|
||||
var connectionStringTestDb = builder.Configuration.GetConnectionString("TestDb");
|
||||
|
||||
#region MongoDb
|
||||
|
||||
//var mongoConnectionSection = builder.Configuration.GetSection("MongoDb");
|
||||
//var mongoDbSettings = mongoConnectionSection.Get<MongoDbConfig>();
|
||||
//var mongoClient = new MongoClient(mongoDbSettings.ConnectionString);
|
||||
//var mongoDatabase = mongoClient.GetDatabase(mongoDbSettings.DatabaseName);
|
||||
|
||||
//builder.Services.AddSingleton<IMongoDatabase>(mongoDatabase);
|
||||
|
||||
#endregion
|
||||
PersonalBootstrapper.Configure(builder.Services, connectionString);
|
||||
TestDbBootStrapper.Configure(builder.Services, connectionStringTestDb);
|
||||
AccountManagementBootstrapper.Configure(builder.Services, connectionString);
|
||||
@@ -163,9 +178,98 @@ builder.Services.AddSignalR();
|
||||
|
||||
#endregion
|
||||
|
||||
#region Swagger
|
||||
builder.Services.AddSwaggerGen(options =>
|
||||
{
|
||||
|
||||
var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
|
||||
var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile);
|
||||
options.IncludeXmlComments(xmlPath);
|
||||
|
||||
// Get XML comments from the class library
|
||||
var classLibraryXmlFile = "CompanyManagment.App.Contracts.xml";
|
||||
var classLibraryXmlPath = Path.Combine(AppContext.BaseDirectory, classLibraryXmlFile);
|
||||
options.IncludeXmlComments(classLibraryXmlPath);
|
||||
|
||||
|
||||
options.SwaggerDoc("General", new OpenApiInfo { Title = "API - General", Version = "v1" });
|
||||
options.SwaggerDoc("Admin", new OpenApiInfo { Title = "API - Admin", Version = "v1" });
|
||||
options.SwaggerDoc("Client", new OpenApiInfo { Title = "API - Client", Version = "v1" });
|
||||
options.SwaggerDoc("Camera", new OpenApiInfo { Title = "API - Camera", Version = "v1" });
|
||||
|
||||
options.DocInclusionPredicate((docName, apiDesc) => string.Equals(docName, apiDesc.GroupName, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
|
||||
// اضافه کردن پشتیبانی از JWT در Swagger
|
||||
options.AddSecurityDefinition("Bearer", new Microsoft.OpenApi.Models.OpenApiSecurityScheme
|
||||
{
|
||||
Name = "Authorization",
|
||||
Type = Microsoft.OpenApi.Models.SecuritySchemeType.ApiKey,
|
||||
Scheme = "Bearer",
|
||||
BearerFormat = "JWT",
|
||||
In = Microsoft.OpenApi.Models.ParameterLocation.Header,
|
||||
Description = "لطفاً 'Bearer [space] token' را وارد کنید."
|
||||
});
|
||||
|
||||
options.AddSecurityRequirement(new Microsoft.OpenApi.Models.OpenApiSecurityRequirement
|
||||
{
|
||||
{
|
||||
new Microsoft.OpenApi.Models.OpenApiSecurityScheme
|
||||
{
|
||||
Reference = new Microsoft.OpenApi.Models.OpenApiReference
|
||||
{
|
||||
Type = Microsoft.OpenApi.Models.ReferenceType.SecurityScheme,
|
||||
Id = "Bearer"
|
||||
}
|
||||
},
|
||||
Array.Empty<string>()
|
||||
}
|
||||
});
|
||||
|
||||
options.EnableAnnotations();
|
||||
});
|
||||
#endregion
|
||||
|
||||
#region CORS
|
||||
|
||||
builder.Services.AddCors(options =>
|
||||
{
|
||||
options.AddPolicy("AllowSpecificOrigins", policy =>
|
||||
{
|
||||
policy.WithOrigins("http://localhost:3000", "http://localhost:3001", "https://gozareshgir.ir", "https://dad-mehr.ir")
|
||||
.AllowAnyHeader()
|
||||
.AllowAnyMethod()
|
||||
.AllowCredentials();
|
||||
});
|
||||
});
|
||||
|
||||
//builder.Services.AddCors(options =>
|
||||
//{
|
||||
// options.AddPolicy("AllowAny", policy =>
|
||||
// {
|
||||
// policy.AllowAnyOrigin()
|
||||
// .AllowAnyHeader()
|
||||
// .AllowAnyMethod();
|
||||
// });
|
||||
// options.AddPolicy("AllowSpecificOrigins", policy =>
|
||||
// {
|
||||
// policy.WithOrigins("http://localhost:3000", "http://localhost:3001", "https://gozareshgir.ir", "https://dad-mehr.ir")
|
||||
// .AllowAnyHeader()
|
||||
// .AllowAnyMethod()
|
||||
// .AllowCredentials();
|
||||
// });
|
||||
//});
|
||||
#endregion
|
||||
|
||||
builder.Services.AddExceptionHandler<CustomExceptionHandler>();
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
app.UseCors("AllowSpecificOrigins");
|
||||
|
||||
#region Mahan
|
||||
app.UseStatusCodePagesWithRedirects("/error/{0}");
|
||||
|
||||
//app.UseStatusCodePagesWithRedirects("/error/{0}");
|
||||
|
||||
//the backend Tester
|
||||
if (builder.Environment.IsDevelopment())
|
||||
@@ -175,6 +279,17 @@ if (builder.Environment.IsDevelopment())
|
||||
await tester.Test();
|
||||
}
|
||||
|
||||
if (app.Environment.IsDevelopment())
|
||||
{
|
||||
app.UseSwagger();
|
||||
app.UseSwaggerUI(options =>
|
||||
{
|
||||
options.SwaggerEndpoint("/swagger/General/swagger.json", "API - General");
|
||||
options.SwaggerEndpoint("/swagger/Admin/swagger.json", "API - Admin");
|
||||
options.SwaggerEndpoint("/swagger/Client/swagger.json", "API - Client");
|
||||
options.SwaggerEndpoint("/swagger/Camera/swagger.json", "API - Camera");
|
||||
});
|
||||
}
|
||||
#endregion
|
||||
//Create Http Pipeline
|
||||
|
||||
|
||||
@@ -3,8 +3,10 @@
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
|
||||
<!--<StartupObject>ServiceHost.Program</StartupObject>-->
|
||||
|
||||
<!--<StartupObject>ServiceHost.Program</StartupObject>-->
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<RazorCompileOnBuild>true</RazorCompileOnBuild>
|
||||
@@ -88,6 +90,8 @@
|
||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="8.0.2" />
|
||||
<PackageReference Include="SocialExplorer.FastDBF" Version="1.0.0" />
|
||||
<PackageReference Include="System.Data.OleDb" Version="8.0.0" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="8.1.4" />
|
||||
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
Reference in New Issue
Block a user