mahan customize workshopSetimgs value object

This commit is contained in:
SamSys
2024-10-06 20:20:21 +03:30
parent 6dc4785057
commit 6219a4ea5a
69 changed files with 12626 additions and 5 deletions

View File

@@ -0,0 +1,60 @@
namespace _0_Framework.Domain.CustomizeCheckoutValueObjects;
public class BaseYearsPay
{
public BaseYearsPay(BaseYearsPayType baseYearsPayType)
{
BaseYearsPayType = baseYearsPayType;
}
private BaseYearsPay()
{
}
public BaseYearsPayType BaseYearsPayType { get; private set; }
public double Value { get; set; }
public BaseYearsPaymentType PaymentType { get; set; }
}
public enum BaseYearsPaymentType
{
/// <summary>
/// پرداخت نمیگردد
/// </summary>
None,
/// <summary>
/// پرداخت به صورت سالانه در آخر سال پرداخت میگردد
/// </summary>
YearlyPay,
/// <summary>
/// پرداخت به صورت ماهانه
/// </summary>
MonthlyPay
}
public enum BaseYearsPayType
{
/// <summary>
///محاسبه نمیشود
/// </summary>
None,
/// <summary>
/// به صورت درصدی از حقوق
/// </summary>
PercentageOfSalary,
/// <summary>
/// دوبرابر حقوق
/// </summary>
TwoTimeOfSalary,
/// <summary>
/// یک برابر حقوق
/// </summary>
OneTimeOfSalary,
/// <summary>
/// مبلغ اختصاصی برای سنوات
/// </summary>
Money
}

View File

@@ -0,0 +1,71 @@
namespace _0_Framework.Domain.CustomizeCheckoutValueObjects;
public class BonusesPay
{
public BonusesPay(BonusesType bonusesPayType, int percentage)
{
BonusesPayType = bonusesPayType;
Value = percentage;
}
private BonusesPay()
{
}
/// <summary>
/// نوع عیدی
/// </summary>
public BonusesType BonusesPayType { get; private set; }
/// <summary>
/// مقدار درصد یا مبلغ
/// </summary>
public double Value { get; private set; }
/// <summary>
/// نوع پرداخت برای عیدی
/// </summary>
public BonusesPaymentType PaymentType { get; set; }
}
public enum BonusesPaymentType
{
/// <summary>
/// پرداخت نمیگردد
/// </summary>
None,
/// <summary>
/// پرداخت به صورت سالانه در آخر سال پرداخت میگردد
/// </summary>
YearlyPay,
/// <summary>
/// پرداخت به صورت ماهانه
/// </summary>
MonthlyPay
}
public enum BonusesType
{
/// <summary>
///محاسبه نمیشود
/// </summary>
None,
/// <summary>
/// به صورت درصدی از حقوق
/// </summary>
PercentageOfSalary,
/// <summary>
/// دوبرابر حقوق
/// </summary>
TwoTimeOfSalary,
/// <summary>
/// یک برابر حقوق
/// </summary>
OneTimeOfSalary,
/// <summary>
/// مبلغ اختصاصی برای عیدی
/// </summary>
Money
}

View File

@@ -0,0 +1,7 @@
namespace _0_Framework.Domain.CustomizeCheckoutValueObjects;
public enum Currency
{
Rial,
Toman
}

View File

@@ -0,0 +1,86 @@
using System.Collections.Generic;
namespace _0_Framework.Domain.CustomizeCheckoutValueObjects;
public class EarlyExit
{
public EarlyExit(EarlyExitType earlyExitType, List<EarlyExitTimeFine> earlyExitTimeFines, double value)
{
EarlyExitType = earlyExitType;
EarlyExitTimeFines = earlyExitTimeFines??new ();
Value = value;
}
private EarlyExit()
{
EarlyExitTimeFines = new();
}
/// <summary>
/// نوع حساب کردن تعجیل در خروج
/// </summary>
public EarlyExitType EarlyExitType { get; private set; }
/// <summary>
/// جریمه های اختصاصی پله ای
/// </summary>
public List<EarlyExitTimeFine> EarlyExitTimeFines { get; private set; }
public double Value { get; private set; }
}
public class EarlyExitTimeFine
{
public EarlyExitTimeFine(string minute, double fineMoney)
{
Minute = minute;
FineMoney = fineMoney;
}
private EarlyExitTimeFine()
{
}
/// <summary>
/// دقیقه تعیین شده برای جریمه
/// </summary>
public string Minute { get; private set; }
/// <summary>
/// مبلغ تعیین شده برای جریمه
/// </summary>
public double FineMoney { get; private set; }
}
//public enum EarlyExitTimeFineType
//{
// /// <summary>
// /// جریمه های زمانی به صورت پله همه باهم جمع گردد
// /// </summary>
// StepByStep,
// /// <summary>
// /// فقط آخرین جریمه لحاظ شود
// /// </summary>
// LastStep,
//}
public enum EarlyExitType
{
/// <summary>
/// محاسبه نمیشود
/// </summary>
None,
/// <summary>
/// هر دقیقه تاخیر به تناسب حقوق مزد روزانه کسر گردد
/// </summary>
DeductEveryMinuteAccordingToDailyWage,
/// <summary>
/// هر دقیقه تاخیر مبلغی کسر میگردد
/// </summary>
MoneyPerMinute
}

View File

@@ -0,0 +1,72 @@
namespace _0_Framework.Domain.CustomizeCheckoutValueObjects;
public class FamilyAllowance
{
public FamilyAllowance(FamilyAllowanceType familyAllowanceType, double value)
{
FamilyAllowanceType = familyAllowanceType;
//NumberOfChildren = numberOfChildren;
Value = value;
}
private FamilyAllowance()
{
}
/// <summary>
/// نوع حق اولاد را مشخص میکند که آیا پرداخت نمیکند یا به صورت درصدی پرداخت میکند یا به صورت مبلغ اختصاصی
/// </summary>
public FamilyAllowanceType FamilyAllowanceType { get; private set; }
/// <summary>
/// تعداد فرزند هایی حق اولاد به آنها تعلق میگیرد.
/// </summary>
// ReSharper disable once GrammarMistakeInComment
//public NumberOfChildren NumberOfChildren { get; private set; }
public double Value { get; private set; }
}
public enum FamilyAllowanceType
{
/// <summary>
///محاسبه نمیشود
/// </summary>
None,
/// <summary>
/// به ازای هر فرزند درصدی از مزد روزانه پرمسل
/// </summary>
Percentage,
/// <summary>
/// به ازای هر فرزند به صورت مبلغ اختصاصی پرداخت میشود
/// </summary>
Money
}
//public enum NumberOfChildren
//{
// /// <summary>
// /// محاسبه نمیشود
// /// </summary>
// None,
// /// <summary>
// /// یک فرزند
// /// </summary>
// One,
// /// <summary>
// /// دو فرزند
// /// </summary>
// Two,
// /// <summary>
// /// سه فرزند
// /// </summary>
// Three,
// /// <summary>
// /// چهار فرزند
// /// </summary>
// Four,
// /// <summary>
// /// تمامی فرزند ها
// /// </summary>
// All
//}

View File

@@ -0,0 +1,85 @@
using System;
using System.Collections.Generic;
namespace _0_Framework.Domain.CustomizeCheckoutValueObjects;
public class FineAbsenceDeduction
{
private FineAbsenceDeduction()
{
FineAbsenceDayOfWeekCollection = new ();
}
public FineAbsenceDeduction(FineAbsenceDeductionType fineAbsenceDeductionType, double value,List<FineAbsenceDayOfWeek> fineAbsenceDayOfWeekCollection)
{
FineAbsenceDeductionType = fineAbsenceDeductionType;
Value = value;
FineAbsenceDayOfWeekCollection = fineAbsenceDayOfWeekCollection ?? new ();
}
/// <summary>
/// نوع جریمه غیبت
/// </summary>
public FineAbsenceDeductionType FineAbsenceDeductionType { get; private set; }
public double Value { get; set; }
/// <summary>
/// جریمه های اختصاصی به ازای روز های هفته
/// </summary>
public List<FineAbsenceDayOfWeek> FineAbsenceDayOfWeekCollection { get; private set; }
}
public class FineAbsenceDayOfWeek
{
public FineAbsenceDayOfWeek(DayOfWeek dayOfWeek)
{
DayOfWeek = dayOfWeek;
}
private FineAbsenceDayOfWeek()
{
}
/// <summary>
/// روز های هفته
/// </summary>
public DayOfWeek DayOfWeek { get; private set; }
}
//public enum FineAbsenceDayOfWeekType
//{
// /// <summary>
// /// مبلغ اختصاصی
// /// </summary>
// Money,
// /// <summary>
// /// چند برابر کردن جریمه به ازای مقداری که داده شده
// /// </summary>
// Multiple,
// /// <summary>
// /// درصد از مزد روزانه
// /// </summary>
// PercentageOfDailyWage
//}
public enum FineAbsenceDeductionType
{
/// <summary>
/// محاسبه نمیشود
/// </summary>
None,
/// <summary>
/// در صورت استفاده غیر مجاز مرخصی و غیبت چند برابر از مزد روزانه کسر میگردد
/// </summary>
MultipleTimesOfDailyWage,
/// <summary>
/// به صورت مبلغ اختصاصی پرداخت میشود
/// </summary>
Money
}

View File

@@ -0,0 +1,20 @@
namespace _0_Framework.Domain.CustomizeCheckoutValueObjects;
public class FineDeduction
{
private FineDeduction()
{
}
public FineDeduction(FineDeductionType fineDeductionType, int percentage)
{
FineDeductionType = fineDeductionType;
Percentage = percentage;
}
public FineDeductionType FineDeductionType { get; private set; }
/// <summary>
/// مقدار درصد
/// </summary>
public int Percentage { get; private set; }
}

View File

@@ -0,0 +1,17 @@
namespace _0_Framework.Domain.CustomizeCheckoutValueObjects;
public enum FineDeductionType
{
/// <summary>
/// دوبرابر حقوق تعیین شده
/// </summary>
TwoTimeOfSalary,
/// <summary>
/// یک برابر حقوق تعیین شده
/// </summary>
OneTImeOfSalary,
/// <summary>
/// درصد تعیین شده
/// </summary>
Percentage
}

View File

@@ -0,0 +1,42 @@
namespace _0_Framework.Domain.CustomizeCheckoutValueObjects;
public enum FridayPayType
{
/// <summary>
///محاسبه نمیشود
/// </summary>
None,
/// <summary>
/// اضافه کار محاسبه میشود
/// </summary>
ExtraWorking,
/// <summary>
/// به صورت درصدی از مزد روزانه به ازای هر ساعت کار در جمعه
/// </summary>
PercentageFromSalaryPerHour,
/// <summary>
/// مقدار پول شخصی سازی شده به ازای هر ساعت کاری که پرسنل در جمعه کار میکند
/// </summary>
MoneyPerFridayPerHour,
/// <summary>
/// مقدار پول شخصی سازی شده برای هرروز کار در روز جمعه
/// </summary>
MoneyPerFridayForDay,
}
public class FridayPay
{
private FridayPay()
{
}
public FridayPay(FridayPayType fridayPayType, double value)
{
FridayPayType = fridayPayType;
Value = value;
}
public FridayPayType FridayPayType { get; private set; }
public double Value { get; private set; }
}

View File

@@ -0,0 +1,40 @@
namespace _0_Framework.Domain.CustomizeCheckoutValueObjects;
public class InsuranceDeduction
{
public InsuranceDeduction(InsuranceDeductionType insuranceDeductionType, double value)
{
InsuranceDeductionType = insuranceDeductionType;
Value = value;
}
private InsuranceDeduction()
{
}
public InsuranceDeductionType InsuranceDeductionType { get; private set; }
public double Value { get; private set; }
}
public enum InsuranceDeductionType
{
/// <summary>
/// محاسبه نمیشود
/// </summary>
None,
/// <summary>
/// بر اساس قانون کار (حقوق+بن کارگری+ بن مسکن+حق تاهل)*7درصد
/// </summary>
BasedOnLaborLaw,
/// <summary>
/// بر اساس درصد از حقوق تعیین شده
/// </summary>
PercentageOfSalary,
/// <summary>
/// به صورت مبلغ ماهانه اختصاصی پرداخت میشود
/// </summary>
Money
}

View File

@@ -0,0 +1,76 @@
using System.Collections.Generic;
namespace _0_Framework.Domain.CustomizeCheckoutValueObjects;
public class LateToWork
{
public LateToWork(LateToWorkType lateToWorkType, List<LateToWorkTimeFine> lateToWorkTimeFines, double value)
{
LateToWorkType = lateToWorkType;
LateToWorkTimeFines = lateToWorkTimeFines??new ();
Value = value;
}
private LateToWork()
{
LateToWorkTimeFines = new ();
}
/// <summary>
/// نوع حساب کردن تاخیر در ورود
/// </summary>
public LateToWorkType LateToWorkType { get; private set; }
/// <summary>
/// این مقدار بستگی به نوع حساب کردن تاخیر در ورود
/// </summary>
public double Value { get; private set; }
/// <summary>
/// جریمه های اختصاصی پله ای
/// </summary>
public List<LateToWorkTimeFine> LateToWorkTimeFines { get; private set; }
}
public enum LateToWorkType
{
/// <summary>
/// محاسبه نمیشود
/// </summary>
None,
/// <summary>
/// هر دقیقه تاخیر به تناسب حقوق مزد روزانه کسر گردد
/// </summary>
DeductEveryMinuteAccordingToDailyWage,
/// <summary>
/// هر دقیقه تاخیر چند برابر از حقوق کسر میگردد
/// </summary>
MultiTimesPerMinute
}
public class LateToWorkTimeFine
{
public LateToWorkTimeFine(string minute, double fineMoney)
{
Minute = minute;
FineMoney = fineMoney;
}
private LateToWorkTimeFine()
{
}
/// <summary>
/// دقیقه تعیین شده برای جریمه
/// </summary>
public string Minute { get; private set; }
/// <summary>
/// مبلغ تعیین شده برای جریمه
/// </summary>
public double FineMoney { get; private set; }
}

View File

@@ -0,0 +1,47 @@
namespace _0_Framework.Domain.CustomizeCheckoutValueObjects;
public class LeavePay
{
public LeavePay(LeavePayType leavePayType, double value)
{
LeavePayType = leavePayType;
//DayCountAllowable = dayCountAllowable;
Value = value;
}
private LeavePay()
{
}
/// <summary>
/// نوع مرخصی
/// </summary>
public LeavePayType LeavePayType { get; private set; }
///// <summary>
///// تعداد روز های مجاز مرخصی
///// </summary>
//public string DayCountAllowable { get; set; }
public double Value { get; private set; }
}
public enum LeavePayType
{
/// <summary>
/// محاسبه و پرداخت نمیشود
/// </summary>
None,
/// <summary>
/// پرداخت میشود
/// </summary>
Pay,
///// <summary>
///// به ازای هر روز استفاده نشده از مرخصی درصدی از حقوق
///// </summary>
//Percentage,
///// <summary>
///// به ازای هر رور استفاده نشده از مرخصی به صورت مبلغ اختصاصی پرداخت میشود
///// </summary>
//Money
}

View File

@@ -0,0 +1,34 @@
namespace _0_Framework.Domain.CustomizeCheckoutValueObjects;
public class MarriedAllowance
{
private MarriedAllowance()
{
}
public MarriedAllowance(MarriedAllowanceType marriedAllowanceType, double value)
{
MarriedAllowanceType = marriedAllowanceType;
Value = value;
}
public MarriedAllowanceType MarriedAllowanceType { get; private set; }
public double Value { get; private set; }
}
public enum MarriedAllowanceType
{
/// <summary>
///محاسبه نمیشود
/// </summary>
None,
/// <summary>
/// به صورت درصدی
/// </summary>
PercentageFromSalary,
/// <summary>
/// به صورت مبلغ اختصاصی پرداخت میشود
/// </summary>
Money
}

View File

@@ -0,0 +1,17 @@
namespace _0_Framework.Domain.CustomizeCheckoutValueObjects;
public enum MaxMonthDays
{
/// <summary>
/// تعداد روز های ماه به صورت عادی باشد و تغییری در آن اعمال نشود
/// </summary>
Default,
/// <summary>
/// تمامی ماه ها 30 روزه حساب شوند
/// </summary>
ThirtyDaysForAllMonth,
/// <summary>
/// تمامی ماه ها 30 روزه حساب شوند ولی اسفند 29 روزه
/// </summary>
ThirtyDaysForAllMonthExceptEsfand
}

View File

@@ -0,0 +1,34 @@
namespace _0_Framework.Domain.CustomizeCheckoutValueObjects;
public class NightWorkPay
{
public NightWorkPay(NightWorkType nightWorkingType, double value)
{
NightWorkingType = nightWorkingType;
Value = value;
}
private NightWorkPay()
{
}
public NightWorkType NightWorkingType { get; private set; }
public double Value { get; private set; }
}
public enum NightWorkType
{
/// <summary>
///محاسبه نمیشود
/// </summary>
None,
/// <summary>
/// به صورت درصدی از مزد روزانه
/// </summary>
PercentageFromSalary,
/// <summary>
/// مقدار پول شخصی سازی شده برای هر ساعت شب کاری
/// </summary>
MoneyPerHour
}

View File

@@ -0,0 +1,31 @@
namespace _0_Framework.Domain.CustomizeCheckoutValueObjects;
public enum OverTimePayType
{
/// <summary>
///محاسبه نمیشود
/// </summary>
None,
/// <summary>
/// مقدار پول شخصی سازی شده برای هر ساعت
/// </summary>
MoneyPerHour,
/// <summary>
/// به صورت درصدی از مزد روزانه به ازای هر ساعت.
/// </summary>
PercentagePerHourOfSalary
}
public class OverTimePay
{
public OverTimePay(OverTimePayType overTimePayType, double value)
{
OverTimePayType = overTimePayType;
Value = value;
}
private OverTimePay()
{
}
public OverTimePayType OverTimePayType { get; private set; }
public double Value { get; private set; }
}

View File

@@ -0,0 +1,66 @@
namespace _0_Framework.Domain.CustomizeCheckoutValueObjects;
public class ShiftPay
{
public ShiftPay(ShiftType shiftType, ShiftPayType shiftPayType, double value)
{
ShiftType = shiftType;
ShiftPayType = shiftPayType;
Value = value;
}
private ShiftPay()
{
}
/// <summary>
/// نوع نوبت کاری را مشخص میکند . به عنوان مثال: صبح و عصر، عصر و شب و غیره...
/// </summary>
public ShiftType ShiftType { get; private set; }
/// <summary>
/// نوع پرداخت را مشخص میکند که آیا به صورت درصدی است یا مبلغ اختصاصی.
/// </summary>
public ShiftPayType ShiftPayType { get; private set; }
public double Value { get; private set; }
}
public enum ShiftPayType
{
/// <summary>
///محاسبه نمیشود
/// </summary>
None,
/// <summary>
/// درصدی از حقوق
/// </summary>
PercentageOfSalary,
/// <summary>
/// به صورت مبلغ اختصاصی پرداخت میشود
/// </summary>
Money
}
public enum ShiftType
{
/// <summary>
///محاسبه نمیشود
/// </summary>
None,
/// <summary>
/// صبح و عصر
/// </summary>
MorningAndEvening,
/// <summary>
/// عصر و شب
/// </summary>
EveningAndNight,
/// <summary>
/// صبح و عصر و شب
/// </summary>
MorningAndEveningAndNight
}

