Merge branch 'Feature/InstitutionContract/add-registration-style' into Main

This commit is contained in:
MahanCh
2025-08-26 09:58:15 +03:30
13 changed files with 1191 additions and 479 deletions

View File

@@ -49,4 +49,5 @@ public interface IInstitutionContractRepository : IRepository<long, InstitutionC
Task<GetInstitutionContractListStatsViewModel> GetListStats(InstitutionContractListSearchModel searchModel);
Task<List<RegistrationWorkflowMainListViewModel>> RegistrationWorkflowMainList();
Task<List<RegistrationWorkflowItemsViewModel>> RegistrationWorkflowItems(long institutionContractId);
Task<InstitutionContractWorkshopDetail> GetInstitutionWorkshopDetails(long institutionWorkshopDetailsId);
}

View File

@@ -1,6 +1,8 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Transactions;
using _0_Framework.Application;
using _0_Framework.Application.Enums;
using CompanyManagment.App.Contracts.Checkout;
using CompanyManagment.App.Contracts.Employee;
@@ -125,4 +127,55 @@ public interface IEmployerApplication
#endregion
Task<OperationResult> CreateWorkflowRegistration(CreateEmployerWorkflowRegistration command);
}
public class CreateEmployerWorkflowRegistration
{
public CreateRealEmployerWorkflowRegistration RealEmployer { get; set; }
public CreateLegalEmployerWorkflowRegistration LegalEmployer { get; set; }
public LegalType LegalType { get; set; }
public long InstitutionWorkshopDetailsId { get; set; }
public long InstitutionContractId { get; set; }
public long ContractingPartyId { get; set; }
}
public class CreateLegalEmployerWorkflowRegistration
{
public string CompanyName { get; set; }
public string RegisterId { get; set; }
public string NationalId { get; set; }
public Gender Gender { get; set; }
public bool IsAuth { get; set; }
public string CeoNationalCode { get; set; }
public string CeoIdNumber { get; set; }
public string CeoFName { get; set; }
public string CeoLName { get; set; }
public string CeoFatherName { get; set; }
public string CeoDateOfBirth { get; set; }
public string CeoPlaceOfIssue { get; set; }
public string CeoDateOfIssue { get; set; }
public string PhoneNumber { get; set; }
public string TelephoneNumber { get; set; }
public GovernmentSystemInfo GovernmentSystemInfo { get; set; }
}
public class CreateRealEmployerWorkflowRegistration
{
public Gender Gender { get; set; }
public bool IsAuth { get; set; }
public string NationalCode { get; set; }
public string IdNumber { get; set; }
public string FName { get; set; }
public string LName { get; set; }
public string FatherName { get; set; }
public string DateOfBirth { get; set; }
public string PhoneNumber { get; set; }
public string PlaceOfIssue { get; set; }
public string DateOfIssue { get; set; }
public string TelephoneNumber { get; set; }
public GovernmentSystemInfo GovernmentSystemInfo { get; set; }
public string Telephone { get; set; }
}

View File

@@ -98,6 +98,7 @@ public class CreateInstitutionContractRequest
/// مالیات ارزش افزوده
/// </summary>
public double TaxAmount { get; set; }
}
/// <summary>
/// مدت زمان قرارداد نهاد

View File

@@ -67,13 +67,13 @@ public interface ITemporaryClientRegistrationApplication
/// و هنوز در دیتابیس ثبت نشده اند
/// </summary>
/// <param name="contractingPartyTempId"></param>
/// <param name="workshopList"></param>
/// <param name="totalPaymentMonth"></param>
/// <param name="duration"></param>
/// <param name="paymentModel"></param>
/// <param name="contractStartType"></param>
/// <param name="paymentModel"></param>
/// <returns></returns>
Task<ReviewAndPaymentViewModel> GetTotalPaymentAndWorkshopList(long contractingPartyTempId,
List<WorkshopTempViewModel> workshopList,
double totalPaymentMonth,
InstitutionContractDuration duration = InstitutionContractDuration.TwelveMonths, string contractStartType = "currentMonth");
/// <summary>

View File

@@ -152,4 +152,5 @@ public class CreateWorkshop
/// </summary>
public bool IsStaticCheckout { get; set; }
}

View File

