merge from master
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
using _0_Framework.Domain;
|
||||
using CompanyManagment.App.Contracts.InstitutionPlan;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Company.Domain.InstitutionPlanAgg;
|
||||
|
||||
public interface IPlanPercentageRepository : IRepository<long, PlanPercentage>
|
||||
{
|
||||
EditInstitutionPlanPercentage GetById(long id);
|
||||
|
||||
EditInstitutionPlanPercentage GetByFirst();
|
||||
|
||||
/// <summary>
|
||||
/// دریافت لیست 30 تایی مبالغ سرویس ها به ازای هر نفر
|
||||
/// </summary>
|
||||
/// <param name="pageIndex"></param>
|
||||
/// <param name="countPeron"></param>
|
||||
/// <returns></returns>
|
||||
List<InstitutionPlanViewModel> GetInstitutionPlanList(int pageIndex, int countPeron);
|
||||
}
|
||||
65
Company.Domain/InstitutionPlanAgg/PlanPercentage.cs
Normal file
65
Company.Domain/InstitutionPlanAgg/PlanPercentage.cs
Normal file
@@ -0,0 +1,65 @@
|
||||
using _0_Framework.Domain;
|
||||
|
||||
namespace Company.Domain.InstitutionPlanAgg;
|
||||
|
||||
public class PlanPercentage : EntityBaseWithoutCreationDate
|
||||
{
|
||||
public PlanPercentage(int contractAndCheckoutPercent, int insurancePercent, int rollCallPercent, int customizeCheckoutPercent, int contractAndCheckoutInPersonPercent, int insuranceInPersonPercent)
|
||||
{
|
||||
ContractAndCheckoutPercent = contractAndCheckoutPercent;
|
||||
InsurancePercent = insurancePercent;
|
||||
RollCallPercent = rollCallPercent;
|
||||
CustomizeCheckoutPercent = customizeCheckoutPercent;
|
||||
ContractAndCheckoutInPersonPercent = contractAndCheckoutInPersonPercent;
|
||||
InsuranceInPersonPercent = insuranceInPersonPercent;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// قرارداد و تصفیه
|
||||
/// درصد از مزد روزانه
|
||||
/// </summary>
|
||||
public int ContractAndCheckoutPercent { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// بیمه
|
||||
/// درصد از مزد روزانه
|
||||
/// </summary>
|
||||
public int InsurancePercent { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// حضورغباب
|
||||
/// درصد از مزد روزانه
|
||||
/// </summary>
|
||||
public int RollCallPercent { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// فیش غیر رسمی
|
||||
/// درصد از مزد روزانه
|
||||
/// </summary>
|
||||
public int CustomizeCheckoutPercent { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// خدمات حضوری قرداد و تصفیه
|
||||
/// درصد از مزد روزانه
|
||||
/// </summary>
|
||||
public int ContractAndCheckoutInPersonPercent { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// خدمات حضوری بیمه
|
||||
/// درصد از مزد روزانه
|
||||
/// </summary>
|
||||
public int InsuranceInPersonPercent { get; private set; }
|
||||
|
||||
|
||||
public void Edit(int contractAndCheckoutPercent, int insurancePercent, int rollCallPercent, int customizeCheckoutPercent, int contractAndCheckoutInPersonPercent, int insuranceInPersonPercent)
|
||||
{
|
||||
ContractAndCheckoutPercent = contractAndCheckoutPercent;
|
||||
InsurancePercent = insurancePercent;
|
||||
RollCallPercent = rollCallPercent;
|
||||
CustomizeCheckoutPercent = customizeCheckoutPercent;
|
||||
ContractAndCheckoutInPersonPercent = contractAndCheckoutInPersonPercent;
|
||||
InsuranceInPersonPercent = insuranceInPersonPercent;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -91,6 +91,10 @@ public class ContractingPartyTemp : EntityBase
|
||||
/// </summary>
|
||||
public string Address { get; private set; }
|
||||
|
||||
|
||||
|
||||
public void UpdateAddress(string state, string city, string address)
|
||||
{
|
||||
this.State = state;
|
||||
this.City = city;
|
||||
this.Address = address;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using _0_Framework.Domain;
|
||||
|
||||
namespace Company.Domain.TemporaryClientRegistrationAgg;
|
||||
|
||||
public interface IWorkshopServicesTempRepository : IRepository<long, WorkshopServicesTemp>
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using _0_Framework.Domain;
|
||||
using CompanyManagment.App.Contracts.TemporaryClientRegistration;
|
||||
|
||||
namespace Company.Domain.TemporaryClientRegistrationAgg;
|
||||
|
||||
public interface IWorkshopTempRepository : IRepository<long, WorkshopTemp>
|
||||
{
|
||||
/// <summary>
|
||||
/// دریافت کارگاه های ذخیره شده
|
||||
/// </summary>
|
||||
/// <param name="contractingPartyTemp"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<WorkshopTempViewModel>> GetWorkshopTemp(long contractingPartyTemp);
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
using _0_Framework.Domain;
|
||||
|
||||
namespace Company.Domain.TemporaryClientRegistrationAgg;
|
||||
|
||||
public class WorkshopServicesTemp : EntityBase
|
||||
{
|
||||
public WorkshopServicesTemp(string serviceName, int countPerson, long workshopTempId)
|
||||
{
|
||||
ServiceName = serviceName;
|
||||
CountPerson = countPerson;
|
||||
WorkshopTempId = workshopTempId;
|
||||
}
|
||||
/// <summary>
|
||||
/// نام سرویس
|
||||
/// </summary>
|
||||
public string ServiceName { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// تعداد پرسنل
|
||||
/// </summary>
|
||||
public int CountPerson { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// آی دی کارگاه موقت
|
||||
/// </summary>
|
||||
public long WorkshopTempId { get; private set; }
|
||||
|
||||
public WorkshopTemp WorkshopTemp { get; private set; }
|
||||
|
||||
public void UpdateService(int countPerson)
|
||||
{
|
||||
this.CountPerson = countPerson;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
using System.Collections.Generic;
|
||||
using _0_Framework.Domain;
|
||||
|
||||
namespace Company.Domain.TemporaryClientRegistrationAgg;
|
||||
|
||||
public class WorkshopTemp : EntityBase
|
||||
{
|
||||
public WorkshopTemp(string workshopName, int countPerson, long contractingPartyTempId, double workshopServicesAmount)
|
||||
{
|
||||
WorkshopName = workshopName;
|
||||
CountPerson = countPerson;
|
||||
ContractingPartyTempId = contractingPartyTempId;
|
||||
WorkshopServicesAmount = workshopServicesAmount;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// نام کارگاه
|
||||
/// </summary>
|
||||
public string WorkshopName { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// تعداد پرسنل
|
||||
/// </summary>
|
||||
public int CountPerson { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// ای دی طرف حساب
|
||||
/// </summary>
|
||||
public long ContractingPartyTempId { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// جمع کل مبالغ سرویس ها برای کارگاه
|
||||
/// </summary>
|
||||
public double WorkshopServicesAmount { get; private set; }
|
||||
|
||||
public List<WorkshopServicesTemp> WorkshopServicesTemps { get; private set; }
|
||||
|
||||
|
||||
|
||||
public void Edit(string workshopName, int countPerson, double workshopServicesAmount)
|
||||
{
|
||||
this.WorkshopName = workshopName;
|
||||
this.CountPerson = countPerson;
|
||||
this.WorkshopServicesAmount = workshopServicesAmount;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -152,14 +152,14 @@ public class CustomizeCheckoutMandatoryViewModel
|
||||
/// مجموع مطالبات
|
||||
/// </summary>
|
||||
public double TotalClaimsDouble => MonthlySalary + FridayPay + OverTimePay + BaseYearsPay + BonusesPay + NightWorkPay +
|
||||
MarriedAllowance + ShiftPay + FamilyAllowance + LeavePay + RewardPay;
|
||||
MarriedAllowance + ShiftPay + FamilyAllowance + LeavePay + RewardPay;
|
||||
|
||||
/// <summary>
|
||||
/// مجموع کسورات
|
||||
/// </summary>
|
||||
public double TotalDeductionsDouble => FineAbsenceDeduction + InsuranceDeduction + LateToWorkDeduction +
|
||||
EarlyExitDeduction + SalaryAidDeduction + InstallmentDeduction +
|
||||
FineDeduction + TaxDeduction;
|
||||
EarlyExitDeduction + SalaryAidDeduction + InstallmentDeduction +
|
||||
FineDeduction + TaxDeduction;
|
||||
|
||||
/// <summary>
|
||||
/// مجموع مطالبات
|
||||
@@ -174,7 +174,7 @@ public class CustomizeCheckoutMandatoryViewModel
|
||||
/// <summary>
|
||||
/// مجموع پرداختی
|
||||
/// </summary>
|
||||
public double TotalPayment => TotalClaimsDouble - TotalDeductionsDouble;
|
||||
public double TotalPayment => Math.Truncate(TotalClaimsDouble - TotalDeductionsDouble);
|
||||
|
||||
#region Employee Information
|
||||
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
using _0_Framework.Domain;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.InstitutionPlan;
|
||||
|
||||
public class CreateInstitutionPlanPercentage : EntityBase
|
||||
{
|
||||
/// <summary>
|
||||
/// قرارداد و تصفیه
|
||||
/// درصد از مزد روزانه
|
||||
/// </summary>
|
||||
public int ContractAndCheckoutPercent { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// بیمه
|
||||
/// درصد از مزد روزانه
|
||||
/// </summary>
|
||||
public int InsurancePercent { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// حضورغباب
|
||||
/// درصد از مزد روزانه
|
||||
/// </summary>
|
||||
public int RollCallPercent { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// فیش غیر رسمی
|
||||
/// درصد از مزد روزانه
|
||||
/// </summary>
|
||||
public int CustomizeCheckoutPercent { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// خدمات حضوری قرداد و تصفیه
|
||||
/// درصد از مزد روزانه
|
||||
/// </summary>
|
||||
public int ContractAndCheckoutInPersonPercent { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// خدمات حضوری بیمه
|
||||
/// درصد از مزد روزانه
|
||||
/// </summary>
|
||||
public int InsuranceInPersonPercent { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// قرارداد و تصفیه
|
||||
/// درصد از مزد روزانه
|
||||
/// string
|
||||
/// </summary>
|
||||
public string ContractAndCheckoutPercentStr { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// بیمه
|
||||
/// درصد از مزد روزانه
|
||||
/// string
|
||||
/// </summary>
|
||||
public string InsurancePercentStr { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// حضورغباب
|
||||
/// درصد از مزد روزانه
|
||||
/// string
|
||||
/// </summary>
|
||||
public string RollCallPercentStr { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// فیش غیر رسمی
|
||||
/// درصد از مزد روزانه
|
||||
/// string
|
||||
/// </summary>
|
||||
public string CustomizeCheckoutPercentStr { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// خدمات حضوری قرداد و تصفیه
|
||||
/// درصد از مزد روزانه
|
||||
/// string
|
||||
/// </summary>
|
||||
public string ContractAndCheckoutInPersonPercentStr { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// خدمات حضوری بیمه
|
||||
/// درصد از مزد روزانه
|
||||
/// string
|
||||
/// </summary>
|
||||
public string InsuranceInPersonPercentStr { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace CompanyManagment.App.Contracts.InstitutionPlan;
|
||||
|
||||
public class EditInstitutionPlanPercentage : CreateInstitutionPlanPercentage
|
||||
{
|
||||
public long Id { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
using System.Collections.Generic;
|
||||
using _0_Framework.Application;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.InstitutionPlan;
|
||||
|
||||
public interface IInstitutionPlanApplication
|
||||
{
|
||||
/// <summary>
|
||||
/// ایجاد یا ویرایش درصد پلن ها
|
||||
/// </summary>
|
||||
/// <param name="command"></param>
|
||||
/// <returns></returns>
|
||||
OperationResult CreateInstitutionPlanPercentage(CreateInstitutionPlanPercentage command);
|
||||
|
||||
/// <summary>
|
||||
/// دریافت لیست 30 تایی مبالغ سرویس ها به ازای هر نفر
|
||||
/// </summary>
|
||||
/// <param name="pageIndex"></param>
|
||||
/// <param name="countPeron"></param>
|
||||
/// <returns></returns>
|
||||
List<InstitutionPlanViewModel> GetInstitutionPlanList(int pageIndex, int countPeron);
|
||||
|
||||
/// <summary>
|
||||
/// دریافت درصد ها برای لود در مودال ایجاد
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
EditInstitutionPlanPercentage GetByFirst();
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
namespace CompanyManagment.App.Contracts.InstitutionPlan;
|
||||
|
||||
public class InstitutionPlanViewModel
|
||||
{
|
||||
/// <summary>
|
||||
/// تعداد پرسنل
|
||||
/// </summary>
|
||||
public int CountPerson { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// مبلغ قرارداد و تصفیه
|
||||
/// </summary>
|
||||
public string ContractAndCheckout{ get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// مبلغ بیمه
|
||||
/// </summary>
|
||||
public string Insurance { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// مبلغ حضورغباب
|
||||
/// </summary>
|
||||
public string RollCall { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// مبلغ فیش غیر رسمی
|
||||
/// </summary>
|
||||
public string CustomizeCheckout { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// مبلغ خدمات حضوری قرداد و تصفیه
|
||||
/// </summary>
|
||||
public string ContractAndCheckoutInPerson { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// مبلغ خدمات حضوری بیمه
|
||||
/// </summary>
|
||||
public string InsuranceInPerson { get; set; }
|
||||
|
||||
|
||||
#region Double
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// مبلغ قرارداد و تصفیه
|
||||
/// Double
|
||||
/// </summary>
|
||||
public double ContractAndCheckoutDouble { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// مبلغ بیمه
|
||||
/// Double
|
||||
/// </summary>
|
||||
public double InsuranceDouble { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// مبلغ حضورغباب
|
||||
/// Double
|
||||
/// </summary>
|
||||
public double RollCallDouble { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// مبلغ فیش غیر رسمی
|
||||
/// Double
|
||||
/// </summary>
|
||||
public double CustomizeCheckoutDouble { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// مبلغ خدمات حضوری قرداد و تصفیه
|
||||
/// Double
|
||||
/// </summary>
|
||||
public double ContractAndCheckoutInPersonDouble { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// مبلغ خدمات حضوری بیمه
|
||||
/// Double
|
||||
/// </summary>
|
||||
public double InsuranceInPersonDouble { get; set; }
|
||||
#endregion
|
||||
|
||||
|
||||
#region Total
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// مبلغ کل خدمات حضوری
|
||||
/// </summary>
|
||||
public string InPersonSumAmountStr { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// مبلغ کل خدمات آنلاین
|
||||
/// </summary>
|
||||
public string OnlineOnlySumAmountStr { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// مبلغ کل خدمات حضوری و آنلاین
|
||||
/// </summary>
|
||||
public string OnlineAndInPersonSumAmountStr { get; set; }
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -4,4 +4,7 @@ public enum RewardType
|
||||
{
|
||||
None,
|
||||
CreatedByCheckoutForBirthDay,
|
||||
Eid,
|
||||
SinzdahBedar,
|
||||
ChahardahFarvardin
|
||||
}
|
||||
@@ -6,4 +6,24 @@ public class ShiftList
|
||||
{
|
||||
public DateTime Start { get; set; }
|
||||
public DateTime End { get; set; }
|
||||
/// <summary>
|
||||
/// تاخیر در ورود (مدت زمانی که کارمند با تأخیر وارد شده است)
|
||||
/// </summary>
|
||||
public TimeSpan LateEntryDuration { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// تعجیل در ورود (مدت زمانی که کارمند زودتر از زمان مشخص وارد شده است)
|
||||
/// </summary>
|
||||
public TimeSpan EarlyEntryDuration { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// تاخیر در خروج (مدت زمانی که کارمند با تأخیر از کار خارج شده است)
|
||||
/// </summary>
|
||||
public TimeSpan LateExitDuration { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// تعجیل در خروج (مدت زمانی که کارمند زودتر از زمان مشخص از کار خارج شده است)
|
||||
/// </summary>
|
||||
public TimeSpan EarlyExitDuration { get; set; }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
namespace CompanyManagment.App.Contracts.TemporaryClientRegistration;
|
||||
|
||||
public class CreateWorkshopServicesTemp
|
||||
{
|
||||
/// <summary>
|
||||
/// نام سرویس
|
||||
/// </summary>
|
||||
public string ServiceName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// تعداد پرسنل
|
||||
/// </summary>
|
||||
public int CountPerson { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// آی دی کارگاه موقت
|
||||
/// </summary>
|
||||
public long WorkshopTempId { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
namespace CompanyManagment.App.Contracts.TemporaryClientRegistration;
|
||||
|
||||
public class CreateWorkshopTemp
|
||||
{
|
||||
/// <summary>
|
||||
/// نام کارگاه
|
||||
/// </summary>
|
||||
public string WorkshopName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// تعداد پرسنل
|
||||
/// </summary>
|
||||
public int CountPerson { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// ای دی طرف حساب
|
||||
/// </summary>
|
||||
public long ContractingPartyTempId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// جمع کل مبالغ سرویس ها برای کارگاه
|
||||
/// Double
|
||||
/// </summary>
|
||||
public double WorkshopServicesAmount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// جمع کل مبالغ سرویس ها برای کارگاه
|
||||
/// فارسی
|
||||
/// </summary>
|
||||
public string WorkshopServicesAmountStr { get; set; }
|
||||
|
||||
|
||||
#region ServiceSelection
|
||||
|
||||
/// <summary>
|
||||
/// قرارداد و تصفیه
|
||||
/// </summary>
|
||||
public bool ContractAndCheckout { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// بیمه
|
||||
/// </summary>
|
||||
public bool Insurance { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// حضورغباب
|
||||
/// </summary>
|
||||
public bool RollCall { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// فیش غیر رسمی
|
||||
/// </summary>
|
||||
public bool CustomizeCheckout { get; set; }
|
||||
|
||||
///// <summary>
|
||||
///// خدمات حضوری قرداد و تصفیه
|
||||
///// </summary>
|
||||
//public bool ContractAndCheckoutInPersonPercent { get; set; }
|
||||
|
||||
///// <summary>
|
||||
///// خدمات حضوری بیمه
|
||||
///// </summary>
|
||||
//public bool InsuranceInPersonPercent { get; set; }
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1,9 +1,34 @@
|
||||
using System.Threading.Tasks;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using _0_Framework.Application;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.TemporaryClientRegistration;
|
||||
|
||||
public interface ITemporaryClientRegistrationApplication
|
||||
{
|
||||
/// <summary>
|
||||
/// احراز هویت
|
||||
/// </summary>
|
||||
/// <param name="nationalCode"></param>
|
||||
/// <param name="dateOfBirth"></param>
|
||||
/// <param name="mobile"></param>
|
||||
/// <returns></returns>
|
||||
Task<OperationResult<ContractingPartyTempViewModel>> CreateContractingPartyTemp(string nationalCode, string dateOfBirth, string mobile);
|
||||
|
||||
/// <summary>
|
||||
/// تکمیل اطلاعات
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="state"></param>
|
||||
/// <param name="city"></param>
|
||||
/// <param name="address"></param>
|
||||
/// <returns></returns>
|
||||
Task<OperationResult> UpdateAddress(long id, string state, string city, string address);
|
||||
|
||||
/// <summary>
|
||||
/// دریافت کارگاه های ذخیره شده
|
||||
/// </summary>
|
||||
/// <param name="contractingPartyTemp"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<WorkshopTempViewModel>> GetWorkshopTemp(long contractingPartyTemp);
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace CompanyManagment.App.Contracts.TemporaryClientRegistration;
|
||||
|
||||
public class WorkshopServicesTempViewModel
|
||||
{
|
||||
public long Id { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace CompanyManagment.App.Contracts.TemporaryClientRegistration;
|
||||
|
||||
public class WorkshopTempViewModel : CreateWorkshopTemp
|
||||
{
|
||||
public long Id { get; set; }
|
||||
}
|
||||
81
CompanyManagment.Application/InstitutionPlanApplication.cs
Normal file
81
CompanyManagment.Application/InstitutionPlanApplication.cs
Normal file
@@ -0,0 +1,81 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using _0_Framework.Application;
|
||||
using Company.Domain.InstitutionPlanAgg;
|
||||
using CompanyManagment.App.Contracts.InstitutionPlan;
|
||||
|
||||
namespace CompanyManagment.Application;
|
||||
|
||||
public class InstitutionPlanApplication : IInstitutionPlanApplication
|
||||
{
|
||||
private readonly IPlanPercentageRepository _planPercentageRepository;
|
||||
|
||||
|
||||
public InstitutionPlanApplication(IPlanPercentageRepository planPercentageRepository)
|
||||
{
|
||||
_planPercentageRepository = planPercentageRepository;
|
||||
}
|
||||
|
||||
public OperationResult CreateInstitutionPlanPercentage(CreateInstitutionPlanPercentage command)
|
||||
{
|
||||
var op = new OperationResult();
|
||||
if (string.IsNullOrWhiteSpace(command.ContractAndCheckoutInPersonPercentStr) || command.ContractAndCheckoutInPersonPercentStr == "0" ||
|
||||
string.IsNullOrWhiteSpace(command.ContractAndCheckoutPercentStr) || (command.ContractAndCheckoutPercentStr == "0" ||
|
||||
string.IsNullOrWhiteSpace(command.CustomizeCheckoutPercentStr) || command.CustomizeCheckoutPercentStr == "0" ||
|
||||
string.IsNullOrWhiteSpace(command.InsuranceInPersonPercentStr) || command.InsuranceInPersonPercentStr == "0" ||
|
||||
string.IsNullOrWhiteSpace(command.InsurancePercentStr) || command.InsurancePercentStr == "0" ||
|
||||
string.IsNullOrWhiteSpace(command.RollCallPercentStr) || command.RollCallPercentStr == "0"))
|
||||
return op.Failed("هیچ یک از فیلدها نمیتوانند صفر باشند");
|
||||
|
||||
int contractAndCheckoutInPersonPercent = 0;
|
||||
int contractAndCheckoutPercent = 0;
|
||||
int customizeCheckoutPercent = 0;
|
||||
int insuranceInPersonPercent = 0;
|
||||
int insurancePercent = 0;
|
||||
int rollCallPercent = 0;
|
||||
|
||||
try
|
||||
{
|
||||
contractAndCheckoutInPersonPercent = Convert.ToInt32(command.ContractAndCheckoutInPersonPercentStr);
|
||||
contractAndCheckoutPercent = Convert.ToInt32(command.ContractAndCheckoutPercentStr);
|
||||
customizeCheckoutPercent = Convert.ToInt32(command.CustomizeCheckoutPercentStr);
|
||||
insuranceInPersonPercent = Convert.ToInt32(command.InsuranceInPersonPercentStr);
|
||||
insurancePercent = Convert.ToInt32(command.InsurancePercentStr);
|
||||
rollCallPercent = Convert.ToInt32(command.RollCallPercentStr);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return op.Failed("لطفا عدد معتبر وارد کنید");
|
||||
|
||||
}
|
||||
|
||||
var firstPlan = _planPercentageRepository.GetByFirst();
|
||||
if (firstPlan != null)
|
||||
{
|
||||
var planPercentage = _planPercentageRepository.Get(firstPlan.Id);
|
||||
planPercentage.Edit(contractAndCheckoutPercent, insurancePercent, rollCallPercent, customizeCheckoutPercent, contractAndCheckoutInPersonPercent, insuranceInPersonPercent);
|
||||
_planPercentageRepository.SaveChanges();
|
||||
}
|
||||
else
|
||||
{
|
||||
var create = new PlanPercentage(contractAndCheckoutPercent, insurancePercent, rollCallPercent,
|
||||
customizeCheckoutPercent, contractAndCheckoutInPersonPercent, insuranceInPersonPercent);
|
||||
_planPercentageRepository.Create(create);
|
||||
_planPercentageRepository.SaveChanges();
|
||||
}
|
||||
|
||||
|
||||
|
||||
return op.Succcedded();
|
||||
}
|
||||
|
||||
public List<InstitutionPlanViewModel> GetInstitutionPlanList(int pageIndex, int countPeron)
|
||||
{
|
||||
return _planPercentageRepository.GetInstitutionPlanList(pageIndex, countPeron);
|
||||
}
|
||||
|
||||
public EditInstitutionPlanPercentage GetByFirst()
|
||||
{
|
||||
return _planPercentageRepository.GetByFirst();
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Threading.Tasks;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Application.UID;
|
||||
using Company.Domain.ContarctingPartyAgg;
|
||||
@@ -21,6 +22,13 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
|
||||
_uidService = uidService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// احراز هویت
|
||||
/// </summary>
|
||||
/// <param name="nationalCode"></param>
|
||||
/// <param name="dateOfBirth"></param>
|
||||
/// <param name="mobile"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<OperationResult<ContractingPartyTempViewModel>> CreateContractingPartyTemp(string nationalCode , string dateOfBirth, string mobile)
|
||||
{
|
||||
var op = new OperationResult<ContractingPartyTempViewModel>();
|
||||
@@ -58,6 +66,8 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
|
||||
|
||||
var dateOfBirthGr = dateOfBirth.ToGeorgianDateTime();
|
||||
|
||||
|
||||
//اگر طرف حساب موقت قبلا ایجاد شده دیتای آن را برمیگرداند
|
||||
if (getExistTemp != null)
|
||||
{
|
||||
|
||||
@@ -107,5 +117,28 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
|
||||
return op.Succcedded(result);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public async Task<OperationResult> UpdateAddress(long id, string state, string city, string address)
|
||||
{
|
||||
var op = new OperationResult();
|
||||
var contractingPartyTemp = _contractingPartyTempRepository.Get(id);
|
||||
|
||||
if (string.IsNullOrWhiteSpace(state) || string.IsNullOrWhiteSpace(city) || string.IsNullOrWhiteSpace(address))
|
||||
return op.Failed("اطلاعات ادرس را تکمیل کنید");
|
||||
|
||||
contractingPartyTemp.UpdateAddress(state,city,address);
|
||||
await _contractingPartyTempRepository.SaveChangesAsync();
|
||||
|
||||
return op.Succcedded();
|
||||
}
|
||||
|
||||
|
||||
public Task<List<WorkshopTempViewModel>> GetWorkshopTemp(long contractingPartyTemp)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
}
|
||||
@@ -188,10 +188,13 @@ public class CompanyContext : DbContext
|
||||
|
||||
#endregion
|
||||
|
||||
public DbSet<PlanPercentage> PlanPercentages { get; set; }
|
||||
|
||||
#region TemporaryClientRegisteration
|
||||
|
||||
public DbSet<ContractingPartyTemp> ContractingPartyTemps { get; set; }
|
||||
|
||||
public DbSet<WorkshopTemp> WorkshopTemps { get; set; }
|
||||
public DbSet<WorkshopServicesTemp> WorkshopServicesTemps { get; set; }
|
||||
#endregion
|
||||
public DbSet<CustomizeCheckout> CustomizeCheckouts { get; set; }
|
||||
public DbSet<CustomizeCheckoutTemp> CustomizeCheckoutTemps { get; set; }
|
||||
|
||||
19
CompanyManagment.EFCore/Mapping/PlanPercentageMapping.cs
Normal file
19
CompanyManagment.EFCore/Mapping/PlanPercentageMapping.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Company.Domain.InstitutionPlanAgg;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace CompanyManagment.EFCore.Mapping;
|
||||
|
||||
public class PlanPercentageMapping : IEntityTypeConfiguration<PlanPercentage>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<PlanPercentage> builder)
|
||||
{
|
||||
builder.ToTable("PlanPercentage");
|
||||
builder.HasKey(x => x.id);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using Company.Domain.TemporaryClientRegistrationAgg;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace CompanyManagment.EFCore.Mapping;
|
||||
|
||||
public class WorkshopServicesTempMapping : IEntityTypeConfiguration<WorkshopServicesTemp>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<WorkshopServicesTemp> builder)
|
||||
{
|
||||
builder.ToTable("WorkshopServicesTemps");
|
||||
builder.HasKey(x => x.id);
|
||||
|
||||
builder.Property(x => x.ServiceName).HasMaxLength(40);
|
||||
|
||||
builder.HasOne(x => x.WorkshopTemp)
|
||||
.WithMany(x => x.WorkshopServicesTemps)
|
||||
.HasForeignKey(x => x.WorkshopTempId);
|
||||
}
|
||||
}
|
||||
20
CompanyManagment.EFCore/Mapping/WorkshopTempMapping.cs
Normal file
20
CompanyManagment.EFCore/Mapping/WorkshopTempMapping.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using Company.Domain.TemporaryClientRegistrationAgg;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace CompanyManagment.EFCore.Mapping;
|
||||
|
||||
public class WorkshopTempMapping : IEntityTypeConfiguration<WorkshopTemp>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<WorkshopTemp> builder)
|
||||
{
|
||||
builder.ToTable("WorkshopTemps");
|
||||
builder.HasKey(x => x.id);
|
||||
|
||||
builder.Property(x => x.WorkshopName).HasMaxLength(255);
|
||||
|
||||
builder.HasMany(x => x.WorkshopServicesTemps)
|
||||
.WithOne(x => x.WorkshopTemp)
|
||||
.HasForeignKey(x => x.WorkshopTempId);
|
||||
}
|
||||
}
|
||||
9010
CompanyManagment.EFCore/Migrations/20250405124141_addPlanPercentageTable.Designer.cs
generated
Normal file
9010
CompanyManagment.EFCore/Migrations/20250405124141_addPlanPercentageTable.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,39 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CompanyManagment.EFCore.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class addPlanPercentageTable : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "PlanPercentage",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<long>(type: "bigint", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
ContractAndCheckoutPercent = table.Column<int>(type: "int", nullable: false),
|
||||
InsurancePercent = table.Column<int>(type: "int", nullable: false),
|
||||
RollCallPercent = table.Column<int>(type: "int", nullable: false),
|
||||
CustomizeCheckoutPercent = table.Column<int>(type: "int", nullable: false),
|
||||
ContractAndCheckoutInPersonPercent = table.Column<int>(type: "int", nullable: false),
|
||||
InsuranceInPersonPercent = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_PlanPercentage", x => x.id);
|
||||
});
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "PlanPercentage");
|
||||
}
|
||||
}
|
||||
}
|
||||
9083
CompanyManagment.EFCore/Migrations/20250408125553_WorkshopTempAndWorkshopServicetemp.Designer.cs
generated
Normal file
9083
CompanyManagment.EFCore/Migrations/20250408125553_WorkshopTempAndWorkshopServicetemp.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,69 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CompanyManagment.EFCore.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class WorkshopTempAndWorkshopServicetemp : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "WorkshopTemps",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<long>(type: "bigint", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
WorkshopName = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: true),
|
||||
CountPerson = table.Column<int>(type: "int", nullable: false),
|
||||
ContractingPartyTempId = table.Column<long>(type: "bigint", nullable: false),
|
||||
WorkshopServicesAmount = table.Column<double>(type: "float", nullable: false),
|
||||
CreationDate = table.Column<DateTime>(type: "datetime2", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_WorkshopTemps", x => x.id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "WorkshopServicesTemps",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<long>(type: "bigint", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
ServiceName = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true),
|
||||
CountPerson = table.Column<int>(type: "int", nullable: false),
|
||||
WorkshopTempId = table.Column<long>(type: "bigint", nullable: false),
|
||||
CreationDate = table.Column<DateTime>(type: "datetime2", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_WorkshopServicesTemps", x => x.id);
|
||||
table.ForeignKey(
|
||||
name: "FK_WorkshopServicesTemps_WorkshopTemps_WorkshopTempId",
|
||||
column: x => x.WorkshopTempId,
|
||||
principalTable: "WorkshopTemps",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_WorkshopServicesTemps_WorkshopTempId",
|
||||
table: "WorkshopServicesTemps",
|
||||
column: "WorkshopTempId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "WorkshopServicesTemps");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "WorkshopTemps");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2893,6 +2893,37 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
b.ToTable("InstitutionPlan", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Company.Domain.InstitutionPlanAgg.PlanPercentage", b =>
|
||||
{
|
||||
b.Property<long>("id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("id"));
|
||||
|
||||
b.Property<int>("ContractAndCheckoutInPersonPercent")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("ContractAndCheckoutPercent")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("CustomizeCheckoutPercent")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("InsuranceInPersonPercent")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("InsurancePercent")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("RollCallPercent")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("id");
|
||||
|
||||
b.ToTable("PlanPercentage", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Company.Domain.InsurancJobAgg.InsuranceJob", b =>
|
||||
{
|
||||
b.Property<long>("id")
|
||||
@@ -4878,6 +4909,63 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
b.ToTable("ContractingPartyTemp", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Company.Domain.TemporaryClientRegistrationAgg.WorkshopServicesTemp", b =>
|
||||
{
|
||||
b.Property<long>("id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("id"));
|
||||
|
||||
b.Property<int>("CountPerson")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("CreationDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("ServiceName")
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("nvarchar(40)");
|
||||
|
||||
b.Property<long>("WorkshopTempId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("id");
|
||||
|
||||
b.HasIndex("WorkshopTempId");
|
||||
|
||||
b.ToTable("WorkshopServicesTemps", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Company.Domain.TemporaryClientRegistrationAgg.WorkshopTemp", b =>
|
||||
{
|
||||
b.Property<long>("id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("id"));
|
||||
|
||||
b.Property<long>("ContractingPartyTempId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<int>("CountPerson")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("CreationDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("WorkshopName")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("nvarchar(255)");
|
||||
|
||||
b.Property<double>("WorkshopServicesAmount")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.HasKey("id");
|
||||
|
||||
b.ToTable("WorkshopTemps", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Company.Domain.TextManagerAgg.EntityTextManager", b =>
|
||||
{
|
||||
b.Property<long>("id")
|
||||
@@ -8557,6 +8645,17 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
b.Navigation("TaxLeftWorkCategory");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Company.Domain.TemporaryClientRegistrationAgg.WorkshopServicesTemp", b =>
|
||||
{
|
||||
b.HasOne("Company.Domain.TemporaryClientRegistrationAgg.WorkshopTemp", "WorkshopTemp")
|
||||
.WithMany("WorkshopServicesTemps")
|
||||
.HasForeignKey("WorkshopTempId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("WorkshopTemp");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Company.Domain.WorkHistory.WorkHistory", b =>
|
||||
{
|
||||
b.HasOne("Company.Domain.Petition.Petition", "Petition")
|
||||
@@ -8922,6 +9021,11 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
b.Navigation("TaxLeftWorkItemList");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Company.Domain.TemporaryClientRegistrationAgg.WorkshopTemp", b =>
|
||||
{
|
||||
b.Navigation("WorkshopServicesTemps");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Company.Domain.TextManagerAgg.EntityTextManager", b =>
|
||||
{
|
||||
b.Navigation("EntityModuleTextManagers");
|
||||
|
||||
@@ -52,6 +52,7 @@ public class ContractingPartyTempRepository : RepositoryBase<long, ContractingPa
|
||||
{
|
||||
Id = x.id,
|
||||
DateOfBirth = x.DateOfBirth,
|
||||
DateOfBirthFa = x.DateOfBirth.ToFarsi(),
|
||||
IdNumberSeri = x.IdNumberSeri,
|
||||
IdNumberSerial = x.IdNumberSerial,
|
||||
Address = x.Address,
|
||||
|
||||
@@ -12,6 +12,7 @@ using CompanyManagment.App.Contracts.Employer;
|
||||
using CompanyManagment.App.Contracts.InstitutionContract;
|
||||
using CompanyManagment.App.Contracts.Workshop;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using PersianTools.Core;
|
||||
|
||||
namespace CompanyManagment.EFCore.Repository;
|
||||
@@ -510,13 +511,64 @@ public class InstitutionContractRepository : RepositoryBase<long, InstitutionCon
|
||||
|
||||
public double GetcontractAmount(int countPerson)
|
||||
{
|
||||
double res = 0;
|
||||
if (countPerson > 0)
|
||||
var planPercentage = _context.PlanPercentages.FirstOrDefault();
|
||||
int contarctAndCheckoutPercent = 100;
|
||||
int insurancePercent = 50;
|
||||
int rollCallPercent = 100;
|
||||
int customizeCkeckoutPercen = 50;
|
||||
int contarctAndCheckoutInPersonPercent = 900;
|
||||
int insuranceInPersonPercent = 500;
|
||||
if (planPercentage != null)
|
||||
{
|
||||
contarctAndCheckoutPercent = planPercentage.ContractAndCheckoutPercent;
|
||||
insurancePercent = planPercentage.InsurancePercent;
|
||||
rollCallPercent = planPercentage.RollCallPercent;
|
||||
customizeCkeckoutPercen = planPercentage.CustomizeCheckoutPercent;
|
||||
contarctAndCheckoutInPersonPercent = planPercentage.ContractAndCheckoutInPersonPercent;
|
||||
insuranceInPersonPercent = planPercentage.InsuranceInPersonPercent;
|
||||
}
|
||||
|
||||
|
||||
|
||||
var dailyWageYearlySalery = _context.YearlySalaries.Include(i=>i.YearlySalaryItemsList).FirstOrDefault(x =>
|
||||
x.StartDate.Date <= DateTime.Now.Date && x.EndDate >= DateTime.Now.Date);
|
||||
double res = 0;
|
||||
if (countPerson > 0 && dailyWageYearlySalery != null)
|
||||
{
|
||||
var dailyWage = dailyWageYearlySalery.YearlySalaryItemsList.Where(x => x.ItemName == "مزد روزانه")
|
||||
.Select(x => x.ItemValue).FirstOrDefault();
|
||||
|
||||
|
||||
var plan = _context.InstitutionPlans.FirstOrDefault(x => x.CountPerson == countPerson);
|
||||
if (plan != null)
|
||||
{
|
||||
res = plan.FinalContractAmont;
|
||||
//مبلغ قرارداد و تصفیه
|
||||
var contarctAndCheckout = ((dailyWage * contarctAndCheckoutPercent) / 100) * countPerson *
|
||||
plan.IncreasePercentage;
|
||||
//خدمات بیمه
|
||||
var insurance = ((dailyWage * insurancePercent) / 100) * countPerson *
|
||||
plan.IncreasePercentage;
|
||||
////خدمات حضور غیاب
|
||||
//var rollCall = ((dailyWage * rollCallPercent) / 100) * countPerson *
|
||||
// plan.IncreasePercentage;
|
||||
|
||||
////خدمات فیش حقوقی غیر رسمی
|
||||
//var customizeCkeckout = ((dailyWage * customizeCkeckoutPercen) / 100) * countPerson *
|
||||
// plan.IncreasePercentage;
|
||||
|
||||
//خدمات حضوری قرارداد و تصفیه
|
||||
var contarctAndCheckoutInPerson = ((dailyWage * contarctAndCheckoutInPersonPercent) / 100) * countPerson *
|
||||
plan.IncreasePercentage;
|
||||
|
||||
//خدمات حضوری بیمه
|
||||
var insuranceInPerson = ((dailyWage * insuranceInPersonPercent) / 100) * countPerson *
|
||||
plan.IncreasePercentage;
|
||||
|
||||
|
||||
//جمع کل
|
||||
res = contarctAndCheckout + insurance + contarctAndCheckoutInPerson + insuranceInPerson;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
170
CompanyManagment.EFCore/Repository/PlanPercentageRepository.cs
Normal file
170
CompanyManagment.EFCore/Repository/PlanPercentageRepository.cs
Normal file
@@ -0,0 +1,170 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.InfraStructure;
|
||||
using Company.Domain.InstitutionPlanAgg;
|
||||
using CompanyManagment.App.Contracts.InstitutionPlan;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace CompanyManagment.EFCore.Repository;
|
||||
|
||||
public class PlanPercentageRepository : RepositoryBase<long, PlanPercentage>, IPlanPercentageRepository
|
||||
{
|
||||
private readonly CompanyContext _context;
|
||||
public PlanPercentageRepository(CompanyContext context) : base(context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public EditInstitutionPlanPercentage GetById(long id)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public EditInstitutionPlanPercentage GetByFirst()
|
||||
{
|
||||
return _context.PlanPercentages.Select(x => new EditInstitutionPlanPercentage()
|
||||
{
|
||||
Id = x.id,
|
||||
ContractAndCheckoutInPersonPercent = x.ContractAndCheckoutInPersonPercent,
|
||||
CustomizeCheckoutPercent = x.CustomizeCheckoutPercent,
|
||||
ContractAndCheckoutPercent = x.ContractAndCheckoutPercent,
|
||||
InsuranceInPersonPercent = x.InsuranceInPersonPercent,
|
||||
InsurancePercent = x.InsurancePercent,
|
||||
RollCallPercent = x.RollCallPercent,
|
||||
ContractAndCheckoutInPersonPercentStr = $"{x.ContractAndCheckoutInPersonPercent}",
|
||||
CustomizeCheckoutPercentStr = $"{x.CustomizeCheckoutPercent}",
|
||||
ContractAndCheckoutPercentStr = $"{x.ContractAndCheckoutPercent}",
|
||||
InsuranceInPersonPercentStr = $"{x.InsuranceInPersonPercent}",
|
||||
InsurancePercentStr = $"{x.InsurancePercent}",
|
||||
RollCallPercentStr = $"{x.RollCallPercent}",
|
||||
|
||||
}).FirstOrDefault();
|
||||
}
|
||||
|
||||
public List<InstitutionPlanViewModel> GetInstitutionPlanList(int pageIndex, int countPeron)
|
||||
{
|
||||
var planPercentage = _context.PlanPercentages.FirstOrDefault();
|
||||
if (planPercentage == null)
|
||||
return new List<InstitutionPlanViewModel>();
|
||||
|
||||
var dailyWageYearlySalery = _context.YearlySalaries.Include(i => i.YearlySalaryItemsList).FirstOrDefault(x =>
|
||||
x.StartDate.Date <= DateTime.Now.Date && x.EndDate >= DateTime.Now.Date);
|
||||
if (dailyWageYearlySalery == null)
|
||||
return new List<InstitutionPlanViewModel>();
|
||||
|
||||
var dailyWage = dailyWageYearlySalery.YearlySalaryItemsList.Where(x => x.ItemName == "مزد روزانه")
|
||||
.Select(x => x.ItemValue).FirstOrDefault();
|
||||
|
||||
if (countPeron > 0)
|
||||
{
|
||||
var planByCountPerson = _context.InstitutionPlans.Where(x => x.CountPerson == countPeron).Select(plan => new InstitutionPlanViewModel
|
||||
{
|
||||
CountPerson = plan.CountPerson,
|
||||
|
||||
ContractAndCheckoutDouble =
|
||||
((dailyWage * planPercentage.ContractAndCheckoutPercent / 100) * plan.CountPerson * plan.IncreasePercentage),
|
||||
|
||||
InsuranceDouble = (((dailyWage * planPercentage.InsurancePercent) / 100) * plan.CountPerson *
|
||||
plan.IncreasePercentage),
|
||||
|
||||
RollCallDouble = (((dailyWage * planPercentage.RollCallPercent) / 100) * plan.CountPerson *
|
||||
plan.IncreasePercentage),
|
||||
|
||||
CustomizeCheckoutDouble = (((dailyWage * planPercentage.CustomizeCheckoutPercent) / 100) * plan.CountPerson *
|
||||
plan.IncreasePercentage),
|
||||
|
||||
ContractAndCheckoutInPersonDouble = (((dailyWage * planPercentage.ContractAndCheckoutInPersonPercent) / 100) * plan.CountPerson *
|
||||
plan.IncreasePercentage),
|
||||
|
||||
InsuranceInPersonDouble = (((dailyWage * planPercentage.InsuranceInPersonPercent) / 100) * plan.CountPerson *
|
||||
plan.IncreasePercentage)
|
||||
|
||||
}).ToList();
|
||||
|
||||
planByCountPerson = planByCountPerson.Select(plan => new InstitutionPlanViewModel
|
||||
{
|
||||
CountPerson = plan.CountPerson,
|
||||
|
||||
ContractAndCheckout = plan.ContractAndCheckoutDouble.ToMoney(),
|
||||
|
||||
Insurance= plan.InsuranceDouble.ToMoney(),
|
||||
|
||||
RollCall = plan.RollCallDouble.ToMoney(),
|
||||
|
||||
CustomizeCheckout = plan.CustomizeCheckoutDouble.ToMoney(),
|
||||
|
||||
ContractAndCheckoutInPerson = plan.ContractAndCheckoutInPersonDouble.ToMoney(),
|
||||
|
||||
InsuranceInPerson = plan.InsuranceInPersonDouble.ToMoney(),
|
||||
|
||||
InPersonSumAmountStr = (plan.ContractAndCheckoutDouble + plan.InsuranceDouble + plan.ContractAndCheckoutInPersonDouble + plan.InsuranceInPersonDouble).ToMoney(),
|
||||
|
||||
OnlineAndInPersonSumAmountStr = (plan.ContractAndCheckoutDouble + plan.InsuranceDouble + plan.ContractAndCheckoutInPersonDouble + plan.InsuranceInPersonDouble + plan.RollCallDouble + plan.CustomizeCheckoutDouble).ToMoney(),
|
||||
|
||||
OnlineOnlySumAmountStr = (plan.ContractAndCheckoutDouble + plan.InsuranceDouble + plan.RollCallDouble + plan.CustomizeCheckoutDouble).ToMoney(),
|
||||
|
||||
}).ToList();
|
||||
|
||||
return planByCountPerson;
|
||||
}
|
||||
|
||||
|
||||
|
||||
var plans = _context.InstitutionPlans
|
||||
.OrderBy(x => x.CountPerson)
|
||||
.Skip(pageIndex)
|
||||
.Take(30)
|
||||
.Select(plan => new InstitutionPlanViewModel
|
||||
{
|
||||
CountPerson = plan.CountPerson,
|
||||
|
||||
ContractAndCheckoutDouble =
|
||||
((dailyWage * planPercentage.ContractAndCheckoutPercent / 100) * plan.CountPerson * plan.IncreasePercentage),
|
||||
|
||||
InsuranceDouble = (((dailyWage * planPercentage.InsurancePercent) / 100) * plan.CountPerson *
|
||||
plan.IncreasePercentage),
|
||||
|
||||
RollCallDouble = (((dailyWage * planPercentage.RollCallPercent) / 100) * plan.CountPerson *
|
||||
plan.IncreasePercentage),
|
||||
|
||||
CustomizeCheckoutDouble = (((dailyWage * planPercentage.CustomizeCheckoutPercent) / 100) * plan.CountPerson *
|
||||
plan.IncreasePercentage),
|
||||
|
||||
ContractAndCheckoutInPersonDouble = (((dailyWage * planPercentage.ContractAndCheckoutInPersonPercent) / 100) * plan.CountPerson *
|
||||
plan.IncreasePercentage),
|
||||
|
||||
InsuranceInPersonDouble = (((dailyWage * planPercentage.InsuranceInPersonPercent) / 100) * plan.CountPerson *
|
||||
plan.IncreasePercentage)
|
||||
}).ToList();
|
||||
|
||||
plans = plans.Select(plan => new InstitutionPlanViewModel
|
||||
{
|
||||
CountPerson = plan.CountPerson,
|
||||
|
||||
ContractAndCheckout = plan.ContractAndCheckoutDouble.ToMoney(),
|
||||
|
||||
Insurance = plan.InsuranceDouble.ToMoney(),
|
||||
|
||||
RollCall = plan.RollCallDouble.ToMoney(),
|
||||
|
||||
CustomizeCheckout = plan.CustomizeCheckoutDouble.ToMoney(),
|
||||
|
||||
ContractAndCheckoutInPerson = plan.ContractAndCheckoutInPersonDouble.ToMoney(),
|
||||
|
||||
InsuranceInPerson = plan.InsuranceInPersonDouble.ToMoney(),
|
||||
|
||||
InPersonSumAmountStr = (plan.ContractAndCheckoutDouble + plan.InsuranceDouble + plan.ContractAndCheckoutInPersonDouble + plan.InsuranceInPersonDouble).ToMoney(),
|
||||
|
||||
OnlineAndInPersonSumAmountStr = (plan.ContractAndCheckoutDouble + plan.InsuranceDouble + plan.ContractAndCheckoutInPersonDouble + plan.InsuranceInPersonDouble + plan.RollCallDouble + plan.CustomizeCheckoutDouble).ToMoney(),
|
||||
|
||||
OnlineOnlySumAmountStr = (plan.ContractAndCheckoutDouble + plan.InsuranceDouble + plan.RollCallDouble + plan.CustomizeCheckoutDouble).ToMoney(),
|
||||
|
||||
}).ToList();
|
||||
|
||||
|
||||
return plans;
|
||||
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -3,6 +3,7 @@ using _0_Framework.Domain.CustomizeCheckoutShared.Base;
|
||||
using _0_Framework.Domain.CustomizeCheckoutShared.Enums;
|
||||
using _0_Framework.Domain.CustomizeCheckoutShared.ValueObjects;
|
||||
using _0_Framework.InfraStructure;
|
||||
using Company.Domain.CustomizeWorkshopEmployeeSettingsAgg.Entities;
|
||||
using Company.Domain.EmployeeAgg;
|
||||
using Company.Domain.RollCallAgg;
|
||||
using Company.Domain.RollCallEmployeeAgg;
|
||||
@@ -364,6 +365,32 @@ public class RollCallRepository : RepositoryBase<long, RollCall>, IRollCallRepos
|
||||
var orderedRollcalls = x.OrderBy(y => y.StartDate!.Value).ToList();
|
||||
var firstRollCall = orderedRollcalls.FirstOrDefault();
|
||||
var secondRollCall = orderedRollcalls.Skip(1).FirstOrDefault();
|
||||
//این برای این هست که ببینه اگر که این شخص گردشی بوده و دوبار وارد در دو شیفت مختلف وارد شده شیفت دوم تاثیر نخواهد گذاشت
|
||||
//منطق کباب مهدی!!!!
|
||||
|
||||
#region SecondTimeDiff
|
||||
var hasSecondTimeDiff = false;
|
||||
if (settings.WorkshopShiftStatus == WorkshopShiftStatus.Rotating)
|
||||
{
|
||||
if (firstRollCall != null && secondRollCall != null)
|
||||
{
|
||||
var firstShift = FindRotatingShift(firstRollCall.StartDate.Value, firstRollCall.EndDate.Value, settings.CustomizeRotatingShifts);
|
||||
var secondShift = FindRotatingShift(secondRollCall.StartDate.Value, secondRollCall.EndDate.Value, settings.CustomizeRotatingShifts);
|
||||
if (firstShift.start == secondShift.start && firstShift.end == secondShift.end)
|
||||
{
|
||||
hasSecondTimeDiff = true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
hasSecondTimeDiff = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
return new CheckoutDailyRollCallViewModel()
|
||||
{
|
||||
@@ -386,7 +413,7 @@ public class RollCallRepository : RepositoryBase<long, RollCall>, IRollCallRepos
|
||||
: "",
|
||||
ExitDifferencesMinutes1 = "",
|
||||
|
||||
EnterDifferencesMinutes2 = secondRollCall != null && secondRollCall.LateEntryDuration > TimeSpan.Zero && workshopId == 170
|
||||
EnterDifferencesMinutes2 = secondRollCall != null && secondRollCall.LateEntryDuration > TimeSpan.Zero && workshopId == 170 && hasSecondTimeDiff
|
||||
? CalculateEntryMinuteDifference(secondRollCall.EarlyEntryDuration,
|
||||
secondRollCall.LateEntryDuration)
|
||||
: "",
|
||||
@@ -1636,6 +1663,32 @@ public class RollCallRepository : RepositoryBase<long, RollCall>, IRollCallRepos
|
||||
var orderedRollcalls = x.OrderBy(y => y.ShiftDate).ToList();
|
||||
var firstRollCall = orderedRollcalls.FirstOrDefault();
|
||||
var secondRollCall = orderedRollcalls.Skip(1).FirstOrDefault();
|
||||
//این برای این هست که ببینه اگر که این شخص گردشی بوده و دوبار وارد در دو شیفت مختلف وارد شده شیفت دوم تاثیر نخواهد گذاشت
|
||||
//منطق کباب مهدی!!!!
|
||||
|
||||
#region SecondTimeDiff
|
||||
var hasSecondTimeDiff = false;
|
||||
if (settings.WorkshopShiftStatus == WorkshopShiftStatus.Rotating)
|
||||
{
|
||||
if (firstRollCall !=null && secondRollCall != null)
|
||||
{
|
||||
var firstShift = FindRotatingShift(firstRollCall.StartDate.Value, firstRollCall.EndDate.Value, settings.CustomizeRotatingShifts);
|
||||
var secondShift = FindRotatingShift(secondRollCall.StartDate.Value, secondRollCall.EndDate.Value, settings.CustomizeRotatingShifts);
|
||||
if (firstShift.start == secondShift.start && firstShift.end == secondShift.end)
|
||||
{
|
||||
hasSecondTimeDiff = true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
hasSecondTimeDiff = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
return new CheckoutDailyRollCallViewModel()
|
||||
{
|
||||
StartDate1 = firstRollCall?.StartDate?.ToString("HH:mm"),
|
||||
@@ -1660,7 +1713,7 @@ public class RollCallRepository : RepositoryBase<long, RollCall>, IRollCallRepos
|
||||
: "",
|
||||
ExitDifferencesMinutes1 = "",
|
||||
|
||||
EnterDifferencesMinutes2 = secondRollCall != null && secondRollCall.LateEntryDuration > TimeSpan.Zero && workshopId == 170
|
||||
EnterDifferencesMinutes2 = secondRollCall != null && secondRollCall.LateEntryDuration > TimeSpan.Zero && workshopId == 170&& hasSecondTimeDiff
|
||||
? CalculateEntryMinuteDifference(secondRollCall.EarlyEntryDuration,
|
||||
secondRollCall.LateEntryDuration)
|
||||
: "",
|
||||
@@ -1796,7 +1849,34 @@ public class RollCallRepository : RepositoryBase<long, RollCall>, IRollCallRepos
|
||||
var orderedRollcalls = x.OrderBy(y => y.StartDate!.Value).ToList();
|
||||
var firstRollCall = orderedRollcalls.FirstOrDefault();
|
||||
var secondRollCall = orderedRollcalls.Skip(1).FirstOrDefault();
|
||||
return new CheckoutDailyRollCallViewModel()
|
||||
|
||||
//این برای این هست که ببینه اگر که این شخص گردشی بوده و دوبار وارد در دو شیفت مختلف وارد شده شیفت دوم تاثیر نخواهد گذاشت
|
||||
//منطق کباب مهدی!!!!
|
||||
|
||||
#region SecondTimeDiff
|
||||
var hasSecondTimeDiff = false;
|
||||
if (settings.WorkshopShiftStatus == WorkshopShiftStatus.Rotating)
|
||||
{
|
||||
if (firstRollCall != null && secondRollCall != null)
|
||||
{
|
||||
var firstShift = FindRotatingShift(firstRollCall.StartDate.Value, firstRollCall.EndDate.Value, settings.CustomizeRotatingShifts);
|
||||
var secondShift = FindRotatingShift(secondRollCall.StartDate.Value, secondRollCall.EndDate.Value, settings.CustomizeRotatingShifts);
|
||||
if (firstShift.start == secondShift.start && firstShift.end == secondShift.end)
|
||||
{
|
||||
hasSecondTimeDiff = true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
hasSecondTimeDiff = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
return new CheckoutDailyRollCallViewModel()
|
||||
{
|
||||
StartDate1 = orderedRollcalls.FirstOrDefault()?.StartDate?.ToString("HH:mm"),
|
||||
EndDate1 = orderedRollcalls.FirstOrDefault()?.EndDate?.ToString("HH:mm"),
|
||||
@@ -1819,11 +1899,11 @@ public class RollCallRepository : RepositoryBase<long, RollCall>, IRollCallRepos
|
||||
: "",
|
||||
ExitDifferencesMinutes1 = "",
|
||||
|
||||
EnterDifferencesMinutes2 = secondRollCall != null && secondRollCall.LateEntryDuration > TimeSpan.Zero && workshopId == 170
|
||||
? CalculateEntryMinuteDifference(secondRollCall.EarlyEntryDuration,
|
||||
secondRollCall.LateEntryDuration)
|
||||
: "",
|
||||
ExitDifferencesMinutes2 = ""
|
||||
EnterDifferencesMinutes2 = secondRollCall != null && secondRollCall.LateEntryDuration > TimeSpan.Zero && workshopId == 170 && hasSecondTimeDiff
|
||||
? CalculateEntryMinuteDifference(secondRollCall.EarlyEntryDuration,
|
||||
secondRollCall.LateEntryDuration)
|
||||
: "",
|
||||
ExitDifferencesMinutes2 = ""
|
||||
};
|
||||
});
|
||||
presentDays = presentDays.Select(x => new CheckoutDailyRollCallViewModel
|
||||
@@ -1866,6 +1946,101 @@ public class RollCallRepository : RepositoryBase<long, RollCall>, IRollCallRepos
|
||||
return result;
|
||||
|
||||
|
||||
|
||||
}
|
||||
public static (DateTime start, DateTime end) FindRotatingShift(DateTime startRollCall, DateTime endRollCall,
|
||||
ICollection<CustomizeRotatingShift> rotatingShifts)
|
||||
{
|
||||
DateTime startDate = startRollCall.Date;
|
||||
DateTime endDate = endRollCall.Date;
|
||||
|
||||
|
||||
|
||||
DateTime startEntryWithDate = startDate.Add(startRollCall.TimeOfDay);
|
||||
DateTime endEntryWithDate = endDate.Add(endRollCall.TimeOfDay);
|
||||
|
||||
DateTime oneHourBeforeStart = startEntryWithDate.AddHours(-1);
|
||||
DateTime oneHourAfterStart = startEntryWithDate.AddHours(1);
|
||||
DateTime oneHourBeforeEnd = endEntryWithDate.AddHours(-1);
|
||||
DateTime oneHourAfterEnd = endEntryWithDate.AddHours(1);
|
||||
|
||||
|
||||
var shiftDateTimes = rotatingShifts.SelectMany(shift =>
|
||||
{
|
||||
var shifts = new List<(DateTime Start, DateTime End)>();
|
||||
for (int i = -1; i <= 1; i++)
|
||||
{
|
||||
var shiftStart = startDate.AddDays(i).Date;
|
||||
shiftStart = shiftStart.Add(shift.StartTime.ToTimeSpan());
|
||||
var shiftEnd = shift.StartTime < shift.EndTime
|
||||
? startDate.AddDays(i).Date.Add(shift.EndTime.ToTimeSpan())
|
||||
: startDate.AddDays(i + 1).Date.Add(shift.EndTime.ToTimeSpan());
|
||||
shifts.Add((shiftStart, shiftEnd));
|
||||
}
|
||||
|
||||
return shifts;
|
||||
}).ToList();
|
||||
|
||||
#region مقایسه شروع حضور غیاب با شیفت
|
||||
|
||||
var startFilteredTimes = shiftDateTimes.Where(shift =>
|
||||
(oneHourBeforeStart <= shift.Start && oneHourAfterStart >= shift.Start) ||
|
||||
(oneHourBeforeStart <= shift.End && oneHourAfterStart >= shift.End)).ToList();
|
||||
|
||||
if (startFilteredTimes.Count == 0)
|
||||
{
|
||||
startFilteredTimes = shiftDateTimes;
|
||||
}
|
||||
else if (startFilteredTimes.Count == 1)
|
||||
{
|
||||
var startChosenShift = startFilteredTimes.First();
|
||||
|
||||
if (startChosenShift.End < startChosenShift.Start)
|
||||
startChosenShift.End = startChosenShift.End.AddDays(1);
|
||||
|
||||
return startChosenShift;
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region مقایسه پایان حضورغیاب با شیفت
|
||||
|
||||
var endFilteredTimes = shiftDateTimes.Where(shift =>
|
||||
(oneHourBeforeEnd <= shift.Start && oneHourAfterEnd >= shift.Start) ||
|
||||
(oneHourBeforeEnd <= shift.End && oneHourAfterEnd >= shift.End)).ToList();
|
||||
if (endFilteredTimes.Count == 0)
|
||||
{
|
||||
endFilteredTimes = startFilteredTimes;
|
||||
}
|
||||
else if (endFilteredTimes.Count == 1)
|
||||
{
|
||||
var endChosenShift = endFilteredTimes.First();
|
||||
return endChosenShift;
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region اشتراک حضور غیاب و شیفت
|
||||
|
||||
var overlapShifts = endFilteredTimes.Select(shift => new
|
||||
{
|
||||
Shift = shift,
|
||||
Overlap = new TimeSpan(Math.Max(0,
|
||||
Math.Min(shift.End.Ticks, oneHourAfterEnd.Ticks) -
|
||||
Math.Max(shift.Start.Ticks, oneHourBeforeStart.Ticks)))
|
||||
});
|
||||
|
||||
var overlapChosenShift = overlapShifts.MaxBy(s => s.Overlap);
|
||||
var end = overlapChosenShift.Shift.End;
|
||||
if (overlapChosenShift.Shift.End < overlapChosenShift.Shift.Start)
|
||||
end = overlapChosenShift.Shift.End.AddDays(1);
|
||||
|
||||
|
||||
return (overlapChosenShift.Shift.Start, end);
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
62
CompanyManagment.EFCore/Repository/WorkshopTempRepository.cs
Normal file
62
CompanyManagment.EFCore/Repository/WorkshopTempRepository.cs
Normal file
@@ -0,0 +1,62 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.InfraStructure;
|
||||
using Company.Domain.TemporaryClientRegistrationAgg;
|
||||
using CompanyManagment.App.Contracts.TemporaryClientRegistration;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace CompanyManagment.EFCore.Repository;
|
||||
|
||||
public class WorkshopTempRepository : RepositoryBase<long, WorkshopTemp>, IWorkshopTempRepository
|
||||
{
|
||||
private readonly CompanyContext _context;
|
||||
public WorkshopTempRepository(CompanyContext context) : base(context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
|
||||
public async Task<List<WorkshopTempViewModel>> GetWorkshopTemp(long contractingPartyTemp)
|
||||
{
|
||||
var result = await _context.WorkshopTemps
|
||||
.Where(x => x.ContractingPartyTempId == contractingPartyTemp)
|
||||
.Include(x => x.WorkshopServicesTemps)
|
||||
.Select(x => new WorkshopTempViewModel
|
||||
{
|
||||
Id = x.id,
|
||||
WorkshopName = x.WorkshopName,
|
||||
WorkshopServicesAmountStr = x.WorkshopServicesAmount.ToMoney(),
|
||||
WorkshopServicesAmount = x.WorkshopServicesAmount,
|
||||
ContractingPartyTempId = x.ContractingPartyTempId,
|
||||
CountPerson = x.CountPerson,
|
||||
ContractAndCheckout = x.WorkshopServicesTemps.Any(s=>s.ServiceName == "ContractAndCheckout"),
|
||||
CustomizeCheckout = x.WorkshopServicesTemps.Any(s => s.ServiceName == "CustomizeCheckout"),
|
||||
Insurance = x.WorkshopServicesTemps.Any(s=> s.ServiceName == "Insurance"),
|
||||
RollCall = x.WorkshopServicesTemps.Any(s => s.ServiceName == "RollCall"),
|
||||
}).ToListAsync();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
//public async Task<OperationResult> CreateOrUpdateWorkshopTemp(List<CreateWorkshopTemp> command)
|
||||
//{
|
||||
// var op = new OperationResult();
|
||||
// if (command.Count == 0)
|
||||
// return op.Failed("هیچ مجموعه ای ایجاد نشده است");
|
||||
// foreach (var workshop in command)
|
||||
// {
|
||||
// if(!string.IsNullOrWhiteSpace(workshop.WorkshopName))
|
||||
// return op.Failed("نام مجموعه نمیتواند خالی باشد");
|
||||
// if (workshop.CountPerson == 0)
|
||||
// op.Failed($"تعداد پرسنل مجوعه {workshop.WorkshopName} صفر است");
|
||||
|
||||
|
||||
// }
|
||||
|
||||
|
||||
// return op.Succcedded();
|
||||
//}
|
||||
}
|
||||
@@ -198,9 +198,11 @@ using CompanyManagement.Infrastructure.Excel.SalaryAid;
|
||||
using CompanyManagment.App.Contracts.EmployeeDocuments;
|
||||
using CompanyManagment.App.Contracts.EmployeeDocumentsAdminSelection;
|
||||
using Company.Domain.EmployeeClientTempAgg;
|
||||
using Company.Domain.InstitutionPlanAgg;
|
||||
using Company.Domain.LeftWorkTempAgg;
|
||||
using Company.Domain.TemporaryClientRegistrationAgg;
|
||||
using CompanyManagment.App.Contracts.EmployeeClientTemp;
|
||||
using CompanyManagment.App.Contracts.InstitutionPlan;
|
||||
using CompanyManagment.App.Contracts.LeftWorkTemp;
|
||||
using CompanyManagment.App.Contracts.TemporaryClientRegistration;
|
||||
|
||||
@@ -452,6 +454,10 @@ public class PersonalBootstrapper
|
||||
|
||||
#endregion
|
||||
services.AddTransient<IRollCallDomainService, RollCallDomainService>();
|
||||
|
||||
|
||||
services.AddTransient<IPlanPercentageRepository, PlanPercentageRepository>();
|
||||
services.AddTransient<IInstitutionPlanApplication, InstitutionPlanApplication>();
|
||||
//=========End Of Main====================================
|
||||
|
||||
//---File Project------------------------------------
|
||||
|
||||
@@ -11,266 +11,292 @@ using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk
|
||||
{
|
||||
[Authorize]
|
||||
public class IndexModel : PageModel
|
||||
{
|
||||
private readonly IAndroidApkVersionApplication _application;
|
||||
private readonly IRollCallDomainService _rollCallDomainService;
|
||||
private readonly CompanyContext _context;
|
||||
private readonly AccountContext _accountContext;
|
||||
[Authorize]
|
||||
public class IndexModel : PageModel
|
||||
{
|
||||
private readonly IAndroidApkVersionApplication _application;
|
||||
private readonly IRollCallDomainService _rollCallDomainService;
|
||||
private readonly CompanyContext _context;
|
||||
private readonly AccountContext _accountContext;
|
||||
|
||||
[BindProperty]
|
||||
public IFormFile File { get; set; }
|
||||
[BindProperty]
|
||||
public IFormFile File { get; set; }
|
||||
|
||||
public IndexModel(IAndroidApkVersionApplication application, IRollCallDomainService rollCallDomainService, CompanyContext context, AccountContext accountContext)
|
||||
{
|
||||
_application = application;
|
||||
_rollCallDomainService = rollCallDomainService;
|
||||
_context = context;
|
||||
_accountContext = accountContext;
|
||||
}
|
||||
public IndexModel(IAndroidApkVersionApplication application, IRollCallDomainService rollCallDomainService, CompanyContext context, AccountContext accountContext)
|
||||
{
|
||||
_application = application;
|
||||
_rollCallDomainService = rollCallDomainService;
|
||||
_context = context;
|
||||
_accountContext = accountContext;
|
||||
}
|
||||
|
||||
public void OnGet()
|
||||
{
|
||||
}
|
||||
public void OnGet()
|
||||
{
|
||||
}
|
||||
|
||||
public async Task<IActionResult> OnPostUpload()
|
||||
{
|
||||
var result = await _application.CreateAndActive(File);
|
||||
ViewData["message"] = result.Message;
|
||||
return Page();
|
||||
}
|
||||
public async Task<IActionResult> OnPostUpload()
|
||||
{
|
||||
var result = await _application.CreateAndActive(File);
|
||||
ViewData["message"] = result.Message;
|
||||
return Page();
|
||||
}
|
||||
|
||||
|
||||
public IActionResult OnPostShiftDate()
|
||||
{
|
||||
//var startRollCall = new DateTime(2025, 2, 19);
|
||||
//var rollCalls = _context.RollCalls.Where(x => x.ShiftDate >= startRollCall);
|
||||
public IActionResult OnPostShiftDate()
|
||||
{
|
||||
//var startRollCall = new DateTime(2025, 2, 19);
|
||||
//var rollCalls = _context.RollCalls.Where(x => x.ShiftDate >= startRollCall);
|
||||
|
||||
//var endedRollCalls = rollCalls.Where(x => x.EndDate != null).ToList();
|
||||
//var endedRollCalls = rollCalls.Where(x => x.EndDate != null).ToList();
|
||||
|
||||
//var notEndedRollCalls = rollCalls.Where(x => x.EndDate == null).ToList();
|
||||
//RefactorAllTheRollCallsOnEsfand(endedRollCalls, notEndedRollCalls);
|
||||
CreateRewardForKebabMahdi().GetAwaiter().GetResult();
|
||||
ViewData["message"] = "ایجاد شد";
|
||||
return Page();
|
||||
}
|
||||
//var notEndedRollCalls = rollCalls.Where(x => x.EndDate == null).ToList();
|
||||
//RefactorAllTheRollCallsOnEsfand(endedRollCalls, notEndedRollCalls);
|
||||
CreateRewardForKebabMahdi().GetAwaiter().GetResult();
|
||||
ViewData["message"] = "ایجاد شد";
|
||||
return Page();
|
||||
}
|
||||
|
||||
public IActionResult OnPostShiftDateNew()
|
||||
{
|
||||
var startRollCall = new DateTime(2025, 2, 19);
|
||||
var rollCalls = _context.RollCalls.Where(x => x.ShiftDate >= startRollCall && x.WorkshopId == 170).ToList();
|
||||
var r1 = rollCalls.Take(3000).ToList();
|
||||
public IActionResult OnPostShiftDateNew()
|
||||
{
|
||||
var startRollCall = new DateTime(2025, 2, 19);
|
||||
var rollCalls = _context.RollCalls.Where(x => x.ShiftDate >= startRollCall && x.WorkshopId == 170).ToList();
|
||||
var r1 = rollCalls.Take(3000).ToList();
|
||||
|
||||
Console.ForegroundColor = ConsoleColor.DarkRed;
|
||||
Console.WriteLine("endStep 1 ============");
|
||||
SetRollCall(r1);
|
||||
Console.ForegroundColor = ConsoleColor.DarkRed;
|
||||
Console.WriteLine("endStep 1 ============");
|
||||
SetRollCall(r1);
|
||||
|
||||
|
||||
ViewData["message"] = "تومام یک";
|
||||
return Page();
|
||||
}
|
||||
|
||||
public IActionResult OnPostShiftDateNew2()
|
||||
{
|
||||
var startRollCall = new DateTime(2025, 2, 19);
|
||||
var rollCalls = _context.RollCalls.Where(x => x.ShiftDate >= startRollCall && x.WorkshopId == 170).ToList();
|
||||
|
||||
var r2 = rollCalls.Skip(3000).ToList();
|
||||
ViewData["message"] = "تومام یک";
|
||||
return Page();
|
||||
}
|
||||
|
||||
Console.ForegroundColor = ConsoleColor.Yellow;
|
||||
Console.WriteLine("endStep 2 ============");
|
||||
SetRollCall2(r2);
|
||||
public IActionResult OnPostShiftDateNew2()
|
||||
{
|
||||
var startRollCall = new DateTime(2025, 2, 19);
|
||||
var rollCalls = _context.RollCalls.Where(x => x.ShiftDate >= startRollCall && x.WorkshopId == 170).ToList();
|
||||
|
||||
ViewData["message"] = "تومام دو";
|
||||
return Page();
|
||||
}
|
||||
var r2 = rollCalls.Skip(3000).ToList();
|
||||
|
||||
Console.ForegroundColor = ConsoleColor.Yellow;
|
||||
Console.WriteLine("endStep 2 ============");
|
||||
SetRollCall2(r2);
|
||||
|
||||
#region Create reward for kebab mahdi
|
||||
ViewData["message"] = "تومام دو";
|
||||
return Page();
|
||||
}
|
||||
|
||||
public async System.Threading.Tasks.Task CreateRewardForKebabMahdi()
|
||||
{
|
||||
var esfandCustomizeCheckouts = _context.CustomizeCheckouts
|
||||
.Where(x => x.WorkshopId == 170 && x.MonthInt == 12 && x.YearInt == 1403);
|
||||
|
||||
#region Create reward for kebab mahdi
|
||||
|
||||
public async System.Threading.Tasks.Task CreateRewardForKebabMahdi()
|
||||
{
|
||||
//var esfandCustomizeCheckouts = _context.CustomizeCheckouts
|
||||
// .Where(x => x.WorkshopId == 170 && x.MonthInt == 12 && x.YearInt == 1403);
|
||||
|
||||
var sinzdahBedarDate = new DateTime(2025, 04, 2);
|
||||
var chahardah = sinzdahBedarDate.AddDays(1);
|
||||
|
||||
var employeeSettings = _context.CustomizeWorkshopEmployeeSettings
|
||||
.Where(x => x.WorkshopId == 170 &&
|
||||
esfandCustomizeCheckouts.Any(c => c.EmployeeId == x.EmployeeId));
|
||||
|
||||
var workingEmp = _context.LeftWorkList.Where(x => x.WorkshopId == 170 && x.StartWorkDate <= sinzdahBedarDate && x.LeftWorkDate >= sinzdahBedarDate)
|
||||
.GroupBy(x => x.EmployeeId).Select(x=>x.Key);
|
||||
|
||||
var absentEmployees = employeeSettings.Where(x => !_context.RollCalls
|
||||
.Any(a => a.EmployeeId == x.EmployeeId && a.ShiftDate == new DateTime(2025,03,20)))
|
||||
.ToList();
|
||||
|
||||
foreach (var employeeSetting in absentEmployees)
|
||||
{
|
||||
var amount = (int) employeeSetting.Salary / 30;
|
||||
var reward = new Reward(employeeSetting.EmployeeId, 170, amount, "", 0, new DateTime(2025, 3, 21),
|
||||
"بابت تعطیلی روز آخر سال 1403");
|
||||
_context.Rewards.Add(reward);
|
||||
}
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
var employeesHaveRollCall = _context.RollCallEmployees
|
||||
.Where(x => workingEmp.Contains(x.EmployeeId) && x.WorkshopId == 170)
|
||||
.Include(x => x.EmployeesStatus)
|
||||
.Where(x => x.EmployeesStatus.Any(s => s.StartDate <= sinzdahBedarDate && s.EndDate >= sinzdahBedarDate)).Select(x=>x.EmployeeId);
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region AccountLeftwork
|
||||
|
||||
private void AddToAccountLeftWork()
|
||||
{
|
||||
List<long> roleIds = [3, 5, 7, 8, 23, 24];
|
||||
var accounts = _accountContext.Accounts
|
||||
.Where(x => roleIds.Contains(x.RoleId)).Where(x => x.AdminAreaPermission == "true");
|
||||
var accountsIds = accounts.Select(x => x.id).ToList();
|
||||
var workshopAccount = _context.WorkshopAccounts
|
||||
.Where(x => accountsIds.Contains(x.AccountId))
|
||||
.GroupBy(x => x.AccountId);
|
||||
var employeeSettings = _context.CustomizeWorkshopEmployeeSettings
|
||||
.Where(x => x.WorkshopId == 170 &&
|
||||
employeesHaveRollCall.Any(c => c == x.EmployeeId));
|
||||
|
||||
List<long> oldAccountleftworkActiveNow = [300, 332, 333, 334, 18, 25, 14];
|
||||
List<long> oldAccountleftworkDeActivedNow = [50, 49, 15];
|
||||
var continueWorking = _0_Framework.Application.StaticWorkshopAccounts.ContinuesWorkingDate;
|
||||
|
||||
var absentEmployeesInSinzdah = employeeSettings.Where(x => !_context.RollCalls
|
||||
.Any(a => a.EmployeeId == x.EmployeeId && a.ShiftDate == sinzdahBedarDate))
|
||||
.ToList();
|
||||
|
||||
foreach (var item in workshopAccount)
|
||||
{
|
||||
var absentEmployeesInChahardah = employeeSettings.Where(x => !_context.RollCalls
|
||||
.Any(a => a.EmployeeId == x.EmployeeId && a.ShiftDate == chahardah))
|
||||
.ToList();
|
||||
|
||||
foreach (var employeeSetting in absentEmployeesInSinzdah)
|
||||
{
|
||||
var amount = (int)employeeSetting.Salary / 30;
|
||||
var reward = new Reward(employeeSetting.EmployeeId, 170, amount, "", 0, sinzdahBedarDate,
|
||||
"بابت تعطیلی روز 13 فروردین");
|
||||
_context.Rewards.Add(reward);
|
||||
}
|
||||
|
||||
var oldActive = item.FirstOrDefault(x => oldAccountleftworkActiveNow.Contains(x.AccountId));
|
||||
if (oldActive != null)
|
||||
{
|
||||
var roleId = accounts.FirstOrDefault(x => x.id == oldActive.AccountId)!.RoleId;
|
||||
var startGr = item.Key != 25 ? new DateTime(2024, 07, 22) : new DateTime(2024, 08, 22);
|
||||
//if (item.Key is 380 or 381)
|
||||
// startGr = new DateTime(2025, 02, 19);
|
||||
if (item.Key is 14 or 18)
|
||||
startGr = new DateTime(2020, 05, 21);
|
||||
if (item.Key is 300)
|
||||
startGr = new DateTime(2024, 05, 22);
|
||||
foreach (var employeeSetting in absentEmployeesInChahardah)
|
||||
{
|
||||
var amount = (int)employeeSetting.Salary / 30;
|
||||
var reward = new Reward(employeeSetting.EmployeeId, 170, amount, "", 0, sinzdahBedarDate.AddDays(1),
|
||||
"بابت تعطیلی روز 14 فروردین");
|
||||
_context.Rewards.Add(reward);
|
||||
}
|
||||
|
||||
foreach (var workshop in item)
|
||||
{
|
||||
_accountContext.AccountLeftWorks.Add(new AccountLeftWork(startGr, continueWorking, workshop.AccountId, workshop.WorkshopId, roleId, true));
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
|
||||
}
|
||||
_accountContext.SaveChanges();
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
var oldDeActive = item.FirstOrDefault(x => oldAccountleftworkDeActivedNow.Contains(x.AccountId));
|
||||
if (oldDeActive != null)
|
||||
{
|
||||
var roleId = accounts.FirstOrDefault(x => x.id == oldDeActive.AccountId)!.RoleId;
|
||||
var startGr = new DateTime(2022, 03, 21);
|
||||
if (item.Key == 49)
|
||||
startGr = new DateTime(2023, 04, 21);
|
||||
if (item.Key == 50)
|
||||
startGr = new DateTime(2023, 03, 21);
|
||||
foreach (var workshop in item)
|
||||
{
|
||||
_accountContext.Add(new AccountLeftWork(startGr, new DateTime(2024, 07, 21), workshop.AccountId, workshop.WorkshopId, roleId, false));
|
||||
#region AccountLeftwork
|
||||
|
||||
}
|
||||
_accountContext.SaveChanges();
|
||||
private void AddToAccountLeftWork()
|
||||
{
|
||||
List<long> roleIds = [3, 5, 7, 8, 23, 24];
|
||||
var accounts = _accountContext.Accounts
|
||||
.Where(x => roleIds.Contains(x.RoleId)).Where(x => x.AdminAreaPermission == "true");
|
||||
var accountsIds = accounts.Select(x => x.id).ToList();
|
||||
var workshopAccount = _context.WorkshopAccounts
|
||||
.Where(x => accountsIds.Contains(x.AccountId))
|
||||
.GroupBy(x => x.AccountId);
|
||||
|
||||
}
|
||||
List<long> oldAccountleftworkActiveNow = [300, 332, 333, 334, 18, 25, 14];
|
||||
List<long> oldAccountleftworkDeActivedNow = [50, 49, 15];
|
||||
var continueWorking = _0_Framework.Application.StaticWorkshopAccounts.ContinuesWorkingDate;
|
||||
|
||||
|
||||
}
|
||||
foreach (var item in workshopAccount)
|
||||
{
|
||||
|
||||
Console.WriteLine("finished");
|
||||
}
|
||||
|
||||
#endregion
|
||||
var oldActive = item.FirstOrDefault(x => oldAccountleftworkActiveNow.Contains(x.AccountId));
|
||||
if (oldActive != null)
|
||||
{
|
||||
var roleId = accounts.FirstOrDefault(x => x.id == oldActive.AccountId)!.RoleId;
|
||||
var startGr = item.Key != 25 ? new DateTime(2024, 07, 22) : new DateTime(2024, 08, 22);
|
||||
//if (item.Key is 380 or 381)
|
||||
// startGr = new DateTime(2025, 02, 19);
|
||||
if (item.Key is 14 or 18)
|
||||
startGr = new DateTime(2020, 05, 21);
|
||||
if (item.Key is 300)
|
||||
startGr = new DateTime(2024, 05, 22);
|
||||
|
||||
#region RefactorRollcall
|
||||
foreach (var workshop in item)
|
||||
{
|
||||
_accountContext.AccountLeftWorks.Add(new AccountLeftWork(startGr, continueWorking, workshop.AccountId, workshop.WorkshopId, roleId, true));
|
||||
|
||||
private void RefactorAllTheRollCallsOnEsfand(List<global::Company.Domain.RollCallAgg.RollCall> endedRollCalls, List<global::Company.Domain.RollCallAgg.RollCall> notEndedRollCalls)
|
||||
{
|
||||
var countEndedRollCalls = endedRollCalls.Count;
|
||||
var countNotEndedRollCalls = notEndedRollCalls.Count;
|
||||
}
|
||||
_accountContext.SaveChanges();
|
||||
|
||||
var step1 = 1;
|
||||
foreach (var rollCall in endedRollCalls)
|
||||
{
|
||||
rollCall.setStartAndEnd(rollCall.StartDate.Value, rollCall.EndDate.Value, _rollCallDomainService);
|
||||
Console.WriteLine($"{step1} - {countEndedRollCalls} ended Edit {rollCall.id}");
|
||||
step1 += 1;
|
||||
}
|
||||
|
||||
var step2 = 1;
|
||||
foreach (var notEndedRollCall in notEndedRollCalls)
|
||||
{
|
||||
notEndedRollCall.SetStartAgain(notEndedRollCall.StartDate.Value);
|
||||
Console.WriteLine($"{step2} - {countNotEndedRollCalls} not ended startAgain {notEndedRollCall.id}");
|
||||
step2 += 1;
|
||||
}
|
||||
|
||||
_context.SaveChanges();
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void SetRollCall(List<global::Company.Domain.RollCallAgg.RollCall> r1)
|
||||
{
|
||||
|
||||
var endedRollCalls2 = r1.Where(x => x.EndDate != null).ToList();
|
||||
var countSetTDRollCall = endedRollCalls2.Count;
|
||||
var stepSetTDRollCal = 1;
|
||||
foreach (var endedRollCall in endedRollCalls2)
|
||||
{
|
||||
endedRollCall.ClearTimeDiff();
|
||||
_context.SaveChanges();
|
||||
endedRollCall.SetEndDateTime(endedRollCall.EndDate.Value, _rollCallDomainService);
|
||||
Console.WriteLine($"{stepSetTDRollCal} - {countSetTDRollCall} ended Set Time Differences{endedRollCall.id}");
|
||||
stepSetTDRollCal += 1;
|
||||
}
|
||||
|
||||
//_context.SaveChanges();
|
||||
}
|
||||
|
||||
|
||||
private void SetRollCall2(List<global::Company.Domain.RollCallAgg.RollCall> r2)
|
||||
{
|
||||
|
||||
|
||||
var endedRollCalls2 = r2.Where(x => x.EndDate != null).ToList();
|
||||
var countSetTDRollCall = endedRollCalls2.Count;
|
||||
var stepSetTDRollCal = 1;
|
||||
foreach (var endedRollCall in endedRollCalls2)
|
||||
{
|
||||
endedRollCall.SetEndDateTime(endedRollCall.EndDate.Value, _rollCallDomainService);
|
||||
Console.WriteLine($"{stepSetTDRollCal} - {countSetTDRollCall} ended Set Time Differences{endedRollCall.id}");
|
||||
stepSetTDRollCal += 1;
|
||||
}
|
||||
|
||||
//_context.SaveChanges();
|
||||
}
|
||||
#endregion
|
||||
//public async Task<IActionResult> OnPostShiftDate()
|
||||
//{
|
||||
// var customizeWorkshopSettings = _context.CustomizeWorkshopSettings.AsSplitQuery();
|
||||
var oldDeActive = item.FirstOrDefault(x => oldAccountleftworkDeActivedNow.Contains(x.AccountId));
|
||||
if (oldDeActive != null)
|
||||
{
|
||||
var roleId = accounts.FirstOrDefault(x => x.id == oldDeActive.AccountId)!.RoleId;
|
||||
var startGr = new DateTime(2022, 03, 21);
|
||||
if (item.Key == 49)
|
||||
startGr = new DateTime(2023, 04, 21);
|
||||
if (item.Key == 50)
|
||||
startGr = new DateTime(2023, 03, 21);
|
||||
foreach (var workshop in item)
|
||||
{
|
||||
_accountContext.Add(new AccountLeftWork(startGr, new DateTime(2024, 07, 21), workshop.AccountId, workshop.WorkshopId, roleId, false));
|
||||
|
||||
}
|
||||
_accountContext.SaveChanges();
|
||||
|
||||
// customizeWorkshopSettings = customizeWorkshopSettings.Where(x => x.WorkshopId == 499);
|
||||
|
||||
// var rollCalls =
|
||||
// _context.RollCalls.Where(x => customizeWorkshopSettings.Any(a => a.WorkshopId == x.WorkshopId))
|
||||
// .ToList();
|
||||
|
||||
// foreach (var rollCall in rollCalls)
|
||||
// {
|
||||
// rollCall.SetShiftDate(_rollCallDomainService);
|
||||
// Console.WriteLine(rollCall.id);
|
||||
// }
|
||||
}
|
||||
|
||||
// await _context.SaveChangesAsync();
|
||||
// ViewData["message"] = "تومام";
|
||||
// return Page();
|
||||
//}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Console.WriteLine("finished");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region RefactorRollcall
|
||||
|
||||
private void RefactorAllTheRollCallsOnEsfand(List<global::Company.Domain.RollCallAgg.RollCall> endedRollCalls, List<global::Company.Domain.RollCallAgg.RollCall> notEndedRollCalls)
|
||||
{
|
||||
var countEndedRollCalls = endedRollCalls.Count;
|
||||
var countNotEndedRollCalls = notEndedRollCalls.Count;
|
||||
|
||||
var step1 = 1;
|
||||
foreach (var rollCall in endedRollCalls)
|
||||
{
|
||||
rollCall.setStartAndEnd(rollCall.StartDate.Value, rollCall.EndDate.Value, _rollCallDomainService);
|
||||
Console.WriteLine($"{step1} - {countEndedRollCalls} ended Edit {rollCall.id}");
|
||||
step1 += 1;
|
||||
}
|
||||
|
||||
var step2 = 1;
|
||||
foreach (var notEndedRollCall in notEndedRollCalls)
|
||||
{
|
||||
notEndedRollCall.SetStartAgain(notEndedRollCall.StartDate.Value);
|
||||
Console.WriteLine($"{step2} - {countNotEndedRollCalls} not ended startAgain {notEndedRollCall.id}");
|
||||
step2 += 1;
|
||||
}
|
||||
|
||||
_context.SaveChanges();
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void SetRollCall(List<global::Company.Domain.RollCallAgg.RollCall> r1)
|
||||
{
|
||||
|
||||
var endedRollCalls2 = r1.Where(x => x.EndDate != null).ToList();
|
||||
var countSetTDRollCall = endedRollCalls2.Count;
|
||||
var stepSetTDRollCal = 1;
|
||||
foreach (var endedRollCall in endedRollCalls2)
|
||||
{
|
||||
endedRollCall.ClearTimeDiff();
|
||||
_context.SaveChanges();
|
||||
endedRollCall.SetEndDateTime(endedRollCall.EndDate.Value, _rollCallDomainService);
|
||||
Console.WriteLine($"{stepSetTDRollCal} - {countSetTDRollCall} ended Set Time Differences{endedRollCall.id}");
|
||||
stepSetTDRollCal += 1;
|
||||
}
|
||||
|
||||
//_context.SaveChanges();
|
||||
}
|
||||
|
||||
|
||||
private void SetRollCall2(List<global::Company.Domain.RollCallAgg.RollCall> r2)
|
||||
{
|
||||
|
||||
|
||||
var endedRollCalls2 = r2.Where(x => x.EndDate != null).ToList();
|
||||
var countSetTDRollCall = endedRollCalls2.Count;
|
||||
var stepSetTDRollCal = 1;
|
||||
foreach (var endedRollCall in endedRollCalls2)
|
||||
{
|
||||
endedRollCall.SetEndDateTime(endedRollCall.EndDate.Value, _rollCallDomainService);
|
||||
Console.WriteLine($"{stepSetTDRollCal} - {countSetTDRollCall} ended Set Time Differences{endedRollCall.id}");
|
||||
stepSetTDRollCal += 1;
|
||||
}
|
||||
|
||||
//_context.SaveChanges();
|
||||
}
|
||||
#endregion
|
||||
//public async Task<IActionResult> OnPostShiftDate()
|
||||
//{
|
||||
// var customizeWorkshopSettings = _context.CustomizeWorkshopSettings.AsSplitQuery();
|
||||
|
||||
|
||||
// customizeWorkshopSettings = customizeWorkshopSettings.Where(x => x.WorkshopId == 499);
|
||||
|
||||
// var rollCalls =
|
||||
// _context.RollCalls.Where(x => customizeWorkshopSettings.Any(a => a.WorkshopId == x.WorkshopId))
|
||||
// .ToList();
|
||||
|
||||
// foreach (var rollCall in rollCalls)
|
||||
// {
|
||||
// rollCall.SetShiftDate(_rollCallDomainService);
|
||||
// Console.WriteLine(rollCall.id);
|
||||
// }
|
||||
|
||||
// await _context.SaveChangesAsync();
|
||||
// ViewData["message"] = "تومام";
|
||||
// return Page();
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ using Company.Domain.ReportAgg;
|
||||
using Company.Domain.RollCallAgg;
|
||||
using Company.Domain.RollCallAgg.DomainService;
|
||||
using CompanyManagment.App.Contracts.AndroidApkVersion;
|
||||
using CompanyManagment.App.Contracts.InstitutionPlan;
|
||||
using CompanyManagment.App.Contracts.TemporaryClientRegistration;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using IUidService = _0_Framework.Application.UID.IUidService;
|
||||
@@ -48,6 +49,7 @@ namespace ServiceHost.Pages
|
||||
private readonly IWebHostEnvironment _webHostEnvironment;
|
||||
private readonly IAndroidApkVersionApplication _androidApkVersionApplication;
|
||||
private readonly ITemporaryClientRegistrationApplication _clientRegistrationApplication;
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -70,27 +72,61 @@ namespace ServiceHost.Pages
|
||||
|
||||
public IActionResult OnGet()
|
||||
{
|
||||
//bool ex = false;
|
||||
//while (!ex)
|
||||
//{
|
||||
// Console.WriteLine("enter National code ... ");
|
||||
// var nationalCode = Console.ReadLine();
|
||||
// Console.WriteLine("enter DateOfBirth ... ");
|
||||
// var dateOfBirth = Console.ReadLine();
|
||||
// Console.WriteLine("enter phoneNumber ... ");
|
||||
// var phone = Console.ReadLine();
|
||||
// var res =_clientRegistrationApplication.CreateContractingPartyTemp(nationalCode, dateOfBirth, phone).GetAwaiter().GetResult();
|
||||
// Console.WriteLine("do you want to exit ... ");
|
||||
// var exitCheck = Console.ReadLine();
|
||||
// if (exitCheck == "yes")
|
||||
// ex = true;
|
||||
//}
|
||||
|
||||
bool ex = false;
|
||||
//while (!ex)
|
||||
//{
|
||||
// Console.WriteLine("enter National code ... ");
|
||||
// var nationalCode = Console.ReadLine();
|
||||
// Console.WriteLine("enter DateOfBirth ... ");
|
||||
// var dateOfBirth = Console.ReadLine();
|
||||
// Console.WriteLine("enter phoneNumber ... ");
|
||||
// var phone = Console.ReadLine();
|
||||
// var res =_clientRegistrationApplication.CreateContractingPartyTemp(nationalCode, dateOfBirth, phone).GetAwaiter().GetResult();
|
||||
// Console.WriteLine("do you want to exit ... ");
|
||||
// var exitCheck = Console.ReadLine();
|
||||
// if (exitCheck == "yes")
|
||||
// ex = true;
|
||||
//}
|
||||
|
||||
// _reportRepository.GetAllActiveWorkshopsNew("1403", "12");
|
||||
// while (!ex)
|
||||
// {
|
||||
// var onGet = _institutionPlanApplication.GetByFirst();
|
||||
// Console.WriteLine("enter ContractAndCheckoutInPersonPercent ... " + onGet.ContractAndCheckoutInPersonPercent);
|
||||
// var ContractAndCheckoutInPersonPercent = Console.ReadLine();
|
||||
// Console.WriteLine("enter ContractAndCheckoutPercent ... " + onGet.ContractAndCheckoutPercent);
|
||||
// var ContractAndCheckoutPercent = Console.ReadLine();
|
||||
|
||||
//var test = _uidService.GetPersonalInfo("2669318622", "1363/02/25");
|
||||
HasApkToDownload = _androidApkVersionApplication.HasAndroidApkToDownload();
|
||||
// Console.WriteLine("enter InsurancePercent ... " + onGet.InsurancePercent);
|
||||
// var InsurancePercent = Console.ReadLine();
|
||||
// Console.WriteLine("enter InsuranceInPersonPercent ... " + onGet.InsuranceInPersonPercent);
|
||||
// var InsuranceInPersonPercent = Console.ReadLine();
|
||||
|
||||
// Console.WriteLine("enter CustomizeCheckoutPercent ... " + onGet.CustomizeCheckoutPercent);
|
||||
// var CustomizeCheckoutPercent = Console.ReadLine();
|
||||
// Console.WriteLine("enter RollCallPercent ... " + onGet.RollCallPercent);
|
||||
// var RollCallPercent = Console.ReadLine();
|
||||
// //var res = _institutionPlanApplication.GetInstitutionPlanList(Convert.ToInt32(pageIndex),
|
||||
// // Convert.ToInt32(countPerson));
|
||||
|
||||
// var res = _institutionPlanApplication.CreateInstitutionPlanPercentage(new CreateInstitutionPlanPercentage()
|
||||
// {
|
||||
// ContractAndCheckoutInPersonPercentStr = ContractAndCheckoutInPersonPercent,
|
||||
// ContractAndCheckoutPercentStr = ContractAndCheckoutPercent,
|
||||
// InsurancePercentStr = InsurancePercent,
|
||||
// InsuranceInPersonPercentStr = InsuranceInPersonPercent,
|
||||
// CustomizeCheckoutPercentStr = CustomizeCheckoutPercent,
|
||||
// RollCallPercentStr = RollCallPercent
|
||||
// });
|
||||
|
||||
// Console.WriteLine("do you want to exit ... ");
|
||||
// var exitCheck = Console.ReadLine();
|
||||
// if (exitCheck == "y")
|
||||
// ex = true;
|
||||
//}
|
||||
// _reportRepository.GetAllActiveWorkshopsNew("1403", "12");
|
||||
|
||||
//var test = _uidService.GetPersonalInfo("2669318622", "1363/02/25");
|
||||
HasApkToDownload = _androidApkVersionApplication.HasAndroidApkToDownload();
|
||||
if (User.Identity is { IsAuthenticated: true })
|
||||
{
|
||||
if (User.FindFirstValue("IsCamera") == "true")
|
||||
|
||||
@@ -249,44 +249,43 @@ function loadEmployeeAjax(groupSettingId) {
|
||||
}
|
||||
|
||||
htmlEmployee += `<div></div>
|
||||
<div class="my-1 Rtable-row align-items-center position-relative itemResultEmployee" data-employee-id="${itemEmployee.employeeId}">
|
||||
<div class="Rtable-cell width1 widthMobile1">
|
||||
<div class="Rtable-cell--content">
|
||||
<span class="d-flex justify-content-center row-index2">
|
||||
${indexEmployee++}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="Rtable-cell width2 widthMobile2">
|
||||
<div class="Rtable-cell--heading d-none">نام پرسنل:</div>
|
||||
<div class="Rtable-cell--content">
|
||||
<div class="d-flex d-md-none">نام پرسنل:</div>
|
||||
<div class="itemEmployeeName">${itemEmployee
|
||||
.name} </div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="my-1 Rtable-row align-items-center position-relative itemResultEmployee" data-employee-id="${itemEmployee.employeeId}">
|
||||
<div class="Rtable-cell width1 widthMobile1">
|
||||
<div class="Rtable-cell--content">
|
||||
<span class="d-flex justify-content-center row-index2">
|
||||
${indexEmployee++}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="Rtable-cell width2 widthMobile2">
|
||||
<div class="Rtable-cell--heading d-none">نام پرسنل:</div>
|
||||
<div class="Rtable-cell--content">
|
||||
<div class="d-flex d-md-none">نام پرسنل:</div>
|
||||
<div class="itemEmployeeName">${itemEmployee.name} </div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="Rtable-cell width3 widthMobile2">
|
||||
<div class="Rtable-cell--heading d-none">نام پرسنل:</div>
|
||||
<div class="Rtable-cell width3 widthMobile2 d-none d-md-block">
|
||||
<div class="Rtable-cell--heading d-none">نوع ساعت کاری:</div>
|
||||
<div class="Rtable-cell--content">
|
||||
<div class="d-flex d-md-none">نام پرسنل:</div>
|
||||
<div class="d-flex d-md-none">نوع ساعت کاری:</div>
|
||||
<div class="text-center">`;
|
||||
if (itemEmployee.workshopShiftStatus === 0) {
|
||||
htmlEmployee += `منظم`;
|
||||
} else if (itemEmployee.workshopShiftStatus === 1) {
|
||||
htmlEmployee += `مختلط`;
|
||||
} else {
|
||||
htmlEmployee += `گردشی`;
|
||||
}
|
||||
htmlEmployee += `</div>
|
||||
if (itemEmployee.workshopShiftStatus === 0) {
|
||||
htmlEmployee += `منظم`;
|
||||
} else if (itemEmployee.workshopShiftStatus === 1) {
|
||||
htmlEmployee += `مختلط`;
|
||||
} else {
|
||||
htmlEmployee += `گردشی`;
|
||||
}
|
||||
htmlEmployee += `</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="Rtable-cell width4 widthMobile2 text-center d-none d-md-block">
|
||||
<div class="Rtable-cell--heading d-none">ساعت کاری:</div>
|
||||
<div class="Rtable-cell--content d-flex text-center">
|
||||
<div class="d-flex d-md-none mx-1">ساعت کاری: </div>
|
||||
<div class="w-100">`;
|
||||
<div class="Rtable-cell width4 widthMobile2 text-center d-none d-md-block">
|
||||
<div class="Rtable-cell--heading d-none">ساعت کاری:</div>
|
||||
<div class="Rtable-cell--content d-flex text-center">
|
||||
<div class="d-flex d-md-none mx-1">ساعت کاری: </div>
|
||||
<div class="w-100">`;
|
||||
|
||||
if (itemEmployee.workshopShiftStatus === 0) {
|
||||
itemEmployee.rollCallWorkshopShifts.forEach(function (itemEmployeeShifts) {
|
||||
|
||||
Reference in New Issue
Block a user