View File

@@ -0,0 +1,212 @@
using System;
using System.Collections.Generic;
using _0_Framework.Domain;
using _0_Framework.Domain.CustomizeCheckoutValueObjects;
using Company.Domain.CustomizeWorkshopGroupSettingsAgg.Entities;
using Company.Domain.EmployeeAgg;
using Company.Domain.WorkshopAgg;
namespace Company.Domain.CustomizeWorkshopEmployeeSettingsAgg.Entities;
public class CustomizeWorkshopEmployeeSettings : EntityBase
{
private CustomizeWorkshopEmployeeSettings()
{
}
public CustomizeWorkshopEmployeeSettings(FridayPay fridayPay, OverTimePay overTimePay, BaseYearsPay baseYearsPay,
BonusesPay bonusesPay, NightWorkPay nightWorkPay, MarriedAllowance marriedAllowance, ShiftPay shiftPay,
FamilyAllowance familyAllowance, LeavePay leavePay, InsuranceDeduction insuranceDeduction, FineAbsenceDeduction fineAbsenceDeduction,
LateToWork lateToWork, EarlyExit earlyExit, long employeeId, long workshopId, double salary, long customizeWorkshopGroupSettingId,
ICollection<CustomizeWorkshopEmployeeSettingsShift> customizeWorkshopEmployeeSettingsShifts)
{
FridayPay = fridayPay;
OverTimePay = overTimePay;
BaseYearsPay = baseYearsPay;
BonusesPay = bonusesPay;
NightWorkPay = nightWorkPay;
FamilyAllowance = familyAllowance;
LeavePay = leavePay;
InsuranceDeduction = insuranceDeduction;
FineAbsenceDeduction = fineAbsenceDeduction;
LateToWork = lateToWork;
EarlyExit = earlyExit;
EmployeeId = employeeId;
WorkshopId = workshopId;
Salary = salary;
CustomizeWorkshopGroupSettingId = customizeWorkshopGroupSettingId;
CustomizeWorkshopEmployeeSettingsShifts = customizeWorkshopEmployeeSettingsShifts;
IsChanged = false;
}
/// <summary>
/// جمعه کاری
/// </summary>
public FridayPay FridayPay { get; private set; }
/// <summary>
/// اضافه کاری
/// </summary>
public OverTimePay OverTimePay { get; private set; }
/// <summary>
/// سنوات
/// </summary>
public BaseYearsPay BaseYearsPay { get; private set; }
/// <summary>
/// عیدی
/// </summary>
public BonusesPay BonusesPay { get; private set; }
/// <summary>
/// شب کاری
/// </summary>
public NightWorkPay NightWorkPay { get; private set; }
/// <summary>
/// حق تاهل
/// </summary>
public MarriedAllowance MarriedAllowance { get; private set; }
/// <summary>
/// نوبت کاری
/// </summary>
public ShiftPay ShiftPay { get; private set; }
/// <summary>
/// حق اولاد(حق فرزند)ء
/// </summary>
public FamilyAllowance FamilyAllowance { get; private set; }
/// <summary>
/// مزد مرخصی
/// </summary>
public LeavePay LeavePay { get; private set; }
/// <summary>
/// حق بیمه
/// </summary>
public InsuranceDeduction InsuranceDeduction { get; private set; }
/// <summary>
/// جریمه غیبت
/// </summary>
public FineAbsenceDeduction FineAbsenceDeduction { get; private set; }
/// <summary>
/// تاخیر در ورود
/// </summary>
public LateToWork LateToWork { get; private set; }
/// <summary>
/// نعجیل در خروج
/// </summary>
public EarlyExit EarlyExit { get; private set; }
public long EmployeeId { get; private set; }
public long WorkshopId { get; private set; }
public double Salary { get; private set; }
public bool IsChanged { get; private set; }
public long CustomizeWorkshopGroupSettingId { get; set; }
public ICollection<CustomizeWorkshopEmployeeSettingsShift> CustomizeWorkshopEmployeeSettingsShifts { get; set; }
public CustomizeWorkshopGroupSettings CustomizeWorkshopGroupSettings { get; set; }
/// <summary>
/// تغییر مقادیر تنظیمات پرسنل با وضعیت بدون تغییر
/// </summary>
/// <param name="employeeSettingsShifts">شیفت های کاری پرسنل</param>
/// <param name="salary"> حقوق ماهیانه اختصاص داده شده</param>
/// <param name="fridayPay">جمعه کاری</param>
/// <param name="overTimePay">اضافه کاری</param>
/// <param name="baseYearsPay">سنوات</param>
/// <param name="bonusesPay">عیدی</param>
/// <param name="nightWorkPay">شب کاری</param>
/// <param name="marriedAllowance">حق تاهل</param>
/// <param name="shiftPay">نوبت کاری</param>
/// <param name="familyAllowance">حق اولاد</param>
/// <param name="leavePay">مزد مرخصی</param>
/// <param name="insuranceDeduction">حق بیمه</param>
/// <param name="fineAbsenceDeduction">جریمه غیبت</param>
/// <param name="lateToWork">تاخیر در ورود</param>
/// <param name="earlyExit">تعجیل درخروج</param>
internal void EditEmployeesAndMakeIsChangeFalse(
ICollection<CustomizeWorkshopEmployeeSettingsShift> employeeSettingsShifts, double salary, FridayPay fridayPay, OverTimePay overTimePay, BaseYearsPay baseYearsPay, BonusesPay bonusesPay,
NightWorkPay nightWorkPay, MarriedAllowance marriedAllowance, ShiftPay shiftPay,
FamilyAllowance familyAllowance, LeavePay leavePay, InsuranceDeduction insuranceDeduction,
FineAbsenceDeduction fineAbsenceDeduction, LateToWork lateToWork, EarlyExit earlyExit)
{
FridayPay = fridayPay;
OverTimePay = overTimePay;
BaseYearsPay = baseYearsPay;
BonusesPay = bonusesPay;
NightWorkPay = nightWorkPay;
MarriedAllowance = marriedAllowance;
ShiftPay = shiftPay;
FamilyAllowance = familyAllowance;
LeavePay = leavePay;
InsuranceDeduction = insuranceDeduction;
FineAbsenceDeduction = fineAbsenceDeduction;
LateToWork = lateToWork;
EarlyExit = earlyExit;
Salary = salary;
CustomizeWorkshopEmployeeSettingsShifts = employeeSettingsShifts;
IsChanged = false;
}
/// <summary>
/// تغییر مقادیر تنظیمات پرسنل و تغییر وضعیت آن به تغییر یافته
/// </summary>
/// <param name="employeeSettingsShifts">شیفت های کاری پرسنل</param>
/// <param name="salary"> حقوق ماهیانه اختصاص داده شده</param>
/// <param name="fridayPay">جمعه کاری</param>
/// <param name="overTimePay">اضافه کاری</param>
/// <param name="baseYearsPay">سنوات</param>
/// <param name="bonusesPay">عیدی</param>
/// <param name="nightWorkPay">شب کاری</param>
/// <param name="marriedAllowance">حق تاهل</param>
/// <param name="shiftPay">نوبت کاری</param>
/// <param name="familyAllowance">حق اولاد</param>
/// <param name="leavePay">مزد مرخصی</param>
/// <param name="insuranceDeduction">حق بیمه</param>
/// <param name="fineAbsenceDeduction">جریمه غیبت</param>
/// <param name="lateToWork">تاخیر در ورود</param>
/// <param name="earlyExit">تعجیل درخروج</param>
public void EditEmployeesAndMakeIsChangeTrue(
ICollection<CustomizeWorkshopEmployeeSettingsShift> employeeSettingsShifts, double salary, FridayPay fridayPay, OverTimePay overTimePay, BaseYearsPay baseYearsPay, BonusesPay bonusesPay,
NightWorkPay nightWorkPay, MarriedAllowance marriedAllowance, ShiftPay shiftPay,
FamilyAllowance familyAllowance, LeavePay leavePay, InsuranceDeduction insuranceDeduction,
FineAbsenceDeduction fineAbsenceDeduction, LateToWork lateToWork, EarlyExit earlyExit)
{
FridayPay = fridayPay;
OverTimePay = overTimePay;
BaseYearsPay = baseYearsPay;
BonusesPay = bonusesPay;
NightWorkPay = nightWorkPay;
MarriedAllowance = marriedAllowance;
ShiftPay = shiftPay;
FamilyAllowance = familyAllowance;
LeavePay = leavePay;
InsuranceDeduction = insuranceDeduction;
FineAbsenceDeduction = fineAbsenceDeduction;
LateToWork = lateToWork;
EarlyExit = earlyExit;
Salary = salary;
CustomizeWorkshopEmployeeSettingsShifts = employeeSettingsShifts;
IsChanged = true;
}
}

View File

@@ -0,0 +1,19 @@
using _0_Framework.Domain;
using CompanyManagment.App.Contracts.CustomizeWorkshopSettings;
namespace Company.Domain.CustomizeWorkshopEmployeeSettingsAgg.Entities;
public class CustomizeWorkshopEmployeeSettingsShift(
string startTime,
string endTime,
ShiftPlacement placement) : EntityBase
{
public string StartTime { get; private set; } = startTime;
public string EndTime { get; private set; } = endTime;
public ShiftPlacement Placement { get; private set; } = placement;
public long CustomizeWorkshopEmployeeSettingsId { get; private set; }
public CustomizeWorkshopEmployeeSettings CustomizeWorkshopEmployeeSettings { get; set; }
}

View File

@@ -0,0 +1,9 @@
using _0_Framework.Domain;
using Company.Domain.CustomizeWorkshopEmployeeSettingsAgg.Entities;
namespace Company.Domain.CustomizeWorkshopEmployeeSettingsAgg;
public interface ICustomizeWorkshopEmployeeSettingsRepository : IRepository<long, CustomizeWorkshopEmployeeSettings>
{
}

View File

@@ -0,0 +1,167 @@
using System.Collections.Generic;
using System.Linq;
using _0_Framework.Domain;
using _0_Framework.Domain.CustomizeCheckoutValueObjects;
using Company.Domain.CustomizeWorkshopEmployeeSettingsAgg.Entities;
using Company.Domain.CustomizeWorkshopSettingsAgg.Entities;
namespace Company.Domain.CustomizeWorkshopGroupSettingsAgg.Entities;
public class CustomizeWorkshopGroupSettings : EntityBase
{
private CustomizeWorkshopGroupSettings()
{
}
public CustomizeWorkshopGroupSettings( string groupName, double salary, long customizeWorkshopSettingId, ICollection<CustomizeWorkshopGroupSettingsShift> customizeWorkshopGroupSettingsShifts)
{
GroupName = groupName;
Salary = salary;
CustomizeWorkshopSettingId = customizeWorkshopSettingId;
CustomizeWorkshopGroupSettingsShifts = customizeWorkshopGroupSettingsShifts;
FridayPay = new FridayPay(FridayPayType.None, 0);
OverTimePay = new OverTimePay(OverTimePayType.None, 0);
BaseYearsPay = new BaseYearsPay(BaseYearsPayType.None);
BonusesPay = new BonusesPay(BonusesType.None, 0);
NightWorkPay = new NightWorkPay(NightWorkType.None, 0);
MarriedAllowance = new MarriedAllowance(MarriedAllowanceType.None, 0);
ShiftPay = new ShiftPay(ShiftType.None, ShiftPayType.None, 0);
FamilyAllowance = new FamilyAllowance(FamilyAllowanceType.None, 0);
LeavePay = new LeavePay(LeavePayType.None, 0);
InsuranceDeduction = new InsuranceDeduction(InsuranceDeductionType.None, 0);
FineAbsenceDeduction = new FineAbsenceDeduction(FineAbsenceDeductionType.None, 0, new());
LateToWork = new LateToWork(LateToWorkType.None, new(), 0);
EarlyExit = new EarlyExit(EarlyExitType.None, new(), 0);
}
/// <summary>
/// جمعه کاری
/// </summary>
public FridayPay FridayPay { get; private set; }
/// <summary>
/// اضافه کاری
/// </summary>
public OverTimePay OverTimePay { get; private set; }
/// <summary>
/// سنوات
/// </summary>
public BaseYearsPay BaseYearsPay { get; private set; }
/// <summary>
/// عیدی
/// </summary>
public BonusesPay BonusesPay { get; private set; }
/// <summary>
/// شب کاری
/// </summary>
public NightWorkPay NightWorkPay { get; private set; }
/// <summary>
/// حق تاهل
/// </summary>
public MarriedAllowance MarriedAllowance { get; private set; }
/// <summary>
/// نوبت کاری
/// </summary>
public ShiftPay ShiftPay { get; private set; }
/// <summary>
/// حق اولاد(حق فرزند)ء
/// </summary>
public FamilyAllowance FamilyAllowance { get; private set; }
/// <summary>
/// مزد مرخصی
/// </summary>
public LeavePay LeavePay { get; private set; }
/// <summary>
/// حق بیمه
/// </summary>
public InsuranceDeduction InsuranceDeduction { get; private set; }
/// <summary>
/// جریمه غیبت
/// </summary>
public FineAbsenceDeduction FineAbsenceDeduction { get; private set; }
/// <summary>
/// تاخیر در ورود
/// </summary>
public LateToWork LateToWork { get; private set; }
/// <summary>
/// نعجیل در خروج
/// </summary>
public EarlyExit EarlyExit { get; private set; }
public string GroupName { get; private set; }
public double Salary { get; private set; }
public long CustomizeWorkshopSettingId { get; private set; }
public ICollection<CustomizeWorkshopGroupSettingsShift> CustomizeWorkshopGroupSettingsShifts { get; set; }
public ICollection<CustomizeWorkshopEmployeeSettings> CustomizeWorkshopEmployeeSettingsCollection { get; set; }
public CustomizeWorkshopSettings CustomizeWorkshopSettings { get; set; }
public void EditAndOverwriteOnEmployees(string groupName, double salary, IEnumerable<long> employeeIds, FridayPay fridayPay,
OverTimePay overTimePay, BaseYearsPay baseYearsPay, BonusesPay bonusesPay, ShiftPay shiftPay,
NightWorkPay nightWorkPay, MarriedAllowance marriedAllowance, FamilyAllowance familyAllowance,
LeavePay leavePay, InsuranceDeduction insuranceDeduction, FineAbsenceDeduction fineAbsenceDeduction,
LateToWork lateToWork, EarlyExit earlyExit,ICollection<CustomizeWorkshopGroupSettingsShift> customizeWorkshopGroupSettingsShifts)
{
GroupName = groupName;
Salary = salary;
FridayPay = fridayPay;
OverTimePay = overTimePay;
BaseYearsPay = baseYearsPay;
BonusesPay = bonusesPay;
NightWorkPay = nightWorkPay;
MarriedAllowance = marriedAllowance;
ShiftPay = shiftPay;
FamilyAllowance = familyAllowance;
LeavePay = leavePay;
InsuranceDeduction = insuranceDeduction;
FineAbsenceDeduction = fineAbsenceDeduction;
LateToWork = lateToWork;
EarlyExit = earlyExit;
CustomizeWorkshopGroupSettingsShifts = customizeWorkshopGroupSettingsShifts;
var employeeSettingsShift = customizeWorkshopGroupSettingsShifts
.Select(x=>new CustomizeWorkshopEmployeeSettingsShift(x.StartTime,x.EndTime,x.Placement)).ToList();
var permittedToOverWrite = CustomizeWorkshopEmployeeSettingsCollection.Where(x => employeeIds.Contains(x.id));
foreach (var item in permittedToOverWrite)
{
item.EditEmployeesAndMakeIsChangeFalse(employeeSettingsShift, salary, fridayPay, overTimePay, baseYearsPay, bonusesPay
, nightWorkPay, marriedAllowance, shiftPay, familyAllowance, leavePay, insuranceDeduction, fineAbsenceDeduction,
lateToWork, earlyExit);
}
}
public void RemoveEmployeeFromGroup(long employeeId)
{
var currentItem = CustomizeWorkshopEmployeeSettingsCollection.FirstOrDefault(x => x.EmployeeId == employeeId);
if (currentItem != null)
CustomizeWorkshopEmployeeSettingsCollection.Remove(currentItem);
}
//public void OverWriteEmployeesShiftAndSalary(IEnumerable<long> ids,ICollection<RollCallWorkshopEmployeeSettingsShift> employeeSettingsShifts,double salary)
//{
// var permittedToOverWrite= RollCallWorkshopEmployeeSettingsCollection.Where(x => ids.Contains(x.id));
// foreach (var item in permittedToOverWrite)
// {
// item.OverWriteSalaryAndShift(employeeSettingsShifts, salary);
// }
//}
}

View File

@@ -0,0 +1,19 @@
using _0_Framework.Domain;
using CompanyManagment.App.Contracts.CustomizeWorkshopSettings;
namespace Company.Domain.CustomizeWorkshopGroupSettingsAgg.Entities;
public class CustomizeWorkshopGroupSettingsShift(
string startTime,
string endTime,
ShiftPlacement placement) : EntityBase
{
public string StartTime { get; private set; } = startTime;
public string EndTime { get; private set; } = endTime;
public ShiftPlacement Placement { get; private set; } = placement;
public long CustomizeWorkshopGroupSettingsId { get; private set; }
public CustomizeWorkshopGroupSettings CustomizeWorkshopGroupSettings { get; set; }
}

View File

@@ -0,0 +1,16 @@
using System.Collections.Generic;
using _0_Framework.Domain;
using Company.Domain.CustomizeWorkshopGroupSettingsAgg.Entities;
using CompanyManagment.App.Contracts.CustomizeWorkshopSettings;
using CompanyManagment.App.Contracts.Employee;
namespace Company.Domain.CustomizeWorkshopGroupSettingsAgg;
public interface ICustomizeWorkshopGroupSettingsRepository : IRepository<long, CustomizeWorkshopGroupSettings>
{
CustomizeWorkshopGroupSettings GetIncludeWorkshopSettings(long id);
List<EmployeeViewModel> GetEmployeesWithoutGroup(long workshopId);
CustomizeWorkshopGroupSettings GetWithEmployees(long groupId);
List<CustomizeWorkshopEmployeeSettingsViewModel> GetChangedEmployeeSettingsByGroupSettingsId(long groupSettingsId);
List<CustomizeWorkshopEmployeeSettingsViewModel> GetEmployeeSettingsByGroupSettingsId(long groupSettingsId);
}

View File