@@ -4,6 +4,7 @@ using System.Threading.Tasks;
using _0_Framework.Application;
using AccountManagement.Application.Contracts.Account;
using CompanyManagment.App.Contracts.Workshop.DTOs;
using Microsoft.AspNetCore.Mvc;
namespace CompanyManagment.App.Contracts.Workshop;
@@ -89,4 +90,167 @@ public interface IWorkshopApplication
#endregion
Task<ActionResult<OperationResult>> CreateWorkshopWorkflowRegistration(CreateWorkshopWorkflowRegistration command);
}
public class CreateWorkshopWorkflowRegistration
{
/// <summary>
/// شناس<D8A7><D8B3> جزئیات کارگاه قرارداد مؤسسه
/// </summary>
public long InstitutionContractWorkshopDetailId { get; set; }
/// <summary>
/// نام کارگاه
/// </summary>
public string WorkshopName { get; set; }
/// <summary>
/// نام مستعار
/// </summary>
public string SureName { get; set; }
/// <summary>
/// نوع مالکیت
/// </summary>
public string TypeOfOwnership { get; set; }
/// <summary>
/// کد بایگانی
/// </summary>
public string ArchiveCode { get; set; }
/// <summary>
/// نام نماینده
/// </summary>
public string AgentName { get; set; }
/// <summary>
/// شناسه طرف قرارداد
/// </summary>
public long ContractingPartyId { get; set; }
/// <summary>
/// شهر
/// </summary>
public string City { get; set; }
/// <summary>
/// استان
/// </summary>
public string Province { get; set; }
/// <summary>
/// آدرس
/// </summary>
public string Address { get; set; }
/// <summary>
/// شناسه حساب کارشناس ارشد قرارداد
/// </summary>
public long SeniorContractAccountId { get; set; }
/// <summary>
/// شناسه حساب کارشناس قرارداد
/// </summary>
public long JuniorContractAccountId { get; set; }
/// <summary>
/// شناسه حساب کارشناس ارشد بیمه
/// </summary>
public long SeniorInsuranceAccountId { get; set; }
/// <summary>
/// شناسه حساب کارشناس بیمه
/// </summary>
public long JuniorInsuranceAccountId { get; set; }
/// <summary>
/// باز بودن در تعطیلات
/// </summary>
public bool OpenInHolidays { get; set; }
/// <summary>
/// محاسبه نوبت کاری در فیش حقوقی
/// </summary>
public bool RotatingShiftCompute { get; set; }
/// <summary>
/// ایجاد قرارداد
/// </summary>
public bool CreateContract { get; set; }
/// <summary>
/// امضاء قراداد
/// </summary>
public bool SignContract { get; set; }
/// <summary>
/// ایجات تصف<D8B5><D981>ه حساب
/// </summary>
public bool CreateCheckout { get; set; }
/// <summary>
/// امضاء تصفیه حساب
/// </summary>
public bool SignCheckout { get; set; }
/// <summary>
/// تصفیه حساب بصورت استاتیک محاصبه شود
/// </summary>
public bool IsStaticCheckout { get; set; }
/// <summary>
/// اگر قرارداد بیش از یک ماه باشد و گزینه انتخاب شده منتهی به پایان سال باشد
/// این آیتم
/// True
/// است
/// </summary>
public IsActive CutContractEndOfYear { get; set; }
/// <summary>
/// سرویس تصفیه حساب سفارشی
/// </summary>
public string HasCustomizeCheckoutService { get; set; }
/// <summary>
/// محاسبه اضافه کار فیش حقوقی در لیست بیمه
/// </summary>
public bool InsuranceCheckoutOvertime { get; set; }
/// <summary>
/// محاسبه حق اولاد در لیست بیمه
/// </summary>
public bool InsuranceCheckoutFamilyAllowance { get; set; }
/// <summary>
/// حضور و غیاب رایگان ویژه
/// </summary>
public string HasRollCallFreeVip { get; set; }
/// <summary>
/// مدت قرارداد
/// </summary>
public string ContractTerm { get; set; }
/// <summary>
/// مخفی کردن کل پرداخت
/// </summary>
public bool TotalPaymentHide { get; set; }
/// <summary>
/// نوع ارسال بیمه
/// </summary>
public string TypeOfInsuranceSend { get; set; }
/// <summary>
/// کد بیمه
/// </summary>
public string InsuranceCode { get; set; }
/// <summary>
/// مشمول دستمزد مقطوع
/// </summary>
public bool FixedSalary { get; set; }
/// <summary>
/// صنف
/// </summary>
public long InsuranceJobId { get; set; }
/// <summary>
/// جمعیت شهر
/// </summary>
public string Population { get; set; }
/// <summary>
/// شماره تماس نماینده کارگاه
/// </summary>
public string AgentPhone { get; set; }
public string TypeOfContract { get; set; }
/// <summary>
/// ردیف پیمان
/// </summary>
public string AgreementNumber { get; set; }
public string ComputeOptions { get; set; }
public bool AddYearsPay { get; set; }
public bool AddLeavePay { get; set; }
public string BonusesOptions { get; set; }
public string YearsOptions { get; set; }
}

File diff suppressed because it is too large Load Diff

View File

@@ -2,10 +2,12 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using _0_Framework.Application;
using _0_Framework.Application.Enums;
using _0_Framework.Exceptions;
using AccountManagement.Application.Contracts.Account;
using Company.Domain.ContarctingPartyAgg;
using Company.Domain.EmployeeAgg;
using Company.Domain.empolyerAgg;
@@ -18,6 +20,7 @@ using Company.Domain.TemporaryClientRegistrationAgg;
using Company.Domain.WorkshopAgg;
using CompanyManagment.App.Contracts.FinancialStatment;
using CompanyManagment.App.Contracts.InstitutionContract;
using CompanyManagment.App.Contracts.InstitutionContractContactinfo;
using CompanyManagment.App.Contracts.PersonalContractingParty;
using CompanyManagment.App.Contracts.Workshop;
using CompanyManagment.EFCore.Migrations;
@@ -39,6 +42,8 @@ public class InstitutionContractApplication : IInstitutionContractApplication
private readonly IWorkshopApplication _workshopApplication;
private readonly IContractingPartyTempRepository _contractingPartyTempRepository;
private readonly IFinancialStatmentRepository _financialStatmentRepository;
private readonly IContactInfoApplication _contactInfoApplication;
private readonly IAccountApplication _accountApplication;
public InstitutionContractApplication(IInstitutionContractRepository institutionContractRepository,
@@ -46,7 +51,9 @@ public class InstitutionContractApplication : IInstitutionContractApplication
IRepresentativeRepository representativeRepository, IEmployerRepository employerRepository,
IWorkshopRepository workshopRepository, ILeftWorkRepository leftWorkRepository,
IFinancialStatmentApplication financialStatmentApplication, IWorkshopApplication workshopApplication,
IContractingPartyTempRepository contractingPartyTempRepository, IFinancialStatmentRepository financialStatmentRepository)
IContractingPartyTempRepository contractingPartyTempRepository,
IFinancialStatmentRepository financialStatmentRepository, IContactInfoApplication contactInfoApplication,
IAccountApplication accountApplication)
{
_institutionContractRepository = institutionContractRepository;
_contractingPartyRepository = contractingPartyRepository;
@@ -58,6 +65,8 @@ public class InstitutionContractApplication : IInstitutionContractApplication
_workshopApplication = workshopApplication;
_contractingPartyTempRepository = contractingPartyTempRepository;
_financialStatmentRepository = financialStatmentRepository;
_contactInfoApplication = contactInfoApplication;
_accountApplication = accountApplication;
}
public OperationResult Create(CreateInstitutionContract command)
@@ -967,9 +976,9 @@ public class InstitutionContractApplication : IInstitutionContractApplication
var workshopDetails = command.Workshops.Select(x =>
new InstitutionContractWorkshopDetail(x.WorkshopName, x.HasRollCallPlan, x.HasCustomizeCheckoutPlan,
x.HasContractPlan, x.PersonnelCount,x.Price)).ToList();
x.HasContractPlan, x.PersonnelCount, x.Price)).ToList();
var financialStatement = new FinancialStatment(contractingParty.id,contractingPartyFullName);
var financialStatement = new FinancialStatment(contractingParty.id, contractingPartyFullName);
if (command.IsInstallment)
{
@@ -986,8 +995,8 @@ public class InstitutionContractApplication : IInstitutionContractApplication
// ایجاد قسط جدید با تاریخ امروز
var todayInstallment = new InstitutionContractInstallment(DateTime.Today, firstInstallmentAmount, "");
var financialTransaction = new FinancialTransaction(0,today,today.ToFarsi(),
"قسط اول سرویس", "debt","بابت خدمات",firstInstallmentAmount,0,0);
var financialTransaction = new FinancialTransaction(0, today, today.ToFarsi(),
"قسط اول سرویس", "debt", "بابت خدمات", firstInstallmentAmount, 0, 0);
financialStatement.AddFinancialTransaction(financialTransaction);
@@ -1007,6 +1016,51 @@ public class InstitutionContractApplication : IInstitutionContractApplication
await _financialStatmentRepository.CreateAsync(financialStatement);
await _institutionContractRepository.CreateAsync(entity);
await _institutionContractRepository.SaveChangesAsync();
var mainContactInfo = new CreateContactInfo
{
InstitutionContractId = entity.id,
PhoneType = "شماره همراه",
Position = "طرف قرارداد",
PhoneNumber = contractingParty.Phone,
FnameLname = contractingPartyFullName,
SendSms = true
};
_contactInfoApplication.Create(mainContactInfo);
foreach (var contactInfo in command.ContactInfos)
{
if (contactInfo.PhoneNumber != null)
{
var contactinfo = new CreateContactInfo
{
InstitutionContractId = entity.id,
PhoneType = contactInfo.PhoneType,
Position = contactInfo.Position,
PhoneNumber = contactInfo.PhoneNumber,
FnameLname = contactInfo.FnameLname,
SendSms = contactInfo.SendSmsString == "true" ? true : false
};
_contactInfoApplication.Create(contactinfo);
}
}
var userPass = contractingParty.IsLegal == "حقیقی"
? contractingParty.Nationalcode
: contractingParty.NationalId;
var createAcc = new RegisterAccount
{
Fullname = contractingParty.LName,
Username = userPass,
Password = userPass,
Mobile = contractingParty.Phone,
NationalCode = userPass
};
var res = _accountApplication.RegisterClient(createAcc);
if (res.IsSuccedded)
CreateContractingPartyAccount(contractingParty.id, res.SendId);
await _institutionContractRepository.SaveChangesAsync();
await transaction.CommitAsync();
return opration.Succcedded();
}

View File