@@ -0,0 +1,145 @@
using System.Collections.Generic;
using _0_Framework.Domain;
using _0_Framework.Domain.CustomizeCheckoutValueObjects;
using Company.Domain.CustomizeWorkshopGroupSettingsAgg.Entities;
using Company.Domain.WorkshopAgg;
namespace Company.Domain.CustomizeWorkshopSettingsAgg.Entities;
public class CustomizeWorkshopSettings : EntityBase
{
private CustomizeWorkshopSettings()
{
}
public CustomizeWorkshopSettings(long workshopId,
ICollection<CustomizeWorkshopSettingsShift> customizeWorkshopSettingsShifts)
{
FridayPay = new FridayPay(FridayPayType.None,0);
OverTimePay =new OverTimePay(OverTimePayType.None,0);
BaseYearsPay = new BaseYearsPay(BaseYearsPayType.None);
BonusesPay = new BonusesPay(BonusesType.None,0);
NightWorkPay = new NightWorkPay(NightWorkType.None,0);
MarriedAllowance = new MarriedAllowance(MarriedAllowanceType.None,0);
ShiftPay = new ShiftPay(ShiftType.None,ShiftPayType.None,0);
FamilyAllowance = new FamilyAllowance(FamilyAllowanceType.None ,0);
LeavePay = new LeavePay(LeavePayType.None,0);
InsuranceDeduction = new InsuranceDeduction(InsuranceDeductionType.None,0);
FineAbsenceDeduction = new FineAbsenceDeduction(FineAbsenceDeductionType.None,0,new());
LateToWork = new LateToWork(LateToWorkType.None,new(),0);
EarlyExit = new EarlyExit(EarlyExitType.None,new(),0);
WorkshopId = workshopId;
CustomizeWorkshopSettingsShifts = customizeWorkshopSettingsShifts;
Currency = Currency.Rial;
MaxMonthDays = MaxMonthDays.Default;
}
/// <summary>
/// جمعه کاری
/// </summary>
public FridayPay FridayPay { get; private set; }
/// <summary>
/// اضافه کاری
/// </summary>
public OverTimePay OverTimePay { get; private set; }
/// <summary>
/// سنوات
/// </summary>
public BaseYearsPay BaseYearsPay { get; private set; }
/// <summary>
/// عیدی
/// </summary>
public BonusesPay BonusesPay { get; private set; }
/// <summary>
/// شب کاری
/// </summary>
public NightWorkPay NightWorkPay { get; private set; }
/// <summary>
/// حق تاهل
/// </summary>
public MarriedAllowance MarriedAllowance { get; private set; }
/// <summary>
/// نوبت کاری
/// </summary>
public ShiftPay ShiftPay { get; private set; }
/// <summary>
/// حق اولاد(حق فرزند)ء
/// </summary>
public FamilyAllowance FamilyAllowance { get; private set; }
/// <summary>
/// مزد مرخصی
/// </summary>
public LeavePay LeavePay { get; private set; }
/// <summary>
/// حق بیمه
/// </summary>
public InsuranceDeduction InsuranceDeduction { get; private set; }
/// <summary>
/// جریمه غیبت
/// </summary>
public FineAbsenceDeduction FineAbsenceDeduction { get; private set; }
/// <summary>
/// تاخیر در ورود
/// </summary>
public LateToWork LateToWork { get; private set; }
/// <summary>
/// نعجیل در خروج
/// </summary>
public EarlyExit EarlyExit { get; private set; }
/// <summary>
/// نوع محاسبه تعداد روز های ماه برای محاسبه فیش حقوقی
/// </summary>
public MaxMonthDays MaxMonthDays { get; private set; }
public long WorkshopId { get; private set; }
public Workshop Workshop { get; set; }
public ICollection<CustomizeWorkshopSettingsShift> CustomizeWorkshopSettingsShifts { get; set; }
public ICollection<CustomizeWorkshopGroupSettings> CustomizeWorkshopGroupSettingsCollection { get; set; }
public Currency Currency { get; set; }
public void Edit(FridayPay fridayPay, OverTimePay overTimePay, BaseYearsPay baseYearsPay, BonusesPay bonusesPay,
NightWorkPay nightWorkPay, MarriedAllowance marriedAllowance, ShiftPay shiftPay,
FamilyAllowance familyAllowance, LeavePay leavePay, InsuranceDeduction insuranceDeduction,
FineAbsenceDeduction fineAbsenceDeduction, LateToWork lateToWork, EarlyExit earlyExit,
ICollection<CustomizeWorkshopSettingsShift> customizeWorkshopSettingsShifts)
{
FridayPay = fridayPay;
OverTimePay = overTimePay;
BaseYearsPay = baseYearsPay;
BonusesPay = bonusesPay;
NightWorkPay = nightWorkPay;
MarriedAllowance = marriedAllowance;
ShiftPay = shiftPay;
FamilyAllowance = familyAllowance;
LeavePay = leavePay;
InsuranceDeduction = insuranceDeduction;
FineAbsenceDeduction = fineAbsenceDeduction;
LateToWork = lateToWork;
EarlyExit = earlyExit;
CustomizeWorkshopSettingsShifts = customizeWorkshopSettingsShifts;
}
//edits the shifts of workshop
public void ChangeCurrency(Currency currency)
{
if (currency == Currency)
return;
Currency = currency;
}
}

View File

@@ -0,0 +1,17 @@
using _0_Framework.Domain;
using CompanyManagment.App.Contracts.CustomizeWorkshopSettings;
namespace Company.Domain.CustomizeWorkshopSettingsAgg.Entities;
public class CustomizeWorkshopSettingsShift(
string startTime,
string endTime,
ShiftPlacement placement) : EntityBase
{
public string StartTime { get; private set; } = startTime;
public string EndTime { get; private set; } = endTime;
public ShiftPlacement Placement { get; private set; } = placement;
public long CustomizeWorkshopSettingsId { get; private set; }
public CustomizeWorkshopSettings CustomizeWorkshopSettings { get; set; }
}

View File

@@ -0,0 +1,14 @@
using _0_Framework.Domain;
using Company.Domain.CustomizeWorkshopSettingsAgg.Entities;
using CompanyManagment.App.Contracts.CustomizeWorkshopSettings;
namespace Company.Domain.CustomizeWorkshopSettingsAgg;
public interface ICustomizeWorkshopSettingsRepository : IRepository<long, CustomizeWorkshopSettings>
{
// It will Get the Workshop Settings with its groups and the employees of groups.
CustomizeWorkshopSettings GetWorkshopSettingsByWorkshopId(long workshopId);
CustomizeWorkshopEmployeeSettingsViewModel GetEmployeeSettingsByWorkshopIdGroupSettingsId(long workshopId,
long employeeId);
}

View File