@@ -514,18 +514,19 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
}
public async Task<ReviewAndPaymentViewModel> GetTotalPaymentAndWorkshopList(long contractingPartyTempId,
List<WorkshopTempViewModel> workshops, InstitutionContractDuration duration = InstitutionContractDuration.TwelveMonths, string contractStartType = "currentMonth")
double totalPaymentMonth, InstitutionContractDuration duration = InstitutionContractDuration.TwelveMonths, string contractStartType = "currentMonth")
{
//دریافت کارگاه ها
double totalPayment1MonthDouble = 0;
//بدست آوردن جمع کل برای یک ماه
foreach (var workshop in workshops)
{
totalPayment1MonthDouble += workshop.WorkshopServicesAmount;
}
// //بدست آوردن جمع کل برای یک ماه
// foreach (var workshop in workshops)
// {
// totalPayment1MonthDouble += workshop.WorkshopServicesAmount;
// }
totalPayment1MonthDouble = totalPaymentMonth;
if (totalPayment1MonthDouble == 0)
return new ReviewAndPaymentViewModel();

View File

@@ -19,6 +19,7 @@ using CompanyManagment.App.Contracts.Workshop;
using CompanyManagment.App.Contracts.Workshop.DTOs;
using CompanyManagment.App.Contracts.WorkshopPlan;
using CompanyManagment.EFCore.Migrations;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration.UserSecrets;
using Microsoft.Identity.Client;
@@ -39,7 +40,12 @@ public class WorkshopAppliction : IWorkshopApplication
private readonly IRollCallServiceApplication _rollCallServiceApplication;
private readonly IPasswordHasher _passwordHasher;
public WorkshopAppliction(IWorkshopRepository workshopRepository, ILeftWorkRepository leftWorkRepository, ILeftWorkInsuranceRepository leftWorkInsuranceRepository, IWorkshopPlanApplication workshopPlanApplication, IEmployeeApplication employeeApplication, IEmployeeChildrenApplication employeeChildrenApplication, IInstitutionContractRepository institutionContractRepository, IPersonalContractingPartyRepository personalContractingPartyRepository, IRollCallServiceApplication rollCallServiceApplication, IPasswordHasher passwordHasher)
public WorkshopAppliction(IWorkshopRepository workshopRepository, ILeftWorkRepository leftWorkRepository,
ILeftWorkInsuranceRepository leftWorkInsuranceRepository, IWorkshopPlanApplication workshopPlanApplication,
IEmployeeApplication employeeApplication, IEmployeeChildrenApplication employeeChildrenApplication,
IInstitutionContractRepository institutionContractRepository,
IPersonalContractingPartyRepository personalContractingPartyRepository,
IRollCallServiceApplication rollCallServiceApplication, IPasswordHasher passwordHasher)
{
_workshopRepository = workshopRepository;
_leftWorkRepository = leftWorkRepository;
@@ -135,14 +141,12 @@ public class WorkshopAppliction : IWorkshopApplication
&& command.CreatePlan.EditGroupPlanlist[i].JobIdList.Count > 0)
{
groupCounter += 1;
}
}
if (groupCounter >= 1)
{
createPlanValidations = true;
}
else
{
@@ -166,7 +170,6 @@ public class WorkshopAppliction : IWorkshopApplication
.ContractingPartyId);
if (account == null || account.ClientAreaPermission != "true")
return operation.Failed("بدلیل نداشتن حساب کاربری کلاینت نمیتوانید سرویس حضور غیاب را فعال کنید");
}
var workshop = new Workshop(command.WorkshopName, command.WorkshopSureName, command.InsuranceCode,
@@ -197,12 +200,8 @@ public class WorkshopAppliction : IWorkshopApplication
MaxPersonValid = 500,
Duration = "12",
HasCustomizeCheckoutService = command.HasCustomizeCheckoutService
};
_rollCallServiceApplication.Create(commandSave);
}
//مشاغل مقطوع
@@ -222,9 +221,7 @@ public class WorkshopAppliction : IWorkshopApplication
var op = _workshopRepository.CreateAccountLeftWorkAndWorkshopAccounts(accountIds, workshop.id);
return operation.Succcedded();
}
public OperationResult Edit(EditWorkshop command)
@@ -242,36 +239,40 @@ public class WorkshopAppliction : IWorkshopApplication
{
accountIds = command.AccountIdsList.ToList();
}
if (workshop == null)
operation.Failed("رکورد مورد نظر وجود ندارد");
if (command.EmployerIdList == null)
return operation.Failed("لطفا کارفرما را انتخاب نمایید");
var employer = command.EmployerIdList.ToList();
//if (_workshopRepository.Exists(x => x.WorkshopName == command.WorkshopName && x.id != command.Id))
// return operation.Failed(" نام کارگاه تکراری است ");
//if (_workshopRepository.Exists(x => x.WorkshopName == command.WorkshopName && x.id != command.Id))
// return operation.Failed(" نام کارگاه تکراری است ");
if (command.ContractTerm != "1" && command.ContractTerm != "ForEver" && (command.CutContractEndOfYear != IsActive.False && command.CutContractEndOfYear != IsActive.True))
return operation.Failed("لطفا تیک قرداداد منتهی به پایان سال را تعیین وضعیت کنید");
if (command.ContractTerm != "1" && command.ContractTerm != "ForEver" &&
(command.CutContractEndOfYear != IsActive.False && command.CutContractEndOfYear != IsActive.True))
return operation.Failed("لطفا تیک قرداداد منتهی به پایان سال را تعیین وضعیت کنید");
if (command.ContractTerm == "1" && command.ContractTerm == "ForEver")
command.CutContractEndOfYear = IsActive.None;
if (!command.CreateContract)
{
command.SignContract = false;
command.CreateCheckout = false;
command.SignCheckout = false;
}
if (command.ContractTerm == "1" && command.ContractTerm == "ForEver")
command.CutContractEndOfYear = IsActive.None;
if (!command.CreateContract)
{
command.SignContract = false;
command.CreateCheckout = false;
command.SignCheckout = false;
}
if (!command.CreateCheckout)
{
command.SignCheckout = false;
}
if (!command.CreateCheckout)
{
command.SignCheckout = false;
}
if (command.TypeOfInsuranceSend != null && string.IsNullOrEmpty(command.InsuranceCode))
if (command.TypeOfInsuranceSend != null && string.IsNullOrEmpty(command.InsuranceCode))
return operation.Failed("لطفا کد بیمه کارگاه را وارد کنید");
if (_workshopRepository.Exists(x => !string.IsNullOrEmpty(x.InsuranceCode) && x.InsuranceCode == command.InsuranceCode && x.id != command.Id))
if (_workshopRepository.Exists(x =>
!string.IsNullOrEmpty(x.InsuranceCode) && x.InsuranceCode == command.InsuranceCode &&
x.id != command.Id))
return operation.Failed("کد بیمه کارگاه تکراری است");
if (command.Address != null && command.State == null)
@@ -294,17 +295,19 @@ public class WorkshopAppliction : IWorkshopApplication
if (string.IsNullOrWhiteSpace(command.Population))
return operation.Failed("لطفا جمعیت شهر را انتخاب کنید");
}
var account = new AccountViewModel();
var institutionContract = new InstitutionContract();
if (command.HasRollCallFreeVip == "true")
{
institutionContract = _institutionContractRepository.InstitutionContractByEmployerId(employer.FirstOrDefault());
institutionContract =
_institutionContractRepository.InstitutionContractByEmployerId(employer.FirstOrDefault());
if (institutionContract == null)
return operation.Failed("بدلیل نداشتن قرار داد مالی نمیتوانید سرویس حضور غیاب را فعال کنید");
account = _personalContractingPartyRepository.GetAccountByPersonalContractingParty(institutionContract.ContractingPartyId);
account = _personalContractingPartyRepository.GetAccountByPersonalContractingParty(institutionContract
.ContractingPartyId);
if ((account == null || account.ClientAreaPermission != "true") && command.Id != 11)
return operation.Failed("بدلیل نداشتن حساب کاربری کلاینت نمیتوانید سرویس حضور غیاب را فعال کنید");
var searchService = _rollCallServiceApplication.GetAllServiceByWorkshopId(command.Id);
@@ -323,7 +326,7 @@ public class WorkshopAppliction : IWorkshopApplication
{
var hasService = searchService.FirstOrDefault(x =>
x.IsActiveString == "true" && x.StartService <= DateTime.Now &&
x.EndService >= DateTime.Now );
x.EndService >= DateTime.Now);
if (hasService == null)
{
_rollCallServiceApplication.Create(commandSave);
@@ -335,22 +338,18 @@ public class WorkshopAppliction : IWorkshopApplication
hasService.HasCustomizeCheckoutService != "true")
{
_rollCallServiceApplication.AddCustomizeCheckoutServiceVip(hasService.Id);
}else if (command.HasCustomizeCheckoutService == "false" &&
hasService.HasCustomizeCheckoutService == "true")
}
else if (command.HasCustomizeCheckoutService == "false" &&
hasService.HasCustomizeCheckoutService == "true")
{
_rollCallServiceApplication.StopVipService(hasService.Id);
}
}
}
else
{
_rollCallServiceApplication.Create(commandSave);
}
}
else
{
@@ -367,15 +366,17 @@ public class WorkshopAppliction : IWorkshopApplication
}
}
workshop.Edit(command.WorkshopName, command.WorkshopSureName, command.InsuranceCode, command.TypeOfOwnership,
workshop.Edit(command.WorkshopName, command.WorkshopSureName, command.InsuranceCode, command.TypeOfOwnership,
command.ArchiveCode, command.AgentName, command.AgentPhone, command.State, command.City,
command.Address,
command.TypeOfInsuranceSend, command.TypeOfContract,command.ContractTerm, command.AgreementNumber
command.TypeOfInsuranceSend, command.TypeOfContract, command.ContractTerm, command.AgreementNumber
, command.FixedSalary, command.Population, command.InsuranceJobId, command.ZoneName,
command.AddBonusesPay, command.AddYearsPay, command.AddLeavePay, command.TotalPaymentHide,command.IsClassified,
command.ComputeOptions,command.BonusesOptions, command.YearsOptions,command.HasRollCallFreeVip,
command.WorkshopHolidayWorking, command.InsuranceCheckoutOvertime,command.InsuranceCheckoutFamilyAllowance,
command.CreateContract, command.SignContract, command.CreateCheckout, command.SignCheckout, command.CutContractEndOfYear,command.RotatingShiftCompute, command.IsStaticCheckout);
command.AddBonusesPay, command.AddYearsPay, command.AddLeavePay, command.TotalPaymentHide,
command.IsClassified,
command.ComputeOptions, command.BonusesOptions, command.YearsOptions, command.HasRollCallFreeVip,
command.WorkshopHolidayWorking, command.InsuranceCheckoutOvertime, command.InsuranceCheckoutFamilyAllowance,
command.CreateContract, command.SignContract, command.CreateCheckout, command.SignCheckout,
command.CutContractEndOfYear, command.RotatingShiftCompute, command.IsStaticCheckout);
_workshopRepository.SaveChanges();
_workshopRepository.RemoveOldRelation(command.Id);
@@ -383,6 +384,7 @@ public class WorkshopAppliction : IWorkshopApplication
{
_workshopRepository.EmployerWorkshop(workshop.id, e);
}
var op = _workshopRepository.EditAccountLeftWorkAndWorkshopAccounts(accountIds, workshop.id);
foreach (var item in leftWork)
{
@@ -390,11 +392,10 @@ public class WorkshopAppliction : IWorkshopApplication
editLeft.EditBonuses(command.AddBonusesPay, command.AddYearsPay, command.AddLeavePay);
_leftWorkRepository.SaveChanges();
}
transaction.Complete();
return operation.Succcedded();
}
public string GetWorkshopFullname(long id)
@@ -412,7 +413,6 @@ public class WorkshopAppliction : IWorkshopApplication
}
return workshop;
}
@@ -425,6 +425,7 @@ public class WorkshopAppliction : IWorkshopApplication
{
return _workshopRepository.GetWorkshopAll();
}
public List<WorkshopViewModel> GetWorkshopAccount()
{
return _workshopRepository.GetWorkshopAccount();
@@ -450,13 +451,17 @@ public class WorkshopAppliction : IWorkshopApplication
InsurancePerson = x.InsurancePerson,
ContractLeft = x.ContractLeft,
InsurancetLeft = x.InsurancetLeft,
Black = ((x.ContractPerson && x.InsurancePerson && x.InsurancetLeft && x.ContractLeft) || (x.ContractPerson && !x.InsurancePerson && x.ContractLeft) || (x.InsurancePerson && !x.ContractPerson && x.InsurancetLeft)) ? true : false
Black = ((x.ContractPerson && x.InsurancePerson && x.InsurancetLeft && x.ContractLeft) ||
(x.ContractPerson && !x.InsurancePerson && x.ContractLeft) ||
(x.InsurancePerson && !x.ContractPerson && x.InsurancetLeft))
? true
: false
}).ToList();
return res;
}
#region Vafa
public List<PersonnelInfoViewModel> GetPersonnelInfo(PersonnelInfoSearchModel searchModel)
{
var res = _workshopRepository.GetPersonnelInfo(searchModel.WorkshopId);
@@ -478,7 +483,11 @@ public class WorkshopAppliction : IWorkshopApplication
InsurancePerson = x.InsurancePerson,
ContractLeft = x.ContractLeft,
InsuranceLeft = x.InsuranceLeft,
Black = ((x.ContractPerson && x.InsurancePerson && x.InsuranceLeft && x.ContractLeft) || (x.ContractPerson && !x.InsurancePerson && x.ContractLeft) || (x.InsurancePerson && !x.ContractPerson && x.InsuranceLeft)) ? true : false,
Black = ((x.ContractPerson && x.InsurancePerson && x.InsuranceLeft && x.ContractLeft) ||
(x.ContractPerson && !x.InsurancePerson && x.ContractLeft) ||
(x.InsurancePerson && !x.ContractPerson && x.InsuranceLeft))
? true
: false,
LastStartContractWork = x.LastStartContractWork,
LastLeftContractWork = x.LastLeftContractWork,
LastStartInsuranceWork = x.LastStartInsuranceWork,
@@ -539,14 +548,11 @@ public class WorkshopAppliction : IWorkshopApplication
{
workshop.DeActive(workshop.ArchiveCode);
_workshopRepository.SaveChanges();
return opration.Succcedded(id,"عملیت با موفقیت انجام شد");
return opration.Succcedded(id, "عملیت با موفقیت انجام شد");
}
//var s = workshop.ArchiveCode;
}
public WorkshopViewModel GetWorkshopInfo(long id)
@@ -569,10 +575,8 @@ public class WorkshopAppliction : IWorkshopApplication
#region client
public OperationResult Remove(long id)
{
var opration = new OperationResult();
bool result = _workshopRepository.Remove(id);
@@ -583,14 +587,15 @@ public class WorkshopAppliction : IWorkshopApplication
}
else
return opration.Failed("حذف با خطا مواجه نشد");
return opration;
return opration;
}
public List<WorkshopViewModel> GetWorkshopByTextSearchForClient(string textSearch)
{
return _workshopRepository.GetWorkshopByTextSearchForClient(textSearch);
}
public List<WorkshopViewModel> SearchForClient(WorkshopSearchModel searchModel)
{
return _workshopRepository.SearchForClient(searchModel);
@@ -598,12 +603,12 @@ public class WorkshopAppliction : IWorkshopApplication
public OperationResult CreateForClient(CreateWorkshop command)
{
throw new NotImplementedException();
throw new NotImplementedException();
}
public OperationResult EditForClient(EditWorkshop command)
{
throw new NotImplementedException();
throw new NotImplementedException();
}
//public OperationResult CreateForClient(CreateWorkshop command)
//{
@@ -664,7 +669,6 @@ public class WorkshopAppliction : IWorkshopApplication
// _workshopRepository.SaveChanges();
// foreach (var e in employer)
// {
// _workshopRepository.EmployerWorkshop(workshop.id, e);
@@ -674,7 +678,6 @@ public class WorkshopAppliction : IWorkshopApplication
// _workshopRepository.CreateWorkshopAccounts(accountIds, workshop.id);
// return operation.Succcedded();
@@ -763,6 +766,7 @@ public class WorkshopAppliction : IWorkshopApplication
{
return _workshopRepository.GetWorkshopAccountByAcountID(acountID);
}
public bool CheckAccountWorkshop(long workshopId)
{
return _workshopRepository.CheckAccountWorkshop(workshopId);
@@ -776,17 +780,13 @@ public class WorkshopAppliction : IWorkshopApplication
#endregion
#region NewByHeydari
public List<WorkshopViewModel> GetWorkshopByTextSearch(string searchText)
{
return _workshopRepository.GetWorkshopByTextSearch(searchText);
}
public List<WorkshopViewModel> SearchForMain(WorkshopSearchModel searchModel)
{
return _workshopRepository.SearchForMain(searchModel);
@@ -803,7 +803,8 @@ public class WorkshopAppliction : IWorkshopApplication
//var workshopObj = _workshopRepository.Get(id);
//workshopObj.DeActive(workshopObj.ArchiveCode);
//_workshopRepository.SaveChanges();
return _workshopRepository.DeActiveAll(id); ;
return _workshopRepository.DeActiveAll(id);
;
}
else
{
@@ -818,6 +819,7 @@ public class WorkshopAppliction : IWorkshopApplication
return opration;
}
public OperationResult ActiveAll(long id)
{
return _workshopRepository.ActiveAll(id);
@@ -829,7 +831,6 @@ public class WorkshopAppliction : IWorkshopApplication
}
public AccountViewModel GetClientAccountByWorkshopId(long workshopId)
{
var contractingParty = _workshopRepository.GetPersonalContractingPartyByWorkshopId(workshopId);
@@ -837,7 +838,6 @@ public class WorkshopAppliction : IWorkshopApplication
}
//public List<ConnectedPersonnelViewModel> GetConnectedPersonnelsForMain(long workshopId)
//{
// return _workshopRepository.GetConnectedPersonnelsForMain(workshopId);
@@ -847,9 +847,9 @@ public class WorkshopAppliction : IWorkshopApplication
#region Pooya
public List<PersonnelInfoViewModel> GetPersonnelInfoRemastered(PersonnelInfoSearchModel searchModel)
{
var res = _workshopRepository.GetPersonnelInfoRemastered(searchModel.WorkshopId);
res = res.Select(x => new PersonnelInfoViewModel
{
@@ -900,23 +900,24 @@ public class WorkshopAppliction : IWorkshopApplication
res = res.Where(x => x.MaritalStatus == searchModel.MaritalStatus).ToList();
return res;
}
#endregion
#region Insurance
public List<WorkshopViewModel> GetWorkshopSelectListInsuransce()
{
return _workshopRepository.GetWorkshopSelectListInsuransce();
}
{
return _workshopRepository.GetWorkshopSelectListInsuransce();
}
#endregion
#region Mahan
public async Task<List<WorkshopWithStartedEmployeesDto>> GetWorkshopsForEmployeeStartWork(long accountId)
{
return await _workshopRepository.GetWorkshopsForEmployeeStartWork(accountId);
}
public async Task<int> GetWorkshopsForEmployeeStartWorkCount(long accountId)
@@ -939,8 +940,180 @@ public class WorkshopAppliction : IWorkshopApplication
return await _workshopRepository.GetSelectList(search, id);
}
public async Task<ActionResult<OperationResult>> CreateWorkshopWorkflowRegistration(
CreateWorkshopWorkflowRegistration command)
{
bool createPlanValidations = false;
var operation = new OperationResult();
var transaction = await _workshopRepository.BeginTransactionAsync();
var contractWorkshopDetail =
await _institutionContractRepository.GetInstitutionWorkshopDetails(command
.InstitutionContractWorkshopDetailId);
if (contractWorkshopDetail == null)
return operation.Failed("جزئیات قرارداد موسسه یافت نشد");
var employerIds = contractWorkshopDetail.Employers.Select(x => x.EmployerId).ToList();
if (employerIds.Count == 0)
return operation.Failed("لطفا کارفرما را انتخاب نمایید");
if (!string.IsNullOrEmpty(command.TypeOfInsuranceSend) && command.TypeOfInsuranceSend != "false" &&
string.IsNullOrEmpty(command.InsuranceCode))
return operation.Failed("لطفا کد بیمه کارگاه را وارد کنید");
if (string.IsNullOrEmpty(command.WorkshopName) || string.IsNullOrEmpty(command.ArchiveCode))
return operation.Failed("موارد اجباری را پر کنید");
//if (_workshopRepository.Exists(x => x.WorkshopName == command.WorkshopName))
// return operation.Failed("نام کارگاه تکراری است");
if (command.ContractTerm != "1" && command.ContractTerm != "ForEver" &&
(command.CutContractEndOfYear != IsActive.False && command.CutContractEndOfYear != IsActive.True))
return operation.Failed("لطفا تیک قرداداد منتهی به پایان سال را تعیین وضعیت کنید");
if (command.ContractTerm == "1" && command.ContractTerm == "ForEver")
command.CutContractEndOfYear = IsActive.None;
if (!command.CreateContract)
{
command.SignContract = false;
command.CreateCheckout = false;
command.SignCheckout = false;
}
if (!command.CreateCheckout)
{
command.SignCheckout = false;
}
if (_workshopRepository.Exists(x =>
!string.IsNullOrEmpty(x.InsuranceCode) && x.InsuranceCode == command.InsuranceCode))
return operation.Failed("کد بیمه کارگاه تکراری است");
if (!string.IsNullOrEmpty(command.Address) && string.IsNullOrEmpty(command.Province))
return operation.Failed("لطفا استان و شهر را انتخاب کنید");
if ((!string.IsNullOrEmpty(command.Address) && !string.IsNullOrEmpty(command.Province)) &&
command.City == "شهرستان")
return operation.Failed("لطفا شهر را انتخاب کنید");
if (string.IsNullOrEmpty(command.Address) && !string.IsNullOrEmpty(command.Province))
return operation.Failed("لطفا آدرس را وارد کنید");
if (command.FixedSalary)
{
if (command.InsuranceJobId == 0 || command.InsuranceJobId == null)
return operation.Failed("لطفا صنف را انتخاب کنید");
if (string.IsNullOrWhiteSpace(command.Population))
return operation.Failed("لطفا جمعیت شهر را انتخاب کنید");
}
// if (command.IsClassified)
// {
// if (string.IsNullOrWhiteSpace(command.CreatePlan.ExecutionDateFa) ||
// command.CreatePlan.ExecutionDateFa.Length < 10)
// return operation.Failed("تاریخ اجرای طرح را بصورت صحیح وارد کنید");
// if (string.IsNullOrWhiteSpace(command.CreatePlan.IncludingDateFa) ||
// command.CreatePlan.IncludingDateFa.Length < 10)
// return operation.Failed("تاریخ شمول طرح را بصورت صحیح وارد کنید");
// var groupCounter = 0;
// // var planEmployeeCounter = command.CreatePlan.EditWorkshopPlanEmployeeList == null ? 0 : command.CreatePlan.EditWorkshopPlanEmployeeList.Count;
// for (int i = 0; i <= command.CreatePlan.EditGroupPlanlist.Count - 1; i++)
// {
// if (!string.IsNullOrWhiteSpace(command.CreatePlan.EditGroupPlanlist[i].AnnualSalaryStr)
// && !string.IsNullOrWhiteSpace(command.CreatePlan.EditGroupPlanlist[i].BaseSalaryStr)
// && !string.IsNullOrWhiteSpace(command.CreatePlan.EditGroupPlanlist[i].JobSalaryStr)
// && command.CreatePlan.EditGroupPlanlist[i].JobIdList.Count > 0)
// {
// groupCounter += 1;
//
// }
// }
//
// if (groupCounter >= 1)
// {
// createPlanValidations = true;
//
// }
// else
// {
// createPlanValidations = false;
// return operation.Failed("وارد کردن اطلاعات تمامی گروه ها الزامی است");
// }
// }
//if (string.IsNullOrWhiteSpace(command.TypeOfInsuranceSend))
// return operation.Failed("لطفا نوع ارسال لیست بیمه را مشخص کنید");
var account = new AccountViewModel();
var institutionContract = new InstitutionContract();
if (command.HasRollCallFreeVip == "true")
{
institutionContract = _institutionContractRepository.Get(contractWorkshopDetail.InstitutionContractId);
if (institutionContract == null)
return operation.Failed("بدلیل نداشتن قرار داد مالی نمیتوانید سرویس حضور غیاب را فعال کنید");
account = _personalContractingPartyRepository.GetAccountByPersonalContractingParty(institutionContract
.ContractingPartyId);
if (account == null || account.ClientAreaPermission != "true")
return operation.Failed("بدلیل نداشتن حساب کاربری کلاینت نمیتوانید سرویس حضور غیاب را فعال کنید");
}
var workshop = new Workshop(command.WorkshopName, command.SureName, command.InsuranceCode,
command.TypeOfOwnership,
command.ArchiveCode, command.AgentName, command.AgentPhone, command.Province, command.City,
command.Address,
command.TypeOfInsuranceSend, command.TypeOfContract, command.ContractTerm, command.AgreementNumber
, command.FixedSalary, command.Population, command.InsuranceJobId, null, false,
command.AddYearsPay, command.AddLeavePay, command.TotalPaymentHide, false,
command.ComputeOptions,
command.BonusesOptions, command.YearsOptions, command.HasRollCallFreeVip, command.OpenInHolidays,
command.InsuranceCheckoutOvertime, command.InsuranceCheckoutFamilyAllowance, command.CreateContract,
command.SignContract,
command.CreateCheckout, command.SignCheckout, command.CutContractEndOfYear, command.RotatingShiftCompute,
command.IsStaticCheckout, institutionContract.ContractingPartyId);
await _workshopRepository.CreateAsync(workshop);
await _workshopRepository.SaveChangesAsync();
if (command.HasRollCallFreeVip == "true")
{
var commandSave = new CreateRollCallService()
{
AccountId = account.Id,
WorkshopId = workshop.id,
ServiceType = "vip",
EndService = institutionContract.ContractEndGr,
Amount = 1000,
MaxPersonValid = 500,
Duration = "12",
HasCustomizeCheckoutService = command.HasCustomizeCheckoutService
};
_rollCallServiceApplication.Create(commandSave);
}
foreach (var e in employerIds)
{
_workshopRepository.EmployerWorkshop(workshop.id, e);
}
var accountIds = StaticWorkshopAccounts.StaticAccountIds.ToList();
accountIds.Add(command.SeniorContractAccountId);
accountIds.Add(command.JuniorContractAccountId);
accountIds.Add(command.SeniorInsuranceAccountId);
accountIds.Add(command.JuniorInsuranceAccountId);
var op = _workshopRepository.CreateAccountLeftWorkAndWorkshopAccounts(accountIds.Distinct().ToList(),
workshop.id);
if (!op.IsSuccedded)
return op;
await transaction.CommitAsync();
return operation.Succcedded();
}
#endregion
}

View File

@@ -1553,6 +1553,12 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
return (listStatus, isExpier);
}
public async Task<InstitutionContractWorkshopDetail> GetInstitutionWorkshopDetails(long institutionWorkshopDetailsId)
{
return await _context.InstitutionContractWorkshopDetails.FirstOrDefaultAsync(x =>
x.id == institutionWorkshopDetailsId);
}
#endregion
@@ -1567,5 +1573,7 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
}
#endregion
}