@@ -6,6 +6,7 @@ using Company.Domain.CheckoutAgg;
using Company.Domain.ClientEmployeeWorkshopAgg;
using Company.Domain.ContractAgg;
using Company.Domain.CustomizeCheckoutAgg;
using Company.Domain.CustomizeWorkshopSettingsAgg.Entities;
using Company.Domain.EmployeeInsuranceRecordAgg;
using Company.Domain.empolyerAgg;
using Company.Domain.InsuranceAgg;
@@ -218,6 +219,7 @@ public class Workshop : EntityBase
public InsuranceWorkshopInfo InsuranceWorkshopInfo { get; set; }
public List<TaxLeftWorkCategory> TaxLeftWorkCategoryList { get; set; }
public List<CustomizeCheckout> CustomizeCheckouts { get; set; }
public CustomizeWorkshopSettings CustomizeWorkshopSettings { get; set; }
public void Edit(string workshopName, string workshopSureName, string insuranceCode,string typeOfOwnership, string archiveCode, string agentName, string agentPhone,
string state, string city, string address, string typeOfInsuranceSend, string typeOfContract, string contractTerm,

View File

@@ -0,0 +1,76 @@
using CompanyManagment.App.Contracts.CustomizeWorkshopSettings.ValueObjectsViewModel;
using System.Collections.Generic;
namespace CompanyManagment.App.Contracts.CustomizeWorkshopSettings;
public class CreateCustomizeEmployeeSettings
{
/// <summary>
/// جمعه کاری
/// </summary>
public FridayPayViewModel FridayPay { get; private set; }
/// <summary>
/// اضافه کاری
/// </summary>
public OverTimePayViewModel OverTimePay { get; private set; }
/// <summary>
/// سنوات
/// </summary>
public BaseYearsPayViewModel BaseYearsPay { get; private set; }
/// <summary>
/// عیدی
/// </summary>
public BonusesPayViewModel BonusesPay { get; private set; }
/// <summary>
/// شب کاری
/// </summary>
public NightWorkPayViewModel NightWorkPay { get; private set; }
/// <summary>
/// حق تاهل
/// </summary>
public MarriedAllowanceViewModel MarriedAllowance { get; private set; }
/// <summary>
/// نوبت کاری
/// </summary>
public ShiftPayViewModel ShiftPay { get; private set; }
/// <summary>
/// حق اولاد(حق فرزند)ء
/// </summary>
public FamilyAllowanceViewModel FamilyAllowance { get; private set; }
/// <summary>
/// مزد مرخصی
/// </summary>
public LeavePayViewModel LeavePay { get; private set; }
/// <summary>
/// حق بیمه
/// </summary>
public InsuranceDeductionViewModel InsuranceDeduction { get; private set; }
/// <summary>
/// جریمه غیبت
/// </summary>
public FineAbsenceDeductionViewModel FineAbsenceDeduction { get; private set; }
/// <summary>
/// تاخیر در ورود
/// </summary>
public LateToWorkViewModel LateToWork { get; private set; }
/// <summary>
/// نعجیل در خروج
/// </summary>
public EarlyExitViewModel EarlyExit { get; private set; }
public List<long> EmployeeIds { get; set; }
public long GroupId { get; set; }
public long WorkshopSettingId { get; set; }
public long WorkshopId { get; set; }
}

View File

@@ -0,0 +1,14 @@
using System.Collections.Generic;
namespace CompanyManagment.App.Contracts.CustomizeWorkshopSettings;
public class CreateCustomizeWorkshopGroupSettings
{
public string Name { get; set; }
public string Salary { get; set; }
public long CustomizeWorkshopSettingId { get; set; }
public IEnumerable<CustomizeWorkshopShiftViewModel> ShiftViewModel { get; set; }
}

View File

@@ -0,0 +1,10 @@
using System.Collections.Generic;
namespace CompanyManagment.App.Contracts.CustomizeWorkshopSettings;
public class CreateCustomizeWorkshopSettings
{
public IEnumerable<CustomizeWorkshopShiftViewModel> ShiftsList { get; set; }
}

View File

@@ -0,0 +1,13 @@
using System.Collections.Generic;
namespace CompanyManagment.App.Contracts.CustomizeWorkshopSettings;
public class CustomizeWorkshopEmployeeSettingsViewModel
{
public long Id { get; set; }
public long EmployeeId { get; set; }
public double Salary { get; set;}
public bool IsChanged { get; set; }
public string Name { get; set; }
public List<CustomizeWorkshopShiftViewModel> RollCallWorkshopShifts { get; set; }
}

View File

@@ -0,0 +1,12 @@
using System.Collections.Generic;
namespace CompanyManagment.App.Contracts.CustomizeWorkshopSettings;
public class CustomizeWorkshopGroupSettingsViewModel
{
public long Id { get; set; }
public double Salary { get; set; }
public string GroupName { get; set; }
public List<CustomizeWorkshopShiftViewModel> RollCallWorkshopShifts { get; set; }
public List<CustomizeWorkshopEmployeeSettingsViewModel> RollCallWorkshopEmployeesSettings { get; set; }
}

View File

@@ -0,0 +1,10 @@
using System.Collections.Generic;
namespace CompanyManagment.App.Contracts.CustomizeWorkshopSettings;
public class CustomizeWorkshopSettingsViewModel
{
public long Id { get; set; }
public string Name { get; set; }
public List<CustomizeWorkshopGroupSettingsViewModel> GroupSettings { get; set; }
}

View File

@@ -0,0 +1,8 @@
namespace CompanyManagment.App.Contracts.CustomizeWorkshopSettings;
public class CustomizeWorkshopShiftViewModel
{
public string StartTime { get; set; }
public string EndTime { get; set; }
public ShiftPlacement Placement { get; set; }
}

View File

@@ -0,0 +1,11 @@
using System.Collections.Generic;
namespace CompanyManagment.App.Contracts.CustomizeWorkshopSettings;
public class EditCustomizeEmployeeSettings:CreateCustomizeEmployeeSettings
{
public long Id { get; set; }
public string Salary { get; set; }
public string EmployeeFullName { get; set; }
public IEnumerable<CustomizeWorkshopShiftViewModel> ShiftViewModel { get; set; }
}

View File

@@ -0,0 +1,82 @@
using _0_Framework.Domain.CustomizeCheckoutValueObjects;
using CompanyManagment.App.Contracts.CustomizeWorkshopSettings.ValueObjectsViewModel;
using System.Collections.Generic;
namespace CompanyManagment.App.Contracts.CustomizeWorkshopSettings;
public class EditCustomizeWorkshopGroupSettings:CreateCustomizeWorkshopGroupSettings
{
public long Id { get; set; }
public List<long> EmployeeIds { get; set; }
/// <summary>
/// نوع محاسبه تعداد روز های ماه برای محاسبه فیش حقوقی
/// </summary>
public MaxMonthDays MaxMonthDays { get; set; }
/// <summary>
/// جمعه کاری
/// </summary>
public FridayPayViewModel FridayPay { get; private set; }
/// <summary>
/// اضافه کاری
/// </summary>
public OverTimePayViewModel OverTimePay { get; private set; }
/// <summary>
/// سنوات
/// </summary>
public BaseYearsPayViewModel BaseYearsPay { get; private set; }
/// <summary>
/// عیدی
/// </summary>
public BonusesPayViewModel BonusesPay { get; private set; }
/// <summary>
/// شب کاری
/// </summary>
public NightWorkPayViewModel NightWorkPay { get; private set; }
/// <summary>
/// حق تاهل
/// </summary>
public MarriedAllowanceViewModel MarriedAllowance { get; private set; }
/// <summary>
/// نوبت کاری
/// </summary>
public ShiftPayViewModel ShiftPay { get; private set; }
/// <summary>
/// حق اولاد(حق فرزند)ء
/// </summary>
public FamilyAllowanceViewModel FamilyAllowance { get; private set; }
/// <summary>
/// مزد مرخصی
/// </summary>
public LeavePayViewModel LeavePay { get; private set; }
/// <summary>
/// حق بیمه
/// </summary>
public InsuranceDeductionViewModel InsuranceDeduction { get; private set; }
/// <summary>
/// جریمه غیبت
/// </summary>
public FineAbsenceDeductionViewModel FineAbsenceDeduction { get; private set; }
/// <summary>
/// تاخیر در ورود
/// </summary>
public LateToWorkViewModel LateToWork { get; private set; }
/// <summary>
/// نعجیل در خروج
/// </summary>
public EarlyExitViewModel EarlyExit { get; private set; }
}

View File

@@ -0,0 +1,80 @@
using _0_Framework.Domain.CustomizeCheckoutValueObjects;
using CompanyManagment.App.Contracts.CustomizeWorkshopSettings.ValueObjectsViewModel;
namespace CompanyManagment.App.Contracts.CustomizeWorkshopSettings;
public class EditCustomizeWorkshopSettings:CreateCustomizeWorkshopSettings
{
public long Id { get; set; }
public Currency Currency { get; set; }
/// <summary>
/// نوع محاسبه تعداد روز های ماه برای محاسبه فیش حقوقی
/// </summary>
public MaxMonthDays MaxMonthDays { get; set; }
/// <summary>
/// جمعه کاری
/// </summary>
public FridayPayViewModel FridayPay { get; private set; }
/// <summary>
/// اضافه کاری
/// </summary>
public OverTimePayViewModel OverTimePay { get; private set; }
/// <summary>
/// سنوات
/// </summary>
public BaseYearsPayViewModel BaseYearsPay { get; private set; }
/// <summary>
/// عیدی
/// </summary>
public BonusesPayViewModel BonusesPay { get; private set; }
/// <summary>
/// شب کاری
/// </summary>
public NightWorkPayViewModel NightWorkPay { get; private set; }
/// <summary>
/// حق تاهل
/// </summary>
public MarriedAllowanceViewModel MarriedAllowance { get; private set; }
/// <summary>
/// نوبت کاری
/// </summary>
public ShiftPayViewModel ShiftPay { get; private set; }
/// <summary>
/// حق اولاد(حق فرزند)ء
/// </summary>
public FamilyAllowanceViewModel FamilyAllowance { get; private set; }
/// <summary>
/// مزد مرخصی
/// </summary>
public LeavePayViewModel LeavePay { get; private set; }
/// <summary>
/// حق بیمه
/// </summary>
public InsuranceDeductionViewModel InsuranceDeduction { get; private set; }
/// <summary>
/// جریمه غیبت
/// </summary>
public FineAbsenceDeductionViewModel FineAbsenceDeduction { get; private set; }
/// <summary>
/// تاخیر در ورود
/// </summary>
public LateToWorkViewModel LateToWork { get; private set; }
/// <summary>
/// نعجیل در خروج
/// </summary>
public EarlyExitViewModel EarlyExit { get; private set; }
}

View File

@@ -0,0 +1,39 @@
using System.Collections.Generic;
using _0_Framework.Application;
using CompanyManagment.App.Contracts.Employee;
namespace CompanyManagment.App.Contracts.CustomizeWorkshopSettings;
public interface ICustomizeWorkshopSettingsApplication
{
//Create workshop settings
OperationResult CreateWorkshopSettings(CreateCustomizeWorkshopSettings command);
//create group settings with workshopSettingsId.
OperationResult CreateGroupSettingsByRollCallWorkshopSettingId(CreateCustomizeWorkshopGroupSettings command);
OperationResult CreateRollCallEmployeeSettings(CreateCustomizeEmployeeSettings command);
//Edit the Workshop Settings Data
OperationResult EditWorkshopSetting(EditCustomizeWorkshopSettings command);
//Edit the Group Settings Data
OperationResult EditRollCallGroupSetting(EditCustomizeWorkshopGroupSettings command);
//Edit the Employee settings and change the 'IsChanged' bool to true.
OperationResult EditRollCallEmployeeSettings(EditCustomizeEmployeeSettings command);
//Remove the Employee From the Group Settings
OperationResult RemoveEmployeeFromRollCallWorkshopGroup(long employeeId,long groupId);
// It will Get the Workshop Settings with its groups and the employees of groups.
CustomizeWorkshopSettingsViewModel GetWorkshopSettingsByWorkshopId(long workshopId);
List<CustomizeWorkshopEmployeeSettingsViewModel> GetChangedEmployeeSettingsByGroupSettingsId(
long groupSettingsId);
List<EmployeeViewModel> GetEmployeesWithoutGroup(long rollCallWorkshopSettingId);
CustomizeWorkshopEmployeeSettingsViewModel GetEmployeeSettingsByEmployeeIdGroupSettingsId(long workshopId,long employeeId);
List<CustomizeWorkshopEmployeeSettingsViewModel> GetEmployeeSettingsByGroupSettingsId(long groupSettingsId);
}

View File

@@ -0,0 +1,8 @@
namespace CompanyManagment.App.Contracts.CustomizeWorkshopSettings;
public enum ShiftPlacement
{
First,
Second,
Third
}

View File

@@ -0,0 +1,9 @@
using _0_Framework.Domain.CustomizeCheckoutValueObjects;
namespace CompanyManagment.App.Contracts.CustomizeWorkshopSettings.ValueObjectsViewModel;
public class BaseYearsPayViewModel
{
public BaseYearsPayType BaseYearsPayType { get; set; }
}

View File

@@ -0,0 +1,9 @@
using _0_Framework.Domain.CustomizeCheckoutValueObjects;
namespace CompanyManagment.App.Contracts.CustomizeWorkshopSettings.ValueObjectsViewModel;
public class BonusesPayViewModel
{
public BonusesType BonusesPayType { get; set; }
public int Percentage { get; set; }
}

View File

@@ -0,0 +1,14 @@
namespace CompanyManagment.App.Contracts.CustomizeWorkshopSettings.ValueObjectsViewModel;
public class EarlyExitTimeFineViewModel
{
/// <summary>
/// دقیقه تعیین شده برای جریمه
/// </summary>
public string Minute { get; set; }
/// <summary>
/// مبلغ تعیین شده برای جریمه
/// </summary>
public double FineMoney { get; set; }
}

View File

@@ -0,0 +1,25 @@
using System.Collections.Generic;
using _0_Framework.Domain.CustomizeCheckoutValueObjects;
namespace CompanyManagment.App.Contracts.CustomizeWorkshopSettings.ValueObjectsViewModel;
public class EarlyExitViewModel
{
/// <summary>
/// نوع حساب کردن تعجیل در خروج
/// </summary>
public EarlyExitType EarlyExitType { get; private set; }
/// <summary>
/// جریمه های اختصاصی پله ای
/// </summary>
public List<EarlyExitTimeFineViewModel> EarlyExitTimeFinesViewModels { get; private set; }
///// <summary>
///// نوع محاسبه جریمه های اختصاصی پله ای. این بخش میتواند نال باشد چون ممکن است شخص جریمه ای اختصاص ندهد
///// </summary>
//public EarlyExitTimeFineType? EarlyExitTimeFineType { get; private set; }
public double Value { get; private set; }
}

View File

@@ -0,0 +1,19 @@
using _0_Framework.Domain.CustomizeCheckoutValueObjects;
namespace CompanyManagment.App.Contracts.CustomizeWorkshopSettings.ValueObjectsViewModel;
public class FamilyAllowanceViewModel
{
/// <summary>
/// نوع حق اولاد را مشخص میکند که آیا پرداخت نمیکند یا به صورت درصدی پرداخت میکند یا به صورت مبلغ اختصاصی
/// </summary>
public FamilyAllowanceType FamilyAllowanceType { get; set; }
/// <summary>
/// تعداد فرزند هایی حق اولاد به آنها تعلق میگیرد.
/// </summary>
// ReSharper disable once GrammarMistakeInComment
//public NumberOfChildren NumberOfChildren { get; set; }
public double Value { get; set; }
}

View File

@@ -0,0 +1,17 @@
using System;
namespace CompanyManagment.App.Contracts.CustomizeWorkshopSettings.ValueObjectsViewModel;
public class FineAbsenceDayOfWeekViewModel
{
/// <summary>
/// روز های هفته
/// </summary>
public DayOfWeek DayOfWeek { get; set; }
///// <summary>
///// نوع جریمه غیبت بر اساس روز خاصی از هفته
///// </summary>
//public FineAbsenceDayOfWeekType AbsenceDayOfWeekType { get; set; }
//public double Value { get; set; }
}

View File

@@ -0,0 +1,19 @@
using System.Collections.Generic;
using _0_Framework.Domain.CustomizeCheckoutValueObjects;
namespace CompanyManagment.App.Contracts.CustomizeWorkshopSettings.ValueObjectsViewModel;
public class FineAbsenceDeductionViewModel
{
/// <summary>
/// نوع جریمه غیبت
/// </summary>
public FineAbsenceDeductionType FineAbsenceDeductionType { get; set; }
public double Value { get; set; }
/// <summary>
/// جریمه های اختصاصی به ازای روز های هفته
/// </summary>
public List<FineAbsenceDayOfWeekViewModel> FineAbsenceDayOfWeekViewModels { get; set; }
}

View File

@@ -0,0 +1,9 @@
using _0_Framework.Domain.CustomizeCheckoutValueObjects;
namespace CompanyManagment.App.Contracts.CustomizeWorkshopSettings.ValueObjectsViewModel;
public class FridayPayViewModel
{
public FridayPayType FridayPayType { get; set; }
public double Value { get; set; }
}

View File

@@ -0,0 +1,9 @@
using _0_Framework.Domain.CustomizeCheckoutValueObjects;
namespace CompanyManagment.App.Contracts.CustomizeWorkshopSettings.ValueObjectsViewModel;
public class InsuranceDeductionViewModel
{
public InsuranceDeductionType InsuranceDeductionType { get; set; }
public double Value { get; set; }
}

View File

@@ -0,0 +1,14 @@
namespace CompanyManagment.App.Contracts.CustomizeWorkshopSettings.ValueObjectsViewModel;
public class LateToWorkTimeFineVewModel
{
/// <summary>
/// دقیقه تعیین شده برای جریمه
/// </summary>
public string Minute { get; set; }
/// <summary>
/// مبلغ تعیین شده برای جریمه
/// </summary>
public double FineMoney { get; set; }
}

View File

@@ -0,0 +1,28 @@
using System.Collections.Generic;
using _0_Framework.Domain.CustomizeCheckoutValueObjects;
namespace CompanyManagment.App.Contracts.CustomizeWorkshopSettings.ValueObjectsViewModel;
public class LateToWorkViewModel
{
/// <summary>
/// نوع حساب کردن تاخیر در ورود
/// </summary>
public LateToWorkType LateToWorkType { get; private set; }
/// <summary>
/// این مقدار اگر نوع حساب کردن به صور مبلغی باشد از این بخش استفاده میشود
/// </summary>
public double Value { get; private set; }
/// <summary>
/// جریمه های اختصاصی پله ای
/// </summary>
public List<LateToWorkTimeFineVewModel> LateToWorkTimeFinesVewModels { get; private set; }
///// <summary>
///// نوع محاسبه جریمه های اختصاصی پله ای. این بخش میتواند نال باشد چون ممکن است شخص جریمه ای اختصاص ندهد
///// </summary>
//public LateToWorkTimeFineType? LateToWorkTimeFineType { get; private set; }
}

View File

@@ -0,0 +1,18 @@
using _0_Framework.Domain.CustomizeCheckoutValueObjects;
namespace CompanyManagment.App.Contracts.CustomizeWorkshopSettings.ValueObjectsViewModel;
public class LeavePayViewModel
{
/// <summary>
/// نوع مرخصی
/// </summary>
public LeavePayType LeavePayType { get; set; }
///// <summary>
///// تعداد روز های مجاز مرخصی
///// </summary>
//public string DayCountAllowable { get; set; }
public double Value { get; set; }
}

View File

@@ -0,0 +1,9 @@
using _0_Framework.Domain.CustomizeCheckoutValueObjects;
namespace CompanyManagment.App.Contracts.CustomizeWorkshopSettings.ValueObjectsViewModel;
public class MarriedAllowanceViewModel
{
public MarriedAllowanceType MarriedAllowanceType { get; set; }
public double Value { get; set; }
}

View File

@@ -0,0 +1,9 @@
using _0_Framework.Domain.CustomizeCheckoutValueObjects;
namespace CompanyManagment.App.Contracts.CustomizeWorkshopSettings.ValueObjectsViewModel;
public class NightWorkPayViewModel
{
public NightWorkType NightWorkingType { get; set; }
public double Value { get; set; }
}

View File

@@ -0,0 +1,9 @@
using _0_Framework.Domain.CustomizeCheckoutValueObjects;
namespace CompanyManagment.App.Contracts.CustomizeWorkshopSettings.ValueObjectsViewModel;
public class OverTimePayViewModel
{
public OverTimePayType OverTimePayType { get; set; }
public double Value { get; set; }
}

View File

@@ -0,0 +1,18 @@
using _0_Framework.Domain.CustomizeCheckoutValueObjects;
namespace CompanyManagment.App.Contracts.CustomizeWorkshopSettings.ValueObjectsViewModel;
public class ShiftPayViewModel
{
/// <summary>
/// نوع نوبت کاری را مشخص میکند . به عنوان مثال: صبح و عصر، عصر و شب و غیره...
/// </summary>
public ShiftType ShiftType { get; set; }
/// <summary>
/// نوع پرداخت را مشخص میکند که آیا به صورت درصدی است یا مبلغ اختصاصی.
/// </summary>
public ShiftPayType ShiftPayType { get; set; }
public double Value { get; set; }
}

View File

@@ -0,0 +1,377 @@
using System.Collections.Generic;
using System.Linq;
using _0_Framework.Application;
using _0_Framework.Domain.CustomizeCheckoutValueObjects;
using Company.Domain.CustomizeWorkshopEmployeeSettingsAgg;
using Company.Domain.CustomizeWorkshopEmployeeSettingsAgg.Entities;
using Company.Domain.CustomizeWorkshopGroupSettingsAgg;
using Company.Domain.CustomizeWorkshopGroupSettingsAgg.Entities;
using Company.Domain.CustomizeWorkshopSettingsAgg;
using Company.Domain.CustomizeWorkshopSettingsAgg.Entities;
using Company.Domain.EmployeeAgg;
using CompanyManagment.App.Contracts.CustomizeWorkshopSettings;
using CompanyManagment.App.Contracts.Employee;
namespace CompanyManagment.Application;
public class CustomizeWorkshopSettingsApplication(ICustomizeWorkshopSettingsRepository customizeWorkshopSettingsRepository,
IAuthHelper authHelper, IPasswordHasher passwordHasher,
ICustomizeWorkshopGroupSettingsRepository customizeWorkshopGroupSettingsRepository, IEmployeeRepository employeeRepository,
ICustomizeWorkshopEmployeeSettingsRepository customizeWorkshopEmployeeSettingsRepository)
: ICustomizeWorkshopSettingsApplication
{
private readonly ICustomizeWorkshopSettingsRepository _customizeWorkshopSettingsRepository = customizeWorkshopSettingsRepository;
private readonly ICustomizeWorkshopGroupSettingsRepository _customizeWorkshopGroupSettingsRepository = customizeWorkshopGroupSettingsRepository;
private readonly ICustomizeWorkshopEmployeeSettingsRepository _customizeWorkshopEmployeeSettingsRepository = customizeWorkshopEmployeeSettingsRepository;
private readonly IAuthHelper _authHelper = authHelper;
private readonly IEmployeeRepository _employeeRepository = employeeRepository;
private readonly IPasswordHasher _passwordHasher = passwordHasher;
//Create workshop settings
public OperationResult CreateWorkshopSettings(CreateCustomizeWorkshopSettings command)
{
OperationResult op = new();
var workshopId = _passwordHasher.SlugDecrypt(_authHelper.GetWorkshopSlug());
if (command.ShiftsList.Any(x => string.IsNullOrWhiteSpace(x.StartTime) || string.IsNullOrWhiteSpace(x.EndTime)))
return op.Failed("ساعات کاری شروع و پایان نمیتواند خالی باشد");
#region Validation
if (workshopId < 1)
{
return op.Failed("خطای سیستمی");
}
#endregion
//تبدیل شیفت های ویو مدل به انتیتی
var shiftCollection =
command.ShiftsList.Select(x => new CustomizeWorkshopSettingsShift(x.StartTime, x.EndTime, x.Placement)).ToList();
var record = new CustomizeWorkshopSettings(workshopId,shiftCollection);
_customizeWorkshopSettingsRepository.Create(record);
_customizeWorkshopSettingsRepository.SaveChanges();
return op.Succcedded(record.id);
}
//create group settings with workshopSettingsId.
public OperationResult CreateGroupSettingsByRollCallWorkshopSettingId(CreateCustomizeWorkshopGroupSettings command)
{
OperationResult op = new();
#region validation
if (!_customizeWorkshopSettingsRepository.Exists(x => x.id == command.CustomizeWorkshopSettingId))
return op.Failed("چنین ساعت کاری برای کارگاهی وجود ندارد");
#endregion
double salary = command.Salary.MoneyToDouble();
var collection = command.ShiftViewModel
.Select(x => new CustomizeWorkshopGroupSettingsShift(x.StartTime, x.EndTime, x.Placement)).ToList();
var entity = new CustomizeWorkshopGroupSettings(command.Name, salary, command.CustomizeWorkshopSettingId ,collection);
_customizeWorkshopGroupSettingsRepository.Create(entity);
_customizeWorkshopGroupSettingsRepository.SaveChanges();
return op.Succcedded();
}
//Create Employee Settings with Group data. It will Replace the Group data (such as salary, shifts and ...) on Employee settings On creation.
public OperationResult CreateRollCallEmployeeSettings(CreateCustomizeEmployeeSettings command)
{
OperationResult op = new();
#region Validation
if (!_customizeWorkshopGroupSettingsRepository.Exists(x => x.id == command.GroupId))
return op.Failed("چنین گروهی وجود ندارد");
if (!_employeeRepository.Exists(x => command.EmployeeIds.Any(y => x.id == y)))
return op.Failed("چنین پرسنلی وجود ندارد");
#endregion
var groupData = _customizeWorkshopGroupSettingsRepository.GetIncludeWorkshopSettings(command.GroupId);
var shifts = groupData.CustomizeWorkshopGroupSettingsShifts.Select(x =>
new CustomizeWorkshopEmployeeSettingsShift(x.StartTime, x.EndTime, x.Placement)).ToList();
foreach (var id in command.EmployeeIds)
{
var entity = new CustomizeWorkshopEmployeeSettings(groupData.FridayPay,groupData.OverTimePay,
groupData.BaseYearsPay,groupData.BonusesPay,groupData.NightWorkPay,groupData.MarriedAllowance,
groupData.ShiftPay,groupData.FamilyAllowance,groupData.LeavePay,groupData.InsuranceDeduction,
groupData.FineAbsenceDeduction,groupData.LateToWork,groupData.EarlyExit,id,
groupData.CustomizeWorkshopSettings.WorkshopId , groupData.Salary, groupData.id,shifts );
_customizeWorkshopEmployeeSettingsRepository.Create(entity);
}
_customizeWorkshopEmployeeSettingsRepository.SaveChanges();
return op.Succcedded();
}
//Edit the Workshop Settings Data
public OperationResult EditWorkshopSetting(EditCustomizeWorkshopSettings command)
{
OperationResult op = new();
#region Validation
if (!_customizeWorkshopSettingsRepository.Exists(x => x.id == command.Id))
return op.Failed("خطای سیستمی");
#endregion
var entity = _customizeWorkshopSettingsRepository.Get(command.Id);
FridayPay fridayPay = new(command.FridayPay.FridayPayType, command.FridayPay.Value);
OverTimePay overTimePay = new(command.OverTimePay.OverTimePayType, command.OverTimePay.Value);
BaseYearsPay baseYearsPay = new(command.BaseYearsPay.BaseYearsPayType);
BonusesPay bonusesPay = new(command.BonusesPay.BonusesPayType, command.BonusesPay.Percentage);
NightWorkPay nightWorkPay = new(command.NightWorkPay.NightWorkingType, command.NightWorkPay.Value);
MarriedAllowance marriedAllowance = new(command.MarriedAllowance.MarriedAllowanceType, command.MarriedAllowance.Value);
ShiftPay shiftPay = new(command.ShiftPay.ShiftType, command.ShiftPay.ShiftPayType, command.ShiftPay.Value);
FamilyAllowance familyAllowance = new(command.FamilyAllowance.FamilyAllowanceType, command.FamilyAllowance.Value);
LeavePay leavePay = new(command.LeavePay.LeavePayType, command.LeavePay.Value);
InsuranceDeduction insuranceDeduction = new(command.InsuranceDeduction.InsuranceDeductionType, command.InsuranceDeduction.Value);
FineAbsenceDeduction fineAbsenceDeduction = new(
command.FineAbsenceDeduction.FineAbsenceDeductionType, command.FineAbsenceDeduction.Value,
command.FineAbsenceDeduction.FineAbsenceDayOfWeekViewModels
.Select(x => new FineAbsenceDayOfWeek(x.DayOfWeek)).ToList()
);
LateToWork lateToWork = new(
command.LateToWork.LateToWorkType,
command.LateToWork.LateToWorkTimeFinesVewModels.Select(x => new LateToWorkTimeFine(x.Minute, x.FineMoney))
.ToList(), command.LateToWork.Value
);
EarlyExit earlyExit = new(command.EarlyExit.EarlyExitType,
command.EarlyExit.EarlyExitTimeFinesViewModels.Select(x => new EarlyExitTimeFine(x.Minute, x.FineMoney))
.ToList(), command.EarlyExit.Value);
var shifts =
command.ShiftsList.Select(x => new CustomizeWorkshopSettingsShift(x.StartTime, x.EndTime, x.Placement)).ToList();
entity.Edit(fridayPay,overTimePay,baseYearsPay,bonusesPay,nightWorkPay,marriedAllowance,shiftPay,familyAllowance,leavePay,insuranceDeduction,
fineAbsenceDeduction,lateToWork,earlyExit,shifts);
_customizeWorkshopSettingsRepository.SaveChanges();
return op.Succcedded();
}
//Edit the Group Settings Data
public OperationResult EditRollCallGroupSetting(EditCustomizeWorkshopGroupSettings command)
{
OperationResult op = new();
#region Validation
if (!_customizeWorkshopGroupSettingsRepository.Exists(x => x.id == command.Id))
return op.Failed("خطای سیستمی");
#endregion
var entity = _customizeWorkshopGroupSettingsRepository.GetWithEmployees(command.Id);
FridayPay fridayPay = new(command.FridayPay.FridayPayType, command.FridayPay.Value);
OverTimePay overTimePay = new(command.OverTimePay.OverTimePayType, command.OverTimePay.Value);
BaseYearsPay baseYearsPay = new(command.BaseYearsPay.BaseYearsPayType);
BonusesPay bonusesPay = new(command.BonusesPay.BonusesPayType, command.BonusesPay.Percentage);
NightWorkPay nightWorkPay = new(command.NightWorkPay.NightWorkingType, command.NightWorkPay.Value);
MarriedAllowance marriedAllowance = new(command.MarriedAllowance.MarriedAllowanceType, command.MarriedAllowance.Value);
ShiftPay shiftPay = new(command.ShiftPay.ShiftType, command.ShiftPay.ShiftPayType, command.ShiftPay.Value);
FamilyAllowance familyAllowance = new(command.FamilyAllowance.FamilyAllowanceType, command.FamilyAllowance.Value);
LeavePay leavePay = new(command.LeavePay.LeavePayType, command.LeavePay.Value);
InsuranceDeduction insuranceDeduction = new(command.InsuranceDeduction.InsuranceDeductionType, command.InsuranceDeduction.Value);
FineAbsenceDeduction fineAbsenceDeduction = new(
command.FineAbsenceDeduction.FineAbsenceDeductionType, command.FineAbsenceDeduction.Value,
command.FineAbsenceDeduction.FineAbsenceDayOfWeekViewModels
.Select(x => new FineAbsenceDayOfWeek(x.DayOfWeek)).ToList()
);
LateToWork lateToWork = new(
command.LateToWork.LateToWorkType,
command.LateToWork.LateToWorkTimeFinesVewModels.Select(x => new LateToWorkTimeFine(x.Minute, x.FineMoney))
.ToList(), command.LateToWork.Value
);
EarlyExit earlyExit = new(command.EarlyExit.EarlyExitType,
command.EarlyExit.EarlyExitTimeFinesViewModels.Select(x => new EarlyExitTimeFine(x.Minute, x.FineMoney))
.ToList(), command.EarlyExit.Value);
double salary = command.Salary.MoneyToDouble();
var employeesShifts = command.ShiftViewModel.Select(x => new CustomizeWorkshopGroupSettingsShift(x.StartTime, x.EndTime, x.Placement)).ToList();
entity.EditAndOverwriteOnEmployees(command.Name, salary, command.EmployeeIds,fridayPay,overTimePay,
baseYearsPay,bonusesPay,shiftPay,nightWorkPay,marriedAllowance,familyAllowance,
leavePay,insuranceDeduction,fineAbsenceDeduction,lateToWork,earlyExit,employeesShifts);
_customizeWorkshopGroupSettingsRepository.SaveChanges();
return op.Succcedded();
}
//Edit the Employee settings and change the 'IsChanged' bool to true.
public OperationResult EditRollCallEmployeeSettings(EditCustomizeEmployeeSettings command)
{
OperationResult op = new();
var entity = _customizeWorkshopEmployeeSettingsRepository.Get(command.Id);
#region Validation
if (entity == null)
return op.Failed("چنین پرسنلی وجود ندارد");
#endregion
FridayPay fridayPay = new(command.FridayPay.FridayPayType, command.FridayPay.Value);
OverTimePay overTimePay = new(command.OverTimePay.OverTimePayType, command.OverTimePay.Value);
BaseYearsPay baseYearsPay = new(command.BaseYearsPay.BaseYearsPayType);
BonusesPay bonusesPay = new(command.BonusesPay.BonusesPayType, command.BonusesPay.Percentage);
NightWorkPay nightWorkPay = new(command.NightWorkPay.NightWorkingType, command.NightWorkPay.Value);
MarriedAllowance marriedAllowance = new(command.MarriedAllowance.MarriedAllowanceType, command.MarriedAllowance.Value);
ShiftPay shiftPay = new(command.ShiftPay.ShiftType, command.ShiftPay.ShiftPayType, command.ShiftPay.Value);
FamilyAllowance familyAllowance = new(command.FamilyAllowance.FamilyAllowanceType, command.FamilyAllowance.Value);
LeavePay leavePay = new(command.LeavePay.LeavePayType, command.LeavePay.Value);
InsuranceDeduction insuranceDeduction = new(command.InsuranceDeduction.InsuranceDeductionType, command.InsuranceDeduction.Value);
FineAbsenceDeduction fineAbsenceDeduction = new(
command.FineAbsenceDeduction.FineAbsenceDeductionType, command.FineAbsenceDeduction.Value,
command.FineAbsenceDeduction.FineAbsenceDayOfWeekViewModels
.Select(x => new FineAbsenceDayOfWeek(x.DayOfWeek)).ToList()
);
LateToWork lateToWork = new(
command.LateToWork.LateToWorkType,
command.LateToWork.LateToWorkTimeFinesVewModels.Select(x => new LateToWorkTimeFine(x.Minute, x.FineMoney))
.ToList(), command.LateToWork.Value
);
EarlyExit earlyExit = new(command.EarlyExit.EarlyExitType,
command.EarlyExit.EarlyExitTimeFinesViewModels.Select(x => new EarlyExitTimeFine(x.Minute, x.FineMoney))
.ToList(), command.EarlyExit.Value);
double salary = command.Salary.MoneyToDouble();
var employeesShifts = command.ShiftViewModel.Select(x => new CustomizeWorkshopEmployeeSettingsShift(x.StartTime, x.EndTime, x.Placement)).ToList();
//change employee data manually. It changes the 'IsChanged' property to true.
entity.EditEmployeesAndMakeIsChangeTrue(employeesShifts, salary,fridayPay, overTimePay, baseYearsPay,
bonusesPay, nightWorkPay, marriedAllowance, shiftPay, familyAllowance, leavePay,
insuranceDeduction, fineAbsenceDeduction, lateToWork, earlyExit);
_customizeWorkshopEmployeeSettingsRepository.SaveChanges();
return op.Succcedded();
}
public List<CustomizeWorkshopEmployeeSettingsViewModel> GetChangedEmployeeSettingsByGroupSettingsId(long groupSettingsId)
{
return _customizeWorkshopGroupSettingsRepository.GetChangedEmployeeSettingsByGroupSettingsId(
groupSettingsId);
}
//Remove the Employee From the Group Settings
public OperationResult RemoveEmployeeFromRollCallWorkshopGroup(long employeeId, long groupId)
{
OperationResult op = new();
var groupEntity = _customizeWorkshopGroupSettingsRepository.GetWithEmployees(groupId);
#region Validation
if (groupEntity == null)
{
return op.Failed("چنین گروهی وجود ندارد");
}
#endregion
groupEntity.RemoveEmployeeFromGroup(employeeId);
_customizeWorkshopGroupSettingsRepository.SaveChanges();
return op.Succcedded();
}
// It will Get the Workshop Settings with its groups and the employees of groups.
public CustomizeWorkshopSettingsViewModel GetWorkshopSettingsByWorkshopId(long workshopId)
{
var user = _authHelper.CurrentAccountInfo();
#region Validation
if (workshopId is < 1)
return new();
var record = _customizeWorkshopSettingsRepository.GetWorkshopSettingsByWorkshopId(workshopId);
if (record == null)
return new();
#endregion
return new CustomizeWorkshopSettingsViewModel()
{
Id = record.id,
Name = user.WorkshopList.FirstOrDefault(w => w.Id == record.WorkshopId)?.Name,
GroupSettings = record.CustomizeWorkshopGroupSettingsCollection.Select(x =>
new CustomizeWorkshopGroupSettingsViewModel()
{
Id = x.id,
GroupName = x.GroupName,
RollCallWorkshopEmployeesSettings = x.CustomizeWorkshopEmployeeSettingsCollection.Select(y =>
{
var employee = _employeeRepository.Get(y.EmployeeId);
return new CustomizeWorkshopEmployeeSettingsViewModel()
{
Id = y.id,
EmployeeId = y.EmployeeId,
IsChanged = y.IsChanged,
Name = $"{employee.FName} {employee.LName}",
RollCallWorkshopShifts = y.CustomizeWorkshopEmployeeSettingsShifts.Select(s =>
new CustomizeWorkshopShiftViewModel()
{
EndTime = s.EndTime,
Placement = s.Placement,
StartTime = s.StartTime
}).ToList(),
Salary = y.Salary,
};
}).ToList(),
Salary = x.Salary,
RollCallWorkshopShifts = x.CustomizeWorkshopGroupSettingsShifts.Select(s =>
new CustomizeWorkshopShiftViewModel()
{
EndTime = s.EndTime,
Placement = s.Placement,
StartTime = s.StartTime
}).ToList(),
}).ToList(),
};
}
public CustomizeWorkshopEmployeeSettingsViewModel GetEmployeeSettingsByEmployeeIdGroupSettingsId(long workshopId,
long employeeId)
{
throw new System.NotImplementedException();
}
public List<CustomizeWorkshopEmployeeSettingsViewModel> GetEmployeeSettingsByGroupSettingsId(long groupSettingsId)
{
List<CustomizeWorkshopEmployeeSettingsViewModel> result = _customizeWorkshopGroupSettingsRepository.GetEmployeeSettingsByGroupSettingsId(groupSettingsId);
if (result == null)
return new();
return result;
}
public List<EmployeeViewModel> GetEmployeesWithoutGroup(long rollCallWorkshopSettingId)
{
return _customizeWorkshopGroupSettingsRepository.GetEmployeesWithoutGroup(rollCallWorkshopSettingId);
}
public CustomizeWorkshopEmployeeSettingsViewModel GetEmployeeSettingsByEmployeeIdWorkshopId(long workshopId, long employeeId)
{
return _customizeWorkshopSettingsRepository.GetEmployeeSettingsByWorkshopIdGroupSettingsId(workshopId, employeeId);
}
}

View File

@@ -13,6 +13,9 @@ using Company.Domain.CrossJobAgg;
using Company.Domain.CrossJobGuildAgg;
using Company.Domain.CrossJobItemsAgg;
using Company.Domain.CustomizeCheckoutAgg;
using Company.Domain.CustomizeWorkshopEmployeeSettingsAgg.Entities;
using Company.Domain.CustomizeWorkshopGroupSettingsAgg.Entities;
using Company.Domain.CustomizeWorkshopSettingsAgg.Entities;
using Company.Domain.DateSalaryAgg;
using Company.Domain.DateSalaryItemAgg;
using Company.Domain.EmployeeAccountAgg;
@@ -130,9 +133,19 @@ public class CompanyContext : DbContext
//public DbSet<Task> Tasks { get; set; }
//public DbSet<TaskStatus> TaskStatuses { get; set; }
//public DbSet<TaskTitle> TaskTitles { get; set; }
//-------Main-Project----------------------------
#region Mahan
//-----------------------------RollCallWorkshopSettings-----------------------------
public DbSet<CustomizeWorkshopSettings> CustomizeWorkshopSettings { get; set; }
public DbSet<CustomizeWorkshopGroupSettings> CustomizeWorkshopGroupSettings { get; set; }
public DbSet<CustomizeWorkshopEmployeeSettings> CustomizeWorkshopEmployeeSettings { get; set; }
#endregion
public DbSet<CustomizeCheckout> CustomizeCheckouts { get; set; }
public DbSet<TaxLeftWorkItem> TaxLeftWorkItems { get; set; }
public DbSet<TaxLeftWorkCategory> TaxLeftWorkCategories { get; set; }

View File

@@ -0,0 +1,202 @@
using System;
using System.Security.Cryptography.X509Certificates;
using _0_Framework.Domain.CustomizeCheckoutValueObjects;
using Company.Domain.CustomizeWorkshopEmployeeSettingsAgg.Entities;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace CompanyManagment.EFCore.Mapping;
public class CustomizeWorkshopEmployeeSettingsMapping : IEntityTypeConfiguration<CustomizeWorkshopEmployeeSettings>
{
public void Configure(EntityTypeBuilder<CustomizeWorkshopEmployeeSettings> builder)
{
builder.ToTable("CustomizeWorkshopEmployeeSettings");
builder.HasKey(x => x.id);
builder.HasOne(x => x.CustomizeWorkshopGroupSettings).WithMany(x => x.CustomizeWorkshopEmployeeSettingsCollection)
.HasForeignKey(x => x.CustomizeWorkshopGroupSettingId);
builder.OwnsOne(x => x.BaseYearsPay, baseYearsPay =>
{
baseYearsPay.Property(a => a.BaseYearsPayType).HasConversion(
v => v.ToString("d"),
v => (BaseYearsPayType)Enum.Parse(typeof(BaseYearsPayType), v)).HasMaxLength(1).HasColumnName("BaseYearsPay_BaseYearsPayType");
baseYearsPay.Property(x => x.PaymentType).HasConversion(
v => v.ToString("d"),
v => (BaseYearsPaymentType)Enum.Parse(typeof(BaseYearsPaymentType), v)).HasMaxLength(1).HasColumnName("BaseYearsPay_PaymentType");
baseYearsPay.Property(x => x.Value).HasColumnName("BaseYearsPay_Value");
});
builder.OwnsOne(x => x.BonusesPay, bonusesPay =>
{
bonusesPay.Property(x => x.BonusesPayType).HasConversion(
v => v.ToString("d"),
v => (BonusesType)Enum.Parse(typeof(BonusesType), v)).HasMaxLength(1).HasColumnName("BonusesPay_BonusesPayType");
bonusesPay.Property(x=>x.PaymentType).HasConversion(
v => v.ToString("d"),
v => (BonusesPaymentType)Enum.Parse(typeof(BonusesPaymentType), v)).HasMaxLength(1).HasColumnName("BonusesPay_PaymentType");
bonusesPay.Property(x => x.Value).HasColumnName("BonusesPay_Value");
});
builder.OwnsOne(x => x.EarlyExit, earlyExit =>
{
earlyExit.Property(x => x.EarlyExitType).HasConversion(
v => v.ToString("d"),
v => (EarlyExitType)Enum.Parse(typeof(EarlyExitType), v)).HasMaxLength(1).HasColumnName("EarlyExit_EarlyExitType");
//earlyExit.Property(x => x.EarlyExitTimeFineType).HasConversion(
// v => v.HasValue ? v.Value.ToString("d") : null,
// v => v != null
// ? (EarlyExitTimeFineType)Enum.Parse(typeof(EarlyExitTimeFineType), v)
// : null).HasColumnName("EarlyExit_EarlyExitTimeFineType").HasMaxLength(1);
earlyExit.OwnsMany(x => x.EarlyExitTimeFines, earlyExitTimeFines =>
{
earlyExitTimeFines.WithOwner().HasForeignKey("CustomizeWorkshopEmployeeSettingsId");
earlyExitTimeFines.Property(x => x.FineMoney).HasColumnName("EarlyExitTimeFines_FineMoney");
earlyExitTimeFines.Property(x => x.Minute).HasColumnName("EarlyExitTimeFines_Minute").HasMaxLength(4);
});
earlyExit.Property(x => x.Value).HasColumnName("EarlyExitTimeFines_Value");
});
builder.OwnsOne(x => x.FamilyAllowance, familyAllowance =>
{
familyAllowance.Property(x => x.Value).HasColumnName("FamilyAllowance_Value");
//familyAllowance.Property(x => x.NumberOfChildren).HasConversion(
// v => v.ToString("d"),
// v => (NumberOfChildren)Enum.Parse(typeof(NumberOfChildren), v)).HasMaxLength(1).HasColumnName("FamilyAllowance_NumberOfChildren");
familyAllowance.Property(x => x.FamilyAllowanceType).HasConversion(
v => v.ToString("d"),
v => (FamilyAllowanceType)Enum.Parse(typeof(FamilyAllowanceType), v)).HasMaxLength(1).HasColumnName("FamilyAllowance_FamilyAllowanceType");
});
builder.OwnsOne(x => x.FineAbsenceDeduction, fineAbsenceDeduction =>
{
fineAbsenceDeduction.Property(x => x.Value).HasColumnName("FineAbsenceDeduction_Value");
fineAbsenceDeduction.Property(x => x.FineAbsenceDeductionType).HasConversion(
v => v.ToString("d"),
v => (FineAbsenceDeductionType)Enum.Parse(typeof(FineAbsenceDeductionType), v)).HasMaxLength(1).HasColumnName("FineAbsenceDeduction_FineAbsenceDeductionType");
fineAbsenceDeduction.OwnsMany(x => x.FineAbsenceDayOfWeekCollection, fineAbsenceDayOfWeek =>
{
fineAbsenceDayOfWeek.WithOwner().HasForeignKey("CustomizeWorkshopEmployeeSettingsId");
fineAbsenceDayOfWeek.Property(x => x.DayOfWeek).HasConversion(
v => v.ToString("d"),
v => (DayOfWeek)Enum.Parse(typeof(DayOfWeek), v)).HasMaxLength(1)
.HasColumnName("FineAbsenceDayOfWeekCollection_DayOfWeek");
});
});
builder.OwnsOne(x => x.FridayPay, fridayPay =>
{
fridayPay.Property(x => x.Value).HasColumnName("FridayPay_Value");
fridayPay.Property(x => x.FridayPayType).HasConversion(
v => v.ToString("d"),
v => (FridayPayType)Enum.Parse(typeof(FridayPayType), v)).HasMaxLength(1);
});
builder.OwnsOne(x => x.InsuranceDeduction, insuranceDeduction =>
{
insuranceDeduction.Property(x => x.Value).HasColumnName("InsuranceDeduction_Value");
insuranceDeduction.Property(x => x.InsuranceDeductionType).HasConversion(
v => v.ToString("d"),
v => (InsuranceDeductionType)Enum.Parse(typeof(InsuranceDeductionType), v)).HasMaxLength(1)
.HasColumnName("InsuranceDeduction_InsuranceDeductionType");
});
builder.OwnsOne(x => x.LateToWork, lateToWork =>
{
lateToWork.Property(x => x.Value).HasColumnName("LateToWork_Value");
lateToWork.Property(x => x.LateToWorkType).HasConversion(
v => v.ToString("d"),
v => (LateToWorkType)Enum.Parse(typeof(LateToWorkType), v)).HasMaxLength(1)
.HasColumnName("LateToWork_LateToWorkType");
//lateToWork.Property(x => x.LateToWorkTimeFineType).HasConversion(
// v => v.HasValue ? v.Value.ToString("d") : null,
// v => v != null
// ? (LateToWorkTimeFineType)Enum.Parse(typeof(LateToWorkTimeFineType), v)
// : null).HasColumnName("LateToWork_LateToWorkTimeFineType").HasMaxLength(1);
lateToWork.OwnsMany(x => x.LateToWorkTimeFines, lateToWorkTimeFines =>
{
lateToWorkTimeFines.WithOwner().HasForeignKey("CustomizeWorkshopEmployeeSettingsId");
lateToWorkTimeFines.Property(x => x.FineMoney).HasColumnName("LateToWorkTimeFines_FineMoney");
lateToWorkTimeFines.Property(x => x.Minute).HasMaxLength(4).HasColumnName("LateToWorkTimeFines_Minute");
});
});
builder.OwnsOne(x => x.LeavePay, leavePay =>
{
leavePay.Property(x => x.Value).HasColumnName("LeavePay_Value");
//leavePay.Property(x => x.DayCountAllowable).HasMaxLength(3).HasColumnName("LeavePay_DayCountAllowable");
leavePay.Property(x => x.LeavePayType).HasConversion(
v => v.ToString("d"),
v => (LeavePayType)Enum.Parse(typeof(LeavePayType), v)).HasMaxLength(1)
.HasColumnName("LeavePay_LeavePayType");
});
builder.OwnsOne(x => x.MarriedAllowance, marriedAllowance =>
{
marriedAllowance.Property(x => x.Value).HasColumnName("MarriedAllowance_Value");
marriedAllowance.Property(x => x.MarriedAllowanceType).HasConversion(
v => v.ToString("d"),
v => (MarriedAllowanceType)Enum.Parse(typeof(MarriedAllowanceType), v)).HasMaxLength(1)
.HasColumnName("MarriedAllowance_MarriedAllowanceType");
});
builder.OwnsOne(x => x.NightWorkPay, nightWorkPay =>
{
nightWorkPay.Property(x => x.NightWorkingType).HasConversion(
v => v.ToString("d"),
v => (NightWorkType)Enum.Parse(typeof(NightWorkType), v)).HasMaxLength(1)
.HasColumnName("NightWorkPay_NightWorkingType");
nightWorkPay.Property(x => x.Value).HasColumnName("NightWorkPay_Value");
});
builder.OwnsOne(x => x.OverTimePay, overTimePay =>
{
overTimePay.Property(x => x.Value).HasColumnName("OverTimePay_Value");
overTimePay.Property(x => x.OverTimePayType).HasConversion(
v => v.ToString("d"),
v => (OverTimePayType)Enum.Parse(typeof(OverTimePayType), v)).HasMaxLength(1)
.HasColumnName("OverTimePay_OverTimePayType");
});
builder.OwnsOne(x => x.ShiftPay, shiftPay =>
{
shiftPay.Property(x => x.Value).HasColumnName("ShiftPay_Value");
shiftPay.Property(x=>x.ShiftPayType).HasConversion(
v => v.ToString("d"),
v => (ShiftPayType)Enum.Parse(typeof(ShiftPayType), v)).HasMaxLength(1)
.HasColumnName("ShiftPay_ShiftPayType");
shiftPay.Property(x=>x.ShiftType).HasConversion(
v => v.ToString("d"),
v => (ShiftType)Enum.Parse(typeof(ShiftType), v)).HasMaxLength(1)
.HasColumnName("ShiftPay_ShiftType");
});
builder.OwnsMany(x => x.CustomizeWorkshopEmployeeSettingsShifts, shift =>
{
shift.ToTable("CustomizeWorkshopEmployeeSettingsShifts");
shift.HasKey(x => x.id);
shift.Property(x => x.Placement).HasConversion<string>().HasMaxLength(20);
shift.Property(x => x.StartTime).HasMaxLength(5);
shift.Property(x => x.EndTime).HasMaxLength(5);
shift.WithOwner(x => x.CustomizeWorkshopEmployeeSettings).HasForeignKey(a => a.CustomizeWorkshopEmployeeSettingsId);
});
}
}

View File

@@ -0,0 +1,207 @@
using _0_Framework.Domain.CustomizeCheckoutValueObjects;
using Company.Domain.CustomizeWorkshopGroupSettingsAgg.Entities;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
namespace CompanyManagment.EFCore.Mapping;
public class CustomizeWorkshopGroupSettingsMapping : IEntityTypeConfiguration<CustomizeWorkshopGroupSettings>
{
public void Configure(EntityTypeBuilder<CustomizeWorkshopGroupSettings> builder)
{
builder.ToTable("CustomizeWorkshopGroupSettings");
builder.HasKey(x => x.id);
builder.Property(x => x.GroupName).HasMaxLength(120);
builder.OwnsOne(x => x.BaseYearsPay, baseYearsPay =>
{
baseYearsPay.Property(a => a.BaseYearsPayType).HasConversion(
v => v.ToString("d"),
v => (BaseYearsPayType)Enum.Parse(typeof(BaseYearsPayType), v)).HasMaxLength(1).HasColumnName("BaseYearsPay_BaseYearsPayType");
baseYearsPay.Property(x => x.PaymentType).HasConversion(
v => v.ToString("d"),
v => (BaseYearsPaymentType)Enum.Parse(typeof(BaseYearsPaymentType), v)).HasMaxLength(1).HasColumnName("BaseYearsPay_PaymentType");
baseYearsPay.Property(x => x.Value).HasColumnName("BaseYearsPay_Value");
});
builder.OwnsOne(x => x.BonusesPay, bonusesPay =>
{
bonusesPay.Property(x => x.BonusesPayType).HasConversion(
v => v.ToString("d"),
v => (BonusesType)Enum.Parse(typeof(BonusesType), v)).HasMaxLength(1).HasColumnName("BonusesPay_BonusesPayType");
bonusesPay.Property(x => x.PaymentType).HasConversion(
v => v.ToString("d"),
v => (BonusesPaymentType)Enum.Parse(typeof(BonusesPaymentType), v)).HasMaxLength(1).HasColumnName("BonusesPay_PaymentType");
bonusesPay.Property(x => x.Value).HasColumnName("BonusesPay_Value");
});
builder.OwnsOne(x => x.EarlyExit, earlyExit =>
{
earlyExit.Property(x => x.EarlyExitType).HasConversion(
v => v.ToString("d"),
v => (EarlyExitType)Enum.Parse(typeof(EarlyExitType), v)).HasMaxLength(1).HasColumnName("EarlyExit_EarlyExitType");
//earlyExit.Property(x => x.EarlyExitTimeFineType).HasConversion(
// v => v.HasValue ? v.Value.ToString("d") : null,
// v => v != null
// ? (EarlyExitTimeFineType)Enum.Parse(typeof(EarlyExitTimeFineType), v)
// : null).HasColumnName("EarlyExit_EarlyExitTimeFineType").HasMaxLength(1);
earlyExit.OwnsMany(x => x.EarlyExitTimeFines, earlyExitTimeFines =>
{
earlyExitTimeFines.WithOwner().HasForeignKey("CustomizeWorkshopGroupSettingsId");
earlyExitTimeFines.Property(x => x.FineMoney).HasColumnName("EarlyExitTimeFines_FineMoney");
earlyExitTimeFines.Property(x => x.Minute).HasColumnName("EarlyExitTimeFines_Minute").HasMaxLength(4);
});
earlyExit.Property(x => x.Value).HasColumnName("EarlyExitTimeFines_Value");
});
builder.OwnsOne(x => x.FamilyAllowance, familyAllowance =>
{
familyAllowance.Property(x => x.Value).HasColumnName("FamilyAllowance_Value");
//familyAllowance.Property(x => x.NumberOfChildren).HasConversion(
// v => v.ToString("d"),
// v => (NumberOfChildren)Enum.Parse(typeof(NumberOfChildren), v)).HasMaxLength(1).HasColumnName("FamilyAllowance_NumberOfChildren");
familyAllowance.Property(x => x.FamilyAllowanceType).HasConversion(
v => v.ToString("d"),
v => (FamilyAllowanceType)Enum.Parse(typeof(FamilyAllowanceType), v)).HasMaxLength(1).HasColumnName("FamilyAllowance_FamilyAllowanceType");
});
builder.OwnsOne(x => x.FineAbsenceDeduction, fineAbsenceDeduction =>
{
fineAbsenceDeduction.Property(x => x.Value).HasColumnName("FineAbsenceDeduction_Value");
fineAbsenceDeduction.Property(x => x.FineAbsenceDeductionType).HasConversion(
v => v.ToString("d"),
v => (FineAbsenceDeductionType)Enum.Parse(typeof(FineAbsenceDeductionType), v)).HasMaxLength(1).HasColumnName("FineAbsenceDeduction_FineAbsenceDeductionType");
fineAbsenceDeduction.OwnsMany(x => x.FineAbsenceDayOfWeekCollection, fineAbsenceDayOfWeek =>
{
fineAbsenceDayOfWeek.WithOwner().HasForeignKey("CustomizeWorkshopGroupSettingsId");
fineAbsenceDayOfWeek.Property(x => x.DayOfWeek).HasConversion(
v => v.ToString("d"),
v => (DayOfWeek)Enum.Parse(typeof(DayOfWeek), v)).HasMaxLength(1)
.HasColumnName("FineAbsenceDayOfWeekCollection_DayOfWeek");
});
});
builder.OwnsOne(x => x.FridayPay, fridayPay =>
{
fridayPay.Property(x => x.Value).HasColumnName("FridayPay_Value");
fridayPay.Property(x => x.FridayPayType).HasConversion(
v => v.ToString("d"),
v => (FridayPayType)Enum.Parse(typeof(FridayPayType), v)).HasMaxLength(1);
});
builder.OwnsOne(x => x.InsuranceDeduction, insuranceDeduction =>
{
insuranceDeduction.Property(x => x.Value).HasColumnName("InsuranceDeduction_Value");
insuranceDeduction.Property(x => x.InsuranceDeductionType).HasConversion(
v => v.ToString("d"),
v => (InsuranceDeductionType)Enum.Parse(typeof(InsuranceDeductionType), v)).HasMaxLength(1)
.HasColumnName("InsuranceDeduction_InsuranceDeductionType");
});
builder.OwnsOne(x => x.LateToWork, lateToWork =>
{
lateToWork.Property(x => x.Value).HasColumnName("LateToWork_Value");
lateToWork.Property(x => x.LateToWorkType).HasConversion(
v => v.ToString("d"),
v => (LateToWorkType)Enum.Parse(typeof(LateToWorkType), v)).HasMaxLength(1)
.HasColumnName("LateToWork_LateToWorkType");
//lateToWork.Property(x => x.LateToWorkTimeFineType).HasConversion(
// v => v.HasValue ? v.Value.ToString("d") : null,
// v => v != null
// ? (LateToWorkTimeFineType)Enum.Parse(typeof(LateToWorkTimeFineType), v)
// : null).HasColumnName("LateToWork_LateToWorkTimeFineType").HasMaxLength(1);
lateToWork.OwnsMany(x => x.LateToWorkTimeFines, lateToWorkTimeFines =>
{
lateToWorkTimeFines.WithOwner().HasForeignKey("CustomizeWorkshopGroupSettingsId");
lateToWorkTimeFines.Property(x => x.FineMoney).HasColumnName("LateToWorkTimeFines_FineMoney");
lateToWorkTimeFines.Property(x => x.Minute).HasMaxLength(4).HasColumnName("LateToWorkTimeFines_Minute");
});
});
builder.OwnsOne(x => x.LeavePay, leavePay =>
{
leavePay.Property(x => x.Value).HasColumnName("LeavePay_Value");
//leavePay.Property(x => x.DayCountAllowable).HasMaxLength(3).HasColumnName("LeavePay_DayCountAllowable");
leavePay.Property(x => x.LeavePayType).HasConversion(
v => v.ToString("d"),
v => (LeavePayType)Enum.Parse(typeof(LeavePayType), v)).HasMaxLength(1)
.HasColumnName("LeavePay_LeavePayType");
});
builder.OwnsOne(x => x.MarriedAllowance, marriedAllowance =>
{
marriedAllowance.Property(x => x.Value).HasColumnName("MarriedAllowance_Value");
marriedAllowance.Property(x => x.MarriedAllowanceType).HasConversion(
v => v.ToString("d"),
v => (MarriedAllowanceType)Enum.Parse(typeof(MarriedAllowanceType), v)).HasMaxLength(1)
.HasColumnName("MarriedAllowance_MarriedAllowanceType");
});
builder.OwnsOne(x => x.NightWorkPay, nightWorkPay =>
{
nightWorkPay.Property(x => x.NightWorkingType).HasConversion(
v => v.ToString("d"),
v => (NightWorkType)Enum.Parse(typeof(NightWorkType), v)).HasMaxLength(1)
.HasColumnName("NightWorkPay_NightWorkingType");
nightWorkPay.Property(x => x.Value).HasColumnName("NightWorkPay_Value");
});
builder.OwnsOne(x => x.OverTimePay, overTimePay =>
{
overTimePay.Property(x => x.Value).HasColumnName("OverTimePay_Value");
overTimePay.Property(x => x.OverTimePayType).HasConversion(
v => v.ToString("d"),
v => (OverTimePayType)Enum.Parse(typeof(OverTimePayType), v)).HasMaxLength(1)
.HasColumnName("OverTimePay_OverTimePayType");
});
builder.OwnsOne(x => x.ShiftPay, shiftPay =>
{
shiftPay.Property(x => x.Value).HasColumnName("ShiftPay_Value");
shiftPay.Property(x => x.ShiftPayType).HasConversion(
v => v.ToString("d"),
v => (ShiftPayType)Enum.Parse(typeof(ShiftPayType), v)).HasMaxLength(1)
.HasColumnName("ShiftPay_ShiftPayType");
shiftPay.Property(x => x.ShiftType).HasConversion(
v => v.ToString("d"),
v => (ShiftType)Enum.Parse(typeof(ShiftType), v)).HasMaxLength(1)
.HasColumnName("ShiftPay_ShiftType");
});
builder.OwnsMany(x => x.CustomizeWorkshopGroupSettingsShifts, shift =>
{
shift.ToTable("CustomizeWorkshopGroupSettingsShifts");
shift.HasKey(x => x.id);
shift.Property(x => x.Placement).HasConversion<string>().HasMaxLength(20);
shift.Property(x => x.StartTime).HasMaxLength(5);
shift.Property(x => x.EndTime).HasMaxLength(5);
shift.WithOwner(x=>x.CustomizeWorkshopGroupSettings).HasForeignKey(a => a.CustomizeWorkshopGroupSettingsId);
});
builder.HasOne(x => x.CustomizeWorkshopSettings).WithMany(x => x.CustomizeWorkshopGroupSettingsCollection)
.HasForeignKey(x => x.CustomizeWorkshopSettingId);
builder.HasMany(x => x.CustomizeWorkshopEmployeeSettingsCollection).WithOne(x => x.CustomizeWorkshopGroupSettings)
.HasForeignKey(x => x.CustomizeWorkshopGroupSettingId);
}
}

View File

@@ -0,0 +1,210 @@
using _0_Framework.Domain.CustomizeCheckoutValueObjects;
using Company.Domain.CustomizeWorkshopSettingsAgg.Entities;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
namespace CompanyManagment.EFCore.Mapping;
public class CustomizeWorkshopSettingsMapping:IEntityTypeConfiguration<CustomizeWorkshopSettings>
{
public void Configure(EntityTypeBuilder<CustomizeWorkshopSettings> builder)
{
builder.ToTable("CustomizeWorkshopSettings");
builder.HasKey(x => x.id);
builder.OwnsOne(x => x.BaseYearsPay, baseYearsPay =>
{
baseYearsPay.Property(a => a.BaseYearsPayType).HasConversion(
v => v.ToString("d"),
v => (BaseYearsPayType)Enum.Parse(typeof(BaseYearsPayType), v)).HasMaxLength(1).HasColumnName("BaseYearsPay_BaseYearsPayType");
});
builder.OwnsOne(x => x.BaseYearsPay, baseYearsPay =>
{
baseYearsPay.Property(a => a.BaseYearsPayType).HasConversion(
v => v.ToString("d"),
v => (BaseYearsPayType)Enum.Parse(typeof(BaseYearsPayType), v)).HasMaxLength(1).HasColumnName("BaseYearsPay_BaseYearsPayType");
baseYearsPay.Property(x => x.PaymentType).HasConversion(
v => v.ToString("d"),
v => (BaseYearsPaymentType)Enum.Parse(typeof(BaseYearsPaymentType), v)).HasMaxLength(1).HasColumnName("BaseYearsPay_PaymentType");
baseYearsPay.Property(x => x.Value).HasColumnName("BaseYearsPay_Value");
});
builder.OwnsOne(x => x.BonusesPay, bonusesPay =>
{
bonusesPay.Property(x => x.BonusesPayType).HasConversion(
v => v.ToString("d"),
v => (BonusesType)Enum.Parse(typeof(BonusesType), v)).HasMaxLength(1).HasColumnName("BonusesPay_BonusesPayType");
bonusesPay.Property(x => x.PaymentType).HasConversion(
v => v.ToString("d"),
v => (BonusesPaymentType)Enum.Parse(typeof(BonusesPaymentType), v)).HasMaxLength(1).HasColumnName("BonusesPay_PaymentType");
bonusesPay.Property(x => x.Value).HasColumnName("BonusesPay_Value");
});
builder.OwnsOne(x => x.EarlyExit, earlyExit =>
{
earlyExit.Property(x => x.EarlyExitType).HasConversion(
v => v.ToString("d"),
v => (EarlyExitType)Enum.Parse(typeof(EarlyExitType), v)).HasMaxLength(1).HasColumnName("EarlyExit_EarlyExitType");
//earlyExit.Property(x => x.EarlyExitTimeFineType).HasConversion(
// v => v.HasValue ? v.Value.ToString("d") : null,
// v => v != null
// ? (EarlyExitTimeFineType)Enum.Parse(typeof(EarlyExitTimeFineType), v)
// : null).HasColumnName("EarlyExit_EarlyExitTimeFineType").HasMaxLength(1);
earlyExit.OwnsMany(x => x.EarlyExitTimeFines, earlyExitTimeFines =>
{
earlyExitTimeFines.WithOwner().HasForeignKey("CustomizeWorkshopSettingsId");
earlyExitTimeFines.Property(x => x.FineMoney).HasColumnName("EarlyExitTimeFines_FineMoney");
earlyExitTimeFines.Property(x => x.Minute).HasColumnName("EarlyExitTimeFines_Minute").HasMaxLength(4);
});
earlyExit.Property(x => x.Value).HasColumnName("EarlyExitTimeFines_Value");
});
builder.OwnsOne(x => x.FamilyAllowance, familyAllowance =>
{
familyAllowance.Property(x => x.Value).HasColumnName("FamilyAllowance_Value");
//familyAllowance.Property(x => x.NumberOfChildren).HasConversion(
// v => v.ToString("d"),
// v => (NumberOfChildren)Enum.Parse(typeof(NumberOfChildren), v)).HasMaxLength(1).HasColumnName("FamilyAllowance_NumberOfChildren");
familyAllowance.Property(x => x.FamilyAllowanceType).HasConversion(
v => v.ToString("d"),
v => (FamilyAllowanceType)Enum.Parse(typeof(FamilyAllowanceType), v)).HasMaxLength(1).HasColumnName("FamilyAllowance_FamilyAllowanceType");
});
builder.OwnsOne(x => x.FineAbsenceDeduction, fineAbsenceDeduction =>
{
fineAbsenceDeduction.Property(x => x.Value).HasColumnName("FineAbsenceDeduction_Value");
fineAbsenceDeduction.Property(x => x.FineAbsenceDeductionType).HasConversion(
v => v.ToString("d"),
v => (FineAbsenceDeductionType)Enum.Parse(typeof(FineAbsenceDeductionType), v)).HasMaxLength(1).HasColumnName("FineAbsenceDeduction_FineAbsenceDeductionType");
fineAbsenceDeduction.OwnsMany(x => x.FineAbsenceDayOfWeekCollection, fineAbsenceDayOfWeek =>
{
fineAbsenceDayOfWeek.WithOwner().HasForeignKey("CustomizeWorkshopSettingsId");
fineAbsenceDayOfWeek.Property(x => x.DayOfWeek).HasConversion(
v => v.ToString("d"),
v => (DayOfWeek)Enum.Parse(typeof(DayOfWeek), v)).HasMaxLength(1)
.HasColumnName("FineAbsenceDayOfWeekCollection_DayOfWeek");
});
});
builder.OwnsOne(x => x.FridayPay, fridayPay =>
{
fridayPay.Property(x => x.Value).HasColumnName("FridayPay_Value");
fridayPay.Property(x => x.FridayPayType).HasConversion(
v => v.ToString("d"),
v => (FridayPayType)Enum.Parse(typeof(FridayPayType), v)).HasMaxLength(1);
});
builder.OwnsOne(x => x.InsuranceDeduction, insuranceDeduction =>
{
insuranceDeduction.Property(x => x.Value).HasColumnName("InsuranceDeduction_Value");
insuranceDeduction.Property(x => x.InsuranceDeductionType).HasConversion(
v => v.ToString("d"),
v => (InsuranceDeductionType)Enum.Parse(typeof(InsuranceDeductionType), v)).HasMaxLength(1)
.HasColumnName("InsuranceDeduction_InsuranceDeductionType");
});
builder.OwnsOne(x => x.LateToWork, lateToWork =>
{
lateToWork.Property(x => x.Value).HasColumnName("LateToWork_Value");
lateToWork.Property(x => x.LateToWorkType).HasConversion(
v => v.ToString("d"),
v => (LateToWorkType)Enum.Parse(typeof(LateToWorkType), v)).HasMaxLength(1)
.HasColumnName("LateToWork_LateToWorkType");
//lateToWork.Property(x => x.LateToWorkTimeFineType).HasConversion(
// v => v.HasValue ? v.Value.ToString("d") : null,
// v => v != null
// ? (LateToWorkTimeFineType)Enum.Parse(typeof(LateToWorkTimeFineType), v)
// : null).HasColumnName("LateToWork_LateToWorkTimeFineType").HasMaxLength(1);
lateToWork.OwnsMany(x => x.LateToWorkTimeFines, lateToWorkTimeFines =>
{
lateToWorkTimeFines.WithOwner().HasForeignKey("CustomizeWorkshopSettingsId");
lateToWorkTimeFines.Property(x => x.FineMoney).HasColumnName("LateToWorkTimeFines_FineMoney");
lateToWorkTimeFines.Property(x => x.Minute).HasMaxLength(4).HasColumnName("LateToWorkTimeFines_Minute");
});
});
builder.OwnsOne(x => x.LeavePay, leavePay =>
{
leavePay.Property(x => x.Value).HasColumnName("LeavePay_Value");
//leavePay.Property(x => x.DayCountAllowable).HasMaxLength(3).HasColumnName("LeavePay_DayCountAllowable");
leavePay.Property(x => x.LeavePayType).HasConversion(
v => v.ToString("d"),
v => (LeavePayType)Enum.Parse(typeof(LeavePayType), v)).HasMaxLength(1)
.HasColumnName("LeavePay_LeavePayType");
});
builder.OwnsOne(x => x.MarriedAllowance, marriedAllowance =>
{
marriedAllowance.Property(x => x.Value).HasColumnName("MarriedAllowance_Value");
marriedAllowance.Property(x => x.MarriedAllowanceType).HasConversion(
v => v.ToString("d"),
v => (MarriedAllowanceType)Enum.Parse(typeof(MarriedAllowanceType), v)).HasMaxLength(1)
.HasColumnName("MarriedAllowance_MarriedAllowanceType");
});
builder.OwnsOne(x => x.NightWorkPay, nightWorkPay =>
{
nightWorkPay.Property(x => x.NightWorkingType).HasConversion(
v => v.ToString("d"),
v => (NightWorkType)Enum.Parse(typeof(NightWorkType), v)).HasMaxLength(1)
.HasColumnName("NightWorkPay_NightWorkingType");
nightWorkPay.Property(x => x.Value).HasColumnName("NightWorkPay_Value");
});
builder.OwnsOne(x => x.OverTimePay, overTimePay =>
{
overTimePay.Property(x => x.Value).HasColumnName("OverTimePay_Value");
overTimePay.Property(x => x.OverTimePayType).HasConversion(
v => v.ToString("d"),
v => (OverTimePayType)Enum.Parse(typeof(OverTimePayType), v)).HasMaxLength(1)
.HasColumnName("OverTimePay_OverTimePayType");
});
builder.OwnsOne(x => x.ShiftPay, shiftPay =>
{
shiftPay.Property(x => x.Value).HasColumnName("ShiftPay_Value");
shiftPay.Property(x => x.ShiftPayType).HasConversion(
v => v.ToString("d"),
v => (ShiftPayType)Enum.Parse(typeof(ShiftPayType), v)).HasMaxLength(1)
.HasColumnName("ShiftPay_ShiftPayType");
shiftPay.Property(x => x.ShiftType).HasConversion(
v => v.ToString("d"),
v => (ShiftType)Enum.Parse(typeof(ShiftType), v)).HasMaxLength(1)
.HasColumnName("ShiftPay_ShiftType");
});
builder.OwnsMany(x => x.CustomizeWorkshopSettingsShifts, shift =>
{
shift.ToTable("CustomizeWorkshopSettingsShifts");
shift.HasKey(x => x.id);
shift.Property(x => x.Placement).HasConversion<string>().HasMaxLength(20);
shift.Property(x => x.StartTime).HasMaxLength(5);
shift.Property(x => x.EndTime).HasMaxLength(5);
shift.WithOwner(x=>x.CustomizeWorkshopSettings).HasForeignKey(a => a.CustomizeWorkshopSettingsId);
});
builder.HasMany(x => x.CustomizeWorkshopGroupSettingsCollection).WithOne(x => x.CustomizeWorkshopSettings)
.HasForeignKey(x => x.CustomizeWorkshopSettingId);
builder.HasOne(x => x.Workshop).WithOne(x => x.CustomizeWorkshopSettings)
.HasForeignKey<CustomizeWorkshopSettings>(x => x.WorkshopId);
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,505 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace CompanyManagment.EFCore.Migrations
{
/// <inheritdoc />
public partial class CustomizeWorkshopSetings : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "CustomizeWorkshopSettings",
columns: table => new
{
id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
FridayPay_FridayPayType = table.Column<string>(type: "nvarchar(1)", maxLength: 1, nullable: true),
FridayPay_Value = table.Column<double>(type: "float", nullable: true),
OverTimePay_OverTimePayType = table.Column<string>(type: "nvarchar(1)", maxLength: 1, nullable: true),
OverTimePay_Value = table.Column<double>(type: "float", nullable: true),
BaseYearsPay_BaseYearsPayType = table.Column<string>(type: "nvarchar(1)", maxLength: 1, nullable: true),
BaseYearsPay_Value = table.Column<double>(type: "float", nullable: true),
BaseYearsPay_PaymentType = table.Column<string>(type: "nvarchar(1)", maxLength: 1, nullable: true),
BonusesPay_BonusesPayType = table.Column<string>(type: "nvarchar(1)", maxLength: 1, nullable: true),
BonusesPay_Value = table.Column<double>(type: "float", nullable: true),
BonusesPay_PaymentType = table.Column<string>(type: "nvarchar(1)", maxLength: 1, nullable: true),
NightWorkPay_NightWorkingType = table.Column<string>(type: "nvarchar(1)", maxLength: 1, nullable: true),
NightWorkPay_Value = table.Column<double>(type: "float", nullable: true),
MarriedAllowance_MarriedAllowanceType = table.Column<string>(type: "nvarchar(1)", maxLength: 1, nullable: true),
MarriedAllowance_Value = table.Column<double>(type: "float", nullable: true),
ShiftPay_ShiftType = table.Column<string>(type: "nvarchar(1)", maxLength: 1, nullable: true),
ShiftPay_ShiftPayType = table.Column<string>(type: "nvarchar(1)", maxLength: 1, nullable: true),
ShiftPay_Value = table.Column<double>(type: "float", nullable: true),
FamilyAllowance_FamilyAllowanceType = table.Column<string>(type: "nvarchar(1)", maxLength: 1, nullable: true),
FamilyAllowance_Value = table.Column<double>(type: "float", nullable: true),
LeavePay_LeavePayType = table.Column<string>(type: "nvarchar(1)", maxLength: 1, nullable: true),
LeavePay_Value = table.Column<double>(type: "float", nullable: true),
InsuranceDeduction_InsuranceDeductionType = table.Column<string>(type: "nvarchar(1)", maxLength: 1, nullable: true),
InsuranceDeduction_Value = table.Column<double>(type: "float", nullable: true),
FineAbsenceDeduction_FineAbsenceDeductionType = table.Column<string>(type: "nvarchar(1)", maxLength: 1, nullable: true),
FineAbsenceDeduction_Value = table.Column<double>(type: "float", nullable: true),
LateToWork_LateToWorkType = table.Column<string>(type: "nvarchar(1)", maxLength: 1, nullable: true),
LateToWork_Value = table.Column<double>(type: "float", nullable: true),
EarlyExit_EarlyExitType = table.Column<string>(type: "nvarchar(1)", maxLength: 1, nullable: true),
EarlyExitTimeFines_Value = table.Column<double>(type: "float", nullable: true),
MaxMonthDays = table.Column<int>(type: "int", nullable: false),
WorkshopId = table.Column<long>(type: "bigint", nullable: false),
Currency = table.Column<int>(type: "int", nullable: false),
CreationDate = table.Column<DateTime>(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_CustomizeWorkshopSettings", x => x.id);
table.ForeignKey(
name: "FK_CustomizeWorkshopSettings_Workshops_WorkshopId",
column: x => x.WorkshopId,
principalTable: "Workshops",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "CustomizeWorkshopGroupSettings",
columns: table => new
{
id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
FridayPay_FridayPayType = table.Column<string>(type: "nvarchar(1)", maxLength: 1, nullable: true),
FridayPay_Value = table.Column<double>(type: "float", nullable: true),
OverTimePay_OverTimePayType = table.Column<string>(type: "nvarchar(1)", maxLength: 1, nullable: true),
OverTimePay_Value = table.Column<double>(type: "float", nullable: true),
BaseYearsPay_BaseYearsPayType = table.Column<string>(type: "nvarchar(1)", maxLength: 1, nullable: true),
BaseYearsPay_Value = table.Column<double>(type: "float", nullable: true),
BaseYearsPay_PaymentType = table.Column<string>(type: "nvarchar(1)", maxLength: 1, nullable: true),
BonusesPay_BonusesPayType = table.Column<string>(type: "nvarchar(1)", maxLength: 1, nullable: true),
BonusesPay_Value = table.Column<double>(type: "float", nullable: true),
BonusesPay_PaymentType = table.Column<string>(type: "nvarchar(1)", maxLength: 1, nullable: true),
NightWorkPay_NightWorkingType = table.Column<string>(type: "nvarchar(1)", maxLength: 1, nullable: true),
NightWorkPay_Value = table.Column<double>(type: "float", nullable: true),
MarriedAllowance_MarriedAllowanceType = table.Column<string>(type: "nvarchar(1)", maxLength: 1, nullable: true),
MarriedAllowance_Value = table.Column<double>(type: "float", nullable: true),
ShiftPay_ShiftType = table.Column<string>(type: "nvarchar(1)", maxLength: 1, nullable: true),
ShiftPay_ShiftPayType = table.Column<string>(type: "nvarchar(1)", maxLength: 1, nullable: true),
ShiftPay_Value = table.Column<double>(type: "float", nullable: true),
FamilyAllowance_FamilyAllowanceType = table.Column<string>(type: "nvarchar(1)", maxLength: 1, nullable: true),
FamilyAllowance_Value = table.Column<double>(type: "float", nullable: true),
LeavePay_LeavePayType = table.Column<string>(type: "nvarchar(1)", maxLength: 1, nullable: true),
LeavePay_Value = table.Column<double>(type: "float", nullable: true),
InsuranceDeduction_InsuranceDeductionType = table.Column<string>(type: "nvarchar(1)", maxLength: 1, nullable: true),
InsuranceDeduction_Value = table.Column<double>(type: "float", nullable: true),
FineAbsenceDeduction_FineAbsenceDeductionType = table.Column<string>(type: "nvarchar(1)", maxLength: 1, nullable: true),
FineAbsenceDeduction_Value = table.Column<double>(type: "float", nullable: true),
LateToWork_LateToWorkType = table.Column<string>(type: "nvarchar(1)", maxLength: 1, nullable: true),
LateToWork_Value = table.Column<double>(type: "float", nullable: true),
EarlyExit_EarlyExitType = table.Column<string>(type: "nvarchar(1)", maxLength: 1, nullable: true),
EarlyExitTimeFines_Value = table.Column<double>(type: "float", nullable: true),
GroupName = table.Column<string>(type: "nvarchar(120)", maxLength: 120, nullable: true),
Salary = table.Column<double>(type: "float", nullable: false),
CustomizeWorkshopSettingId = table.Column<long>(type: "bigint", nullable: false),
CreationDate = table.Column<DateTime>(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_CustomizeWorkshopGroupSettings", x => x.id);
table.ForeignKey(
name: "FK_CustomizeWorkshopGroupSettings_CustomizeWorkshopSettings_CustomizeWorkshopSettingId",
column: x => x.CustomizeWorkshopSettingId,
principalTable: "CustomizeWorkshopSettings",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "CustomizeWorkshopSettings_EarlyExitTimeFines",
columns: table => new
{
CustomizeWorkshopSettingsId = table.Column<long>(type: "bigint", nullable: false),
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
EarlyExitTimeFines_Minute = table.Column<string>(type: "nvarchar(4)", maxLength: 4, nullable: true),
EarlyExitTimeFines_FineMoney = table.Column<double>(type: "float", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_CustomizeWorkshopSettings_EarlyExitTimeFines", x => new { x.CustomizeWorkshopSettingsId, x.Id });
table.ForeignKey(
name: "FK_CustomizeWorkshopSettings_EarlyExitTimeFines_CustomizeWorkshopSettings_CustomizeWorkshopSettingsId",
column: x => x.CustomizeWorkshopSettingsId,
principalTable: "CustomizeWorkshopSettings",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "CustomizeWorkshopSettings_FineAbsenceDayOfWeekCollection",
columns: table => new
{
CustomizeWorkshopSettingsId = table.Column<long>(type: "bigint", nullable: false),
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
FineAbsenceDayOfWeekCollection_DayOfWeek = table.Column<string>(type: "nvarchar(1)", maxLength: 1, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_CustomizeWorkshopSettings_FineAbsenceDayOfWeekCollection", x => new { x.CustomizeWorkshopSettingsId, x.Id });
table.ForeignKey(
name: "FK_CustomizeWorkshopSettings_FineAbsenceDayOfWeekCollection_CustomizeWorkshopSettings_CustomizeWorkshopSettingsId",
column: x => x.CustomizeWorkshopSettingsId,
principalTable: "CustomizeWorkshopSettings",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "CustomizeWorkshopSettings_LateToWorkTimeFines",
columns: table => new
{
CustomizeWorkshopSettingsId = table.Column<long>(type: "bigint", nullable: false),
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
LateToWorkTimeFines_Minute = table.Column<string>(type: "nvarchar(4)", maxLength: 4, nullable: true),
LateToWorkTimeFines_FineMoney = table.Column<double>(type: "float", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_CustomizeWorkshopSettings_LateToWorkTimeFines", x => new { x.CustomizeWorkshopSettingsId, x.Id });
table.ForeignKey(
name: "FK_CustomizeWorkshopSettings_LateToWorkTimeFines_CustomizeWorkshopSettings_CustomizeWorkshopSettingsId",
column: x => x.CustomizeWorkshopSettingsId,
principalTable: "CustomizeWorkshopSettings",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "CustomizeWorkshopSettingsShifts",
columns: table => new
{
id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
StartTime = table.Column<string>(type: "nvarchar(5)", maxLength: 5, nullable: true),
EndTime = table.Column<string>(type: "nvarchar(5)", maxLength: 5, nullable: true),
Placement = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: false),
CustomizeWorkshopSettingsId = table.Column<long>(type: "bigint", nullable: false),
CreationDate = table.Column<DateTime>(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_CustomizeWorkshopSettingsShifts", x => x.id);
table.ForeignKey(
name: "FK_CustomizeWorkshopSettingsShifts_CustomizeWorkshopSettings_CustomizeWorkshopSettingsId",
column: x => x.CustomizeWorkshopSettingsId,
principalTable: "CustomizeWorkshopSettings",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "CustomizeWorkshopEmployeeSettings",
columns: table => new
{
id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
FridayPay_FridayPayType = table.Column<string>(type: "nvarchar(1)", maxLength: 1, nullable: true),
FridayPay_Value = table.Column<double>(type: "float", nullable: true),
OverTimePay_OverTimePayType = table.Column<string>(type: "nvarchar(1)", maxLength: 1, nullable: true),
OverTimePay_Value = table.Column<double>(type: "float", nullable: true),
BaseYearsPay_BaseYearsPayType = table.Column<string>(type: "nvarchar(1)", maxLength: 1, nullable: true),
BaseYearsPay_Value = table.Column<double>(type: "float", nullable: true),
BaseYearsPay_PaymentType = table.Column<string>(type: "nvarchar(1)", maxLength: 1, nullable: true),
BonusesPay_BonusesPayType = table.Column<string>(type: "nvarchar(1)", maxLength: 1, nullable: true),
BonusesPay_Value = table.Column<double>(type: "float", nullable: true),
BonusesPay_PaymentType = table.Column<string>(type: "nvarchar(1)", maxLength: 1, nullable: true),
NightWorkPay_NightWorkingType = table.Column<string>(type: "nvarchar(1)", maxLength: 1, nullable: true),
NightWorkPay_Value = table.Column<double>(type: "float", nullable: true),
MarriedAllowance_MarriedAllowanceType = table.Column<string>(type: "nvarchar(1)", maxLength: 1, nullable: true),
MarriedAllowance_Value = table.Column<double>(type: "float", nullable: true),
ShiftPay_ShiftType = table.Column<string>(type: "nvarchar(1)", maxLength: 1, nullable: true),
ShiftPay_ShiftPayType = table.Column<string>(type: "nvarchar(1)", maxLength: 1, nullable: true),
ShiftPay_Value = table.Column<double>(type: "float", nullable: true),
FamilyAllowance_FamilyAllowanceType = table.Column<string>(type: "nvarchar(1)", maxLength: 1, nullable: true),
FamilyAllowance_Value = table.Column<double>(type: "float", nullable: true),
LeavePay_LeavePayType = table.Column<string>(type: "nvarchar(1)", maxLength: 1, nullable: true),
LeavePay_Value = table.Column<double>(type: "float", nullable: true),
InsuranceDeduction_InsuranceDeductionType = table.Column<string>(type: "nvarchar(1)", maxLength: 1, nullable: true),
InsuranceDeduction_Value = table.Column<double>(type: "float", nullable: true),
FineAbsenceDeduction_FineAbsenceDeductionType = table.Column<string>(type: "nvarchar(1)", maxLength: 1, nullable: true),
FineAbsenceDeduction_Value = table.Column<double>(type: "float", nullable: true),
LateToWork_LateToWorkType = table.Column<string>(type: "nvarchar(1)", maxLength: 1, nullable: true),
LateToWork_Value = table.Column<double>(type: "float", nullable: true),
EarlyExit_EarlyExitType = table.Column<string>(type: "nvarchar(1)", maxLength: 1, nullable: true),
EarlyExitTimeFines_Value = table.Column<double>(type: "float", nullable: true),
EmployeeId = table.Column<long>(type: "bigint", nullable: false),
WorkshopId = table.Column<long>(type: "bigint", nullable: false),
Salary = table.Column<double>(type: "float", nullable: false),
IsChanged = table.Column<bool>(type: "bit", nullable: false),
CustomizeWorkshopGroupSettingId = table.Column<long>(type: "bigint", nullable: false),
CreationDate = table.Column<DateTime>(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_CustomizeWorkshopEmployeeSettings", x => x.id);
table.ForeignKey(
name: "FK_CustomizeWorkshopEmployeeSettings_CustomizeWorkshopGroupSettings_CustomizeWorkshopGroupSettingId",
column: x => x.CustomizeWorkshopGroupSettingId,
principalTable: "CustomizeWorkshopGroupSettings",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "CustomizeWorkshopGroupSettings_EarlyExitTimeFines",
columns: table => new
{
CustomizeWorkshopGroupSettingsId = table.Column<long>(type: "bigint", nullable: false),
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
EarlyExitTimeFines_Minute = table.Column<string>(type: "nvarchar(4)", maxLength: 4, nullable: true),
EarlyExitTimeFines_FineMoney = table.Column<double>(type: "float", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_CustomizeWorkshopGroupSettings_EarlyExitTimeFines", x => new { x.CustomizeWorkshopGroupSettingsId, x.Id });
table.ForeignKey(
name: "FK_CustomizeWorkshopGroupSettings_EarlyExitTimeFines_CustomizeWorkshopGroupSettings_CustomizeWorkshopGroupSettingsId",
column: x => x.CustomizeWorkshopGroupSettingsId,
principalTable: "CustomizeWorkshopGroupSettings",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "CustomizeWorkshopGroupSettings_FineAbsenceDayOfWeekCollection",
columns: table => new
{
CustomizeWorkshopGroupSettingsId = table.Column<long>(type: "bigint", nullable: false),
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
FineAbsenceDayOfWeekCollection_DayOfWeek = table.Column<string>(type: "nvarchar(1)", maxLength: 1, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_CustomizeWorkshopGroupSettings_FineAbsenceDayOfWeekCollection", x => new { x.CustomizeWorkshopGroupSettingsId, x.Id });
table.ForeignKey(
name: "FK_CustomizeWorkshopGroupSettings_FineAbsenceDayOfWeekCollection_CustomizeWorkshopGroupSettings_CustomizeWorkshopGroupSettingsId",
column: x => x.CustomizeWorkshopGroupSettingsId,
principalTable: "CustomizeWorkshopGroupSettings",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "CustomizeWorkshopGroupSettings_LateToWorkTimeFines",
columns: table => new
{
CustomizeWorkshopGroupSettingsId = table.Column<long>(type: "bigint", nullable: false),
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
LateToWorkTimeFines_Minute = table.Column<string>(type: "nvarchar(4)", maxLength: 4, nullable: true),
LateToWorkTimeFines_FineMoney = table.Column<double>(type: "float", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_CustomizeWorkshopGroupSettings_LateToWorkTimeFines", x => new { x.CustomizeWorkshopGroupSettingsId, x.Id });
table.ForeignKey(
name: "FK_CustomizeWorkshopGroupSettings_LateToWorkTimeFines_CustomizeWorkshopGroupSettings_CustomizeWorkshopGroupSettingsId",
column: x => x.CustomizeWorkshopGroupSettingsId,
principalTable: "CustomizeWorkshopGroupSettings",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "CustomizeWorkshopGroupSettingsShifts",
columns: table => new
{
id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
StartTime = table.Column<string>(type: "nvarchar(5)", maxLength: 5, nullable: true),
EndTime = table.Column<string>(type: "nvarchar(5)", maxLength: 5, nullable: true),
Placement = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: false),
CustomizeWorkshopGroupSettingsId = table.Column<long>(type: "bigint", nullable: false),
CreationDate = table.Column<DateTime>(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_CustomizeWorkshopGroupSettingsShifts", x => x.id);
table.ForeignKey(
name: "FK_CustomizeWorkshopGroupSettingsShifts_CustomizeWorkshopGroupSettings_CustomizeWorkshopGroupSettingsId",
column: x => x.CustomizeWorkshopGroupSettingsId,
principalTable: "CustomizeWorkshopGroupSettings",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "CustomizeWorkshopEmployeeSettings_EarlyExitTimeFines",
columns: table => new
{
CustomizeWorkshopEmployeeSettingsId = table.Column<long>(type: "bigint", nullable: false),
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
EarlyExitTimeFines_Minute = table.Column<string>(type: "nvarchar(4)", maxLength: 4, nullable: true),
EarlyExitTimeFines_FineMoney = table.Column<double>(type: "float", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_CustomizeWorkshopEmployeeSettings_EarlyExitTimeFines", x => new { x.CustomizeWorkshopEmployeeSettingsId, x.Id });
table.ForeignKey(
name: "FK_CustomizeWorkshopEmployeeSettings_EarlyExitTimeFines_CustomizeWorkshopEmployeeSettings_CustomizeWorkshopEmployeeSettingsId",
column: x => x.CustomizeWorkshopEmployeeSettingsId,
principalTable: "CustomizeWorkshopEmployeeSettings",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "CustomizeWorkshopEmployeeSettings_FineAbsenceDayOfWeekCollection",
columns: table => new
{
CustomizeWorkshopEmployeeSettingsId = table.Column<long>(type: "bigint", nullable: false),
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
FineAbsenceDayOfWeekCollection_DayOfWeek = table.Column<string>(type: "nvarchar(1)", maxLength: 1, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_CustomizeWorkshopEmployeeSettings_FineAbsenceDayOfWeekCollection", x => new { x.CustomizeWorkshopEmployeeSettingsId, x.Id });
table.ForeignKey(
name: "FK_CustomizeWorkshopEmployeeSettings_FineAbsenceDayOfWeekCollection_CustomizeWorkshopEmployeeSettings_CustomizeWorkshopEmployee~",
column: x => x.CustomizeWorkshopEmployeeSettingsId,
principalTable: "CustomizeWorkshopEmployeeSettings",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "CustomizeWorkshopEmployeeSettings_LateToWorkTimeFines",
columns: table => new
{
CustomizeWorkshopEmployeeSettingsId = table.Column<long>(type: "bigint", nullable: false),
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
LateToWorkTimeFines_Minute = table.Column<string>(type: "nvarchar(4)", maxLength: 4, nullable: true),
LateToWorkTimeFines_FineMoney = table.Column<double>(type: "float", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_CustomizeWorkshopEmployeeSettings_LateToWorkTimeFines", x => new { x.CustomizeWorkshopEmployeeSettingsId, x.Id });
table.ForeignKey(
name: "FK_CustomizeWorkshopEmployeeSettings_LateToWorkTimeFines_CustomizeWorkshopEmployeeSettings_CustomizeWorkshopEmployeeSettingsId",
column: x => x.CustomizeWorkshopEmployeeSettingsId,
principalTable: "CustomizeWorkshopEmployeeSettings",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "CustomizeWorkshopEmployeeSettingsShifts",
columns: table => new
{
id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
StartTime = table.Column<string>(type: "nvarchar(5)", maxLength: 5, nullable: true),
EndTime = table.Column<string>(type: "nvarchar(5)", maxLength: 5, nullable: true),
Placement = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: false),
CustomizeWorkshopEmployeeSettingsId = table.Column<long>(type: "bigint", nullable: false),
CreationDate = table.Column<DateTime>(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_CustomizeWorkshopEmployeeSettingsShifts", x => x.id);
table.ForeignKey(
name: "FK_CustomizeWorkshopEmployeeSettingsShifts_CustomizeWorkshopEmployeeSettings_CustomizeWorkshopEmployeeSettingsId",
column: x => x.CustomizeWorkshopEmployeeSettingsId,
principalTable: "CustomizeWorkshopEmployeeSettings",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_CustomizeWorkshopEmployeeSettings_CustomizeWorkshopGroupSettingId",
table: "CustomizeWorkshopEmployeeSettings",
column: "CustomizeWorkshopGroupSettingId");
migrationBuilder.CreateIndex(
name: "IX_CustomizeWorkshopEmployeeSettingsShifts_CustomizeWorkshopEmployeeSettingsId",
table: "CustomizeWorkshopEmployeeSettingsShifts",
column: "CustomizeWorkshopEmployeeSettingsId");
migrationBuilder.CreateIndex(
name: "IX_CustomizeWorkshopGroupSettings_CustomizeWorkshopSettingId",
table: "CustomizeWorkshopGroupSettings",
column: "CustomizeWorkshopSettingId");
migrationBuilder.CreateIndex(
name: "IX_CustomizeWorkshopGroupSettingsShifts_CustomizeWorkshopGroupSettingsId",
table: "CustomizeWorkshopGroupSettingsShifts",
column: "CustomizeWorkshopGroupSettingsId");
migrationBuilder.CreateIndex(
name: "IX_CustomizeWorkshopSettings_WorkshopId",
table: "CustomizeWorkshopSettings",
column: "WorkshopId",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_CustomizeWorkshopSettingsShifts_CustomizeWorkshopSettingsId",
table: "CustomizeWorkshopSettingsShifts",
column: "CustomizeWorkshopSettingsId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "CustomizeWorkshopEmployeeSettings_EarlyExitTimeFines");
migrationBuilder.DropTable(
name: "CustomizeWorkshopEmployeeSettings_FineAbsenceDayOfWeekCollection");
migrationBuilder.DropTable(
name: "CustomizeWorkshopEmployeeSettings_LateToWorkTimeFines");
migrationBuilder.DropTable(
name: "CustomizeWorkshopEmployeeSettingsShifts");
migrationBuilder.DropTable(
name: "CustomizeWorkshopGroupSettings_EarlyExitTimeFines");
migrationBuilder.DropTable(
name: "CustomizeWorkshopGroupSettings_FineAbsenceDayOfWeekCollection");
migrationBuilder.DropTable(
name: "CustomizeWorkshopGroupSettings_LateToWorkTimeFines");
migrationBuilder.DropTable(
name: "CustomizeWorkshopGroupSettingsShifts");
migrationBuilder.DropTable(
name: "CustomizeWorkshopSettings_EarlyExitTimeFines");
migrationBuilder.DropTable(
name: "CustomizeWorkshopSettings_FineAbsenceDayOfWeekCollection");
migrationBuilder.DropTable(
name: "CustomizeWorkshopSettings_LateToWorkTimeFines");
migrationBuilder.DropTable(
name: "CustomizeWorkshopSettingsShifts");
migrationBuilder.DropTable(
name: "CustomizeWorkshopEmployeeSettings");
migrationBuilder.DropTable(
name: "CustomizeWorkshopGroupSettings");
migrationBuilder.DropTable(
name: "CustomizeWorkshopSettings");
}
}
}

View File

@@ -0,0 +1,12 @@
using _0_Framework.InfraStructure;
using Company.Domain.CustomizeWorkshopEmployeeSettingsAgg;
using Company.Domain.CustomizeWorkshopEmployeeSettingsAgg.Entities;
namespace CompanyManagment.EFCore.Repository;
public class CustomizeWorkshopEmployeeSettingsRepository(CompanyContext companyContext)
: RepositoryBase<long, CustomizeWorkshopEmployeeSettings>(companyContext),
ICustomizeWorkshopEmployeeSettingsRepository
{
private readonly CompanyContext _companyContext = companyContext;
}

View File

@@ -0,0 +1,125 @@
using System;
using System.Collections.Generic;
using System.Linq;
using _0_Framework.InfraStructure;
using Company.Domain.CustomizeWorkshopGroupSettingsAgg;
using Company.Domain.CustomizeWorkshopGroupSettingsAgg.Entities;
using CompanyManagment.App.Contracts.CustomizeWorkshopSettings;
using CompanyManagment.App.Contracts.Employee;
using Microsoft.EntityFrameworkCore;
namespace CompanyManagment.EFCore.Repository;
public class CustomizeWorkshopGroupSettingsRepository(CompanyContext companyContext)
: RepositoryBase<long, CustomizeWorkshopGroupSettings>(companyContext),
ICustomizeWorkshopGroupSettingsRepository
{
private readonly CompanyContext _companyContext = companyContext;
public CustomizeWorkshopGroupSettings GetIncludeWorkshopSettings(long id)
{
return _companyContext.CustomizeWorkshopGroupSettings.Include(x => x.CustomizeWorkshopSettings)
.FirstOrDefault(x => x.id == id);
}
public List<EmployeeViewModel> GetEmployeesWithoutGroup(long rollCallWorkshopSettingId)
{
var rollCallWorkshopSettings = _companyContext.CustomizeWorkshopSettings
.Include(x => x.CustomizeWorkshopGroupSettingsCollection).ThenInclude(x => x.CustomizeWorkshopEmployeeSettingsCollection)
.FirstOrDefault(x => x.id == rollCallWorkshopSettingId);
if (rollCallWorkshopSettings == null)
return new();
var dateNow = DateTime.Now;
var listOfEmployeeIdsHasGroup = rollCallWorkshopSettings.CustomizeWorkshopGroupSettingsCollection.SelectMany(x =>
x.CustomizeWorkshopEmployeeSettingsCollection.Select(a => a.EmployeeId).Distinct()).ToList();
var employees = _companyContext.Employees.Include(x => x.LeftWorks).Include(x => x.LeftWorkInsurances)
.Where(x => x.LeftWorks.Any(y => y.WorkshopId == rollCallWorkshopSettings.WorkshopId && y.StartWorkDate <= dateNow && y.LeftWorkDate > dateNow) ||
x.LeftWorkInsurances
.Any(y => y.WorkshopId == rollCallWorkshopSettings.WorkshopId && y.StartWorkDate <= dateNow && (y.LeftWorkDate > dateNow || y.LeftWorkDate == null)) )
.Select(x => new EmployeeViewModel()
{
Id = x.id,
EmployeeFullName = $"{x.FName} {x.LName}"
}).Where(x=>!listOfEmployeeIdsHasGroup.Contains(x.Id)).ToList();
//_companyContext.LeftWorkList;
//_companyContext.Employees.Where(x=> x.LeftWorks.any&& !listOfEmployeeIdsHasGroup.Contains(x.id)).Select()
return employees;
}
public CustomizeWorkshopGroupSettings GetWithEmployees(long groupId)
{
return _companyContext.CustomizeWorkshopGroupSettings.Include(x => x.CustomizeWorkshopEmployeeSettingsCollection)
.FirstOrDefault(x => x.id == groupId);
}
public List<CustomizeWorkshopEmployeeSettingsViewModel> GetChangedEmployeeSettingsByGroupSettingsId(long groupSettingsId)
{
var groupEmployeeSettingsList = _companyContext.CustomizeWorkshopGroupSettings
.Include(x => x.CustomizeWorkshopEmployeeSettingsCollection)
.FirstOrDefault(x => x.id == groupSettingsId)?.CustomizeWorkshopEmployeeSettingsCollection
.Where(x => x.IsChanged).ToList();
if (groupEmployeeSettingsList == null)
return new();
var employeeIds = groupEmployeeSettingsList.Select(x => x.EmployeeId);
var employees = _companyContext.Employees.Where(x => employeeIds.Contains(x.id)).Select(x => new
{
x.FullName,
x.id
}).ToList();
return groupEmployeeSettingsList.Join(employees,x=>x.EmployeeId,y=>y.id, (x,y)=> new CustomizeWorkshopEmployeeSettingsViewModel()
{
EmployeeId = x.EmployeeId,
Id = x.id,
IsChanged = x.IsChanged,
Name = y.FullName,
RollCallWorkshopShifts = x.CustomizeWorkshopEmployeeSettingsShifts.Select(z=> new CustomizeWorkshopShiftViewModel()
{
EndTime = z.EndTime,
Placement = z.Placement,
StartTime = z.StartTime
}).ToList()
}).ToList();
}
public List<CustomizeWorkshopEmployeeSettingsViewModel> GetEmployeeSettingsByGroupSettingsId(long groupSettingsId)
{
var entity = _companyContext.CustomizeWorkshopGroupSettings.Select(x=>new{x.CustomizeWorkshopEmployeeSettingsCollection,x.id})
.FirstOrDefault(x => x.id == groupSettingsId);
if (entity == null)
return new();
var employees = entity.CustomizeWorkshopEmployeeSettingsCollection;
var employeeIds = employees.Select(x => x.EmployeeId);
var names = _companyContext.Employees.Where(x => employeeIds.Contains(x.id)).Select(x=>new{x.id,x.FullName}).ToList();
var joinedList = employees.Join(names, x => x.EmployeeId, y => y.id, (x, y) =>
new CustomizeWorkshopEmployeeSettingsViewModel
{
EmployeeId = x.EmployeeId,
Id = x.id,
Name = y.FullName,
IsChanged = x.IsChanged,
RollCallWorkshopShifts = x.CustomizeWorkshopEmployeeSettingsShifts.Select(z=>new CustomizeWorkshopShiftViewModel()
{
EndTime = z.EndTime,
StartTime = z.StartTime,
Placement = z.Placement
}).ToList()
});
return joinedList.ToList();
}
}

View File

@@ -0,0 +1,64 @@
using System;
using System.Linq;
using _0_Framework.InfraStructure;
using Company.Domain.CustomizeWorkshopSettingsAgg;
using Company.Domain.CustomizeWorkshopSettingsAgg.Entities;
using CompanyManagment.App.Contracts.CustomizeWorkshopSettings;
using Microsoft.EntityFrameworkCore;
namespace CompanyManagment.EFCore.Repository
{
public class CustomizeWorkshopSettingsRepository(CompanyContext companyContext)
: RepositoryBase<long, CustomizeWorkshopSettings>(companyContext), ICustomizeWorkshopSettingsRepository
{
private readonly CompanyContext _companyContext = companyContext;
public CustomizeWorkshopSettings GetWorkshopSettingsByWorkshopId(long workshopId)
{
return _companyContext.CustomizeWorkshopSettings
.Include(x=>x.CustomizeWorkshopGroupSettingsCollection)
.ThenInclude(x=>x.CustomizeWorkshopEmployeeSettingsCollection)
.FirstOrDefault(x => x.WorkshopId == workshopId);
}
public CustomizeWorkshopEmployeeSettingsViewModel GetEmployeeSettingsByWorkshopIdGroupSettingsId(long workshopId,
long employeeId)
{
throw new NotImplementedException();
}
public CustomizeWorkshopEmployeeSettingsViewModel GetEmployeeSettingsByWorkshopIdEmployeeId(long workshopId, long employeeId)
{
var employee = _companyContext.CustomizeWorkshopSettings
.Include(x => x.CustomizeWorkshopGroupSettingsCollection)
.ThenInclude(x => x.CustomizeWorkshopEmployeeSettingsCollection).ThenInclude(
customizeWorkshopEmployeeSettings =>
customizeWorkshopEmployeeSettings.CustomizeWorkshopEmployeeSettingsShifts)
.FirstOrDefault(x => x.WorkshopId == workshopId)?.CustomizeWorkshopGroupSettingsCollection.SelectMany(x=>x.CustomizeWorkshopEmployeeSettingsCollection)
.FirstOrDefault(x => x.EmployeeId == employeeId);
if (employee == null)
return new();
var employeeName = _companyContext.Employees.Select(x => new { x.FullName, x.id })
.FirstOrDefault(x => x.id == employee.EmployeeId);
return new CustomizeWorkshopEmployeeSettingsViewModel()
{
EmployeeId = employee.EmployeeId,
Id = employee.id,
IsChanged = employee.IsChanged,
Name = employeeName?.FullName,
RollCallWorkshopShifts = employee.CustomizeWorkshopEmployeeSettingsShifts.Select(x =>
new CustomizeWorkshopShiftViewModel()
{
EndTime = x.EndTime,
Placement = x.Placement,
StartTime = x.StartTime
}).ToList(),
Salary = employee.Salary
};
}
}
}

View File

@@ -568,7 +568,7 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
return result;
}
public List<RotatingShiftViewModel> RotatingShiftCheck(List<GroupedRollCalls> rollCallList)
{
List<RotatingShiftViewModel> finalResult = new List<RotatingShiftViewModel>();

View File

@@ -166,6 +166,10 @@ using CompanyManagment.App.Contracts.ReportClient;
using CompanyManagment.App.Contracts.TaxJobCategory;
using Company.Domain.RollCallEmployeeStatusAgg;
using CompanyManagment.App.Contracts.RollCallEmployeeStatus;
using Company.Domain.CustomizeWorkshopEmployeeSettingsAgg;
using Company.Domain.CustomizeWorkshopGroupSettingsAgg;
using Company.Domain.CustomizeWorkshopSettingsAgg;
using CompanyManagment.App.Contracts.CustomizeWorkshopSettings;
namespace PersonalContractingParty.Config;
@@ -351,6 +355,14 @@ public class PersonalBootstrapper
services.AddTransient<IRollCallEmployeeStatusRepository, RollCallEmployeeStatusRepository>();
services.AddTransient<IRollCallEmployeeStatusApplication, RollCallEmployeeStatusApplication>();
#region Mahan
services.AddTransient<ICustomizeWorkshopSettingsApplication, CustomizeWorkshopSettingsApplication>();
services.AddTransient<ICustomizeWorkshopSettingsRepository, CustomizeWorkshopSettingsRepository>();
services.AddTransient<ICustomizeWorkshopEmployeeSettingsRepository, CustomizeWorkshopEmployeeSettingsRepository>();
services.AddTransient<ICustomizeWorkshopGroupSettingsRepository, CustomizeWorkshopGroupSettingsRepository>();
#endregion
//=========End Of Main====================================
//---File Project------------------------------------

View File

@@ -12,10 +12,10 @@
//"MesbahDb": "Data Source=DESKTOP-NUE119G\\MSNEW;Initial Catalog=Mesbah_db;Integrated Security=True"
//server
//"MesbahDb": "Data Source=171.22.24.15;Initial Catalog=mesbah_db;Persist Security Info=False;User ID=ir_db;Password=R2rNp[170]is[3019]#@ATt;TrustServerCertificate=true;"
"MesbahDb": "Data Source=171.22.24.15;Initial Catalog=mesbah_db;Persist Security Info=False;User ID=ir_db;Password=R2rNp[170]is[3019]#@ATt;TrustServerCertificate=true;"
//local
"MesbahDb": "Data Source=.;Initial Catalog=Mesbah_db;Integrated Security=True;TrustServerCertificate=true;"
//"MesbahDb": "Data Source=.;Initial Catalog=Mesbah_db;Integrated Security=True;TrustServerCertificate=true;"
},
"GoogleRecaptchaV3": {
"SiteKey": "6Lfhp_AnAAAAAB79WkrMoHd1k8ir4m8VvfjE7FTH",