View File

@@ -1,6 +1,9 @@
using CompanyManagment.App.Contracts.AdminMonthlyOverview;
using _0_Framework.Application;
using CompanyManagment.App.Contracts.AdminMonthlyOverview;
using CompanyManagment.App.Contracts.Employer;
using CompanyManagment.App.Contracts.InstitutionContract;
using CompanyManagment.App.Contracts.TemporaryClientRegistration;
using CompanyManagment.App.Contracts.Workshop;
using Microsoft.AspNetCore.Mvc;
using ServiceHost.BaseControllers;
@@ -9,12 +12,18 @@ namespace ServiceHost.Areas.Admin.Controllers
public class RegistrationWorkflowController : AdminBaseController
{
private readonly ITemporaryClientRegistrationApplication _temporaryClientRegistrationApplication;
protected readonly IInstitutionContractApplication _institutionContractApplication;
private readonly IInstitutionContractApplication _institutionContractApplication;
private readonly IEmployerApplication _employerApplication;
private readonly IWorkshopApplication _workshopApplication;
public RegistrationWorkflowController(ITemporaryClientRegistrationApplication temporaryClientRegistrationApplication, IInstitutionContractApplication institutionContractApplication)
public RegistrationWorkflowController(ITemporaryClientRegistrationApplication temporaryClientRegistrationApplication,
IInstitutionContractApplication institutionContractApplication, IEmployerApplication employerApplication, IWorkshopApplication workshopApplication)
{
_temporaryClientRegistrationApplication = temporaryClientRegistrationApplication;
_institutionContractApplication = institutionContractApplication;
_employerApplication = employerApplication;
_workshopApplication = workshopApplication;
}
/// <summary>
@@ -35,5 +44,19 @@ namespace ServiceHost.Areas.Admin.Controllers
var result = await _institutionContractApplication.RegistrationWorkflowItems(institutionContractId);
return result;
}
[HttpPost("create-employer")]
public async Task<ActionResult<OperationResult>> CreateEmployerForWorkshopDetails(CreateEmployerWorkflowRegistration command)
{
var result = await _employerApplication.CreateWorkflowRegistration(command);
return result;
}
[HttpPost("create-workshop")]
public async Task<ActionResult<OperationResult>> CreateWorkshop(
CreateWorkshopWorkflowRegistration command)
{
var result = await _workshopApplication.CreateWorkshopWorkflowRegistration(command);
return result;
}
}
}

View File

@@ -609,8 +609,7 @@ public class institutionContractController : AdminBaseController
public async Task<ActionResult<InstitutionPlanCalculatorResponse>> InstitutionPlanCalculator(
[FromBody] InstitutionPlanCalculatorRequest request)
{
var res = await _temporaryClientRegistration.GetTotalPaymentAndWorkshopList(0,
request.workshopList, contractStartType: request.ContractStartType,duration:request.Duration);
var res = await _temporaryClientRegistration.GetTotalPaymentAndWorkshopList(0, request.TotalAmountMonth,duration: request.Duration, contractStartType: request.ContractStartType);
var response = new InstitutionPlanCalculatorResponse
{
Installments = res.MonthlyInstallments,
@@ -680,7 +679,7 @@ public class WorkshopServiceCalculatorResponse
public string TotalAmount { get; set; }
}
public record InstitutionPlanCalculatorRequest(List<WorkshopTempViewModel> workshopList,
public record InstitutionPlanCalculatorRequest(double TotalAmountMonth,
InstitutionContractDuration Duration = InstitutionContractDuration.TwelveMonths,
string PaymentModel = "OneTime",
string ContractStartType = "currentMonth");