diff --git a/0_Framework/Application/AuthHelper.cs b/0_Framework/Application/AuthHelper.cs index 7bbc80e1..db08f01f 100644 --- a/0_Framework/Application/AuthHelper.cs +++ b/0_Framework/Application/AuthHelper.cs @@ -37,7 +37,9 @@ public class AuthHelper : IAuthHelper result.PositionValue = !string.IsNullOrWhiteSpace(claims.FirstOrDefault(x => x.Type == "PositionValue")?.Value) ? int.Parse(claims.FirstOrDefault(x => x.Type == "PositionValue")?.Value) : 0; result.WorkshopList = Tools.DeserializeFromBsonList(claims.FirstOrDefault(x => x is { Type: "workshopList" })?.Value); result.WorkshopSlug = claims.FirstOrDefault(x => x is { Type: "WorkshopSlug" }).Value; - return result; + result.Mobile = claims.FirstOrDefault(x => x is { Type: "Mobile" }).Value; + result.SubAccountId = long.Parse(claims.FirstOrDefault(x => x.Type == "SubAccountId").Value); + return result; } public List GetPermissions() @@ -56,8 +58,13 @@ public class AuthHelper : IAuthHelper ? long.Parse(_contextAccessor.HttpContext.User.Claims.First(x => x.Type == "AccountId")?.Value) : 0; } - - public string CurrentAccountMobile() + public long CurrentSubAccountId() + { + return IsAuthenticated() + ? long.Parse(_contextAccessor.HttpContext.User.Claims.First(x => x.Type == "SubAccountId")?.Value) + : 0; + } + public string CurrentAccountMobile() { return IsAuthenticated() ? _contextAccessor.HttpContext.User.Claims.First(x => x.Type == "Mobile")?.Value @@ -140,7 +147,8 @@ public class AuthHelper : IAuthHelper new Claim("Mobile", account.Mobile), new Claim("ProfilePhoto", account.ProfilePhoto ), new Claim("RoleName", account.RoleName), - new Claim("AdminAreaPermission", account.AdminAreaPermission.ToString()), + new Claim("SubAccountId", account.SubAccountId.ToString()), + new Claim("AdminAreaPermission", account.AdminAreaPermission.ToString()), new Claim("ClientAriaPermission", account.ClientAriaPermission.ToString()), new Claim("IsCamera", "false"), new Claim("PositionValue",account.PositionValue.ToString()), diff --git a/0_Framework/Application/AuthViewModel.cs b/0_Framework/Application/AuthViewModel.cs index 39c08a3e..1e2a0927 100644 --- a/0_Framework/Application/AuthViewModel.cs +++ b/0_Framework/Application/AuthViewModel.cs @@ -24,8 +24,11 @@ public class AuthViewModel #endregion + public long SubAccountId { get; set; } + + public AuthViewModel(long id, long roleId, string fullname, string username, string mobile,string profilePhoto, - List permissions, string roleName, string adminAreaPermission, string clientAriaPermission, int? positionValue) + List permissions, string roleName, string adminAreaPermission, string clientAriaPermission, int? positionValue, long subAccountId = 0) { Id = id; RoleId = roleId; @@ -38,7 +41,7 @@ public class AuthViewModel AdminAreaPermission = adminAreaPermission; ClientAriaPermission = clientAriaPermission; PositionValue = positionValue; - + SubAccountId = subAccountId; } public AuthViewModel() diff --git a/0_Framework/Application/IAuthHelper.cs b/0_Framework/Application/IAuthHelper.cs index 0ae1ad48..30405c5f 100644 --- a/0_Framework/Application/IAuthHelper.cs +++ b/0_Framework/Application/IAuthHelper.cs @@ -20,6 +20,6 @@ public interface IAuthHelper void UpdateWorkshopSlugClaim(string workshopSlug); #endregion - + long CurrentSubAccountId(); string GetWorkshopSlug(); } \ No newline at end of file diff --git a/0_Framework/Application/Tools.cs b/0_Framework/Application/Tools.cs index 58be81f6..09d1ffcc 100644 --- a/0_Framework/Application/Tools.cs +++ b/0_Framework/Application/Tools.cs @@ -1133,6 +1133,36 @@ public static class Tools } #region Mahan + /// + /// این متد سعی میکند رشته را به تاریخ برگرداند و یک بول و دیت تایم برمیگرداند + /// + /// تاریخ شمسی + /// تاریخ + /// + public static bool TryToGeorgianDateTime(this string persianDate, out DateTime georgianDateTime) + { + persianDate = persianDate.ToEnglishNumber(); + try + { + var year = Convert.ToInt32(persianDate.Substring(0, 4)); + var month = Convert.ToInt32(persianDate.Substring(5, 2)); + var day = Convert.ToInt32(persianDate.Substring(8, 2)); + + georgianDateTime = new DateTime(year, month, day, new PersianCalendar()); + return true; + } + catch + { + georgianDateTime = new DateTime(3000, 12, 20, new PersianCalendar()); + return false; + } + } + + public static string FindFirstDayOfMonth(this DateTime date) + { + var pc = new PersianCalendar(); + return $"{pc.GetYear(date)}/{pc.GetMonth(date):00}/01"; + } public static string ToFarsiDuration(this string date) { var today = DateTime.Now.ToFarsi(); @@ -1355,39 +1385,87 @@ public static class Tools } - #endregion + #endregion - #region Pooya + #region Pooya + /// + /// محاسبه روز های هر ماه شمسی + /// + /// تاریخ روزی از ماه + public static int CountPersianMonthDays(this DateTime date) + { + DateTime currentMonthDate, nextMonthDate; + currentMonthDate = date.FindFirstDayOfMonth().ToGeorgianDateTime(); + FindFirstDayOfNextMonth(date, out nextMonthDate); - /// - /// محاسبه روز های هر ماه شمسی - /// - /// تاریخ روزی از ماه - public static int CountPersianMonthDays(this DateTime date) - { - var dateFa = date.ToFarsi(); - int year = Convert.ToInt32(dateFa.Substring(0, 4)); - int month = Convert.ToInt32(dateFa.Substring(5, 2)); - int nextMonth; - int nextMonthYear; - if (month == 12) - { - nextMonthYear = year + 1; - nextMonth = 1; - } - else - { - nextMonthYear = year; - nextMonth = month + 1; - } - var currentMonthDate = new DateTime(year, month, 1, new PersianCalendar()); - var nextMonthDate = new DateTime(nextMonthYear, nextMonth, 1, new PersianCalendar()); + return ((int)(nextMonthDate.Date - currentMonthDate.Date).TotalDays); + } + + public static string FindFirstDayOfNextMonth(this DateTime date, out DateTime nextMonthDate) + { + var dateFa = date.ToFarsi(); + int year = Convert.ToInt32(dateFa.Substring(0, 4)); + int month = Convert.ToInt32(dateFa.Substring(5, 2)); + int nextMonth; + int nextMonthYear; + if (month == 12) + { + nextMonthYear = year + 1; + nextMonth = 1; + } + else + { + nextMonthYear = year; + nextMonth = month + 1; + } + nextMonthDate = new DateTime(nextMonthYear, nextMonth, 1, new PersianCalendar()); + return $"{nextMonthYear:0000}/{nextMonth:00}/01"; + } - return ((int)(nextMonthDate.Date - currentMonthDate.Date).TotalDays); - } + /// + /// اضافه یا کم کردن ماه، توجه داشته باشید خروجی متد همیشه یکم ماه می باشد + /// + public static string AddMonthsFa(this DateTime date, int count, out DateTime result) + { + var dateFa = date.ToFarsi(); + int year = Convert.ToInt32(dateFa.Substring(0, 4)); + int month = Convert.ToInt32(dateFa.Substring(5, 2)); - public static DateTime GetUndefinedDateTime() + int newMonth; + int newYear; + + //add operation + if (count >= 0) + { + newYear = year; + while (month + count > 12) + { + newYear += 1; + count -= 12; + } + newMonth = month + count; + + } + + //subtract operation + else + { + newYear = year; + while (month + count < 1) + { + newYear -= 1; + count += 12; + } + newMonth = month + count; + } + result = new DateTime(newYear, newMonth, 1, new PersianCalendar()); + return $"{newYear:0000}/{newMonth:00}/01"; + + } + + + public static DateTime GetUndefinedDateTime() { return new DateTime(2121, 03, 21); } @@ -1428,6 +1506,7 @@ public static class Tools // If all properties are equal, return true return true; - } + } + #endregion } \ No newline at end of file diff --git a/0_Framework/Domain/CustomizeCheckoutShared/Base/BaseCustomizeEntity.cs b/0_Framework/Domain/CustomizeCheckoutShared/Base/BaseCustomizeEntity.cs new file mode 100644 index 00000000..f1490e86 --- /dev/null +++ b/0_Framework/Domain/CustomizeCheckoutShared/Base/BaseCustomizeEntity.cs @@ -0,0 +1,114 @@ +using System.Collections.Generic; +using _0_Framework.Domain.CustomizeCheckoutShared.Enums; +using _0_Framework.Domain.CustomizeCheckoutShared.ValueObjects; +using Microsoft.EntityFrameworkCore.Design.Internal; + +namespace _0_Framework.Domain.CustomizeCheckoutShared.Base; + +public class BaseCustomizeEntity : EntityBase +{ + public BaseCustomizeEntity() + { + } + public BaseCustomizeEntity(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, + FridayWork fridayWork, HolidayWork holidayWork, BreakTime breakTime) + { + + 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; + FridayWork = fridayWork; + HolidayWork = holidayWork; + BreakTime = breakTime; + } + + /// + /// جمعه کاری + /// + public FridayPay FridayPay { get; protected set; } + + /// + /// اضافه کاری + /// + public OverTimePay OverTimePay { get; protected set; } + + /// + /// سنوات + /// + public BaseYearsPay BaseYearsPay { get; protected set; } + + /// + /// عیدی + /// + public BonusesPay BonusesPay { get; protected set; } + + /// + /// شب کاری + /// + public NightWorkPay NightWorkPay { get; protected set; } + + /// + /// حق تاهل + /// + public MarriedAllowance MarriedAllowance { get; protected set; } + + /// + /// نوبت کاری + /// + public ShiftPay ShiftPay { get; protected set; } + + /// + /// حق اولاد(حق فرزند)ء + /// + public FamilyAllowance FamilyAllowance { get; protected set; } + + /// + /// مزد مرخصی + /// + public LeavePay LeavePay { get; protected set; } + + /// + /// حق بیمه + /// + public InsuranceDeduction InsuranceDeduction { get; protected set; } + + /// + /// جریمه غیبت + /// + public FineAbsenceDeduction FineAbsenceDeduction { get; protected set; } + + /// + /// تاخیر در ورود + /// + public LateToWork LateToWork { get; protected set; } + + /// + /// نعجیل در خروج + /// + public EarlyExit EarlyExit { get; protected set; } + + /// + /// آیا جمعه کار میکند یا نه + /// + public FridayWork FridayWork { get; protected set; } + + /// + /// آیا در روز های تعطیل کار میکند + /// + public HolidayWork HolidayWork { get; protected set; } + + + public BreakTime BreakTime { get; protected set; } +} \ No newline at end of file diff --git a/0_Framework/Domain/CustomizeCheckoutShared/Base/CustomizeSifts.cs b/0_Framework/Domain/CustomizeCheckoutShared/Base/CustomizeSifts.cs new file mode 100644 index 00000000..1450cc99 --- /dev/null +++ b/0_Framework/Domain/CustomizeCheckoutShared/Base/CustomizeSifts.cs @@ -0,0 +1,39 @@ +using _0_Framework.Domain.CustomizeCheckoutShared.Enums; +using System; + +namespace _0_Framework.Domain.CustomizeCheckoutShared.Base; + +public class CustomizeSifts : EntityBase +{ + private CustomizeSifts() + { + + } + + public CustomizeSifts(TimeOnly startTime, TimeOnly endTime, ShiftPlacement placement) + { + Placement = placement; + StartTime = startTime; + EndTime = endTime; + + } + + public TimeOnly StartTime { get; private set; } + public TimeOnly EndTime { get; private set; } + public ShiftPlacement Placement { get; private set; } + + + public override bool Equals(object obj) + { + if (obj is CustomizeSifts other) + { + return StartTime.Equals(other.StartTime) && + EndTime.Equals(other.EndTime) && + Placement.Equals(other.Placement); + + } + + return false; + } +} + diff --git a/0_Framework/Domain/CustomizeCheckoutValueObjects/BaseYearsPayInEndOfYear.cs b/0_Framework/Domain/CustomizeCheckoutShared/Enums/BaseYearsPayInEndOfYear.cs similarity index 79% rename from 0_Framework/Domain/CustomizeCheckoutValueObjects/BaseYearsPayInEndOfYear.cs rename to 0_Framework/Domain/CustomizeCheckoutShared/Enums/BaseYearsPayInEndOfYear.cs index fecb5331..511149a7 100644 --- a/0_Framework/Domain/CustomizeCheckoutValueObjects/BaseYearsPayInEndOfYear.cs +++ b/0_Framework/Domain/CustomizeCheckoutShared/Enums/BaseYearsPayInEndOfYear.cs @@ -1,4 +1,4 @@ -namespace _0_Framework.Domain.CustomizeCheckoutValueObjects; +namespace _0_Framework.Domain.CustomizeCheckoutShared.Enums; public enum BaseYearsPayInEndOfYear { diff --git a/0_Framework/Domain/CustomizeCheckoutShared/Enums/BaseYearsPayType.cs b/0_Framework/Domain/CustomizeCheckoutShared/Enums/BaseYearsPayType.cs new file mode 100644 index 00000000..3c593177 --- /dev/null +++ b/0_Framework/Domain/CustomizeCheckoutShared/Enums/BaseYearsPayType.cs @@ -0,0 +1,18 @@ +namespace _0_Framework.Domain.CustomizeCheckoutShared.Enums; + +public enum BaseYearsPayType +{ + /// + ///محاسبه نمیشود + /// + None, + + /// + /// به صورت درصدی از حقوق + /// + PercentageOfSalary, + /// + /// مبلغ اختصاصی برای سنوات + /// + Money +} \ No newline at end of file diff --git a/0_Framework/Domain/CustomizeCheckoutShared/Enums/BaseYearsPaymentType.cs b/0_Framework/Domain/CustomizeCheckoutShared/Enums/BaseYearsPaymentType.cs new file mode 100644 index 00000000..a6af5c4a --- /dev/null +++ b/0_Framework/Domain/CustomizeCheckoutShared/Enums/BaseYearsPaymentType.cs @@ -0,0 +1,18 @@ +namespace _0_Framework.Domain.CustomizeCheckoutShared.Enums; + +public enum BaseYearsPaymentType +{ + /// + /// پرداخت نمیگردد + /// + None, + /// + /// پرداخت به صورت سالانه در آخر سال پرداخت میگردد + /// + YearlyPay, + /// + /// پرداخت به صورت ماهانه + /// + MonthlyPay + +} \ No newline at end of file diff --git a/0_Framework/Domain/CustomizeCheckoutShared/Enums/BonusesPaymentType.cs b/0_Framework/Domain/CustomizeCheckoutShared/Enums/BonusesPaymentType.cs new file mode 100644 index 00000000..d9944a28 --- /dev/null +++ b/0_Framework/Domain/CustomizeCheckoutShared/Enums/BonusesPaymentType.cs @@ -0,0 +1,18 @@ +namespace _0_Framework.Domain.CustomizeCheckoutShared.Enums; + +public enum BonusesPaymentType +{ + /// + /// پرداخت نمیگردد + /// + None, + /// + /// پرداخت به صورت سالانه در آخر سال پرداخت میگردد + /// + YearlyPay, + /// + /// پرداخت به صورت ماهانه + /// + MonthlyPay + +} \ No newline at end of file diff --git a/0_Framework/Domain/CustomizeCheckoutValueObjects/BonusesPaysInEndOfYear.cs b/0_Framework/Domain/CustomizeCheckoutShared/Enums/BonusesPaysInEndOfYear.cs similarity index 79% rename from 0_Framework/Domain/CustomizeCheckoutValueObjects/BonusesPaysInEndOfYear.cs rename to 0_Framework/Domain/CustomizeCheckoutShared/Enums/BonusesPaysInEndOfYear.cs index 69f59254..1fb6f123 100644 --- a/0_Framework/Domain/CustomizeCheckoutValueObjects/BonusesPaysInEndOfYear.cs +++ b/0_Framework/Domain/CustomizeCheckoutShared/Enums/BonusesPaysInEndOfYear.cs @@ -1,4 +1,4 @@ -namespace _0_Framework.Domain.CustomizeCheckoutValueObjects; +namespace _0_Framework.Domain.CustomizeCheckoutShared.Enums; public enum BonusesPaysInEndOfYear { diff --git a/0_Framework/Domain/CustomizeCheckoutShared/Enums/BonusesType.cs b/0_Framework/Domain/CustomizeCheckoutShared/Enums/BonusesType.cs new file mode 100644 index 00000000..22260e8d --- /dev/null +++ b/0_Framework/Domain/CustomizeCheckoutShared/Enums/BonusesType.cs @@ -0,0 +1,28 @@ +namespace _0_Framework.Domain.CustomizeCheckoutShared.Enums; + +public enum BonusesType +{ + /// + ///محاسبه نمیشود + /// + None, + + /// + /// به صورت درصدی از حقوق + /// + PercentageOfSalary, + + /// + /// دوبرابر حقوق + /// + TwoTimeOfSalary, + + /// + /// یک برابر حقوق + /// + OneTimeOfSalary, + /// + /// مبلغ اختصاصی برای عیدی + /// + Money +} \ No newline at end of file diff --git a/0_Framework/Domain/CustomizeCheckoutShared/Enums/BreakTimeType.cs b/0_Framework/Domain/CustomizeCheckoutShared/Enums/BreakTimeType.cs new file mode 100644 index 00000000..727de526 --- /dev/null +++ b/0_Framework/Domain/CustomizeCheckoutShared/Enums/BreakTimeType.cs @@ -0,0 +1,8 @@ +namespace _0_Framework.Domain.CustomizeCheckoutShared.Enums; + +public enum BreakTimeType +{ + None = 0, + WithTime, + WithoutTime +} \ No newline at end of file diff --git a/0_Framework/Domain/CustomizeCheckoutShared/Enums/Currency.cs b/0_Framework/Domain/CustomizeCheckoutShared/Enums/Currency.cs new file mode 100644 index 00000000..d4d14521 --- /dev/null +++ b/0_Framework/Domain/CustomizeCheckoutShared/Enums/Currency.cs @@ -0,0 +1,7 @@ +namespace _0_Framework.Domain.CustomizeCheckoutShared.Enums; + +public enum Currency +{ + Rial, + Toman +} \ No newline at end of file diff --git a/0_Framework/Domain/CustomizeCheckoutShared/Enums/EarlyExitType.cs b/0_Framework/Domain/CustomizeCheckoutShared/Enums/EarlyExitType.cs new file mode 100644 index 00000000..a9cc3db0 --- /dev/null +++ b/0_Framework/Domain/CustomizeCheckoutShared/Enums/EarlyExitType.cs @@ -0,0 +1,19 @@ +namespace _0_Framework.Domain.CustomizeCheckoutShared.Enums; + +public enum EarlyExitType +{ + /// + /// محاسبه نمیشود + /// + None, + + /// + /// هر دقیقه تاخیر به تناسب حقوق مزد روزانه کسر گردد + /// + DeductEveryMinuteAccordingToDailyWage, + + /// + /// هر دقیقه تاخیر مبلغی کسر میگردد + /// + MoneyPerMinute +} \ No newline at end of file diff --git a/0_Framework/Domain/CustomizeCheckoutShared/Enums/FamilyAllowanceType.cs b/0_Framework/Domain/CustomizeCheckoutShared/Enums/FamilyAllowanceType.cs new file mode 100644 index 00000000..95bf14a8 --- /dev/null +++ b/0_Framework/Domain/CustomizeCheckoutShared/Enums/FamilyAllowanceType.cs @@ -0,0 +1,18 @@ +namespace _0_Framework.Domain.CustomizeCheckoutShared.Enums; + +public enum FamilyAllowanceType +{ + /// + ///محاسبه نمیشود + /// + None, + + /// + /// به ازای هر فرزند درصدی از مزد روزانه پرمسل + /// + Percentage, + /// + /// به ازای هر فرزند به صورت مبلغ اختصاصی پرداخت میشود + /// + Money +} \ No newline at end of file diff --git a/0_Framework/Domain/CustomizeCheckoutShared/Enums/FineAbsenceDeductionType.cs b/0_Framework/Domain/CustomizeCheckoutShared/Enums/FineAbsenceDeductionType.cs new file mode 100644 index 00000000..2ebb1a66 --- /dev/null +++ b/0_Framework/Domain/CustomizeCheckoutShared/Enums/FineAbsenceDeductionType.cs @@ -0,0 +1,19 @@ +namespace _0_Framework.Domain.CustomizeCheckoutShared.Enums; + +public enum FineAbsenceDeductionType +{ + /// + /// محاسبه نمیشود + /// + None, + + /// + /// در صورت استفاده غیر مجاز مرخصی و غیبت چند برابر از مزد روزانه کسر میگردد + /// + MultipleTimesOfDailyWage, + + /// + /// به صورت مبلغ اختصاصی پرداخت میشود + /// + Money +} \ No newline at end of file diff --git a/0_Framework/Domain/CustomizeCheckoutValueObjects/FineDeductionType.cs b/0_Framework/Domain/CustomizeCheckoutShared/Enums/FineDeductionType.cs similarity index 84% rename from 0_Framework/Domain/CustomizeCheckoutValueObjects/FineDeductionType.cs rename to 0_Framework/Domain/CustomizeCheckoutShared/Enums/FineDeductionType.cs index 277e4761..348e9edc 100644 --- a/0_Framework/Domain/CustomizeCheckoutValueObjects/FineDeductionType.cs +++ b/0_Framework/Domain/CustomizeCheckoutShared/Enums/FineDeductionType.cs @@ -1,4 +1,4 @@ -namespace _0_Framework.Domain.CustomizeCheckoutValueObjects; +namespace _0_Framework.Domain.CustomizeCheckoutShared.Enums; public enum FineDeductionType { diff --git a/0_Framework/Domain/CustomizeCheckoutValueObjects/FridayPay.cs b/0_Framework/Domain/CustomizeCheckoutShared/Enums/FridayPayType.cs similarity index 66% rename from 0_Framework/Domain/CustomizeCheckoutValueObjects/FridayPay.cs rename to 0_Framework/Domain/CustomizeCheckoutShared/Enums/FridayPayType.cs index 19b97246..6fc52193 100644 --- a/0_Framework/Domain/CustomizeCheckoutValueObjects/FridayPay.cs +++ b/0_Framework/Domain/CustomizeCheckoutShared/Enums/FridayPayType.cs @@ -1,4 +1,4 @@ -namespace _0_Framework.Domain.CustomizeCheckoutValueObjects; +namespace _0_Framework.Domain.CustomizeCheckoutShared.Enums; public enum FridayPayType { @@ -23,20 +23,4 @@ public enum FridayPayType /// 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; } -} +} \ No newline at end of file diff --git a/0_Framework/Domain/CustomizeCheckoutValueObjects/FridayWork.cs b/0_Framework/Domain/CustomizeCheckoutShared/Enums/FridayWork.cs similarity index 83% rename from 0_Framework/Domain/CustomizeCheckoutValueObjects/FridayWork.cs rename to 0_Framework/Domain/CustomizeCheckoutShared/Enums/FridayWork.cs index 47c5a543..b50092fc 100644 --- a/0_Framework/Domain/CustomizeCheckoutValueObjects/FridayWork.cs +++ b/0_Framework/Domain/CustomizeCheckoutShared/Enums/FridayWork.cs @@ -1,4 +1,4 @@ -namespace _0_Framework.Domain.CustomizeCheckoutValueObjects; +namespace _0_Framework.Domain.CustomizeCheckoutShared.Enums; public enum FridayWork { diff --git a/0_Framework/Domain/CustomizeCheckoutValueObjects/HolidayWork.cs b/0_Framework/Domain/CustomizeCheckoutShared/Enums/HolidayWork.cs similarity index 83% rename from 0_Framework/Domain/CustomizeCheckoutValueObjects/HolidayWork.cs rename to 0_Framework/Domain/CustomizeCheckoutShared/Enums/HolidayWork.cs index 737a8d97..643b0b1a 100644 --- a/0_Framework/Domain/CustomizeCheckoutValueObjects/HolidayWork.cs +++ b/0_Framework/Domain/CustomizeCheckoutShared/Enums/HolidayWork.cs @@ -1,4 +1,4 @@ -namespace _0_Framework.Domain.CustomizeCheckoutValueObjects; +namespace _0_Framework.Domain.CustomizeCheckoutShared.Enums; public enum HolidayWork { diff --git a/0_Framework/Domain/CustomizeCheckoutValueObjects/InsuranceDeduction.cs b/0_Framework/Domain/CustomizeCheckoutShared/Enums/InsuranceDeductionType.cs similarity index 54% rename from 0_Framework/Domain/CustomizeCheckoutValueObjects/InsuranceDeduction.cs rename to 0_Framework/Domain/CustomizeCheckoutShared/Enums/InsuranceDeductionType.cs index d52cd13b..daa233d3 100644 --- a/0_Framework/Domain/CustomizeCheckoutValueObjects/InsuranceDeduction.cs +++ b/0_Framework/Domain/CustomizeCheckoutShared/Enums/InsuranceDeductionType.cs @@ -1,20 +1,5 @@ -namespace _0_Framework.Domain.CustomizeCheckoutValueObjects; +namespace _0_Framework.Domain.CustomizeCheckoutShared.Enums; -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 { /// diff --git a/0_Framework/Domain/CustomizeCheckoutShared/Enums/LateToWorkType.cs b/0_Framework/Domain/CustomizeCheckoutShared/Enums/LateToWorkType.cs new file mode 100644 index 00000000..6d9d7411 --- /dev/null +++ b/0_Framework/Domain/CustomizeCheckoutShared/Enums/LateToWorkType.cs @@ -0,0 +1,19 @@ +namespace _0_Framework.Domain.CustomizeCheckoutShared.Enums; + +public enum LateToWorkType +{ + /// + /// محاسبه نمیشود + /// + None, + + /// + /// هر دقیقه تاخیر به تناسب حقوق مزد روزانه کسر گردد + /// + DeductEveryMinuteAccordingToDailyWage, + + /// + /// هر دقیقه تاخیر چند برابر از حقوق کسر میگردد + /// + MultiTimesPerMinute +} \ No newline at end of file diff --git a/0_Framework/Domain/CustomizeCheckoutShared/Enums/LeavePayType.cs b/0_Framework/Domain/CustomizeCheckoutShared/Enums/LeavePayType.cs new file mode 100644 index 00000000..e1db9178 --- /dev/null +++ b/0_Framework/Domain/CustomizeCheckoutShared/Enums/LeavePayType.cs @@ -0,0 +1,22 @@ +namespace _0_Framework.Domain.CustomizeCheckoutShared.Enums; + +public enum LeavePayType +{ + /// + /// محاسبه و پرداخت نمیشود + /// + None, + /// + /// پرداخت میشود و چند برابر فیش حقوقی است + /// + Pay, + + ///// + ///// به ازای هر روز استفاده نشده از مرخصی درصدی از حقوق + ///// + //Percentage, + ///// + ///// به ازای هر رور استفاده نشده از مرخصی به صورت مبلغ اختصاصی پرداخت میشود + ///// + //Money +} \ No newline at end of file diff --git a/0_Framework/Domain/CustomizeCheckoutShared/Enums/MarriedAllowanceType.cs b/0_Framework/Domain/CustomizeCheckoutShared/Enums/MarriedAllowanceType.cs new file mode 100644 index 00000000..35f0e6a0 --- /dev/null +++ b/0_Framework/Domain/CustomizeCheckoutShared/Enums/MarriedAllowanceType.cs @@ -0,0 +1,19 @@ +namespace _0_Framework.Domain.CustomizeCheckoutShared.Enums; + +public enum MarriedAllowanceType +{ + /// + ///محاسبه نمیشود + /// + None, + + /// + /// به صورت درصدی + /// + PercentageFromSalary, + + /// + /// به صورت مبلغ اختصاصی پرداخت میشود + /// + Money +} \ No newline at end of file diff --git a/0_Framework/Domain/CustomizeCheckoutShared/Enums/MaxMonthDays.cs b/0_Framework/Domain/CustomizeCheckoutShared/Enums/MaxMonthDays.cs new file mode 100644 index 00000000..a5151990 --- /dev/null +++ b/0_Framework/Domain/CustomizeCheckoutShared/Enums/MaxMonthDays.cs @@ -0,0 +1,17 @@ +namespace _0_Framework.Domain.CustomizeCheckoutShared.Enums; + +public enum MaxMonthDays +{ + /// + /// تعداد روز های ماه به صورت عادی باشد و تغییری در آن اعمال نشود + /// + Default, + /// + /// تمامی ماه ها 30 روزه حساب شوند + /// + ThirtyDaysForAllMonth, + ///// + ///// تمامی ماه ها 30 روزه حساب شوند ولی اسفند 29 روزه + ///// + //ThirtyDaysForAllMonthExceptEsfand +} \ No newline at end of file diff --git a/0_Framework/Domain/CustomizeCheckoutShared/Enums/NightWorkType.cs b/0_Framework/Domain/CustomizeCheckoutShared/Enums/NightWorkType.cs new file mode 100644 index 00000000..1ff3453f --- /dev/null +++ b/0_Framework/Domain/CustomizeCheckoutShared/Enums/NightWorkType.cs @@ -0,0 +1,19 @@ +namespace _0_Framework.Domain.CustomizeCheckoutShared.Enums; + +public enum NightWorkType +{ + /// + ///محاسبه نمیشود + /// + None, + + /// + /// به صورت درصدی از مزد روزانه + /// + PercentageFromSalary, + + /// + /// مقدار پول شخصی سازی شده برای هر ساعت شب کاری + /// + MoneyPerHour +} \ No newline at end of file diff --git a/0_Framework/Domain/CustomizeCheckoutShared/Enums/OverTimePayType.cs b/0_Framework/Domain/CustomizeCheckoutShared/Enums/OverTimePayType.cs new file mode 100644 index 00000000..f4f36326 --- /dev/null +++ b/0_Framework/Domain/CustomizeCheckoutShared/Enums/OverTimePayType.cs @@ -0,0 +1,17 @@ +namespace _0_Framework.Domain.CustomizeCheckoutShared.Enums; + +public enum OverTimePayType +{ + /// + ///محاسبه نمیشود + /// + None, + /// + /// مقدار پول شخصی سازی شده برای هر ساعت + /// + MoneyPerHour, + /// + /// به صورت درصدی از مزد روزانه به ازای هر ساعت. + /// + PercentagePerHourOfSalary +} \ No newline at end of file diff --git a/0_Framework/Domain/CustomizeCheckoutShared/Enums/ShiftPayType.cs b/0_Framework/Domain/CustomizeCheckoutShared/Enums/ShiftPayType.cs new file mode 100644 index 00000000..0dbfec3b --- /dev/null +++ b/0_Framework/Domain/CustomizeCheckoutShared/Enums/ShiftPayType.cs @@ -0,0 +1,19 @@ +namespace _0_Framework.Domain.CustomizeCheckoutShared.Enums; + +public enum ShiftPayType +{ + /// + ///محاسبه نمیشود + /// + None, + + /// + /// درصدی از حقوق + /// + PercentageOfSalary, + + /// + /// به صورت مبلغ اختصاصی پرداخت میشود + /// + Money +} \ No newline at end of file diff --git a/0_Framework/Domain/CustomizeCheckoutShared/Enums/ShiftPlacement.cs b/0_Framework/Domain/CustomizeCheckoutShared/Enums/ShiftPlacement.cs new file mode 100644 index 00000000..6c639576 --- /dev/null +++ b/0_Framework/Domain/CustomizeCheckoutShared/Enums/ShiftPlacement.cs @@ -0,0 +1,8 @@ +namespace _0_Framework.Domain.CustomizeCheckoutShared.Enums; + +public enum ShiftPlacement +{ + First, + Second, + Third +} \ No newline at end of file diff --git a/0_Framework/Domain/CustomizeCheckoutShared/Enums/ShiftType.cs b/0_Framework/Domain/CustomizeCheckoutShared/Enums/ShiftType.cs new file mode 100644 index 00000000..a82283a5 --- /dev/null +++ b/0_Framework/Domain/CustomizeCheckoutShared/Enums/ShiftType.cs @@ -0,0 +1,24 @@ +namespace _0_Framework.Domain.CustomizeCheckoutShared.Enums; + +public enum ShiftType +{ + /// + ///محاسبه نمیشود + /// + None, + + /// + /// صبح و عصر + /// + MorningAndEvening, + + /// + /// عصر و شب + /// + EveningAndNight, + + /// + /// صبح و عصر و شب + /// + MorningAndEveningAndNight +} \ No newline at end of file diff --git a/0_Framework/Domain/CustomizeCheckoutShared/Enums/WorkshopIrregularShifts.cs b/0_Framework/Domain/CustomizeCheckoutShared/Enums/WorkshopIrregularShifts.cs new file mode 100644 index 00000000..94de43c9 --- /dev/null +++ b/0_Framework/Domain/CustomizeCheckoutShared/Enums/WorkshopIrregularShifts.cs @@ -0,0 +1,26 @@ +namespace _0_Framework.Domain.CustomizeCheckoutShared.Enums; + +public enum WorkshopIrregularShifts +{ + /// + /// غیرفعال + /// + None, + /// + /// 12 - 24 (دوازده - بیست و چهار) + /// + TwelveTwentyFour, + /// + /// 24-24 (بیست و چهار - بیست و چهار) + /// + TwentyFourTwentyFour, + /// + /// 12-36 (دوازده - سی و شش) + /// + TwelveThirtySix, + /// + /// 24 - 48 (بیست و چهار - چهل و هشت) + /// + TwentyFourFortyEight + +} \ No newline at end of file diff --git a/0_Framework/Domain/CustomizeCheckoutShared/Enums/WorkshopShiftStatus.cs b/0_Framework/Domain/CustomizeCheckoutShared/Enums/WorkshopShiftStatus.cs new file mode 100644 index 00000000..a281acc9 --- /dev/null +++ b/0_Framework/Domain/CustomizeCheckoutShared/Enums/WorkshopShiftStatus.cs @@ -0,0 +1,14 @@ +namespace _0_Framework.Domain.CustomizeCheckoutShared.Enums; + +public enum WorkshopShiftStatus +{ + /// + /// منظم + /// + Regular, + + /// + /// نامنظم + /// + Irregular +} \ No newline at end of file diff --git a/0_Framework/Domain/CustomizeCheckoutShared/ValueObjects/BaseYearsPay.cs b/0_Framework/Domain/CustomizeCheckoutShared/ValueObjects/BaseYearsPay.cs new file mode 100644 index 00000000..bc8491db --- /dev/null +++ b/0_Framework/Domain/CustomizeCheckoutShared/ValueObjects/BaseYearsPay.cs @@ -0,0 +1,22 @@ +using _0_Framework.Domain.CustomizeCheckoutShared.Enums; + +namespace _0_Framework.Domain.CustomizeCheckoutShared.ValueObjects; + +public record BaseYearsPay +{ + public BaseYearsPay(BaseYearsPayType baseYearsPayType, double value, BaseYearsPaymentType paymentType) + { + BaseYearsPayType = baseYearsPayType; + Value = value; + PaymentType = paymentType; + } + + private BaseYearsPay() + { + + } + + public BaseYearsPayType BaseYearsPayType { get; private set; } + public double Value { get; private set; } + public BaseYearsPaymentType PaymentType { get; private set; } +} \ No newline at end of file diff --git a/0_Framework/Domain/CustomizeCheckoutShared/ValueObjects/BonusesPay.cs b/0_Framework/Domain/CustomizeCheckoutShared/ValueObjects/BonusesPay.cs new file mode 100644 index 00000000..09774161 --- /dev/null +++ b/0_Framework/Domain/CustomizeCheckoutShared/ValueObjects/BonusesPay.cs @@ -0,0 +1,33 @@ +using _0_Framework.Domain.CustomizeCheckoutShared.Enums; + +namespace _0_Framework.Domain.CustomizeCheckoutShared.ValueObjects; + +public record BonusesPay +{ + public BonusesPay(BonusesType bonusesPayType, double value, BonusesPaymentType paymentType) + { + BonusesPayType = bonusesPayType; + Value = value; + PaymentType = paymentType; + + } + + private BonusesPay() + { + } + + /// + /// نوع عیدی + /// + public BonusesType BonusesPayType { get; private set; } + /// + /// مقدار درصد یا مبلغ + /// + public double Value { get; private set; } + /// + /// نوع پرداخت برای عیدی + /// + public BonusesPaymentType PaymentType { get; private set; } + + +} \ No newline at end of file diff --git a/0_Framework/Domain/CustomizeCheckoutShared/ValueObjects/BreakTime.cs b/0_Framework/Domain/CustomizeCheckoutShared/ValueObjects/BreakTime.cs new file mode 100644 index 00000000..34015aa0 --- /dev/null +++ b/0_Framework/Domain/CustomizeCheckoutShared/ValueObjects/BreakTime.cs @@ -0,0 +1,43 @@ +using System; +using _0_Framework.Domain.CustomizeCheckoutShared.Enums; + +namespace _0_Framework.Domain.CustomizeCheckoutShared.ValueObjects; + +public record BreakTime +{ + public BreakTime() + { + + } + public BreakTime(bool hasBreakTimeValue, TimeOnly breakTimeValue) + { + HasBreakTimeValue = hasBreakTimeValue; + if (hasBreakTimeValue) + { + if (breakTimeValue == new TimeOnly()) + { + BreakTimeValue = breakTimeValue; + BreakTimeType = BreakTimeType.WithoutTime; + } + else + { + BreakTimeType = BreakTimeType.WithTime; + BreakTimeValue = breakTimeValue; + } + + HasBreakTimeValue = true; + } + else + { + BreakTimeType = BreakTimeType.None; + BreakTimeValue = new TimeOnly(); + HasBreakTimeValue = false; + } + + } + + public bool HasBreakTimeValue { get; set; } + public BreakTimeType BreakTimeType { get; private set; } + public TimeOnly BreakTimeValue { get; set; } + +} \ No newline at end of file diff --git a/0_Framework/Domain/CustomizeCheckoutShared/ValueObjects/EarlyExit.cs b/0_Framework/Domain/CustomizeCheckoutShared/ValueObjects/EarlyExit.cs new file mode 100644 index 00000000..9ca7382c --- /dev/null +++ b/0_Framework/Domain/CustomizeCheckoutShared/ValueObjects/EarlyExit.cs @@ -0,0 +1,46 @@ +using System.Collections.Generic; +using _0_Framework.Domain.CustomizeCheckoutShared.Enums; + +namespace _0_Framework.Domain.CustomizeCheckoutShared.ValueObjects; + +public record EarlyExit +{ + public EarlyExit(EarlyExitType earlyExitType, List earlyExitTimeFines, double value) + { + EarlyExitType = earlyExitType; + EarlyExitTimeFines = earlyExitTimeFines ?? new(); + Value = value; + } + + private EarlyExit() + { + EarlyExitTimeFines = new(); + } + + /// + /// نوع حساب کردن تعجیل در خروج + /// + public EarlyExitType EarlyExitType { get; private set; } + + /// + /// جریمه های اختصاصی پله ای + /// + public List EarlyExitTimeFines { get; private set; } + + public double Value { get; private set; } + + +} + +//public enum EarlyExitTimeFineType +//{ +// /// +// /// جریمه های زمانی به صورت پله همه باهم جمع گردد +// /// +// StepByStep, + +// /// +// /// فقط آخرین جریمه لحاظ شود +// /// +// LastStep, +//} \ No newline at end of file diff --git a/0_Framework/Domain/CustomizeCheckoutShared/ValueObjects/EarlyExitTimeFine.cs b/0_Framework/Domain/CustomizeCheckoutShared/ValueObjects/EarlyExitTimeFine.cs new file mode 100644 index 00000000..2764bd06 --- /dev/null +++ b/0_Framework/Domain/CustomizeCheckoutShared/ValueObjects/EarlyExitTimeFine.cs @@ -0,0 +1,24 @@ +namespace _0_Framework.Domain.CustomizeCheckoutShared.ValueObjects; + +public record EarlyExitTimeFine +{ + public EarlyExitTimeFine(string minute, double fineMoney) + { + Minute = minute; + FineMoney = fineMoney; + } + + private EarlyExitTimeFine() + { + } + + /// + /// دقیقه تعیین شده برای جریمه + /// + public string Minute { get; private set; } + + /// + /// مبلغ تعیین شده برای جریمه + /// + public double FineMoney { get; private set; } +} \ No newline at end of file diff --git a/0_Framework/Domain/CustomizeCheckoutValueObjects/FamilyAllowance.cs b/0_Framework/Domain/CustomizeCheckoutShared/ValueObjects/FamilyAllowance.cs similarity index 73% rename from 0_Framework/Domain/CustomizeCheckoutValueObjects/FamilyAllowance.cs rename to 0_Framework/Domain/CustomizeCheckoutShared/ValueObjects/FamilyAllowance.cs index 7538106b..8cc07f4a 100644 --- a/0_Framework/Domain/CustomizeCheckoutValueObjects/FamilyAllowance.cs +++ b/0_Framework/Domain/CustomizeCheckoutShared/ValueObjects/FamilyAllowance.cs @@ -1,6 +1,8 @@ -namespace _0_Framework.Domain.CustomizeCheckoutValueObjects; +using _0_Framework.Domain.CustomizeCheckoutShared.Enums; -public class FamilyAllowance +namespace _0_Framework.Domain.CustomizeCheckoutShared.ValueObjects; + +public record FamilyAllowance { public FamilyAllowance(FamilyAllowanceType familyAllowanceType, double value) { @@ -27,22 +29,6 @@ public class FamilyAllowance public double Value { get; private set; } } -public enum FamilyAllowanceType -{ - /// - ///محاسبه نمیشود - /// - None, - - /// - /// به ازای هر فرزند درصدی از مزد روزانه پرمسل - /// - Percentage, - /// - /// به ازای هر فرزند به صورت مبلغ اختصاصی پرداخت میشود - /// - Money -} //public enum NumberOfChildren //{ // /// diff --git a/0_Framework/Domain/CustomizeCheckoutShared/ValueObjects/FineAbsenceDayOfWeek.cs b/0_Framework/Domain/CustomizeCheckoutShared/ValueObjects/FineAbsenceDayOfWeek.cs new file mode 100644 index 00000000..f6c5bcad --- /dev/null +++ b/0_Framework/Domain/CustomizeCheckoutShared/ValueObjects/FineAbsenceDayOfWeek.cs @@ -0,0 +1,22 @@ +using System; + +namespace _0_Framework.Domain.CustomizeCheckoutShared.ValueObjects; + +public record FineAbsenceDayOfWeek +{ + public FineAbsenceDayOfWeek(DayOfWeek dayOfWeek) + { + DayOfWeek = dayOfWeek; + + } + + private FineAbsenceDayOfWeek() + { + } + + /// + /// روز های هفته + /// + public DayOfWeek DayOfWeek { get; private set; } + +} \ No newline at end of file diff --git a/0_Framework/Domain/CustomizeCheckoutShared/ValueObjects/FineAbsenceDeduction.cs b/0_Framework/Domain/CustomizeCheckoutShared/ValueObjects/FineAbsenceDeduction.cs new file mode 100644 index 00000000..cd8c3e4e --- /dev/null +++ b/0_Framework/Domain/CustomizeCheckoutShared/ValueObjects/FineAbsenceDeduction.cs @@ -0,0 +1,48 @@ +using System.Collections.Generic; +using _0_Framework.Domain.CustomizeCheckoutShared.Enums; + +namespace _0_Framework.Domain.CustomizeCheckoutShared.ValueObjects; + +public record FineAbsenceDeduction +{ + private FineAbsenceDeduction() + { + FineAbsenceDayOfWeekCollection = new(); + } + public FineAbsenceDeduction(FineAbsenceDeductionType fineAbsenceDeductionType, double value, List fineAbsenceDayOfWeekCollection) + { + FineAbsenceDeductionType = fineAbsenceDeductionType; + Value = value; + FineAbsenceDayOfWeekCollection = fineAbsenceDayOfWeekCollection ?? new(); + } + + /// + /// نوع جریمه غیبت + /// + public FineAbsenceDeductionType FineAbsenceDeductionType { get; private set; } + + public double Value { get; set; } + + /// + /// جریمه های اختصاصی به ازای روز های هفته + /// + public List FineAbsenceDayOfWeekCollection { get; private set; } +} + +//public enum FineAbsenceDayOfWeekType +//{ +// /// +// /// مبلغ اختصاصی +// /// +// Money, + +// /// +// /// چند برابر کردن جریمه به ازای مقداری که داده شده +// /// +// Multiple, + +// /// +// /// درصد از مزد روزانه +// /// +// PercentageOfDailyWage +//} \ No newline at end of file diff --git a/0_Framework/Domain/CustomizeCheckoutValueObjects/FineDeduction.cs b/0_Framework/Domain/CustomizeCheckoutShared/ValueObjects/FineDeduction.cs similarity index 71% rename from 0_Framework/Domain/CustomizeCheckoutValueObjects/FineDeduction.cs rename to 0_Framework/Domain/CustomizeCheckoutShared/ValueObjects/FineDeduction.cs index 10cc893f..44019751 100644 --- a/0_Framework/Domain/CustomizeCheckoutValueObjects/FineDeduction.cs +++ b/0_Framework/Domain/CustomizeCheckoutShared/ValueObjects/FineDeduction.cs @@ -1,6 +1,8 @@ -namespace _0_Framework.Domain.CustomizeCheckoutValueObjects; +using _0_Framework.Domain.CustomizeCheckoutShared.Enums; -public class FineDeduction +namespace _0_Framework.Domain.CustomizeCheckoutShared.ValueObjects; + +public record FineDeduction { private FineDeduction() { diff --git a/0_Framework/Domain/CustomizeCheckoutShared/ValueObjects/FridayPay.cs b/0_Framework/Domain/CustomizeCheckoutShared/ValueObjects/FridayPay.cs new file mode 100644 index 00000000..98fb1bdc --- /dev/null +++ b/0_Framework/Domain/CustomizeCheckoutShared/ValueObjects/FridayPay.cs @@ -0,0 +1,20 @@ +using _0_Framework.Domain.CustomizeCheckoutShared.Enums; + +namespace _0_Framework.Domain.CustomizeCheckoutShared.ValueObjects; + +public record 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; } +} diff --git a/0_Framework/Domain/CustomizeCheckoutShared/ValueObjects/InsuranceDeduction.cs b/0_Framework/Domain/CustomizeCheckoutShared/ValueObjects/InsuranceDeduction.cs new file mode 100644 index 00000000..427ec61d --- /dev/null +++ b/0_Framework/Domain/CustomizeCheckoutShared/ValueObjects/InsuranceDeduction.cs @@ -0,0 +1,19 @@ +using _0_Framework.Domain.CustomizeCheckoutShared.Enums; + +namespace _0_Framework.Domain.CustomizeCheckoutShared.ValueObjects; + +public record 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; } +} \ No newline at end of file diff --git a/0_Framework/Domain/CustomizeCheckoutShared/ValueObjects/IrregularShift.cs b/0_Framework/Domain/CustomizeCheckoutShared/ValueObjects/IrregularShift.cs new file mode 100644 index 00000000..a6313e6f --- /dev/null +++ b/0_Framework/Domain/CustomizeCheckoutShared/ValueObjects/IrregularShift.cs @@ -0,0 +1,23 @@ +using System; +using _0_Framework.Domain.CustomizeCheckoutShared.Enums; + +namespace _0_Framework.Domain.CustomizeCheckoutShared.ValueObjects; + +public record IrregularShift +{ + public IrregularShift() + { + + } + public IrregularShift(TimeOnly startTime, TimeOnly endTime, WorkshopIrregularShifts workshopIrregularShifts) + { + StartTime = startTime; + EndTime = endTime; + WorkshopIrregularShifts = workshopIrregularShifts; + } + + public TimeOnly StartTime { get; set; } + public TimeOnly EndTime { get; set; } + public WorkshopIrregularShifts WorkshopIrregularShifts { get; set; } + +} \ No newline at end of file diff --git a/0_Framework/Domain/CustomizeCheckoutShared/ValueObjects/LateToWork.cs b/0_Framework/Domain/CustomizeCheckoutShared/ValueObjects/LateToWork.cs new file mode 100644 index 00000000..4391422c --- /dev/null +++ b/0_Framework/Domain/CustomizeCheckoutShared/ValueObjects/LateToWork.cs @@ -0,0 +1,38 @@ +using System.Collections.Generic; +using _0_Framework.Domain.CustomizeCheckoutShared.Enums; + +namespace _0_Framework.Domain.CustomizeCheckoutShared.ValueObjects; + +public record LateToWork +{ + public LateToWork(LateToWorkType lateToWorkType, List lateToWorkTimeFines, double value) + { + LateToWorkType = lateToWorkType; + LateToWorkTimeFines = lateToWorkTimeFines ?? new(); + Value = value; + } + + private LateToWork() + { + LateToWorkTimeFines = new(); + } + + /// + /// نوع حساب کردن تاخیر در ورود + /// + public LateToWorkType LateToWorkType { get; private set; } + + /// + /// این مقدار بستگی به نوع حساب کردن تاخیر در ورود + /// + public double Value { get; private set; } + + /// + /// جریمه های اختصاصی پله ای + /// + public List LateToWorkTimeFines { get; private set; } + + + + +} \ No newline at end of file diff --git a/0_Framework/Domain/CustomizeCheckoutShared/ValueObjects/LateToWorkTimeFine.cs b/0_Framework/Domain/CustomizeCheckoutShared/ValueObjects/LateToWorkTimeFine.cs new file mode 100644 index 00000000..be2e3f52 --- /dev/null +++ b/0_Framework/Domain/CustomizeCheckoutShared/ValueObjects/LateToWorkTimeFine.cs @@ -0,0 +1,24 @@ +namespace _0_Framework.Domain.CustomizeCheckoutShared.ValueObjects; + +public record LateToWorkTimeFine +{ + public LateToWorkTimeFine(string minute, double fineMoney) + { + Minute = minute; + FineMoney = fineMoney; + } + + private LateToWorkTimeFine() + { + } + + /// + /// دقیقه تعیین شده برای جریمه + /// + public string Minute { get; private set; } + + /// + /// مبلغ تعیین شده برای جریمه + /// + public double FineMoney { get; private set; } +} \ No newline at end of file diff --git a/0_Framework/Domain/CustomizeCheckoutShared/ValueObjects/LeavePay.cs b/0_Framework/Domain/CustomizeCheckoutShared/ValueObjects/LeavePay.cs new file mode 100644 index 00000000..91716d43 --- /dev/null +++ b/0_Framework/Domain/CustomizeCheckoutShared/ValueObjects/LeavePay.cs @@ -0,0 +1,29 @@ +using _0_Framework.Domain.CustomizeCheckoutShared.Enums; + +namespace _0_Framework.Domain.CustomizeCheckoutShared.ValueObjects; + +public record LeavePay +{ + public LeavePay(LeavePayType leavePayType, double value) + { + LeavePayType = leavePayType; + //DayCountAllowable = dayCountAllowable; + Value = value; + } + + private LeavePay() + { + } + + /// + /// نوع مرخصی + /// + public LeavePayType LeavePayType { get; private set; } + + ///// + ///// تعداد روز های مجاز مرخصی + ///// + //public string DayCountAllowable { get; set; } + + public double Value { get; private set; } +} \ No newline at end of file diff --git a/0_Framework/Domain/CustomizeCheckoutShared/ValueObjects/MarriedAllowance.cs b/0_Framework/Domain/CustomizeCheckoutShared/ValueObjects/MarriedAllowance.cs new file mode 100644 index 00000000..215ed243 --- /dev/null +++ b/0_Framework/Domain/CustomizeCheckoutShared/ValueObjects/MarriedAllowance.cs @@ -0,0 +1,19 @@ +using _0_Framework.Domain.CustomizeCheckoutShared.Enums; + +namespace _0_Framework.Domain.CustomizeCheckoutShared.ValueObjects; + +public record 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; } +} \ No newline at end of file diff --git a/0_Framework/Domain/CustomizeCheckoutShared/ValueObjects/NightWorkPay.cs b/0_Framework/Domain/CustomizeCheckoutShared/ValueObjects/NightWorkPay.cs new file mode 100644 index 00000000..03740375 --- /dev/null +++ b/0_Framework/Domain/CustomizeCheckoutShared/ValueObjects/NightWorkPay.cs @@ -0,0 +1,19 @@ +using _0_Framework.Domain.CustomizeCheckoutShared.Enums; + +namespace _0_Framework.Domain.CustomizeCheckoutShared.ValueObjects; + +public record 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; } +} \ No newline at end of file diff --git a/0_Framework/Domain/CustomizeCheckoutShared/ValueObjects/OverTimePay.cs b/0_Framework/Domain/CustomizeCheckoutShared/ValueObjects/OverTimePay.cs new file mode 100644 index 00000000..7b527f47 --- /dev/null +++ b/0_Framework/Domain/CustomizeCheckoutShared/ValueObjects/OverTimePay.cs @@ -0,0 +1,19 @@ +using _0_Framework.Domain.CustomizeCheckoutShared.Enums; + +namespace _0_Framework.Domain.CustomizeCheckoutShared.ValueObjects; + +public record 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; } +} \ No newline at end of file diff --git a/0_Framework/Domain/CustomizeCheckoutShared/ValueObjects/ShiftPay.cs b/0_Framework/Domain/CustomizeCheckoutShared/ValueObjects/ShiftPay.cs new file mode 100644 index 00000000..c7133323 --- /dev/null +++ b/0_Framework/Domain/CustomizeCheckoutShared/ValueObjects/ShiftPay.cs @@ -0,0 +1,29 @@ +using _0_Framework.Domain.CustomizeCheckoutShared.Enums; + +namespace _0_Framework.Domain.CustomizeCheckoutShared.ValueObjects; + +public record ShiftPay +{ + public ShiftPay(ShiftType shiftType, ShiftPayType shiftPayType, double value) + { + ShiftType = shiftType; + ShiftPayType = shiftPayType; + Value = value; + } + + private ShiftPay() + { + } + + /// + /// نوع نوبت کاری را مشخص میکند . به عنوان مثال: صبح و عصر، عصر و شب و غیره... + /// + public ShiftType ShiftType { get; private set; } + + /// + /// نوع پرداخت را مشخص میکند که آیا به صورت درصدی است یا مبلغ اختصاصی. + /// + public ShiftPayType ShiftPayType { get; private set; } + + public double Value { get; private set; } +} \ No newline at end of file diff --git a/0_Framework/Domain/CustomizeCheckoutValueObjects/BaseYearsPay.cs b/0_Framework/Domain/CustomizeCheckoutValueObjects/BaseYearsPay.cs deleted file mode 100644 index 97ecca27..00000000 --- a/0_Framework/Domain/CustomizeCheckoutValueObjects/BaseYearsPay.cs +++ /dev/null @@ -1,55 +0,0 @@ -namespace _0_Framework.Domain.CustomizeCheckoutValueObjects; - -public class BaseYearsPay -{ - public BaseYearsPay(BaseYearsPayType baseYearsPayType, double value, BaseYearsPaymentType paymentType) - { - BaseYearsPayType = baseYearsPayType; - Value = value; - PaymentType = paymentType; - } - - private BaseYearsPay() - { - - } - - public BaseYearsPayType BaseYearsPayType { get; private set; } - public double Value { get; private set; } - public BaseYearsPaymentType PaymentType { get; private set; } -} - - - -public enum BaseYearsPayType -{ - /// - ///محاسبه نمیشود - /// - None, - - /// - /// به صورت درصدی از حقوق - /// - PercentageOfSalary, - /// - /// مبلغ اختصاصی برای سنوات - /// - Money -} -public enum BaseYearsPaymentType -{ - /// - /// پرداخت نمیگردد - /// - None, - /// - /// پرداخت به صورت سالانه در آخر سال پرداخت میگردد - /// - YearlyPay, - /// - /// پرداخت به صورت ماهانه - /// - MonthlyPay - -} \ No newline at end of file diff --git a/0_Framework/Domain/CustomizeCheckoutValueObjects/BonusesPay.cs b/0_Framework/Domain/CustomizeCheckoutValueObjects/BonusesPay.cs deleted file mode 100644 index ec18c3ef..00000000 --- a/0_Framework/Domain/CustomizeCheckoutValueObjects/BonusesPay.cs +++ /dev/null @@ -1,77 +0,0 @@ -namespace _0_Framework.Domain.CustomizeCheckoutValueObjects; - -public class BonusesPay -{ - public BonusesPay(BonusesType bonusesPayType, double value, BonusesPaymentType paymentType) - { - BonusesPayType = bonusesPayType; - Value = value; - PaymentType = paymentType; - - } - - private BonusesPay() - { - } - - /// - /// نوع عیدی - /// - public BonusesType BonusesPayType { get; private set; } - /// - /// مقدار درصد یا مبلغ - /// - public double Value { get; private set; } - /// - /// نوع پرداخت برای عیدی - /// - public BonusesPaymentType PaymentType { get; private set; } - - -} - - - -public enum BonusesPaymentType -{ - /// - /// پرداخت نمیگردد - /// - None, - /// - /// پرداخت به صورت سالانه در آخر سال پرداخت میگردد - /// - YearlyPay, - /// - /// پرداخت به صورت ماهانه - /// - MonthlyPay - -} - -public enum BonusesType -{ - /// - ///محاسبه نمیشود - /// - None, - - /// - /// به صورت درصدی از حقوق - /// - PercentageOfSalary, - - /// - /// دوبرابر حقوق - /// - TwoTimeOfSalary, - - /// - /// یک برابر حقوق - /// - OneTimeOfSalary, - /// - /// مبلغ اختصاصی برای عیدی - /// - Money -} \ No newline at end of file diff --git a/0_Framework/Domain/CustomizeCheckoutValueObjects/Currency.cs b/0_Framework/Domain/CustomizeCheckoutValueObjects/Currency.cs deleted file mode 100644 index 8db21954..00000000 --- a/0_Framework/Domain/CustomizeCheckoutValueObjects/Currency.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace _0_Framework.Domain.CustomizeCheckoutValueObjects; - -public enum Currency -{ - Rial, - Toman -} \ No newline at end of file diff --git a/0_Framework/Domain/CustomizeCheckoutValueObjects/EarlyExit.cs b/0_Framework/Domain/CustomizeCheckoutValueObjects/EarlyExit.cs deleted file mode 100644 index 5a30e3d9..00000000 --- a/0_Framework/Domain/CustomizeCheckoutValueObjects/EarlyExit.cs +++ /dev/null @@ -1,86 +0,0 @@ -using System.Collections.Generic; - -namespace _0_Framework.Domain.CustomizeCheckoutValueObjects; - -public class EarlyExit -{ - public EarlyExit(EarlyExitType earlyExitType, List earlyExitTimeFines, double value) - { - EarlyExitType = earlyExitType; - EarlyExitTimeFines = earlyExitTimeFines??new (); - Value = value; - } - - private EarlyExit() - { - EarlyExitTimeFines = new(); - } - - /// - /// نوع حساب کردن تعجیل در خروج - /// - public EarlyExitType EarlyExitType { get; private set; } - - /// - /// جریمه های اختصاصی پله ای - /// - public List 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() - { - } - - /// - /// دقیقه تعیین شده برای جریمه - /// - public string Minute { get; private set; } - - /// - /// مبلغ تعیین شده برای جریمه - /// - public double FineMoney { get; private set; } -} - -//public enum EarlyExitTimeFineType -//{ -// /// -// /// جریمه های زمانی به صورت پله همه باهم جمع گردد -// /// -// StepByStep, - -// /// -// /// فقط آخرین جریمه لحاظ شود -// /// -// LastStep, -//} - -public enum EarlyExitType -{ - /// - /// محاسبه نمیشود - /// - None, - - /// - /// هر دقیقه تاخیر به تناسب حقوق مزد روزانه کسر گردد - /// - DeductEveryMinuteAccordingToDailyWage, - - /// - /// هر دقیقه تاخیر مبلغی کسر میگردد - /// - MoneyPerMinute -} \ No newline at end of file diff --git a/0_Framework/Domain/CustomizeCheckoutValueObjects/FineAbsenceDeduction.cs b/0_Framework/Domain/CustomizeCheckoutValueObjects/FineAbsenceDeduction.cs deleted file mode 100644 index 1b67f8a2..00000000 --- a/0_Framework/Domain/CustomizeCheckoutValueObjects/FineAbsenceDeduction.cs +++ /dev/null @@ -1,85 +0,0 @@ -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 fineAbsenceDayOfWeekCollection) - { - FineAbsenceDeductionType = fineAbsenceDeductionType; - Value = value; - FineAbsenceDayOfWeekCollection = fineAbsenceDayOfWeekCollection ?? new (); - } - - /// - /// نوع جریمه غیبت - /// - public FineAbsenceDeductionType FineAbsenceDeductionType { get; private set; } - - public double Value { get; set; } - - /// - /// جریمه های اختصاصی به ازای روز های هفته - /// - public List FineAbsenceDayOfWeekCollection { get; private set; } -} - -public class FineAbsenceDayOfWeek -{ - public FineAbsenceDayOfWeek(DayOfWeek dayOfWeek) - { - DayOfWeek = dayOfWeek; - - } - - private FineAbsenceDayOfWeek() - { - } - - /// - /// روز های هفته - /// - public DayOfWeek DayOfWeek { get; private set; } - -} - -//public enum FineAbsenceDayOfWeekType -//{ -// /// -// /// مبلغ اختصاصی -// /// -// Money, - -// /// -// /// چند برابر کردن جریمه به ازای مقداری که داده شده -// /// -// Multiple, - -// /// -// /// درصد از مزد روزانه -// /// -// PercentageOfDailyWage -//} - -public enum FineAbsenceDeductionType -{ - /// - /// محاسبه نمیشود - /// - None, - - /// - /// در صورت استفاده غیر مجاز مرخصی و غیبت چند برابر از مزد روزانه کسر میگردد - /// - MultipleTimesOfDailyWage, - - /// - /// به صورت مبلغ اختصاصی پرداخت میشود - /// - Money -} \ No newline at end of file diff --git a/0_Framework/Domain/CustomizeCheckoutValueObjects/LateToWork.cs b/0_Framework/Domain/CustomizeCheckoutValueObjects/LateToWork.cs deleted file mode 100644 index d7786432..00000000 --- a/0_Framework/Domain/CustomizeCheckoutValueObjects/LateToWork.cs +++ /dev/null @@ -1,76 +0,0 @@ -using System.Collections.Generic; - -namespace _0_Framework.Domain.CustomizeCheckoutValueObjects; - -public class LateToWork -{ - public LateToWork(LateToWorkType lateToWorkType, List lateToWorkTimeFines, double value) - { - LateToWorkType = lateToWorkType; - LateToWorkTimeFines = lateToWorkTimeFines??new (); - Value = value; - } - - private LateToWork() - { - LateToWorkTimeFines = new (); - } - - /// - /// نوع حساب کردن تاخیر در ورود - /// - public LateToWorkType LateToWorkType { get; private set; } - - /// - /// این مقدار بستگی به نوع حساب کردن تاخیر در ورود - /// - public double Value { get; private set; } - - /// - /// جریمه های اختصاصی پله ای - /// - public List LateToWorkTimeFines { get; private set; } - - - - -} -public enum LateToWorkType -{ - /// - /// محاسبه نمیشود - /// - None, - - /// - /// هر دقیقه تاخیر به تناسب حقوق مزد روزانه کسر گردد - /// - DeductEveryMinuteAccordingToDailyWage, - - /// - /// هر دقیقه تاخیر چند برابر از حقوق کسر میگردد - /// - MultiTimesPerMinute -} -public class LateToWorkTimeFine -{ - public LateToWorkTimeFine(string minute, double fineMoney) - { - Minute = minute; - FineMoney = fineMoney; - } - - private LateToWorkTimeFine() - { - } - - /// - /// دقیقه تعیین شده برای جریمه - /// - public string Minute { get; private set; } - - /// - /// مبلغ تعیین شده برای جریمه - /// - public double FineMoney { get; private set; } -} \ No newline at end of file diff --git a/0_Framework/Domain/CustomizeCheckoutValueObjects/LeavePay.cs b/0_Framework/Domain/CustomizeCheckoutValueObjects/LeavePay.cs deleted file mode 100644 index ccb10928..00000000 --- a/0_Framework/Domain/CustomizeCheckoutValueObjects/LeavePay.cs +++ /dev/null @@ -1,47 +0,0 @@ -namespace _0_Framework.Domain.CustomizeCheckoutValueObjects; - -public class LeavePay -{ - public LeavePay(LeavePayType leavePayType, double value) - { - LeavePayType = leavePayType; - //DayCountAllowable = dayCountAllowable; - Value = value; - } - - private LeavePay() - { - } - - /// - /// نوع مرخصی - /// - public LeavePayType LeavePayType { get; private set; } - - ///// - ///// تعداد روز های مجاز مرخصی - ///// - //public string DayCountAllowable { get; set; } - - public double Value { get; private set; } -} -public enum LeavePayType -{ - /// - /// محاسبه و پرداخت نمیشود - /// - None, - /// - /// پرداخت میشود و چند برابر فیش حقوقی است - /// - Pay, - - ///// - ///// به ازای هر روز استفاده نشده از مرخصی درصدی از حقوق - ///// - //Percentage, - ///// - ///// به ازای هر رور استفاده نشده از مرخصی به صورت مبلغ اختصاصی پرداخت میشود - ///// - //Money -} \ No newline at end of file diff --git a/0_Framework/Domain/CustomizeCheckoutValueObjects/MarriedAllowance.cs b/0_Framework/Domain/CustomizeCheckoutValueObjects/MarriedAllowance.cs deleted file mode 100644 index 880efe6f..00000000 --- a/0_Framework/Domain/CustomizeCheckoutValueObjects/MarriedAllowance.cs +++ /dev/null @@ -1,34 +0,0 @@ -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 -{ - /// - ///محاسبه نمیشود - /// - None, - - /// - /// به صورت درصدی - /// - PercentageFromSalary, - - /// - /// به صورت مبلغ اختصاصی پرداخت میشود - /// - Money -} \ No newline at end of file diff --git a/0_Framework/Domain/CustomizeCheckoutValueObjects/MaxMonthDays.cs b/0_Framework/Domain/CustomizeCheckoutValueObjects/MaxMonthDays.cs deleted file mode 100644 index a783a3a8..00000000 --- a/0_Framework/Domain/CustomizeCheckoutValueObjects/MaxMonthDays.cs +++ /dev/null @@ -1,17 +0,0 @@ -namespace _0_Framework.Domain.CustomizeCheckoutValueObjects; - -public enum MaxMonthDays -{ - /// - /// تعداد روز های ماه به صورت عادی باشد و تغییری در آن اعمال نشود - /// - Default, - /// - /// تمامی ماه ها 30 روزه حساب شوند - /// - ThirtyDaysForAllMonth, - /// - /// تمامی ماه ها 30 روزه حساب شوند ولی اسفند 29 روزه - /// - ThirtyDaysForAllMonthExceptEsfand -} \ No newline at end of file diff --git a/0_Framework/Domain/CustomizeCheckoutValueObjects/NightWorkPay.cs b/0_Framework/Domain/CustomizeCheckoutValueObjects/NightWorkPay.cs deleted file mode 100644 index 0cc76cbf..00000000 --- a/0_Framework/Domain/CustomizeCheckoutValueObjects/NightWorkPay.cs +++ /dev/null @@ -1,34 +0,0 @@ -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 -{ - /// - ///محاسبه نمیشود - /// - None, - - /// - /// به صورت درصدی از مزد روزانه - /// - PercentageFromSalary, - - /// - /// مقدار پول شخصی سازی شده برای هر ساعت شب کاری - /// - MoneyPerHour -} \ No newline at end of file diff --git a/0_Framework/Domain/CustomizeCheckoutValueObjects/OverTimePay.cs b/0_Framework/Domain/CustomizeCheckoutValueObjects/OverTimePay.cs deleted file mode 100644 index e0c5c154..00000000 --- a/0_Framework/Domain/CustomizeCheckoutValueObjects/OverTimePay.cs +++ /dev/null @@ -1,31 +0,0 @@ -namespace _0_Framework.Domain.CustomizeCheckoutValueObjects; -public enum OverTimePayType -{ - /// - ///محاسبه نمیشود - /// - None, - /// - /// مقدار پول شخصی سازی شده برای هر ساعت - /// - MoneyPerHour, - /// - /// به صورت درصدی از مزد روزانه به ازای هر ساعت. - /// - 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; } -} \ No newline at end of file diff --git a/0_Framework/Domain/CustomizeCheckoutValueObjects/ShiftPay.cs b/0_Framework/Domain/CustomizeCheckoutValueObjects/ShiftPay.cs deleted file mode 100644 index fa3fe879..00000000 --- a/0_Framework/Domain/CustomizeCheckoutValueObjects/ShiftPay.cs +++ /dev/null @@ -1,66 +0,0 @@ -namespace _0_Framework.Domain.CustomizeCheckoutValueObjects; - -public class ShiftPay -{ - public ShiftPay(ShiftType shiftType, ShiftPayType shiftPayType, double value) - { - ShiftType = shiftType; - ShiftPayType = shiftPayType; - Value = value; - } - - private ShiftPay() - { - } - - /// - /// نوع نوبت کاری را مشخص میکند . به عنوان مثال: صبح و عصر، عصر و شب و غیره... - /// - public ShiftType ShiftType { get; private set; } - - /// - /// نوع پرداخت را مشخص میکند که آیا به صورت درصدی است یا مبلغ اختصاصی. - /// - public ShiftPayType ShiftPayType { get; private set; } - - public double Value { get; private set; } -} -public enum ShiftPayType -{ - /// - ///محاسبه نمیشود - /// - None, - - /// - /// درصدی از حقوق - /// - PercentageOfSalary, - - /// - /// به صورت مبلغ اختصاصی پرداخت میشود - /// - Money -} -public enum ShiftType -{ - /// - ///محاسبه نمیشود - /// - None, - - /// - /// صبح و عصر - /// - MorningAndEvening, - - /// - /// عصر و شب - /// - EveningAndNight, - - /// - /// صبح و عصر و شب - /// - MorningAndEveningAndNight -} \ No newline at end of file diff --git a/AccountManagement.Application.Contracts/Account/AccountChangePasswordAndPhoneNumber.cs b/AccountManagement.Application.Contracts/Account/AccountChangePasswordAndPhoneNumber.cs new file mode 100644 index 00000000..7b139a4e --- /dev/null +++ b/AccountManagement.Application.Contracts/Account/AccountChangePasswordAndPhoneNumber.cs @@ -0,0 +1,9 @@ +namespace AccountManagement.Application.Contracts.Account; + +public class AccountChangePasswordAndPhoneNumber +{ + public long AccountId { get; set; } + public string Password { get; set; } + public string RePassword { get; set; } + public string PhoneNumber { get; set; } +} \ No newline at end of file diff --git a/AccountManagement.Application.Contracts/Account/AccountSearchModel.cs b/AccountManagement.Application.Contracts/Account/AccountSearchModel.cs index 68540f6c..0bba1433 100644 --- a/AccountManagement.Application.Contracts/Account/AccountSearchModel.cs +++ b/AccountManagement.Application.Contracts/Account/AccountSearchModel.cs @@ -2,6 +2,7 @@ public class AccountSearchModel { + public long Id { get; set; } public string Fullname { get; set; } public string Username { get; set; } public string Mobile { get; set; } diff --git a/AccountManagement.Application.Contracts/Account/IAccountApplication.cs b/AccountManagement.Application.Contracts/Account/IAccountApplication.cs index 990bcb18..19ac782c 100644 --- a/AccountManagement.Application.Contracts/Account/IAccountApplication.cs +++ b/AccountManagement.Application.Contracts/Account/IAccountApplication.cs @@ -43,5 +43,14 @@ public interface IAccountApplication List GetAccountEqualToLowerPositionValue(); OperationResult ReLogin(); + #endregion + + #region Pooya + + //UserClaimsResponseDTO GetClaimsForSignIn(Login command); + OperationResult ChangePasswordAndPhoneNumber(AccountChangePasswordAndPhoneNumber command); + OperationResult IsPhoneNumberAndPasswordValid(long accountId, string phoneNumber, string password, string rePassword); + + #endregion } \ No newline at end of file diff --git a/AccountManagement.Application.Contracts/CameraAccount/ICameraAccountApplication.cs b/AccountManagement.Application.Contracts/CameraAccount/ICameraAccountApplication.cs index ea83815b..18c8448c 100644 --- a/AccountManagement.Application.Contracts/CameraAccount/ICameraAccountApplication.cs +++ b/AccountManagement.Application.Contracts/CameraAccount/ICameraAccountApplication.cs @@ -18,6 +18,8 @@ public interface ICameraAccountApplication OperationResult DeActive(long id); OperationResult ChangePass(ChangePassword command); bool HasCameraAccount(long workshopId, long accountId); + List GetAllByWorkshopIdAndAccountId(long accountId, List<(long Id, string Name)> workshops); + OperationResult CheckUsername(string username); #region Safa diff --git a/AccountManagement.Application.Contracts/SubAccount/AssignPermissionsToRole.cs b/AccountManagement.Application.Contracts/SubAccount/AssignPermissionsToRole.cs new file mode 100644 index 00000000..07d5bae3 --- /dev/null +++ b/AccountManagement.Application.Contracts/SubAccount/AssignPermissionsToRole.cs @@ -0,0 +1,10 @@ +using System.Collections.Generic; + +namespace AccountManagement.Application.Contracts.SubAccount +{ + public class AssignPermissionsToRole + { + public long RoleId { get; set; } + public List Permissions { get; set; } + } +} diff --git a/AccountManagement.Application.Contracts/SubAccount/AssignSubAccountRole.cs b/AccountManagement.Application.Contracts/SubAccount/AssignSubAccountRole.cs new file mode 100644 index 00000000..01623f61 --- /dev/null +++ b/AccountManagement.Application.Contracts/SubAccount/AssignSubAccountRole.cs @@ -0,0 +1,8 @@ +namespace AccountManagement.Application.Contracts.SubAccount +{ + public class AssignSubAccountRole + { + public long SubAccountRoleId { get; set; } + public long SubAccountId { get; set; } + } +} diff --git a/AccountManagement.Application.Contracts/SubAccount/CreateSubAccount.cs b/AccountManagement.Application.Contracts/SubAccount/CreateSubAccount.cs new file mode 100644 index 00000000..9f82aa3c --- /dev/null +++ b/AccountManagement.Application.Contracts/SubAccount/CreateSubAccount.cs @@ -0,0 +1,20 @@ +using _0_Framework.Application; +using System.Collections.Generic; + +namespace AccountManagement.Application.Contracts.SubAccount +{ + public class CreateSubAccount + { + public long AccountId { get; set; } + public string Password { get; set; } + public long SubAccountRoleId { get; set; } + public IsActive IsActive { get; set; } + public string FName { get; set; } + public string LName { get; set; } + public string NationalCode { get; set; } + public string PhoneNumber { get; set; } + public string Username { get; set; } + public string ProfilePhoto { get; set; } + public List WorkshopIds { get; set; } + } +} diff --git a/AccountManagement.Application.Contracts/SubAccount/CreateSubAccountRole.cs b/AccountManagement.Application.Contracts/SubAccount/CreateSubAccountRole.cs new file mode 100644 index 00000000..2e7a9035 --- /dev/null +++ b/AccountManagement.Application.Contracts/SubAccount/CreateSubAccountRole.cs @@ -0,0 +1,12 @@ +using System.Collections.Generic; +using AccountManagement.Application.Contracts.SubAccountPermissionSubtitle; + +namespace AccountManagement.Application.Contracts.SubAccount +{ + public class CreateSubAccountRole + { + public string Title { get; set; } + public long AccountId { get; set; } + public List Permissions { get; set; } + } +} diff --git a/AccountManagement.Application.Contracts/SubAccount/EditSubAccount.cs b/AccountManagement.Application.Contracts/SubAccount/EditSubAccount.cs new file mode 100644 index 00000000..f2b9eeda --- /dev/null +++ b/AccountManagement.Application.Contracts/SubAccount/EditSubAccount.cs @@ -0,0 +1,20 @@ +using System.Collections.Generic; + +namespace AccountManagement.Application.Contracts.SubAccount +{ + public class EditSubAccount + { + public long SubAccountId { get; set; } + public string FName { get; set; } + public string LName { get; set; } + public string NationalCode { get; set; } + public string ProfilePhoto { get; set; } + public string Password { get; set; } + public string PhoneNumber { get; set; } + public string RePassword { get; set; } + public long SubAccountRoleId { get; set; } + public List WorkshopIds { get; set; } + + + } +} diff --git a/AccountManagement.Application.Contracts/SubAccount/EditSubAccountProfile.cs b/AccountManagement.Application.Contracts/SubAccount/EditSubAccountProfile.cs new file mode 100644 index 00000000..cd1be100 --- /dev/null +++ b/AccountManagement.Application.Contracts/SubAccount/EditSubAccountProfile.cs @@ -0,0 +1,11 @@ +namespace AccountManagement.Application.Contracts.SubAccount +{ + public class EditSubAccountProfile + { + public long SubAccountId { get; set; } + public string FullName { get; set; } + public string Username { get; set; } + public string ProfilePhoto { get; set; } + + } +} diff --git a/AccountManagement.Application.Contracts/SubAccount/EditSubAccountRole.cs b/AccountManagement.Application.Contracts/SubAccount/EditSubAccountRole.cs new file mode 100644 index 00000000..b3c615af --- /dev/null +++ b/AccountManagement.Application.Contracts/SubAccount/EditSubAccountRole.cs @@ -0,0 +1,7 @@ +namespace AccountManagement.Application.Contracts.SubAccount +{ + public class EditSubAccountRole : CreateSubAccountRole + { + public long Id { get; set; } + } +} diff --git a/AccountManagement.Application.Contracts/SubAccount/ISubAccountApplication.cs b/AccountManagement.Application.Contracts/SubAccount/ISubAccountApplication.cs new file mode 100644 index 00000000..da71e581 --- /dev/null +++ b/AccountManagement.Application.Contracts/SubAccount/ISubAccountApplication.cs @@ -0,0 +1,31 @@ + + +using _0_Framework.Application; +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace AccountManagement.Application.Contracts.SubAccount +{ + public interface ISubAccountApplication + { + OperationResult Create(CreateSubAccount cmd, List accountWorkshopsList); + OperationResult EditSubAccount(EditSubAccount cmd, List accountWorkshopsList); + OperationResult ChangePassword(SubAccountChangePassword cmd); + OperationResult Delete(long id); + SubAccountViewModel GetDetails(long subAccountId); + OperationResult CreateRole(CreateSubAccountRole command); + OperationResult EditRole(EditSubAccountRole cmd); + List GetAllByAccountId(long accountId, int pageIndex); + OperationResult AssignRoleToSubAccount(AssignSubAccountRole command); + OperationResult DeleteRole(long id); + List GetSubAccountRolesByAccountId(long accountId); + OperationResult Deactivate(long subAccountId); + OperationResult Activate(long subAccountId); + List GetSubAccountsByAccountIdGroupedByRole(long accountId); + SubAccountRoleViewModel GetRoleDetails(long subAccountRoleId); + OperationResult ChangePasswordAndPhoneNumber(SubAccountChangePasswordAndPhoneNumber cmd); + OperationResult IsPhoneNumberAndPasswordValid(long accountId, string phoneNumber, string password, string rePassword); + Task SendVerifyCodeForPasswordChange(string phone, long id); + SubAccountViewModel GetByVerifyCodeAndPhoneNumber(string code, string phone); + } +} diff --git a/AccountManagement.Application.Contracts/SubAccount/SubAccountChangePassword.cs b/AccountManagement.Application.Contracts/SubAccount/SubAccountChangePassword.cs new file mode 100644 index 00000000..ff82f32d --- /dev/null +++ b/AccountManagement.Application.Contracts/SubAccount/SubAccountChangePassword.cs @@ -0,0 +1,9 @@ +namespace AccountManagement.Application.Contracts.SubAccount +{ + public class SubAccountChangePassword + { + public long SubAccountId { get; set; } + //public string OldPassword { get; set; } + public string NewPassword { get; set; } + } +} diff --git a/AccountManagement.Application.Contracts/SubAccount/SubAccountChangePasswordAndPhoneNumber.cs b/AccountManagement.Application.Contracts/SubAccount/SubAccountChangePasswordAndPhoneNumber.cs new file mode 100644 index 00000000..0d6cf251 --- /dev/null +++ b/AccountManagement.Application.Contracts/SubAccount/SubAccountChangePasswordAndPhoneNumber.cs @@ -0,0 +1,9 @@ +namespace AccountManagement.Application.Contracts.SubAccount; + +public class SubAccountChangePasswordAndPhoneNumber +{ + public long SubAccountId { get; set; } + public string Password { get; set; } + public string RePassword { get; set; } + public string PhoneNumber { get; set; } +} \ No newline at end of file diff --git a/AccountManagement.Application.Contracts/SubAccount/SubAccountRoleViewModel.cs b/AccountManagement.Application.Contracts/SubAccount/SubAccountRoleViewModel.cs new file mode 100644 index 00000000..2b1ad82e --- /dev/null +++ b/AccountManagement.Application.Contracts/SubAccount/SubAccountRoleViewModel.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; + +namespace AccountManagement.Application.Contracts.SubAccount +{ + public class SubAccountRoleViewModel + { + public long Id { get; set; } + public string Title { get; set; } + public List Permissions { get; set; } + } +} diff --git a/AccountManagement.Application.Contracts/SubAccount/SubAccountViewModel.cs b/AccountManagement.Application.Contracts/SubAccount/SubAccountViewModel.cs new file mode 100644 index 00000000..dae132c0 --- /dev/null +++ b/AccountManagement.Application.Contracts/SubAccount/SubAccountViewModel.cs @@ -0,0 +1,28 @@ +using _0_Framework.Application; +using System.Collections.Generic; + +namespace AccountManagement.Application.Contracts.SubAccount +{ + public class SubAccountViewModel + { + public long Id { get; set; } + + //نام صاحب اکانت + public string AccountFullName { get; set; } + + //نام صاحب ساب اکانت + public string SubAccountFullName { get; set; } + public string FName { get; set; } + public string LName { get; set; } + public string NationalCode { get; set; } + public string SubAccountRole { get; set; } + + public List<(long Id, string Name)> SubAccountWorkshops { get; set; } + + public string Username { get; set; } + public string PhoneNumber { get; set; } + public IsActive IsActive { get; set; } + public string ProfilePhoto { get; set; } + public long SubAccountRoleId { get; set; } + } +} diff --git a/AccountManagement.Application.Contracts/SubAccount/SubAccountsGroupedByRoleViewModel.cs b/AccountManagement.Application.Contracts/SubAccount/SubAccountsGroupedByRoleViewModel.cs new file mode 100644 index 00000000..cc396675 --- /dev/null +++ b/AccountManagement.Application.Contracts/SubAccount/SubAccountsGroupedByRoleViewModel.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; + +namespace AccountManagement.Application.Contracts.SubAccount +{ + public class SubAccountsGroupedByRoleViewModel + { + public long RoleId { get; set; } + public string RoleTitle { get; set; } + public List SubAccounts { get; set; } + } +} diff --git a/AccountManagement.Application.Contracts/SubAccountPermissionSubtitle/CreateSubAccountPermissionSubtitle1.cs b/AccountManagement.Application.Contracts/SubAccountPermissionSubtitle/CreateSubAccountPermissionSubtitle1.cs new file mode 100644 index 00000000..6876afeb --- /dev/null +++ b/AccountManagement.Application.Contracts/SubAccountPermissionSubtitle/CreateSubAccountPermissionSubtitle1.cs @@ -0,0 +1,8 @@ +namespace AccountManagement.Application.Contracts.SubAccountPermissionSubtitle +{ + public class CreateSubAccountPermissionSubtitle1 + { + public string Title { get; set; } + public int Code { get; set; } + } +} diff --git a/AccountManagement.Application.Contracts/SubAccountPermissionSubtitle/CreateSubAccountPermissionSubtitle2.cs b/AccountManagement.Application.Contracts/SubAccountPermissionSubtitle/CreateSubAccountPermissionSubtitle2.cs new file mode 100644 index 00000000..8eef6b0b --- /dev/null +++ b/AccountManagement.Application.Contracts/SubAccountPermissionSubtitle/CreateSubAccountPermissionSubtitle2.cs @@ -0,0 +1,9 @@ +namespace AccountManagement.Application.Contracts.SubAccountPermissionSubtitle +{ + public class CreateSubAccountPermissionSubtitle2 + { + public string Title { get; set; } + public int Code { get; set; } + public long ParentId { get; set; } + } +} diff --git a/AccountManagement.Application.Contracts/SubAccountPermissionSubtitle/CreateSubAccountPermissionSubtitle3.cs b/AccountManagement.Application.Contracts/SubAccountPermissionSubtitle/CreateSubAccountPermissionSubtitle3.cs new file mode 100644 index 00000000..68624f2d --- /dev/null +++ b/AccountManagement.Application.Contracts/SubAccountPermissionSubtitle/CreateSubAccountPermissionSubtitle3.cs @@ -0,0 +1,9 @@ +namespace AccountManagement.Application.Contracts.SubAccountPermissionSubtitle +{ + public class CreateSubAccountPermissionSubtitle3 + { + public string Title { get; set; } + public int Code { get; set; } + public long ParentId { get; set; } + } +} diff --git a/AccountManagement.Application.Contracts/SubAccountPermissionSubtitle/CreateSubAccountPermissionSubtitle4.cs b/AccountManagement.Application.Contracts/SubAccountPermissionSubtitle/CreateSubAccountPermissionSubtitle4.cs new file mode 100644 index 00000000..2112dca5 --- /dev/null +++ b/AccountManagement.Application.Contracts/SubAccountPermissionSubtitle/CreateSubAccountPermissionSubtitle4.cs @@ -0,0 +1,9 @@ +namespace AccountManagement.Application.Contracts.SubAccountPermissionSubtitle +{ + public class CreateSubAccountPermissionSubtitle4 + { + public string Title { get; set; } + public int Code { get; set; } + public long ParentId { get; set; } + } +} diff --git a/AccountManagement.Application.Contracts/SubAccountPermissionSubtitle/EditSubAccountPermissionSubtitle1.cs b/AccountManagement.Application.Contracts/SubAccountPermissionSubtitle/EditSubAccountPermissionSubtitle1.cs new file mode 100644 index 00000000..7f6e2a3a --- /dev/null +++ b/AccountManagement.Application.Contracts/SubAccountPermissionSubtitle/EditSubAccountPermissionSubtitle1.cs @@ -0,0 +1,9 @@ +namespace AccountManagement.Application.Contracts.SubAccountPermissionSubtitle +{ + public class EditSubAccountPermissionSubtitle1 + { + public long Id { get; set; } + public string Title { get; set; } + public int Code { get; set; } + } +} diff --git a/AccountManagement.Application.Contracts/SubAccountPermissionSubtitle/EditSubAccountPermissionSubtitle2.cs b/AccountManagement.Application.Contracts/SubAccountPermissionSubtitle/EditSubAccountPermissionSubtitle2.cs new file mode 100644 index 00000000..fff3f240 --- /dev/null +++ b/AccountManagement.Application.Contracts/SubAccountPermissionSubtitle/EditSubAccountPermissionSubtitle2.cs @@ -0,0 +1,11 @@ +namespace AccountManagement.Application.Contracts.SubAccountPermissionSubtitle +{ + public class EditSubAccountPermissionSubtitle2 + { + public string Title { get; set; } + public int Code { get; set; } + public long Id { get; set; } + public long ParentId { get; set; } + + } +} diff --git a/AccountManagement.Application.Contracts/SubAccountPermissionSubtitle/EditSubAccountPermissionSubtitle3.cs b/AccountManagement.Application.Contracts/SubAccountPermissionSubtitle/EditSubAccountPermissionSubtitle3.cs new file mode 100644 index 00000000..382d2135 --- /dev/null +++ b/AccountManagement.Application.Contracts/SubAccountPermissionSubtitle/EditSubAccountPermissionSubtitle3.cs @@ -0,0 +1,10 @@ +namespace AccountManagement.Application.Contracts.SubAccountPermissionSubtitle +{ + public class EditSubAccountPermissionSubtitle3 + { + public string Title { get; set; } + public int Code { get; set; } + public long Id { get; set; } + public long ParentId { get; set; } + } +} diff --git a/AccountManagement.Application.Contracts/SubAccountPermissionSubtitle/EditSubAccountPermissionSubtitle4.cs b/AccountManagement.Application.Contracts/SubAccountPermissionSubtitle/EditSubAccountPermissionSubtitle4.cs new file mode 100644 index 00000000..f72851d3 --- /dev/null +++ b/AccountManagement.Application.Contracts/SubAccountPermissionSubtitle/EditSubAccountPermissionSubtitle4.cs @@ -0,0 +1,10 @@ +namespace AccountManagement.Application.Contracts.SubAccountPermissionSubtitle +{ + public class EditSubAccountPermissionSubtitle4 + { + public string Title { get; set; } + public int Code { get; set; } + public long Id { get; set; } + public long ParentId { get; set; } + } +} diff --git a/AccountManagement.Application.Contracts/SubAccountPermissionSubtitle/ISubAccountPermissionSubtitleApplication.cs b/AccountManagement.Application.Contracts/SubAccountPermissionSubtitle/ISubAccountPermissionSubtitleApplication.cs new file mode 100644 index 00000000..5dec2ed1 --- /dev/null +++ b/AccountManagement.Application.Contracts/SubAccountPermissionSubtitle/ISubAccountPermissionSubtitleApplication.cs @@ -0,0 +1,26 @@ +using _0_Framework.Application; +using System.Collections.Generic; + +namespace AccountManagement.Application.Contracts.SubAccountPermissionSubtitle +{ + public interface ISubAccountPermissionSubtitleApplication + { + OperationResult Create(CreateSubAccountPermissionSubtitle1 command); + OperationResult Create(CreateSubAccountPermissionSubtitle2 command); + OperationResult Create(CreateSubAccountPermissionSubtitle3 command); + OperationResult Create(CreateSubAccountPermissionSubtitle4 command); + + OperationResult Edit(EditSubAccountPermissionSubtitle1 command); + OperationResult Edit(EditSubAccountPermissionSubtitle2 command); + OperationResult Edit(EditSubAccountPermissionSubtitle3 command); + OperationResult Edit(EditSubAccountPermissionSubtitle4 command); + + List GetAllSubtitlesNested(); + + + OperationResult DeleteSubtitle1(long id); + OperationResult DeleteSubtitle2(long id); + OperationResult DeleteSubtitle3(long id); + OperationResult DeleteSubtitle4(long id); + } +} diff --git a/AccountManagement.Application.Contracts/SubAccountPermissionSubtitle/NestedSubAccountPermissionSubtitlesViewModel.cs b/AccountManagement.Application.Contracts/SubAccountPermissionSubtitle/NestedSubAccountPermissionSubtitlesViewModel.cs new file mode 100644 index 00000000..e3c83f65 --- /dev/null +++ b/AccountManagement.Application.Contracts/SubAccountPermissionSubtitle/NestedSubAccountPermissionSubtitlesViewModel.cs @@ -0,0 +1,10 @@ +using System.Collections.Generic; + +namespace AccountManagement.Application.Contracts.SubAccountPermissionSubtitle +{ + public class NestedSubAccountPermissionSubtitlesViewModel + { + public List Subtitles1 { get; set; } + + } +} diff --git a/AccountManagement.Application.Contracts/SubAccountPermissionSubtitle/SubAccountPermissionSubtitleViewModel.cs b/AccountManagement.Application.Contracts/SubAccountPermissionSubtitle/SubAccountPermissionSubtitleViewModel.cs new file mode 100644 index 00000000..0731271d --- /dev/null +++ b/AccountManagement.Application.Contracts/SubAccountPermissionSubtitle/SubAccountPermissionSubtitleViewModel.cs @@ -0,0 +1,14 @@ +using System.Collections.Generic; + +namespace AccountManagement.Application.Contracts.SubAccountPermissionSubtitle +{ + public class SubAccountPermissionSubtitleViewModel + { + public long Id { get; set; } + public int Code { get; set; } + public string Title { get; set; } + + public SubAccountPermissionSubtitleViewModel Parent { get; set; } = null; + public List Children { get; set; } = null; + } +} diff --git a/AccountManagement.Application/AccountApplication.cs b/AccountManagement.Application/AccountApplication.cs index 92542c51..e2346312 100644 --- a/AccountManagement.Application/AccountApplication.cs +++ b/AccountManagement.Application/AccountApplication.cs @@ -18,6 +18,12 @@ using Microsoft.AspNetCore.Mvc.Rendering; using static Microsoft.EntityFrameworkCore.DbLoggerCategory.Database; using TaskManager.Domain.PositionAgg; using Company.Domain.WorkshopAgg; +using System.Security.Claims; +using AccountManagement.Domain.SubAccountAgg; +using AccountManagement.Domain.SubAccountPermissionSubtitle1Agg; +using AccountManagement.Domain.SubAccountRoleAgg; +using Company.Domain.WorkshopSubAccountAgg; + //using AccountManagement.Domain.RoleAgg; namespace AccountManagement.Application; @@ -34,10 +40,13 @@ public class AccountApplication : IAccountApplication private readonly IPositionRepository _positionRepository; private readonly IAccountLeftworkRepository _accountLeftworkRepository; private readonly IWorkshopRepository _workshopRepository; + private readonly ISubAccountRepository _subAccountRepository; + private readonly ISubAccountRoleRepository _subAccountRoleRepository; + private readonly IWorkshopSubAccountRepository _workshopSubAccountRepository; + private readonly ISubAccountPermissionSubtitle1Repository _accountPermissionSubtitle1Repository; - - public AccountApplication(IAccountRepository accountRepository, IPasswordHasher passwordHasher, - IFileUploader fileUploader, IAuthHelper authHelper, IRoleRepository roleRepository, IWorker worker, ISmsService smsService, ICameraAccountRepository cameraAccountRepository, IPositionRepository positionRepository, IAccountLeftworkRepository accountLeftworkRepository, IWorkshopRepository workshopRepository) + public AccountApplication(IAccountRepository accountRepository, IPasswordHasher passwordHasher, + IFileUploader fileUploader, IAuthHelper authHelper, IRoleRepository roleRepository, IWorker worker, ISmsService smsService, ICameraAccountRepository cameraAccountRepository, IPositionRepository positionRepository, IAccountLeftworkRepository accountLeftworkRepository, IWorkshopRepository workshopRepository, ISubAccountRepository subAccountRepository, ISubAccountRoleRepository subAccountRoleRepository, IWorkshopSubAccountRepository workshopSubAccountRepository, ISubAccountPermissionSubtitle1Repository accountPermissionSubtitle1Repository) { _authHelper = authHelper; _roleRepository = roleRepository; @@ -46,6 +55,10 @@ public class AccountApplication : IAccountApplication _positionRepository = positionRepository; _accountLeftworkRepository = accountLeftworkRepository; _workshopRepository = workshopRepository; + _subAccountRepository = subAccountRepository; + _subAccountRoleRepository = subAccountRoleRepository; + _workshopSubAccountRepository = workshopSubAccountRepository; + _accountPermissionSubtitle1Repository = accountPermissionSubtitle1Repository; _fileUploader = fileUploader; _passwordHasher = passwordHasher; _accountRepository = accountRepository; @@ -203,8 +216,9 @@ public class AccountApplication : IAccountApplication var account = _accountRepository.GetBy(command.Username); var cameraAccount = _cameraAccountRepository.GetBy(command.Username); - if (account == null && cameraAccount == null) - return operation.Failed(ApplicationMessages.WrongUserPass); + SubAccount subAccount = _subAccountRepository.GetBy(command.Username); + if (account == null && cameraAccount == null && subAccount == null) + return operation.Failed(ApplicationMessages.WrongUserPass); if (account != null) { @@ -230,7 +244,9 @@ public class AccountApplication : IAccountApplication if (account.ClientAriaPermission == "true" && account.AdminAreaPermission == "false" && account.IsActiveString == "true") { - var workshopList = _workshopRepository.SearchForClient(new WorkshopSearchModel() { AccountId = account.id }) + var clientPermissions = _accountPermissionSubtitle1Repository.GetAllPermissionCodes(); + authViewModel.Permissions = clientPermissions; + var workshopList = _workshopRepository.SearchForClient(new WorkshopSearchModel() { AccountId = account.id }) .OrderByDescending(x => x.PersonnelCount).ToList().Select(x => new WorkshopClaim() { Slug = _passwordHasher.SlugHasher(x.Id), @@ -272,9 +288,35 @@ public class AccountApplication : IAccountApplication idAutoriz = 0; } - } - - return operation.Succcedded(idAutoriz); + } + + if (subAccount != null) + { + (bool Verified, bool NeedUpgrade) result = _passwordHasher.Check(subAccount.Password, command.Password); + if (!result.Verified) + return operation.Failed(ApplicationMessages.WrongUserPass); + var role = _subAccountRoleRepository.Get(subAccount.SubAccountRoleId); + + var permissions = role.RolePermissions.Select(x => x.PermissionCode).ToList(); + var authViewModel = new AuthViewModel(subAccount.AccountId, subAccount.SubAccountRoleId, subAccount.FullName + , subAccount.Username, subAccount.PhoneNumber, "", permissions, role.Title, "false", + "true", 0, subAccount.id); + var workshopList = _workshopSubAccountRepository.GetWorkshopsBySubAccountId(subAccount.id); + authViewModel.WorkshopList = workshopList.Select(x => new WorkshopClaim() + { + Slug = _passwordHasher.SlugHasher(x.WorkshopId), + Name = x.WorkshopName, + PersonnelCount = 0, + Id = x.WorkshopId + }).ToList(); + + if (workshopList.Any()) + authViewModel.WorkshopSlug = _passwordHasher.SlugHasher(workshopList.First().WorkshopId); + _authHelper.Signin(authViewModel); + idAutoriz = 2; + } + + return operation.Succcedded(idAutoriz); } public OperationResult LoginWithMobile(long id) { @@ -444,6 +486,9 @@ public class AccountApplication : IAccountApplication _authHelper.SignOut(); + + + var authViewModel = new AuthViewModel(account.id, account.RoleId, account.Fullname , account.Username, account.Mobile, account.ProfilePhoto, permissions, account.RoleName, "false", "true",null); authViewModel.WorkshopList = _workshopRepository.SearchForClient(new WorkshopSearchModel() { AccountId = account.id }) @@ -455,7 +500,10 @@ public class AccountApplication : IAccountApplication Id = x.Id } ).ToList(); - if (authViewModel.WorkshopList.Any()) + + var clientPermissions = _accountPermissionSubtitle1Repository.GetAllPermissionCodes(); + authViewModel.Permissions = clientPermissions; + if (authViewModel.WorkshopList.Any()) authViewModel.WorkshopSlug = _passwordHasher.SlugHasher(authViewModel.WorkshopList.First().Id); _authHelper.Signin(authViewModel); return operation.Succcedded(2); @@ -538,6 +586,163 @@ public class AccountApplication : IAccountApplication } + + + #endregion + #region Pooya + public OperationResult IsPhoneNumberAndPasswordValid(long accountId, string phoneNumber, string password, string rePassword) + { + OperationResult op = new(); + + var entity = _accountRepository.Get(accountId); + + if (entity == null) + return op.Failed(ApplicationMessages.RecordNotFound); + + if (!string.IsNullOrWhiteSpace(rePassword) || !string.IsNullOrWhiteSpace(password)) + { + if (rePassword != password) + return op.Failed("تکرار رمز عبور با رمز عبور مطابقت ندارد"); + + if (password.Length < 8) + return op.Failed("رمز عبور نمی تواند کمتر از 8 کاراکتر باشد"); + } + + if ((string.IsNullOrWhiteSpace(phoneNumber) || entity.Mobile == phoneNumber) && string.IsNullOrWhiteSpace(rePassword)) + return op.Failed("چیزی برای تغییر وجود ندارد"); + + + if (!string.IsNullOrWhiteSpace(phoneNumber) && entity.Mobile != phoneNumber) + { + phoneNumber = phoneNumber.Trim(); + if (phoneNumber.Length != 11) + return op.Failed("شماره تلفن همراه به درستی وارد نشده است"); + if (_accountRepository.Exists(x => x.Mobile == phoneNumber && x.id != accountId) || + _subAccountRepository.Exists(x => x.PhoneNumber == phoneNumber) || + _cameraAccountRepository.Exists(x => x.Mobile == phoneNumber)) + return op.Failed("قبلا یک حساب با این شماره ثبت شده است"); + } + + + return op.Succcedded(); + } + + public OperationResult ChangePasswordAndPhoneNumber(AccountChangePasswordAndPhoneNumber command) + { + OperationResult op = new(); + command.PhoneNumber = command.PhoneNumber.Trim(); + var entity = _accountRepository.Get(command.AccountId); + if (entity == null) + return op.Failed(ApplicationMessages.RecordNotFound); + var validationResult = IsPhoneNumberAndPasswordValid(command.AccountId, command.PhoneNumber, command.Password, command.RePassword); + if (validationResult.IsSuccedded == false) + return validationResult; + + if (!string.IsNullOrWhiteSpace(command.RePassword)) + { + + entity.ChangePassword(_passwordHasher.Hash(command.Password)); + } + + if (!string.IsNullOrWhiteSpace(command.PhoneNumber)) + { + entity.Edit(entity.Fullname, entity.Username, command.PhoneNumber, entity.RoleId, entity.ProfilePhoto, entity.RoleName); + } + _accountRepository.SaveChanges(); + return op.Succcedded(); + } + //public UserClaimsResponseDTO GetClaimsForSignIn(Login command) + //{ + // var operation = new OperationResult(); + // var claimsResponse = new UserClaimsResponseDTO() { UserType = UserType.Anonymous }; + + // if (string.IsNullOrWhiteSpace(command.Password)) + // return claimsResponse.Failed(ApplicationMessages.EmptyPassword); + + // if (string.IsNullOrWhiteSpace(command.Username)) + // return claimsResponse.Failed(ApplicationMessages.EmptyUsername); + + + // var account = _accountRepository.GetBy(command.Username); + // var cameraAccount = _cameraAccountRepository.GetBy(command.Username); + // if (account == null && cameraAccount == null) + // return claimsResponse.Failed(ApplicationMessages.WrongUserPass); + + // if (account != null) + // { + // (bool Verified, bool NeedUpgrade) result = _passwordHasher.Check(account.Password, command.Password); + // if (!result.Verified) + // return claimsResponse.Failed(ApplicationMessages.WrongUserPass); + // var permissions = _roleRepository.Get(account.RoleId) + // .Permissions + // .Select(x => x.Code) + // .ToList(); + // int? positionValue; + // if (account.PositionId != null) + // { + // positionValue = _positionRepository.Get((long)account.PositionId).PositionValue; + // } + // else + // { + // positionValue = null; + // } + // var authViewModel = new AuthViewModel(account.id, account.RoleId, account.Fullname + // , account.Username, account.Mobile, account.ProfilePhoto, permissions, account.RoleName, account.AdminAreaPermission, account.ClientAriaPermission, positionValue); + + // if (account.ClientAriaPermission == "true" && account.AdminAreaPermission == "false" && + // account.IsActiveString == "true") + // { + // var workshopList = _workshopRepository.SearchForClient(new WorkshopSearchModel() { AccountId = account.id }) + // .OrderByDescending(x => x.PersonnelCount).ToList().Select(x => new WorkshopClaim() + // { + // Slug = _passwordHasher.SlugHasher(x.Id), + // Name = x.WorkshopFullName, + // PersonnelCount = x.PersonnelCount, + // Id = x.Id + // } + // ).ToList(); + // authViewModel.WorkshopList = workshopList; + // if (workshopList.Any()) + // authViewModel.WorkshopSlug = _passwordHasher.SlugHasher(workshopList.First().Id); + // ClaimsIdentity claims = _authHelper.GetClaimsIdentityForSignIn(authViewModel); + // var encryptedClaim = Tools.SerializeToBson(claims); + // return claimsResponse.Succeeded(UserType.Client, encryptedClaim); + + // } + + + // if ((account.AdminAreaPermission == "true" && account.ClientAriaPermission == "true" && + // account.IsActiveString == "true") || (account.AdminAreaPermission == "true" && + // account.ClientAriaPermission == "false" && + // account.IsActiveString == "true")) + // { + // ClaimsIdentity claims = _authHelper.GetClaimsIdentityForSignIn(authViewModel); + // var encryptedClaim = Tools.SerializeToBson(claims); + // return claimsResponse.Succeeded(UserType.Admin, encryptedClaim); + // } + + // } + + // if (cameraAccount != null) + // { + // (bool Verified, bool NeedUpgrade) result = _passwordHasher.Check(cameraAccount.Password, command.Password); + // if (!result.Verified) + // return claimsResponse.Failed(ApplicationMessages.WrongUserPass); + + // var mobile = string.IsNullOrWhiteSpace(cameraAccount.Mobile) ? " " : cameraAccount.Mobile; + // var authViewModel = new CameraAuthViewModel(cameraAccount.id, cameraAccount.WorkshopId, + // cameraAccount.Username, mobile, cameraAccount.WorkshopName, cameraAccount.AccountId, cameraAccount.IsActiveSting); + // if (cameraAccount.IsActiveSting == "true") + // { + // var claims = _authHelper.GetCameraClaimsIdentityForSignIn(authViewModel); + // var serializedClaims = Tools.SerializeToBson(claims); + // return claimsResponse.Succeeded(UserType.Admin, serializedClaims); + + // } + // } + + // return claimsResponse.Failed(ApplicationMessages.WrongUserPass); + //} #endregion } \ No newline at end of file diff --git a/AccountManagement.Application/CameraAccountApplication.cs b/AccountManagement.Application/CameraAccountApplication.cs index 27aac649..a1885e7e 100644 --- a/AccountManagement.Application/CameraAccountApplication.cs +++ b/AccountManagement.Application/CameraAccountApplication.cs @@ -59,6 +59,22 @@ public class CameraAccountApplication : ICameraAccountApplication return _cameraAccountRepository.Exists(x => x.WorkshopId == workshopId && x.AccountId == accountId); } + public List GetAllByWorkshopIdAndAccountId(long accountId, List<(long Id, string Name)> workshops) + { + var cameraAccounts = _cameraAccountRepository.GetAllByAccountId(accountId); + + return cameraAccounts.Select(x => new CameraAccountViewModel() + { + AccountId = x.AccountId, + Id = x.Id, + IsActiveString = x.IsActiveString, + Username = x.Username, + Mobile = x.Mobile, + WorkshopId = x.WorkshopId, + WorkshopName = workshops.FirstOrDefault(y => x.WorkshopId == y.Id).Name + }).ToList(); + } + public OperationResult CheckUsername(string username) { var operation = new OperationResult(); diff --git a/AccountManagement.Application/SubAccountApplication.cs b/AccountManagement.Application/SubAccountApplication.cs new file mode 100644 index 00000000..2a005564 --- /dev/null +++ b/AccountManagement.Application/SubAccountApplication.cs @@ -0,0 +1,354 @@ +using _0_Framework.Application; +using _0_Framework.Application.Sms; +using AccountManagement.Application.Contracts.SubAccount; +using AccountManagement.Domain.AccountAgg; +using AccountManagement.Domain.CameraAccountAgg; +using AccountManagement.Domain.SubAccountAgg; +using AccountManagement.Domain.SubAccountRoleAgg; +using Company.Domain.WorkshopAccountAgg; +using Company.Domain.WorkshopSubAccountAgg; +using CompanyManagment.App.Contracts.Workshop; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using static Microsoft.EntityFrameworkCore.DbLoggerCategory.Database; + + +namespace AccountManagement.Application +{ + public class SubAccountApplication : ISubAccountApplication + { + private readonly ISubAccountRepository _subAccountRepository; + private readonly IPasswordHasher _passwordHasher; + private readonly ISubAccountRoleRepository _subAccountRoleRepository; + private readonly IWorkshopSubAccountRepository _workshopSubAccountRepository; + private readonly ICameraAccountRepository _cameraAccountRepository; + private readonly IAccountRepository _accountRepository; + private readonly ISmsService _smsService; + public SubAccountApplication(ISubAccountRepository subAccountRepository, IPasswordHasher passwordHasher, ISubAccountRoleRepository subAccountRoleRepository, + IWorkshopSubAccountRepository workshopSubAccountRepository, IAccountRepository accountRepository, ICameraAccountRepository cameraAccountRepository, ISmsService smsService) + { + _subAccountRepository = subAccountRepository; + _passwordHasher = passwordHasher; + _subAccountRoleRepository = subAccountRoleRepository; + _workshopSubAccountRepository = workshopSubAccountRepository; + _accountRepository = accountRepository; + _cameraAccountRepository = cameraAccountRepository; + _smsService = smsService; + } + + public OperationResult ChangePassword(SubAccountChangePassword cmd) + { + OperationResult op = new(); + var entity = _subAccountRepository.Get(cmd.SubAccountId); + if (entity == null) + return op.Failed(ApplicationMessages.RecordNotFound); + //(bool verified, bool needsUpgrade) = _passwordHasher.Check(entity.Password, cmd.OldPassword); + //if (!verified) + // return op.Failed(ApplicationMessages.WrongUserPass); + entity.ChangePassword(_passwordHasher.Hash(cmd.NewPassword)); + _subAccountRepository.SaveChanges(); + return op.Succcedded(); + + } + + public OperationResult ChangePasswordAndPhoneNumber(SubAccountChangePasswordAndPhoneNumber cmd) + { + OperationResult op = new(); + cmd.PhoneNumber = cmd.PhoneNumber.Trim(); + var entity = _subAccountRepository.Get(cmd.SubAccountId); + if (entity == null) + return op.Failed(ApplicationMessages.RecordNotFound); + var validationResult = IsPhoneNumberAndPasswordValid(cmd.SubAccountId, cmd.PhoneNumber, cmd.Password, cmd.RePassword); + if (validationResult.IsSuccedded == false) + return validationResult; + if (!string.IsNullOrWhiteSpace(cmd.PhoneNumber)) + { + + entity.ChangePhoneNumber(cmd.PhoneNumber); + } + + if (!string.IsNullOrWhiteSpace(cmd.RePassword)) + { + + entity.ChangePassword(_passwordHasher.Hash(cmd.Password)); + } + _subAccountRepository.SaveChanges(); + return op.Succcedded(); + + } + + public async Task SendVerifyCodeForPasswordChange(string phone, long id) + { + var operation = new OperationResult(); + var subAccount = _subAccountRepository.Get(id); + if (subAccount == null) + return operation.Failed(ApplicationMessages.RecordNotFound); + //var verifyCodeHash = _passwordHasher.Hash(verifyCode); + Random generator = new Random(); + String r = generator.Next(1, 1000000).ToString("D6"); + subAccount.SetVerifyCode(r); + _subAccountRepository.SaveChanges(); + _smsService.VerifySend(phone, r); + + TimeSpan delay = TimeSpan.FromSeconds(130); + await Task.Delay(delay); + + subAccount.SetVerifyCode(""); + _accountRepository.SaveChanges(); + return operation.Succcedded(); + } + public SubAccountViewModel GetByVerifyCodeAndPhoneNumber(string code, string phone) + { + return _subAccountRepository.GetByVerifyCodeAndPhoneNumber(code, phone); + } + public OperationResult Create(CreateSubAccount cmd, List accountWorkshopsList) + { + OperationResult op = new(); + + cmd.Username = cmd.Username.ToLower(); + cmd.PhoneNumber = cmd.PhoneNumber.Trim(); + + if (cmd.PhoneNumber.Length != 11) + return op.Failed("شماره تلفن همراه نامعتبر است"); + + if (!cmd.WorkshopIds.Any()) + return op.Failed("حداقل یک کارگاه را انتخاب کنید"); + + + if (!cmd.WorkshopIds.All(x => accountWorkshopsList.Contains(x))) + return op.Failed("خطای سیستمی"); + + + if (cmd.SubAccountRoleId == 0 || !_subAccountRoleRepository.Exists(x => cmd.SubAccountRoleId == x.id)) + return op.Failed("نقش مورد نظر وجود ندارد"); + + if (cmd.NationalCode.NationalCodeValid() != "valid") + return op.Failed("کد ملی وارد شده صحیح نمی باشد"); + + if (_subAccountRepository.Exists(x => x.Username == cmd.Username) || _accountRepository.Exists(x => x.Username == cmd.Username) || + _cameraAccountRepository.Exists(x => x.Username == cmd.Username)) + return op.Failed("نام کاربری نمی تواند تکراری باشد"); + + var entity = new SubAccount(cmd.AccountId, cmd.SubAccountRoleId, cmd.NationalCode, cmd.FName, cmd.LName, cmd.PhoneNumber, cmd.Username, _passwordHasher.Hash(cmd.Password), + cmd.ProfilePhoto); + + if (_subAccountRepository.Exists(x => x.PhoneNumber == cmd.PhoneNumber) || _accountRepository.Exists(x => x.Mobile == cmd.PhoneNumber) || + _cameraAccountRepository.Exists(x => x.Mobile == cmd.PhoneNumber)) + return op.Failed("قبلا یک حساب با این شماره ثبت شده است"); + + _subAccountRepository.Create(entity); + _subAccountRepository.SaveChanges(); + + + var workshops = cmd.WorkshopIds.Select(x => new WorkshopSubAccount(x, entity.id)); + + foreach (var w in workshops) + _workshopSubAccountRepository.Create(w); + + _workshopSubAccountRepository.SaveChanges(); + return op.Succcedded(entity.id); + } + + public OperationResult Delete(long id) + { + OperationResult op = new(); + var entity = _subAccountRepository.Get(id); + if (entity == null) + return op.Failed(ApplicationMessages.RecordNotFound); + _subAccountRepository.Remove(entity); + _subAccountRepository.SaveChanges(); + return op.Succcedded(); + } + + public OperationResult EditSubAccount(EditSubAccount cmd, List accountWorkshopsList) + { + OperationResult op = new(); + + + + var entity = _subAccountRepository.Get(cmd.SubAccountId); + if (entity == null) + return op.Failed(ApplicationMessages.RecordNotFound); + + + + + if (!cmd.WorkshopIds.All(x => accountWorkshopsList.Contains(x))) + return op.Failed("خطای سیستمی"); + + + if (cmd.SubAccountRoleId == 0 || !_subAccountRoleRepository.Exists(x => cmd.SubAccountRoleId == x.id)) + return op.Failed("نقش مورد نظر وجود ندارد"); + + var workshopSubAccounts = _workshopSubAccountRepository.GetWorkshopsSubAccountEntityBySubAccountId(entity.id); + foreach (var workshopSubAccount in workshopSubAccounts) + _workshopSubAccountRepository.Remove(workshopSubAccount); + + + var workshops = cmd.WorkshopIds.Select(x => new WorkshopSubAccount(x, entity.id)); + + foreach (var w in workshops) + _workshopSubAccountRepository.Create(w); + + entity.Edit(cmd.SubAccountRoleId, cmd.NationalCode, cmd.FName, cmd.LName, cmd.ProfilePhoto); + _workshopSubAccountRepository.SaveChanges(); + _subAccountRepository.SaveChanges(); + return op.Succcedded(); + } + + public SubAccountViewModel GetDetails(long subAccountId) + { + var entity = _subAccountRepository.GetDetails(subAccountId); + if (entity == null) return null; + List<(long Id, string Name)> subAccountWorkshops = _workshopSubAccountRepository.GetWorkshopsBySubAccountId(subAccountId).Select(x => (x.WorkshopId, x.WorkshopName)).ToList(); + return new SubAccountViewModel() + { + Id = entity.id, + IsActive = entity.IsActive, + PhoneNumber = entity.PhoneNumber, + ProfilePhoto = entity.ProfilePhoto, + Username = entity.Username, + SubAccountFullName = entity.FullName, + SubAccountRole = entity.SubAccountRole.Title, + SubAccountWorkshops = subAccountWorkshops, + FName = entity.FName, + LName = entity.LName, + NationalCode = entity.NationalCode, + SubAccountRoleId = entity.SubAccountRoleId + }; + } + public SubAccountRoleViewModel GetRoleDetails(long subAccountRoleId) + { + var entity = _subAccountRoleRepository.Get(subAccountRoleId); + if (entity == null) return null; + return new SubAccountRoleViewModel() + { + Id = entity.id, + Title = entity.Title, + Permissions = entity.RolePermissions.Select(x => x.PermissionCode).ToList() + }; + } + + public List GetAllByAccountId(long accountId, int pageIndex) + { + return _subAccountRepository.GetAllByAccountId(accountId, pageIndex); + } + + public OperationResult CreateRole(CreateSubAccountRole command) + { + OperationResult op = new(); + if (_subAccountRoleRepository.Exists(x => x.AccountId == command.AccountId && x.Title.Trim() == command.Title.Trim())) + return op.Failed("یک نقش با این عنوان وجود دارد"); + var role = new SubAccountRole(command.Title, command.Permissions, command.AccountId); + _subAccountRoleRepository.Create(role); + _subAccountRoleRepository.SaveChanges(); + return op.Succcedded(role.id); + } + public OperationResult EditRole(EditSubAccountRole cmd) + { + OperationResult op = new(); + if (_subAccountRoleRepository.Exists(x => x.AccountId == cmd.AccountId && x.Title.Trim() == cmd.Title.Trim() && x.id != cmd.Id)) + return op.Failed("یک نقش با این عنوان وجود دارد"); + var entity = _subAccountRoleRepository.Get(cmd.Id); + if (entity == null) + return op.Failed(ApplicationMessages.RecordNotFound); + entity.Edit(cmd.Title, cmd.Permissions); + _subAccountRoleRepository.SaveChanges(); + return op.Succcedded(); + } + public OperationResult AssignRoleToSubAccount(AssignSubAccountRole command) + { + OperationResult op = new(); + var entity = _subAccountRepository.Get(command.SubAccountId); + + if (entity == null) + return op.Failed(ApplicationMessages.RecordNotFound); + + if (!_subAccountRoleRepository.Exists(x => x.id == command.SubAccountRoleId)) + return op.Failed("نقش انتخاب شده وجود ندارد"); + + entity.AssignRole(command.SubAccountRoleId); + _subAccountRoleRepository.SaveChanges(); + return op.Succcedded(); + } + public OperationResult DeleteRole(long id) + { + OperationResult op = new(); + var entity = _subAccountRoleRepository.Get(id); + if (entity == null) + return op.Failed(ApplicationMessages.RecordNotFound); + if (_subAccountRepository.Exists(x => x.SubAccountRoleId == id)) + return op.Failed("برای حذف نقش نباید حساب کاربری با این نقش وجود داشته باشد"); + _subAccountRoleRepository.Remove(entity); + _subAccountRoleRepository.SaveChanges(); + return op.Succcedded(); + } + public OperationResult Activate(long subAccountId) + { + OperationResult op = new(); + var entity = _subAccountRepository.Get(subAccountId); + if (entity == null) + return op.Failed(ApplicationMessages.RecordNotFound); + entity.Activate(); + _subAccountRepository.SaveChanges(); + return op.Succcedded(); + } + public OperationResult Deactivate(long subAccountId) + { + OperationResult op = new(); + var entity = _subAccountRepository.Get(subAccountId); + if (entity == null) + return op.Failed(ApplicationMessages.RecordNotFound); + entity.Deactivate(); + _subAccountRepository.SaveChanges(); + return op.Succcedded(); + } + public List GetSubAccountRolesByAccountId(long accountId) + { + return _subAccountRoleRepository.GetSubAccountRolesByAccountId(accountId); + } + public List GetSubAccountsByAccountIdGroupedByRole(long accountId) + { + return _subAccountRepository.GetSubAccountsByAccountIdGroupedByRole(accountId); + } + public OperationResult IsPhoneNumberAndPasswordValid(long subAccountId, string phoneNumber, string password, string rePassword) + { + OperationResult op = new(); + + var entity = _subAccountRepository.Get(subAccountId); + + if (entity == null) + return op.Failed(ApplicationMessages.RecordNotFound); + + if (!string.IsNullOrWhiteSpace(rePassword) || !string.IsNullOrWhiteSpace(password)) + { + if (rePassword != password) + return op.Failed("تکرار رمز عبور با رمز عبور مطابقت ندارد"); + + if (password.Length < 8) + return op.Failed("رمز عبور نمی تواند کمتر از 8 کاراکتر باشد"); + } + + + if ((string.IsNullOrWhiteSpace(phoneNumber) || entity.PhoneNumber == phoneNumber) && string.IsNullOrWhiteSpace(rePassword)) + return op.Failed("چیزی برای تغییر وجود ندارد"); + + + if (!string.IsNullOrWhiteSpace(phoneNumber) && entity.PhoneNumber != phoneNumber) + { + phoneNumber = phoneNumber.Trim(); + if (phoneNumber.Length != 11) + return op.Failed("شماره تلفن همراه به درستی وارد نشده است"); + if (_accountRepository.Exists(x => x.Mobile == phoneNumber) || + _subAccountRepository.Exists(x => x.PhoneNumber == phoneNumber && x.id != subAccountId) || + _cameraAccountRepository.Exists(x => x.Mobile == phoneNumber)) + return op.Failed("قبلا یک حساب با این شماره ثبت شده است"); + } + + + return op.Succcedded(); + } + } +} diff --git a/AccountManagement.Application/SubAccountPermissionSubtitleApplication.cs b/AccountManagement.Application/SubAccountPermissionSubtitleApplication.cs new file mode 100644 index 00000000..196b3a53 --- /dev/null +++ b/AccountManagement.Application/SubAccountPermissionSubtitleApplication.cs @@ -0,0 +1,268 @@ +using _0_Framework.Application; +using AccountManagement.Application.Contracts.SubAccountPermissionSubtitle; +using AccountManagement.Domain.SubAccountPermissionSubtitle1Agg; +using AccountManagement.Domain.SubAccountPermissionSubtitle2Agg; +using AccountManagement.Domain.SubAccountPermissionSubtitle3Agg; +using AccountManagement.Domain.SubAccountPermissionSubtitle4Agg; +using System.Collections.Generic; + +namespace AccountManagement.Application +{ + public class SubAccountPermissionSubtitleApplication : ISubAccountPermissionSubtitleApplication + { + private readonly ISubAccountPermissionSubtitle1Repository _subAccountPermissionSubtitle1Repository; + private readonly ISubAccountPermissionSubtitle2Repository _subAccountPermissionSubtitle2Repository; + private readonly ISubAccountPermissionSubtitle3Repository _subAccountPermissionSubtitle3Repository; + private readonly ISubAccountPermissionSubtitle4Repository _subAccountPermissionSubtitle4Repository; + + public SubAccountPermissionSubtitleApplication(ISubAccountPermissionSubtitle4Repository subAccountPermissionSubtitle4Repository, ISubAccountPermissionSubtitle3Repository subAccountPermissionSubtitle3Repository, ISubAccountPermissionSubtitle2Repository subAccountPermissionSubtitle2Repository, ISubAccountPermissionSubtitle1Repository subAccountPermissionSubtitle1Repository) + { + _subAccountPermissionSubtitle4Repository = subAccountPermissionSubtitle4Repository; + _subAccountPermissionSubtitle3Repository = subAccountPermissionSubtitle3Repository; + _subAccountPermissionSubtitle2Repository = subAccountPermissionSubtitle2Repository; + _subAccountPermissionSubtitle1Repository = subAccountPermissionSubtitle1Repository; + } + + public OperationResult Create(CreateSubAccountPermissionSubtitle1 command) + { + OperationResult op = new(); + + command.Title = command.Title.Trim(); + + if (_subAccountPermissionSubtitle1Repository.Exists(x => x.Title == command.Title)) + return op.Failed(ApplicationMessages.DuplicatedRecord); + if (string.IsNullOrWhiteSpace(command.Title)) + return op.Failed("عنوان نقش نمی تواند خالی باشند"); + + + var entity = new SubAccountPermissionSubtitle1(command.Title, command.Code); + + _subAccountPermissionSubtitle1Repository.Create(entity); + _subAccountPermissionSubtitle1Repository.SaveChanges(); + return op.Succcedded(entity.id); + } + + public OperationResult Create(CreateSubAccountPermissionSubtitle2 command) + { + OperationResult op = new(); + + command.Title = command.Title.Trim(); + + + if (!_subAccountPermissionSubtitle1Repository.Exists(x => x.id == command.ParentId)) + return op.Failed("خطای سیستمی"); + + if (_subAccountPermissionSubtitle2Repository.Exists(x => x.Title == command.Title)) + return op.Failed(ApplicationMessages.DuplicatedRecord); + + if (string.IsNullOrWhiteSpace(command.Title)) + return op.Failed("عنوان نقش نمی تواند خالی باشند"); + + + + + var entity = new SubAccountPermissionSubtitle2(command.Title, command.Code, command.ParentId); + + _subAccountPermissionSubtitle2Repository.Create(entity); + _subAccountPermissionSubtitle2Repository.SaveChanges(); + return op.Succcedded(entity.id); + } + + public OperationResult Create(CreateSubAccountPermissionSubtitle3 command) + { + OperationResult op = new(); + + command.Title = command.Title.Trim(); + + + if (!_subAccountPermissionSubtitle2Repository.Exists(x => x.id == command.ParentId)) + return op.Failed("خطای سیستمی"); + + if (_subAccountPermissionSubtitle3Repository.Exists(x => x.Title == command.Title)) + return op.Failed(ApplicationMessages.DuplicatedRecord); + + if (string.IsNullOrWhiteSpace(command.Title)) + return op.Failed("عنوان نقش نمی تواند خالی باشند"); + + + + var entity = new SubAccountPermissionSubtitle3(command.Title, command.Code, command.ParentId); + + _subAccountPermissionSubtitle3Repository.Create(entity); + _subAccountPermissionSubtitle3Repository.SaveChanges(); + return op.Succcedded(entity.id); + } + + public OperationResult Create(CreateSubAccountPermissionSubtitle4 command) + { + OperationResult op = new(); + + command.Title = command.Title.Trim(); + + + if (!_subAccountPermissionSubtitle3Repository.Exists(x => x.id == command.ParentId)) + return op.Failed("خطای سیستمی"); + + if (_subAccountPermissionSubtitle4Repository.Exists(x => x.Title == command.Title)) + return op.Failed(ApplicationMessages.DuplicatedRecord); + if (string.IsNullOrWhiteSpace(command.Title)) + return op.Failed("عنوان نقش نمی تواند خالی باشند"); + + + var entity = new SubAccountPermissionSubtitle4(command.Title, command.Code, command.ParentId); + + _subAccountPermissionSubtitle4Repository.Create(entity); + _subAccountPermissionSubtitle4Repository.SaveChanges(); + return op.Succcedded(entity.id); + } + + public OperationResult DeleteSubtitle1(long id) + { + OperationResult op = new(); + var entity = _subAccountPermissionSubtitle1Repository.Get(id); + if (entity == null) + return op.Failed(ApplicationMessages.RecordNotFound); + if (_subAccountPermissionSubtitle2Repository.Exists(x => x.ParentId == entity.id)) + return op.Failed("برای حذف کردن این نقش اول باید نقش های فرزند را حذف کنید"); + _subAccountPermissionSubtitle1Repository.Remove(entity); + _subAccountPermissionSubtitle1Repository.SaveChanges(); + return op.Succcedded(id); + } + + public OperationResult DeleteSubtitle2(long id) + { + OperationResult op = new(); + var entity = _subAccountPermissionSubtitle2Repository.Get(id); + if (entity == null) + return op.Failed(ApplicationMessages.RecordNotFound); + if (_subAccountPermissionSubtitle3Repository.Exists(x => x.ParentId == entity.id)) + return op.Failed("برای حذف کردن این نقش اول باید نقش های فرزند را حذف کنید"); + _subAccountPermissionSubtitle2Repository.Remove(entity); + _subAccountPermissionSubtitle2Repository.SaveChanges(); + return op.Succcedded(id); + } + + public OperationResult DeleteSubtitle3(long id) + { + OperationResult op = new(); + var entity = _subAccountPermissionSubtitle3Repository.Get(id); + if (entity == null) + return op.Failed(ApplicationMessages.RecordNotFound); + if (_subAccountPermissionSubtitle4Repository.Exists(x => x.ParentId == entity.id)) + return op.Failed("برای حذف کردن این نقش اول باید نقش های فرزند را حذف کنید"); + _subAccountPermissionSubtitle3Repository.Remove(entity); + _subAccountPermissionSubtitle3Repository.SaveChanges(); + return op.Succcedded(id); + } + + public OperationResult DeleteSubtitle4(long id) + { + OperationResult op = new(); + var entity = _subAccountPermissionSubtitle4Repository.Get(id); + if (entity == null) + return op.Failed(ApplicationMessages.RecordNotFound); + _subAccountPermissionSubtitle4Repository.Remove(entity); + _subAccountPermissionSubtitle4Repository.SaveChanges(); + return op.Succcedded(id); + } + + public OperationResult Edit(EditSubAccountPermissionSubtitle1 command) + { + OperationResult op = new(); + + command.Title = command.Title.Trim(); + + var entity = _subAccountPermissionSubtitle1Repository.Get(command.Id); + if (entity == null) + return op.Failed(ApplicationMessages.RecordNotFound); + + if (_subAccountPermissionSubtitle1Repository.Exists(x => x.Title == command.Title && x.id != command.Id)) + return op.Failed(ApplicationMessages.DuplicatedRecord); + if (string.IsNullOrWhiteSpace(command.Title)) + return op.Failed("عنوان نقش نمی تواند خالی باشند"); + entity.Edit(command.Title, command.Code); + _subAccountPermissionSubtitle1Repository.SaveChanges(); + return op.Succcedded(); + } + + public OperationResult Edit(EditSubAccountPermissionSubtitle2 command) + { + OperationResult op = new(); + + command.Title = command.Title.Trim(); + + var entity = _subAccountPermissionSubtitle2Repository.Get(command.Id); + if (entity == null) + return op.Failed(ApplicationMessages.RecordNotFound); + + if (!_subAccountPermissionSubtitle1Repository.Exists(x => x.id == command.ParentId)) + return op.Failed("خطای سیستمی"); + + + if (_subAccountPermissionSubtitle2Repository.Exists(x => x.Title == command.Title && x.id != command.Id)) + return op.Failed(ApplicationMessages.DuplicatedRecord); + + if (string.IsNullOrWhiteSpace(command.Title)) + return op.Failed("عنوان نقش نمی تواند خالی باشند"); + + entity.Edit(command.Title, command.Code, command.ParentId); + _subAccountPermissionSubtitle2Repository.SaveChanges(); + return op.Succcedded(); + } + + public OperationResult Edit(EditSubAccountPermissionSubtitle3 command) + { + OperationResult op = new(); + + command.Title = command.Title.Trim(); + + var entity = _subAccountPermissionSubtitle3Repository.Get(command.Id); + if (entity == null) + return op.Failed(ApplicationMessages.RecordNotFound); + + if (!_subAccountPermissionSubtitle2Repository.Exists(x => x.id == command.ParentId)) + return op.Failed("خطای سیستمی"); + + + if (_subAccountPermissionSubtitle3Repository.Exists(x => x.Title == command.Title && x.id != command.Id)) + return op.Failed(ApplicationMessages.DuplicatedRecord); + + if (string.IsNullOrWhiteSpace(command.Title)) + return op.Failed("عنوان نقش نمی تواند خالی باشند"); + + entity.Edit(command.Title, command.Code, command.ParentId); + _subAccountPermissionSubtitle3Repository.SaveChanges(); + return op.Succcedded(); + } + + public OperationResult Edit(EditSubAccountPermissionSubtitle4 command) + { + OperationResult op = new(); + + command.Title = command.Title.Trim(); + + var entity = _subAccountPermissionSubtitle4Repository.Get(command.Id); + if (entity == null) + return op.Failed(ApplicationMessages.RecordNotFound); + + if (!_subAccountPermissionSubtitle3Repository.Exists(x => x.id == command.ParentId)) + return op.Failed("خطای سیستمی"); + + + if (_subAccountPermissionSubtitle4Repository.Exists(x => x.Title == command.Title && x.id != command.Id)) + return op.Failed(ApplicationMessages.DuplicatedRecord); + + if (string.IsNullOrWhiteSpace(command.Title)) + return op.Failed("عنوان نقش نمی تواند خالی باشند"); + + entity.Edit(command.Title, command.Code, command.ParentId); + _subAccountPermissionSubtitle4Repository.SaveChanges(); + return op.Succcedded(); + } + + public List GetAllSubtitlesNested() + { + return _subAccountPermissionSubtitle1Repository.GetAllWithChildren(); + } + } +} diff --git a/AccountManagement.Configuration/AccountManagementBootstrapper.cs b/AccountManagement.Configuration/AccountManagementBootstrapper.cs index cd8c1b25..34b1dc05 100644 --- a/AccountManagement.Configuration/AccountManagementBootstrapper.cs +++ b/AccountManagement.Configuration/AccountManagementBootstrapper.cs @@ -3,6 +3,8 @@ using AccountManagement.Application.Contracts.Account; using AccountManagement.Application.Contracts.CameraAccount; using AccountManagement.Application.Contracts.Position; using AccountManagement.Application.Contracts.Role; +using AccountManagement.Application.Contracts.SubAccount; +using AccountManagement.Application.Contracts.SubAccountPermissionSubtitle; using AccountManagement.Application.Contracts.Task; using AccountManagement.Application.Contracts.TaskSubject; using AccountManagement.Application.Contracts.Ticket; @@ -13,6 +15,12 @@ using AccountManagement.Domain.AssignAgg; using AccountManagement.Domain.CameraAccountAgg; using AccountManagement.Domain.MediaAgg; using AccountManagement.Domain.RoleAgg; +using AccountManagement.Domain.SubAccountAgg; +using AccountManagement.Domain.SubAccountPermissionSubtitle1Agg; +using AccountManagement.Domain.SubAccountPermissionSubtitle2Agg; +using AccountManagement.Domain.SubAccountPermissionSubtitle3Agg; +using AccountManagement.Domain.SubAccountPermissionSubtitle4Agg; +using AccountManagement.Domain.SubAccountRoleAgg; using AccountManagement.Domain.TaskAgg; using AccountManagement.Domain.TaskMessageAgg; using AccountManagement.Domain.TaskSubjectAgg; @@ -73,6 +81,18 @@ namespace AccountManagement.Configuration #endregion + #region Pooya + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + #endregion + + services.AddScoped(); services.AddDbContext(x => x.UseSqlServer(connectionString)); diff --git a/AccountManagement.Domain/CameraAccountAgg/ICameraAccountRepository.cs b/AccountManagement.Domain/CameraAccountAgg/ICameraAccountRepository.cs index 88f377b0..15ebbbdc 100644 --- a/AccountManagement.Domain/CameraAccountAgg/ICameraAccountRepository.cs +++ b/AccountManagement.Domain/CameraAccountAgg/ICameraAccountRepository.cs @@ -16,6 +16,10 @@ namespace AccountManagement.Domain.CameraAccountAgg CameraAccount GetById(long id); EditCameraAccount GetDetails(long id); + #region Pooya + List GetAllByAccountId(long accountId); + #endregion + #region Safa EditCameraAccount GetDetailsByWorkshop(long workshopId); diff --git a/AccountManagement.Domain/SubAccountAgg/ISubAccountRepository.cs b/AccountManagement.Domain/SubAccountAgg/ISubAccountRepository.cs new file mode 100644 index 00000000..eba9137e --- /dev/null +++ b/AccountManagement.Domain/SubAccountAgg/ISubAccountRepository.cs @@ -0,0 +1,17 @@ + +using _0_Framework.Domain; +using AccountManagement.Application.Contracts.SubAccount; +using System.Collections.Generic; + +namespace AccountManagement.Domain.SubAccountAgg +{ + public interface ISubAccountRepository : IRepository + { + List GetAllByAccountId(long accountId, int pageIndex); + List GetSubAccountsByAccountIdGroupedByRole(long accountId); + void Remove(SubAccount subAccount); + SubAccount GetDetails(long subAccountId); + SubAccount GetBy(string commandUsername); + SubAccountViewModel GetByVerifyCodeAndPhoneNumber(string code, string phone); + } +} diff --git a/AccountManagement.Domain/SubAccountAgg/SubAccount.cs b/AccountManagement.Domain/SubAccountAgg/SubAccount.cs new file mode 100644 index 00000000..cf32fcfa --- /dev/null +++ b/AccountManagement.Domain/SubAccountAgg/SubAccount.cs @@ -0,0 +1,85 @@ +using _0_Framework.Application; +using _0_Framework.Domain; +using AccountManagement.Domain.SubAccountRoleAgg; + +namespace AccountManagement.Domain.SubAccountAgg +{ + public class SubAccount : EntityBase + { + public string FullName + { + get { return $"{FName} {LName}"; } + } + public string PhoneNumber { get; private set; } + public string NationalCode { get; private set; } + public string FName { get; private set; } + public string LName { get; private set; } + public long SubAccountRoleId { get; private set; } + public SubAccountRole SubAccountRole { get; private set; } + + public long AccountId { get; private set; } + + public string Username { get; private set; } + public string Password { get; private set; } + public string VerifyCode { get; private set; } + public IsActive IsActive { get; private set; } + public string ProfilePhoto { get; private set; } + + public SubAccount(long accountId, long subAccountRoleId, string nationalCode, string fName, string lName, string phoneNumber, string username, string password,string profilePhoto) + { + PhoneNumber = phoneNumber; + AccountId = accountId; + Username = username; + Password = password; + FName = fName; + LName = lName; + NationalCode = nationalCode; + ProfilePhoto = profilePhoto; + IsActive = IsActive.True; + SubAccountRoleId = subAccountRoleId; + } + + public void ChangePassword(string newPassword) + { + Password = newPassword; + } + + public void ChangePhoneNumber(string newPhoneNumber) + { + PhoneNumber = newPhoneNumber; + } + + public void Edit(long subAccountRoleId, string nationalCode, string fName, string lName, string profilePhoto) + { + + FName = fName; + LName = lName; + NationalCode = nationalCode; + ProfilePhoto = profilePhoto; + SubAccountRoleId = subAccountRoleId; + } + + public void SetVerifyCode(string verifyCode) + { + + VerifyCode = verifyCode; + } + + public void Deactivate() + { + IsActive = IsActive.False; + } + + public void Activate() + { + IsActive = IsActive.True; + + } + + public void AssignRole(long subAccountRoleId) + { + SubAccountRoleId = subAccountRoleId; + } + + } +} diff --git a/AccountManagement.Domain/SubAccountPermissionSubtitle1Agg/ISubAccountPermissionSubtitle1Repository.cs b/AccountManagement.Domain/SubAccountPermissionSubtitle1Agg/ISubAccountPermissionSubtitle1Repository.cs new file mode 100644 index 00000000..edef247a --- /dev/null +++ b/AccountManagement.Domain/SubAccountPermissionSubtitle1Agg/ISubAccountPermissionSubtitle1Repository.cs @@ -0,0 +1,14 @@ + +using _0_Framework.Domain; +using AccountManagement.Application.Contracts.SubAccountPermissionSubtitle; +using System.Collections.Generic; + +namespace AccountManagement.Domain.SubAccountPermissionSubtitle1Agg +{ + public interface ISubAccountPermissionSubtitle1Repository : IRepository + { + List GetAllWithChildren(); + public void Remove(SubAccountPermissionSubtitle1 entity); + List GetAllPermissionCodes(); + } +} diff --git a/AccountManagement.Domain/SubAccountPermissionSubtitle1Agg/SubAccountPermissionSubtitle1.cs b/AccountManagement.Domain/SubAccountPermissionSubtitle1Agg/SubAccountPermissionSubtitle1.cs new file mode 100644 index 00000000..320a359f --- /dev/null +++ b/AccountManagement.Domain/SubAccountPermissionSubtitle1Agg/SubAccountPermissionSubtitle1.cs @@ -0,0 +1,25 @@ +using _0_Framework.Domain; +using AccountManagement.Domain.SubAccountPermissionSubtitle2Agg; +using System.Collections.Generic; + +namespace AccountManagement.Domain.SubAccountPermissionSubtitle1Agg +{ + public class SubAccountPermissionSubtitle1 : EntityBase + { + public string Title { get; private set; } + public int Code { get; private set; } + + public List Children { get; } = []; + + public SubAccountPermissionSubtitle1(string title, int code) + { + Title = title; + Code = code; + } + public void Edit(string title, int code) + { + Title = title; + Code = code; + } + } +} diff --git a/AccountManagement.Domain/SubAccountPermissionSubtitle2Agg/ISubAccountPermissionSubtitle2Repository.cs b/AccountManagement.Domain/SubAccountPermissionSubtitle2Agg/ISubAccountPermissionSubtitle2Repository.cs new file mode 100644 index 00000000..04c26722 --- /dev/null +++ b/AccountManagement.Domain/SubAccountPermissionSubtitle2Agg/ISubAccountPermissionSubtitle2Repository.cs @@ -0,0 +1,12 @@ + +using _0_Framework.Domain; +using AccountManagement.Domain.SubAccountPermissionSubtitle1Agg; + +namespace AccountManagement.Domain.SubAccountPermissionSubtitle2Agg +{ + public interface ISubAccountPermissionSubtitle2Repository : IRepository + { + public void Remove(SubAccountPermissionSubtitle2 entity); + + } +} diff --git a/AccountManagement.Domain/SubAccountPermissionSubtitle2Agg/SubAccountPermissionSubtitle2.cs b/AccountManagement.Domain/SubAccountPermissionSubtitle2Agg/SubAccountPermissionSubtitle2.cs new file mode 100644 index 00000000..d9f48161 --- /dev/null +++ b/AccountManagement.Domain/SubAccountPermissionSubtitle2Agg/SubAccountPermissionSubtitle2.cs @@ -0,0 +1,34 @@ + +using _0_Framework.Domain; +using AccountManagement.Domain.SubAccountPermissionSubtitle1Agg; +using AccountManagement.Domain.SubAccountPermissionSubtitle3Agg; +using System.Collections.Generic; + +namespace AccountManagement.Domain.SubAccountPermissionSubtitle2Agg +{ + public class SubAccountPermissionSubtitle2 : EntityBase + { + public string Title { get; private set; } + public int Code { get; private set; } + + + public SubAccountPermissionSubtitle1 Parent { get; private set; } + public long ParentId { get; private set; } + + + public List Children { get; } = []; + + public SubAccountPermissionSubtitle2(string title, int code, long parentId) + { + Title = title; + Code = code; + ParentId = parentId; + } + public void Edit(string title, int code, long parentId) + { + Title = title; + Code = code; + ParentId = parentId; + } + } +} diff --git a/AccountManagement.Domain/SubAccountPermissionSubtitle3Agg/ISubAccountPermissionSubtitle3Repository.cs b/AccountManagement.Domain/SubAccountPermissionSubtitle3Agg/ISubAccountPermissionSubtitle3Repository.cs new file mode 100644 index 00000000..e902e8a7 --- /dev/null +++ b/AccountManagement.Domain/SubAccountPermissionSubtitle3Agg/ISubAccountPermissionSubtitle3Repository.cs @@ -0,0 +1,12 @@ + +using _0_Framework.Domain; +using AccountManagement.Domain.SubAccountPermissionSubtitle1Agg; + +namespace AccountManagement.Domain.SubAccountPermissionSubtitle3Agg +{ + public interface ISubAccountPermissionSubtitle3Repository : IRepository + { + public void Remove(SubAccountPermissionSubtitle3 entity); + + } +} diff --git a/AccountManagement.Domain/SubAccountPermissionSubtitle3Agg/SubAccountPermissionSubtitle3.cs b/AccountManagement.Domain/SubAccountPermissionSubtitle3Agg/SubAccountPermissionSubtitle3.cs new file mode 100644 index 00000000..5a2df480 --- /dev/null +++ b/AccountManagement.Domain/SubAccountPermissionSubtitle3Agg/SubAccountPermissionSubtitle3.cs @@ -0,0 +1,34 @@ + +using _0_Framework.Domain; +using AccountManagement.Domain.SubAccountPermissionSubtitle2Agg; +using AccountManagement.Domain.SubAccountPermissionSubtitle4Agg; +using System.Collections.Generic; + +namespace AccountManagement.Domain.SubAccountPermissionSubtitle3Agg +{ + public class SubAccountPermissionSubtitle3 : EntityBase + { + public string Title { get; private set; } + public int Code { get; private set; } + + + public SubAccountPermissionSubtitle2 Parent { get; private set; } + public long ParentId { get; private set; } + + + public List Children { get; } = []; + + public SubAccountPermissionSubtitle3(string title, int code, long parentId) + { + Title = title; + Code = code; + ParentId = parentId; + } + public void Edit(string title, int code, long parentId) + { + Title = title; + Code = code; + ParentId = parentId; + } + } +} diff --git a/AccountManagement.Domain/SubAccountPermissionSubtitle4Agg/ISubAccountPermissionSubtitle4Repository.cs b/AccountManagement.Domain/SubAccountPermissionSubtitle4Agg/ISubAccountPermissionSubtitle4Repository.cs new file mode 100644 index 00000000..6622de21 --- /dev/null +++ b/AccountManagement.Domain/SubAccountPermissionSubtitle4Agg/ISubAccountPermissionSubtitle4Repository.cs @@ -0,0 +1,12 @@ + +using _0_Framework.Domain; +using AccountManagement.Domain.SubAccountPermissionSubtitle1Agg; + +namespace AccountManagement.Domain.SubAccountPermissionSubtitle4Agg +{ + public interface ISubAccountPermissionSubtitle4Repository : IRepository + { + public void Remove(SubAccountPermissionSubtitle4 entity); + + } +} diff --git a/AccountManagement.Domain/SubAccountPermissionSubtitle4Agg/SubAccountPermissionSubtitle4.cs b/AccountManagement.Domain/SubAccountPermissionSubtitle4Agg/SubAccountPermissionSubtitle4.cs new file mode 100644 index 00000000..fe51b165 --- /dev/null +++ b/AccountManagement.Domain/SubAccountPermissionSubtitle4Agg/SubAccountPermissionSubtitle4.cs @@ -0,0 +1,28 @@ + +using _0_Framework.Domain; +using AccountManagement.Domain.SubAccountPermissionSubtitle3Agg; + +namespace AccountManagement.Domain.SubAccountPermissionSubtitle4Agg +{ + public class SubAccountPermissionSubtitle4 : EntityBase + { + public string Title { get; private set; } + public int Code { get; private set; } + + public SubAccountPermissionSubtitle3 Parent { get; private set; } + public long ParentId { get; private set; } + + public SubAccountPermissionSubtitle4(string title, int code, long parentId) + { + Title = title; + Code = code; + ParentId = parentId; + } + public void Edit(string title, int code, long parentId) + { + Title = title; + Code = code; + ParentId = parentId; + } + } +} diff --git a/AccountManagement.Domain/SubAccountRoleAgg/ISubAccountRoleRepository.cs b/AccountManagement.Domain/SubAccountRoleAgg/ISubAccountRoleRepository.cs new file mode 100644 index 00000000..1384dfe8 --- /dev/null +++ b/AccountManagement.Domain/SubAccountRoleAgg/ISubAccountRoleRepository.cs @@ -0,0 +1,13 @@ +using _0_Framework.Domain; +using AccountManagement.Application.Contracts.SubAccount; +using System.Collections.Generic; + +namespace AccountManagement.Domain.SubAccountRoleAgg +{ + public interface ISubAccountRoleRepository : IRepository + { + List GetSubAccountRolesByAccountId(long accountId); + void Remove(SubAccountRole subAccountRole); + + } +} diff --git a/AccountManagement.Domain/SubAccountRoleAgg/SubAccountRole.cs b/AccountManagement.Domain/SubAccountRoleAgg/SubAccountRole.cs new file mode 100644 index 00000000..e7267447 --- /dev/null +++ b/AccountManagement.Domain/SubAccountRoleAgg/SubAccountRole.cs @@ -0,0 +1,41 @@ +using _0_Framework.Domain; +using AccountManagement.Domain.AccountAgg; +using AccountManagement.Domain.SubAccountAgg; +using System.Collections.Generic; +using System.Linq; +namespace AccountManagement.Domain.SubAccountRoleAgg +{ + public class SubAccountRole : EntityBase + { + public string Title { get; private set; } + + public long AccountId { get; private set; } + + public List RolePermissions { get; private set; } + public List SubAccounts { get; private set; } + + private SubAccountRole() + { + } + + public SubAccountRole(string title, List permissions, long accountId) + { + Title = title; + RolePermissions = permissions.Select(x => new SubAccountRolePermission(x, id)).ToList(); + AccountId = accountId; + } + public void ChangeTitle(string title) + { + Title = title; + } + public void AddPermissions(List permissionIds) + { + RolePermissions.AddRange(permissionIds.Select(x => new SubAccountRolePermission(x, id))); + } + public void Edit(string title, List permissions) + { + Title = title; + RolePermissions = permissions.Select(x => new SubAccountRolePermission(x, id)).ToList(); + } + } +} \ No newline at end of file diff --git a/AccountManagement.Domain/SubAccountRoleAgg/SubAccountRolePermission.cs b/AccountManagement.Domain/SubAccountRoleAgg/SubAccountRolePermission.cs new file mode 100644 index 00000000..b53d8b5d --- /dev/null +++ b/AccountManagement.Domain/SubAccountRoleAgg/SubAccountRolePermission.cs @@ -0,0 +1,17 @@ +using _0_Framework.Domain; + +namespace AccountManagement.Domain.SubAccountRoleAgg +{ + public class SubAccountRolePermission : EntityBaseWithoutCreationDate + { + public int PermissionCode { get; private set; } + public long SubAccountRoleId { get; private set; } + public SubAccountRole SubAccountRole { get; private set; } + + public SubAccountRolePermission(int permissionCode, long subAccountRoleId) + { + PermissionCode = permissionCode; + SubAccountRoleId = subAccountRoleId; + } + } +} diff --git a/AccountMangement.Infrastructure.EFCore/AccountContext.cs b/AccountMangement.Infrastructure.EFCore/AccountContext.cs index bf99a681..2eed36f9 100644 --- a/AccountMangement.Infrastructure.EFCore/AccountContext.cs +++ b/AccountMangement.Infrastructure.EFCore/AccountContext.cs @@ -20,6 +20,12 @@ using AccountManagement.Domain.TicketMediasAgg; using AccountManagement.Domain.TaskMessageAgg; using AccountManagement.Domain.TaskMessageItemsAgg; using AccountManagement.Domain.TicketAccessAccountAgg; +using AccountManagement.Domain.SubAccountAgg; +using AccountManagement.Domain.SubAccountPermissionSubtitle1Agg; +using AccountManagement.Domain.SubAccountPermissionSubtitle2Agg; +using AccountManagement.Domain.SubAccountPermissionSubtitle3Agg; +using AccountManagement.Domain.SubAccountPermissionSubtitle4Agg; +using AccountManagement.Domain.SubAccountRoleAgg; namespace AccountMangement.Infrastructure.EFCore { @@ -50,6 +56,16 @@ namespace AccountMangement.Infrastructure.EFCore public DbSet TicketAccessAccounts { get; set; } + #endregion + + #region Pooya + public DbSet SubAccounts { get; set; } + public DbSet SubAccountRoles { get; set; } + public DbSet SubAccountPermissionSubtitle1Collection { get; set; } + public DbSet SubAccountPermissionSubtitle2Collection { get; set; } + public DbSet SubAccountPermissionSubtitle3Collection { get; set; } + public DbSet SubAccountPermissionSubtitle4Collection { get; set; } + public DbSet SubAccountRolePermissions { get; set; } #endregion public AccountContext(DbContextOptions options) : base(options) { diff --git a/AccountMangement.Infrastructure.EFCore/Mappings/SubAccountMapping.cs b/AccountMangement.Infrastructure.EFCore/Mappings/SubAccountMapping.cs new file mode 100644 index 00000000..d00e3349 --- /dev/null +++ b/AccountMangement.Infrastructure.EFCore/Mappings/SubAccountMapping.cs @@ -0,0 +1,30 @@ +using _0_Framework.Application; +using AccountManagement.Domain.SubAccountAgg; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using System; + +namespace AccountMangement.Infrastructure.EFCore.Mappings +{ + public class SubAccountMapping : IEntityTypeConfiguration + { + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("SubAccounts"); + builder.HasKey(x => x.id); + builder.Property(x => x.IsActive).HasConversion(x => x.ToString("d") + , x => ((IsActive)Enum.Parse(typeof(IsActive), x))).HasMaxLength(1); + builder.Property(x => x.PhoneNumber).HasMaxLength(11).IsRequired(); + builder.Ignore(x => x.FullName); + builder.Property(x => x.Username).HasMaxLength(100).IsRequired(); + builder.Property(x => x.Password).HasMaxLength(1000).IsRequired(); + builder.Property(x => x.VerifyCode).HasMaxLength(10); + builder.Property(x => x.NationalCode).HasMaxLength(10); + builder.Property(x => x.FName).HasMaxLength(50); + builder.Property(x => x.LName).HasMaxLength(50); + builder.Property(x => x.ProfilePhoto).HasMaxLength(500).IsRequired(false); + builder.Property(x => x.SubAccountRoleId); + builder.HasOne(x => x.SubAccountRole).WithMany(x => x.SubAccounts).HasForeignKey(x => x.SubAccountRoleId); + } + } +} diff --git a/AccountMangement.Infrastructure.EFCore/Mappings/SubAccountPermissionSubtitle1Mapping.cs b/AccountMangement.Infrastructure.EFCore/Mappings/SubAccountPermissionSubtitle1Mapping.cs new file mode 100644 index 00000000..7663e7ca --- /dev/null +++ b/AccountMangement.Infrastructure.EFCore/Mappings/SubAccountPermissionSubtitle1Mapping.cs @@ -0,0 +1,19 @@ +using AccountManagement.Domain.SubAccountPermissionSubtitle1Agg; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; + +namespace AccountMangement.Infrastructure.EFCore.Mappings +{ + public class SubAccountPermissionSubtitle1Mapping : IEntityTypeConfiguration + { + public void Configure(EntityTypeBuilder builder) + { + builder.HasKey(x => x.id); + builder.ToTable("SubAccountPermissionSubtitle1"); + builder.Property(x => x.Code).HasMaxLength(15).IsRequired(); + builder.Property(x => x.Title).HasMaxLength(50).IsRequired(); + + builder.HasMany(x => x.Children).WithOne(x => x.Parent).HasForeignKey(x => x.ParentId); + } + } +} diff --git a/AccountMangement.Infrastructure.EFCore/Mappings/SubAccountPermissionSubtitle2Mapping.cs b/AccountMangement.Infrastructure.EFCore/Mappings/SubAccountPermissionSubtitle2Mapping.cs new file mode 100644 index 00000000..99a70bc5 --- /dev/null +++ b/AccountMangement.Infrastructure.EFCore/Mappings/SubAccountPermissionSubtitle2Mapping.cs @@ -0,0 +1,24 @@ + + +using AccountManagement.Domain.SubAccountPermissionSubtitle2Agg; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; + +namespace AccountMangement.Infrastructure.EFCore.Mappings +{ + public class SubAccountPermissionSubtitle2Mapping : IEntityTypeConfiguration + { + public void Configure(EntityTypeBuilder builder) + { + builder.HasKey(x => x.id); + builder.ToTable("SubAccountPermissionSubtitle2"); + builder.Property(x => x.Code).HasMaxLength(15).IsRequired(); + builder.Property(x => x.Title).HasMaxLength(50).IsRequired(); + + + builder.HasOne(x => x.Parent).WithMany(x => x.Children).HasForeignKey(x => x.ParentId); + builder.HasMany(x => x.Children).WithOne(x => x.Parent).HasForeignKey(x => x.ParentId); + + } + } +} diff --git a/AccountMangement.Infrastructure.EFCore/Mappings/SubAccountPermissionSubtitle3Mapping.cs b/AccountMangement.Infrastructure.EFCore/Mappings/SubAccountPermissionSubtitle3Mapping.cs new file mode 100644 index 00000000..64b7282f --- /dev/null +++ b/AccountMangement.Infrastructure.EFCore/Mappings/SubAccountPermissionSubtitle3Mapping.cs @@ -0,0 +1,22 @@ + + +using AccountManagement.Domain.SubAccountPermissionSubtitle3Agg; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; + +namespace AccountMangement.Infrastructure.EFCore.Mappings +{ + public class SubAccountPermissionSubtitle3Mapping : IEntityTypeConfiguration + { + public void Configure(EntityTypeBuilder builder) + { + builder.HasKey(x => x.id); + builder.ToTable("SubAccountPermissionSubtitle3"); + builder.Property(x => x.Code).HasMaxLength(15).IsRequired(); + builder.Property(x => x.Title).HasMaxLength(50).IsRequired(); + + builder.HasOne(x => x.Parent).WithMany(x => x.Children).HasForeignKey(x => x.ParentId); + builder.HasMany(x => x.Children).WithOne(x => x.Parent).HasForeignKey(x => x.ParentId); + } + } +} diff --git a/AccountMangement.Infrastructure.EFCore/Mappings/SubAccountPermissionSubtitle4Mapping.cs b/AccountMangement.Infrastructure.EFCore/Mappings/SubAccountPermissionSubtitle4Mapping.cs new file mode 100644 index 00000000..1ed2664d --- /dev/null +++ b/AccountMangement.Infrastructure.EFCore/Mappings/SubAccountPermissionSubtitle4Mapping.cs @@ -0,0 +1,21 @@ + + +using AccountManagement.Domain.SubAccountPermissionSubtitle4Agg; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; + +namespace AccountMangement.Infrastructure.EFCore.Mappings +{ + public class SubAccountPermissionSubtitle4Mapping : IEntityTypeConfiguration + { + public void Configure(EntityTypeBuilder builder) + { + builder.HasKey(x => x.id); + builder.ToTable("SubAccountPermissionSubtitle4"); + builder.Property(x => x.Code).HasMaxLength(15).IsRequired(); + builder.Property(x => x.Title).HasMaxLength(50).IsRequired(); + + builder.HasOne(x => x.Parent).WithMany(x => x.Children).HasForeignKey(x => x.ParentId); + } + } +} diff --git a/AccountMangement.Infrastructure.EFCore/Mappings/SubAccountRoleMapping.cs b/AccountMangement.Infrastructure.EFCore/Mappings/SubAccountRoleMapping.cs new file mode 100644 index 00000000..6058d7e1 --- /dev/null +++ b/AccountMangement.Infrastructure.EFCore/Mappings/SubAccountRoleMapping.cs @@ -0,0 +1,26 @@ +using AccountManagement.Domain.SubAccountRoleAgg; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; + +namespace AccountMangement.Infrastructure.EFCore.Mappings +{ + public class SubAccountRoleMapping : IEntityTypeConfiguration + { + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("SubAccountRoles"); + builder.HasKey(x => x.id); + builder.Property(x => x.Title).HasMaxLength(60); + + builder.HasMany(x => x.SubAccounts).WithOne(x => x.SubAccountRole).HasForeignKey(x => x.SubAccountRoleId); + + builder.OwnsMany(x => x.RolePermissions, opt => + { + opt.ToTable("SubAccountRolePermissions"); + opt.HasKey(x => x.id); + opt.WithOwner(x => x.SubAccountRole); + }); + + } + } +} diff --git a/AccountMangement.Infrastructure.EFCore/Migrations/20241201170643_SubAccount_SubTitleForClientPermission.Designer.cs b/AccountMangement.Infrastructure.EFCore/Migrations/20241201170643_SubAccount_SubTitleForClientPermission.Designer.cs new file mode 100644 index 00000000..9b3694b4 --- /dev/null +++ b/AccountMangement.Infrastructure.EFCore/Migrations/20241201170643_SubAccount_SubTitleForClientPermission.Designer.cs @@ -0,0 +1,1251 @@ +// +using System; +using AccountMangement.Infrastructure.EFCore; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace AccountMangement.Infrastructure.EFCore.Migrations +{ + [DbContext(typeof(AccountContext))] + [Migration("20241201170643_SubAccount_SubTitleForClientPermission")] + partial class SubAccount_SubTitleForClientPermission + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.10") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("AccountManagement.Domain.AccountAgg.Account", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("AdminAreaPermission") + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.Property("ClientAriaPermission") + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("Email") + .HasMaxLength(150) + .HasColumnType("nvarchar(150)"); + + b.Property("Fullname") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("IsActiveString") + .HasMaxLength(6) + .HasColumnType("nvarchar(6)"); + + b.Property("Mobile") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("nvarchar(20)"); + + b.Property("NationalCode") + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.Property("Password") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.Property("PositionId") + .HasMaxLength(10) + .HasColumnType("bigint"); + + b.Property("PositionIsActive") + .HasMaxLength(5) + .HasColumnType("nvarchar(5)"); + + b.Property("ProfilePhoto") + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("RoleId") + .HasColumnType("bigint"); + + b.Property("RoleName") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Username") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("VerifyCode") + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.HasKey("id"); + + b.HasIndex("PositionId"); + + b.HasIndex("RoleId"); + + b.ToTable("Accounts", (string)null); + }); + + modelBuilder.Entity("AccountManagement.Domain.AccountLeftWorkAgg.AccountLeftWork", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("AccountId") + .HasColumnType("bigint"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("LeftWorkGr") + .HasColumnType("datetime2"); + + b.Property("StartWorkGr") + .HasColumnType("datetime2"); + + b.HasKey("id"); + + b.HasIndex("AccountId"); + + b.ToTable("AccountLeftWork", (string)null); + }); + + modelBuilder.Entity("AccountManagement.Domain.AdminResponseAgg.AdminResponse", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("AdminAccountId") + .HasColumnType("bigint"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("IsActiveString") + .HasMaxLength(5) + .HasColumnType("nvarchar(5)"); + + b.Property("Response") + .HasColumnType("ntext"); + + b.Property("TicketId") + .HasColumnType("bigint"); + + b.HasKey("id"); + + b.HasIndex("TicketId"); + + b.ToTable("AdminResponses", (string)null); + }); + + modelBuilder.Entity("AccountManagement.Domain.AdminResponseMediaAgg.AdminResponseMedia", b => + { + b.Property("AdminResponseId") + .HasColumnType("bigint"); + + b.Property("MediaId") + .HasColumnType("bigint"); + + b.HasKey("AdminResponseId", "MediaId"); + + b.HasIndex("MediaId"); + + b.ToTable("AdminResponseMedias", (string)null); + }); + + modelBuilder.Entity("AccountManagement.Domain.AssignAgg.Assign", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("AcceptedTimeRequest") + .HasColumnType("int"); + + b.Property("AssignedId") + .HasColumnType("bigint"); + + b.Property("AssignedName") + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("AssignedPositionValue") + .HasColumnType("int"); + + b.Property("AssignerId") + .HasColumnType("bigint"); + + b.Property("AssignerPositionValue") + .HasColumnType("int"); + + b.Property("CancelDescription") + .HasColumnType("ntext"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("DoneDescription") + .HasColumnType("ntext"); + + b.Property("EndTaskDate") + .HasColumnType("datetime2"); + + b.Property("FirstTimeCreation") + .HasColumnType("bit"); + + b.Property("IsCancel") + .HasColumnType("bit"); + + b.Property("IsCanceledRequest") + .HasColumnType("bit"); + + b.Property("IsDone") + .HasColumnType("bit"); + + b.Property("IsDoneRequest") + .HasColumnType("bit"); + + b.Property("RequestDate") + .HasColumnType("datetime2"); + + b.Property("TaskId") + .HasColumnType("bigint"); + + b.Property("TimeRequest") + .HasColumnType("bit"); + + b.Property("TimeRequestDescription") + .HasColumnType("ntext"); + + b.HasKey("id"); + + b.HasIndex("TaskId"); + + b.ToTable("Assigns", (string)null); + }); + + modelBuilder.Entity("AccountManagement.Domain.CameraAccountAgg.CameraAccount", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("AccountId") + .HasColumnType("bigint"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("IsActiveSting") + .IsRequired() + .HasMaxLength(5) + .HasColumnType("nvarchar(5)"); + + b.Property("Mobile") + .HasMaxLength(11) + .HasColumnType("nvarchar(11)"); + + b.Property("Password") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.Property("Username") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("WorkshopId") + .HasColumnType("bigint"); + + b.Property("WorkshopName") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("id"); + + b.HasIndex("AccountId"); + + b.ToTable("CameraAccounts", (string)null); + }); + + modelBuilder.Entity("AccountManagement.Domain.ClientResponseAgg.ClientResponse", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("Response") + .HasColumnType("ntext"); + + b.Property("TicketId") + .HasColumnType("bigint"); + + b.HasKey("id"); + + b.HasIndex("TicketId"); + + b.ToTable("ClientResponses", (string)null); + }); + + modelBuilder.Entity("AccountManagement.Domain.ClientResponseMediaAgg.ClientResponseMedia", b => + { + b.Property("ClientResponseId") + .HasColumnType("bigint"); + + b.Property("MediaId") + .HasColumnType("bigint"); + + b.HasKey("ClientResponseId", "MediaId"); + + b.HasIndex("MediaId"); + + b.ToTable("ClientResponseMedias", (string)null); + }); + + modelBuilder.Entity("AccountManagement.Domain.MediaAgg.Media", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("Category") + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("Path") + .HasColumnType("ntext"); + + b.Property("Type") + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.HasKey("id"); + + b.ToTable("Medias", (string)null); + }); + + modelBuilder.Entity("AccountManagement.Domain.RoleAgg.Role", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("id"); + + b.ToTable("Roles", (string)null); + }); + + modelBuilder.Entity("AccountManagement.Domain.SubAccountAgg.SubAccount", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("AccountId") + .HasColumnType("bigint"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("FName") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("IsActive") + .IsRequired() + .HasMaxLength(1) + .HasColumnType("nvarchar(1)"); + + b.Property("LName") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("NationalCode") + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.Property("Password") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.Property("PhoneNumber") + .IsRequired() + .HasMaxLength(11) + .HasColumnType("nvarchar(11)"); + + b.Property("ProfilePhoto") + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("SubAccountRoleId") + .HasColumnType("bigint"); + + b.Property("Username") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("VerifyCode") + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.HasKey("id"); + + b.HasIndex("SubAccountRoleId"); + + b.ToTable("SubAccounts", (string)null); + }); + + modelBuilder.Entity("AccountManagement.Domain.SubAccountPermissionSubtitle1Agg.SubAccountPermissionSubtitle1", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("Code") + .HasMaxLength(15) + .HasColumnType("int"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.HasKey("id"); + + b.ToTable("SubAccountPermissionSubtitle1", (string)null); + }); + + modelBuilder.Entity("AccountManagement.Domain.SubAccountPermissionSubtitle2Agg.SubAccountPermissionSubtitle2", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("Code") + .HasMaxLength(15) + .HasColumnType("int"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("ParentId") + .HasColumnType("bigint"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.HasKey("id"); + + b.HasIndex("ParentId"); + + b.ToTable("SubAccountPermissionSubtitle2", (string)null); + }); + + modelBuilder.Entity("AccountManagement.Domain.SubAccountPermissionSubtitle3Agg.SubAccountPermissionSubtitle3", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("Code") + .HasMaxLength(15) + .HasColumnType("int"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("ParentId") + .HasColumnType("bigint"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.HasKey("id"); + + b.HasIndex("ParentId"); + + b.ToTable("SubAccountPermissionSubtitle3", (string)null); + }); + + modelBuilder.Entity("AccountManagement.Domain.SubAccountPermissionSubtitle4Agg.SubAccountPermissionSubtitle4", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("Code") + .HasMaxLength(15) + .HasColumnType("int"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("ParentId") + .HasColumnType("bigint"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.HasKey("id"); + + b.HasIndex("ParentId"); + + b.ToTable("SubAccountPermissionSubtitle4", (string)null); + }); + + modelBuilder.Entity("AccountManagement.Domain.SubAccountRoleAgg.SubAccountRole", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("AccountId") + .HasColumnType("bigint"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("Title") + .HasMaxLength(60) + .HasColumnType("nvarchar(60)"); + + b.HasKey("id"); + + b.ToTable("SubAccountRoles", (string)null); + }); + + modelBuilder.Entity("AccountManagement.Domain.TaskAgg.Tasks", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("ContractingPartyName") + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasColumnType("ntext"); + + b.Property("IsActiveString") + .HasMaxLength(7) + .HasColumnType("nvarchar(7)"); + + b.Property("SenderId") + .HasColumnType("bigint"); + + b.Property("StartTaskDate") + .HasColumnType("datetime2"); + + b.Property("TaskScheduleId") + .HasColumnType("bigint"); + + b.Property("TicketId") + .HasColumnType("bigint"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("id"); + + b.HasIndex("TaskScheduleId"); + + b.ToTable("TasksManager", (string)null); + }); + + modelBuilder.Entity("AccountManagement.Domain.TaskMediaAgg.TaskMedia", b => + { + b.Property("MediaId") + .HasColumnType("bigint"); + + b.Property("TaskId") + .HasColumnType("bigint"); + + b.HasKey("MediaId", "TaskId"); + + b.HasIndex("TaskId"); + + b.ToTable("TasksMedias", (string)null); + }); + + modelBuilder.Entity("AccountManagement.Domain.TaskMessageAgg.TaskMessage", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("AssignId") + .HasColumnType("bigint"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("Message") + .HasColumnType("ntext"); + + b.Property("RequestedDateFa") + .HasMaxLength(25) + .HasColumnType("nvarchar(25)"); + + b.Property("TypeOfMessage") + .HasMaxLength(30) + .HasColumnType("nvarchar(30)"); + + b.HasKey("id"); + + b.HasIndex("AssignId"); + + b.ToTable("TaskMessages", (string)null); + }); + + modelBuilder.Entity("AccountManagement.Domain.TaskMessageItemsAgg.TaskMessageItems", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("ReceiverAccountId") + .HasColumnType("bigint"); + + b.Property("SenderAccountId") + .HasColumnType("bigint"); + + b.Property("TaskMessageId") + .HasColumnType("bigint"); + + b.HasKey("id"); + + b.HasIndex("TaskMessageId"); + + b.ToTable("TaskMessageItems", (string)null); + }); + + modelBuilder.Entity("AccountManagement.Domain.TaskScheduleAgg.TaskSchedule", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("Count") + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("LastEndTaskDate") + .HasColumnType("datetime2"); + + b.Property("Type") + .HasMaxLength(12) + .HasColumnType("nvarchar(12)"); + + b.Property("UnitNumber") + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.Property("UnitType") + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.HasKey("id"); + + b.ToTable("TaskSchedules", (string)null); + }); + + modelBuilder.Entity("AccountManagement.Domain.TaskSubjectAgg.TaskSubject", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("Subject") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("id"); + + b.ToTable("TaskSubjects", (string)null); + }); + + modelBuilder.Entity("AccountManagement.Domain.TicketAccessAccountAgg.TicketAccessAccount", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("AccountId") + .HasColumnType("bigint"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.HasKey("id"); + + b.ToTable("TicketAccessAccounts", (string)null); + }); + + modelBuilder.Entity("AccountManagement.Domain.TicketAgg.Ticket", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("ContractingPartyName") + .HasMaxLength(155) + .HasColumnType("nvarchar(155)"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasColumnType("ntext"); + + b.Property("SenderId") + .HasColumnType("bigint"); + + b.Property("Status") + .HasMaxLength(30) + .HasColumnType("nvarchar(30)"); + + b.Property("SubAccountSenderId") + .HasColumnType("bigint"); + + b.Property("TicketNumber") + .HasMaxLength(12) + .HasColumnType("nvarchar(12)"); + + b.Property("TicketType") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Title") + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("WorkshopId") + .HasColumnType("bigint"); + + b.HasKey("id"); + + b.ToTable("Tickets", (string)null); + }); + + modelBuilder.Entity("AccountManagement.Domain.TicketMediasAgg.TicketMedia", b => + { + b.Property("TicketId") + .HasColumnType("bigint"); + + b.Property("MediaId") + .HasColumnType("bigint"); + + b.HasKey("TicketId", "MediaId"); + + b.HasIndex("MediaId"); + + b.ToTable("TicketMedias", (string)null); + }); + + modelBuilder.Entity("TaskManager.Domain.PositionAgg.Position", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("PositionName") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("PositionValue") + .HasMaxLength(2) + .HasColumnType("int"); + + b.HasKey("id"); + + b.ToTable("Positions", (string)null); + }); + + modelBuilder.Entity("AccountManagement.Domain.AccountAgg.Account", b => + { + b.HasOne("TaskManager.Domain.PositionAgg.Position", "Position") + .WithMany("Accounts") + .HasForeignKey("PositionId"); + + b.HasOne("AccountManagement.Domain.RoleAgg.Role", "Role") + .WithMany("Accounts") + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Position"); + + b.Navigation("Role"); + }); + + modelBuilder.Entity("AccountManagement.Domain.AccountLeftWorkAgg.AccountLeftWork", b => + { + b.HasOne("AccountManagement.Domain.AccountAgg.Account", "Account") + .WithMany("AccountLeftWorkList") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Account"); + }); + + modelBuilder.Entity("AccountManagement.Domain.AdminResponseAgg.AdminResponse", b => + { + b.HasOne("AccountManagement.Domain.TicketAgg.Ticket", "Ticket") + .WithMany("AdminResponses") + .HasForeignKey("TicketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Ticket"); + }); + + modelBuilder.Entity("AccountManagement.Domain.AdminResponseMediaAgg.AdminResponseMedia", b => + { + b.HasOne("AccountManagement.Domain.AdminResponseAgg.AdminResponse", "AdminResponse") + .WithMany("AdminResponseMedias") + .HasForeignKey("AdminResponseId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AccountManagement.Domain.MediaAgg.Media", "Media") + .WithMany("AdminResponseMedias") + .HasForeignKey("MediaId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("AdminResponse"); + + b.Navigation("Media"); + }); + + modelBuilder.Entity("AccountManagement.Domain.AssignAgg.Assign", b => + { + b.HasOne("AccountManagement.Domain.TaskAgg.Tasks", "Task") + .WithMany("Assigns") + .HasForeignKey("TaskId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("Task"); + }); + + modelBuilder.Entity("AccountManagement.Domain.CameraAccountAgg.CameraAccount", b => + { + b.HasOne("AccountManagement.Domain.AccountAgg.Account", "Account") + .WithMany("CameraAccounts") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Account"); + }); + + modelBuilder.Entity("AccountManagement.Domain.ClientResponseAgg.ClientResponse", b => + { + b.HasOne("AccountManagement.Domain.TicketAgg.Ticket", "Ticket") + .WithMany("ClientResponses") + .HasForeignKey("TicketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Ticket"); + }); + + modelBuilder.Entity("AccountManagement.Domain.ClientResponseMediaAgg.ClientResponseMedia", b => + { + b.HasOne("AccountManagement.Domain.ClientResponseAgg.ClientResponse", "ClientResponse") + .WithMany("ClientResponseMedias") + .HasForeignKey("ClientResponseId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AccountManagement.Domain.MediaAgg.Media", "Media") + .WithMany("ClientResponseMedias") + .HasForeignKey("MediaId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ClientResponse"); + + b.Navigation("Media"); + }); + + modelBuilder.Entity("AccountManagement.Domain.RoleAgg.Role", b => + { + b.OwnsMany("AccountManagement.Domain.RoleAgg.Permission", "Permissions", b1 => + { + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b1.Property("Id")); + + b1.Property("Code") + .HasColumnType("int"); + + b1.Property("RoleId") + .HasColumnType("bigint"); + + b1.HasKey("Id"); + + b1.HasIndex("RoleId"); + + b1.ToTable("RolePermissions", (string)null); + + b1.WithOwner("Role") + .HasForeignKey("RoleId"); + + b1.Navigation("Role"); + }); + + b.Navigation("Permissions"); + }); + + modelBuilder.Entity("AccountManagement.Domain.SubAccountAgg.SubAccount", b => + { + b.HasOne("AccountManagement.Domain.SubAccountRoleAgg.SubAccountRole", "SubAccountRole") + .WithMany("SubAccounts") + .HasForeignKey("SubAccountRoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("SubAccountRole"); + }); + + modelBuilder.Entity("AccountManagement.Domain.SubAccountPermissionSubtitle2Agg.SubAccountPermissionSubtitle2", b => + { + b.HasOne("AccountManagement.Domain.SubAccountPermissionSubtitle1Agg.SubAccountPermissionSubtitle1", "Parent") + .WithMany("Children") + .HasForeignKey("ParentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Parent"); + }); + + modelBuilder.Entity("AccountManagement.Domain.SubAccountPermissionSubtitle3Agg.SubAccountPermissionSubtitle3", b => + { + b.HasOne("AccountManagement.Domain.SubAccountPermissionSubtitle2Agg.SubAccountPermissionSubtitle2", "Parent") + .WithMany("Children") + .HasForeignKey("ParentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Parent"); + }); + + modelBuilder.Entity("AccountManagement.Domain.SubAccountPermissionSubtitle4Agg.SubAccountPermissionSubtitle4", b => + { + b.HasOne("AccountManagement.Domain.SubAccountPermissionSubtitle3Agg.SubAccountPermissionSubtitle3", "Parent") + .WithMany("Children") + .HasForeignKey("ParentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Parent"); + }); + + modelBuilder.Entity("AccountManagement.Domain.SubAccountRoleAgg.SubAccountRole", b => + { + b.OwnsMany("AccountManagement.Domain.SubAccountRoleAgg.SubAccountRolePermission", "RolePermissions", b1 => + { + b1.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b1.Property("id")); + + b1.Property("PermissionCode") + .HasColumnType("int"); + + b1.Property("SubAccountRoleId") + .HasColumnType("bigint"); + + b1.HasKey("id"); + + b1.HasIndex("SubAccountRoleId"); + + b1.ToTable("SubAccountRolePermissions", (string)null); + + b1.WithOwner("SubAccountRole") + .HasForeignKey("SubAccountRoleId"); + + b1.Navigation("SubAccountRole"); + }); + + b.Navigation("RolePermissions"); + }); + + modelBuilder.Entity("AccountManagement.Domain.TaskAgg.Tasks", b => + { + b.HasOne("AccountManagement.Domain.TaskScheduleAgg.TaskSchedule", "TaskSchedule") + .WithMany("TasksList") + .HasForeignKey("TaskScheduleId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("TaskSchedule"); + }); + + modelBuilder.Entity("AccountManagement.Domain.TaskMediaAgg.TaskMedia", b => + { + b.HasOne("AccountManagement.Domain.MediaAgg.Media", "Media") + .WithMany("TaskMedias") + .HasForeignKey("MediaId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AccountManagement.Domain.TaskAgg.Tasks", "Tasks") + .WithMany("TaskMedias") + .HasForeignKey("TaskId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Media"); + + b.Navigation("Tasks"); + }); + + modelBuilder.Entity("AccountManagement.Domain.TaskMessageAgg.TaskMessage", b => + { + b.HasOne("AccountManagement.Domain.AssignAgg.Assign", "Assign") + .WithMany("TaskMessageList") + .HasForeignKey("AssignId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Assign"); + }); + + modelBuilder.Entity("AccountManagement.Domain.TaskMessageItemsAgg.TaskMessageItems", b => + { + b.HasOne("AccountManagement.Domain.TaskMessageAgg.TaskMessage", "TaskMessage") + .WithMany("TaskMessageItemsList") + .HasForeignKey("TaskMessageId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("TaskMessage"); + }); + + modelBuilder.Entity("AccountManagement.Domain.TicketMediasAgg.TicketMedia", b => + { + b.HasOne("AccountManagement.Domain.MediaAgg.Media", "Media") + .WithMany("TicketMedias") + .HasForeignKey("MediaId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AccountManagement.Domain.TicketAgg.Ticket", "Ticket") + .WithMany("TicketMedias") + .HasForeignKey("TicketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Media"); + + b.Navigation("Ticket"); + }); + + modelBuilder.Entity("AccountManagement.Domain.AccountAgg.Account", b => + { + b.Navigation("AccountLeftWorkList"); + + b.Navigation("CameraAccounts"); + }); + + modelBuilder.Entity("AccountManagement.Domain.AdminResponseAgg.AdminResponse", b => + { + b.Navigation("AdminResponseMedias"); + }); + + modelBuilder.Entity("AccountManagement.Domain.AssignAgg.Assign", b => + { + b.Navigation("TaskMessageList"); + }); + + modelBuilder.Entity("AccountManagement.Domain.ClientResponseAgg.ClientResponse", b => + { + b.Navigation("ClientResponseMedias"); + }); + + modelBuilder.Entity("AccountManagement.Domain.MediaAgg.Media", b => + { + b.Navigation("AdminResponseMedias"); + + b.Navigation("ClientResponseMedias"); + + b.Navigation("TaskMedias"); + + b.Navigation("TicketMedias"); + }); + + modelBuilder.Entity("AccountManagement.Domain.RoleAgg.Role", b => + { + b.Navigation("Accounts"); + }); + + modelBuilder.Entity("AccountManagement.Domain.SubAccountPermissionSubtitle1Agg.SubAccountPermissionSubtitle1", b => + { + b.Navigation("Children"); + }); + + modelBuilder.Entity("AccountManagement.Domain.SubAccountPermissionSubtitle2Agg.SubAccountPermissionSubtitle2", b => + { + b.Navigation("Children"); + }); + + modelBuilder.Entity("AccountManagement.Domain.SubAccountPermissionSubtitle3Agg.SubAccountPermissionSubtitle3", b => + { + b.Navigation("Children"); + }); + + modelBuilder.Entity("AccountManagement.Domain.SubAccountRoleAgg.SubAccountRole", b => + { + b.Navigation("SubAccounts"); + }); + + modelBuilder.Entity("AccountManagement.Domain.TaskAgg.Tasks", b => + { + b.Navigation("Assigns"); + + b.Navigation("TaskMedias"); + }); + + modelBuilder.Entity("AccountManagement.Domain.TaskMessageAgg.TaskMessage", b => + { + b.Navigation("TaskMessageItemsList"); + }); + + modelBuilder.Entity("AccountManagement.Domain.TaskScheduleAgg.TaskSchedule", b => + { + b.Navigation("TasksList"); + }); + + modelBuilder.Entity("AccountManagement.Domain.TicketAgg.Ticket", b => + { + b.Navigation("AdminResponses"); + + b.Navigation("ClientResponses"); + + b.Navigation("TicketMedias"); + }); + + modelBuilder.Entity("TaskManager.Domain.PositionAgg.Position", b => + { + b.Navigation("Accounts"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/AccountMangement.Infrastructure.EFCore/Migrations/20241201170643_SubAccount_SubTitleForClientPermission.cs b/AccountMangement.Infrastructure.EFCore/Migrations/20241201170643_SubAccount_SubTitleForClientPermission.cs new file mode 100644 index 00000000..8305d09f --- /dev/null +++ b/AccountMangement.Infrastructure.EFCore/Migrations/20241201170643_SubAccount_SubTitleForClientPermission.cs @@ -0,0 +1,211 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace AccountMangement.Infrastructure.EFCore.Migrations +{ + /// + public partial class SubAccount_SubTitleForClientPermission : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "SubAccountPermissionSubtitle1", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Title = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), + Code = table.Column(type: "int", maxLength: 15, nullable: false), + CreationDate = table.Column(type: "datetime2", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_SubAccountPermissionSubtitle1", x => x.id); + }); + + migrationBuilder.CreateTable( + name: "SubAccountRoles", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Title = table.Column(type: "nvarchar(60)", maxLength: 60, nullable: true), + AccountId = table.Column(type: "bigint", nullable: false), + CreationDate = table.Column(type: "datetime2", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_SubAccountRoles", x => x.id); + }); + + migrationBuilder.CreateTable( + name: "SubAccountPermissionSubtitle2", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Title = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), + Code = table.Column(type: "int", maxLength: 15, nullable: false), + ParentId = table.Column(type: "bigint", nullable: false), + CreationDate = table.Column(type: "datetime2", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_SubAccountPermissionSubtitle2", x => x.id); + table.ForeignKey( + name: "FK_SubAccountPermissionSubtitle2_SubAccountPermissionSubtitle1_ParentId", + column: x => x.ParentId, + principalTable: "SubAccountPermissionSubtitle1", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "SubAccountRolePermissions", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + PermissionCode = table.Column(type: "int", nullable: false), + SubAccountRoleId = table.Column(type: "bigint", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_SubAccountRolePermissions", x => x.id); + table.ForeignKey( + name: "FK_SubAccountRolePermissions_SubAccountRoles_SubAccountRoleId", + column: x => x.SubAccountRoleId, + principalTable: "SubAccountRoles", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "SubAccounts", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + PhoneNumber = table.Column(type: "nvarchar(11)", maxLength: 11, nullable: false), + NationalCode = table.Column(type: "nvarchar(10)", maxLength: 10, nullable: true), + FName = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true), + LName = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true), + SubAccountRoleId = table.Column(type: "bigint", nullable: false), + AccountId = table.Column(type: "bigint", nullable: false), + Username = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + Password = table.Column(type: "nvarchar(1000)", maxLength: 1000, nullable: false), + VerifyCode = table.Column(type: "nvarchar(10)", maxLength: 10, nullable: true), + IsActive = table.Column(type: "nvarchar(1)", maxLength: 1, nullable: false), + ProfilePhoto = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: true), + CreationDate = table.Column(type: "datetime2", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_SubAccounts", x => x.id); + table.ForeignKey( + name: "FK_SubAccounts_SubAccountRoles_SubAccountRoleId", + column: x => x.SubAccountRoleId, + principalTable: "SubAccountRoles", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "SubAccountPermissionSubtitle3", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Title = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), + Code = table.Column(type: "int", maxLength: 15, nullable: false), + ParentId = table.Column(type: "bigint", nullable: false), + CreationDate = table.Column(type: "datetime2", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_SubAccountPermissionSubtitle3", x => x.id); + table.ForeignKey( + name: "FK_SubAccountPermissionSubtitle3_SubAccountPermissionSubtitle2_ParentId", + column: x => x.ParentId, + principalTable: "SubAccountPermissionSubtitle2", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "SubAccountPermissionSubtitle4", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Title = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), + Code = table.Column(type: "int", maxLength: 15, nullable: false), + ParentId = table.Column(type: "bigint", nullable: false), + CreationDate = table.Column(type: "datetime2", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_SubAccountPermissionSubtitle4", x => x.id); + table.ForeignKey( + name: "FK_SubAccountPermissionSubtitle4_SubAccountPermissionSubtitle3_ParentId", + column: x => x.ParentId, + principalTable: "SubAccountPermissionSubtitle3", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_SubAccountPermissionSubtitle2_ParentId", + table: "SubAccountPermissionSubtitle2", + column: "ParentId"); + + migrationBuilder.CreateIndex( + name: "IX_SubAccountPermissionSubtitle3_ParentId", + table: "SubAccountPermissionSubtitle3", + column: "ParentId"); + + migrationBuilder.CreateIndex( + name: "IX_SubAccountPermissionSubtitle4_ParentId", + table: "SubAccountPermissionSubtitle4", + column: "ParentId"); + + migrationBuilder.CreateIndex( + name: "IX_SubAccountRolePermissions_SubAccountRoleId", + table: "SubAccountRolePermissions", + column: "SubAccountRoleId"); + + migrationBuilder.CreateIndex( + name: "IX_SubAccounts_SubAccountRoleId", + table: "SubAccounts", + column: "SubAccountRoleId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "SubAccountPermissionSubtitle4"); + + migrationBuilder.DropTable( + name: "SubAccountRolePermissions"); + + migrationBuilder.DropTable( + name: "SubAccounts"); + + migrationBuilder.DropTable( + name: "SubAccountPermissionSubtitle3"); + + migrationBuilder.DropTable( + name: "SubAccountRoles"); + + migrationBuilder.DropTable( + name: "SubAccountPermissionSubtitle2"); + + migrationBuilder.DropTable( + name: "SubAccountPermissionSubtitle1"); + } + } +} diff --git a/AccountMangement.Infrastructure.EFCore/Migrations/AccountContextModelSnapshot.cs b/AccountMangement.Infrastructure.EFCore/Migrations/AccountContextModelSnapshot.cs index 1512697e..fef8fd2c 100644 --- a/AccountMangement.Infrastructure.EFCore/Migrations/AccountContextModelSnapshot.cs +++ b/AccountMangement.Infrastructure.EFCore/Migrations/AccountContextModelSnapshot.cs @@ -17,7 +17,7 @@ namespace AccountMangement.Infrastructure.EFCore.Migrations { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "8.0.4") + .HasAnnotation("ProductVersion", "8.0.10") .HasAnnotation("Relational:MaxIdentifierLength", 128); SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); @@ -385,6 +385,208 @@ namespace AccountMangement.Infrastructure.EFCore.Migrations b.ToTable("Roles", (string)null); }); + modelBuilder.Entity("AccountManagement.Domain.SubAccountAgg.SubAccount", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("AccountId") + .HasColumnType("bigint"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("FName") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("IsActive") + .IsRequired() + .HasMaxLength(1) + .HasColumnType("nvarchar(1)"); + + b.Property("LName") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("NationalCode") + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.Property("Password") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.Property("PhoneNumber") + .IsRequired() + .HasMaxLength(11) + .HasColumnType("nvarchar(11)"); + + b.Property("ProfilePhoto") + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("SubAccountRoleId") + .HasColumnType("bigint"); + + b.Property("Username") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("VerifyCode") + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.HasKey("id"); + + b.HasIndex("SubAccountRoleId"); + + b.ToTable("SubAccounts", (string)null); + }); + + modelBuilder.Entity("AccountManagement.Domain.SubAccountPermissionSubtitle1Agg.SubAccountPermissionSubtitle1", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("Code") + .HasMaxLength(15) + .HasColumnType("int"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.HasKey("id"); + + b.ToTable("SubAccountPermissionSubtitle1", (string)null); + }); + + modelBuilder.Entity("AccountManagement.Domain.SubAccountPermissionSubtitle2Agg.SubAccountPermissionSubtitle2", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("Code") + .HasMaxLength(15) + .HasColumnType("int"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("ParentId") + .HasColumnType("bigint"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.HasKey("id"); + + b.HasIndex("ParentId"); + + b.ToTable("SubAccountPermissionSubtitle2", (string)null); + }); + + modelBuilder.Entity("AccountManagement.Domain.SubAccountPermissionSubtitle3Agg.SubAccountPermissionSubtitle3", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("Code") + .HasMaxLength(15) + .HasColumnType("int"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("ParentId") + .HasColumnType("bigint"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.HasKey("id"); + + b.HasIndex("ParentId"); + + b.ToTable("SubAccountPermissionSubtitle3", (string)null); + }); + + modelBuilder.Entity("AccountManagement.Domain.SubAccountPermissionSubtitle4Agg.SubAccountPermissionSubtitle4", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("Code") + .HasMaxLength(15) + .HasColumnType("int"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("ParentId") + .HasColumnType("bigint"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.HasKey("id"); + + b.HasIndex("ParentId"); + + b.ToTable("SubAccountPermissionSubtitle4", (string)null); + }); + + modelBuilder.Entity("AccountManagement.Domain.SubAccountRoleAgg.SubAccountRole", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("AccountId") + .HasColumnType("bigint"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("Title") + .HasMaxLength(60) + .HasColumnType("nvarchar(60)"); + + b.HasKey("id"); + + b.ToTable("SubAccountRoles", (string)null); + }); + modelBuilder.Entity("AccountManagement.Domain.TaskAgg.Tasks", b => { b.Property("id") @@ -807,6 +1009,81 @@ namespace AccountMangement.Infrastructure.EFCore.Migrations b.Navigation("Permissions"); }); + modelBuilder.Entity("AccountManagement.Domain.SubAccountAgg.SubAccount", b => + { + b.HasOne("AccountManagement.Domain.SubAccountRoleAgg.SubAccountRole", "SubAccountRole") + .WithMany("SubAccounts") + .HasForeignKey("SubAccountRoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("SubAccountRole"); + }); + + modelBuilder.Entity("AccountManagement.Domain.SubAccountPermissionSubtitle2Agg.SubAccountPermissionSubtitle2", b => + { + b.HasOne("AccountManagement.Domain.SubAccountPermissionSubtitle1Agg.SubAccountPermissionSubtitle1", "Parent") + .WithMany("Children") + .HasForeignKey("ParentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Parent"); + }); + + modelBuilder.Entity("AccountManagement.Domain.SubAccountPermissionSubtitle3Agg.SubAccountPermissionSubtitle3", b => + { + b.HasOne("AccountManagement.Domain.SubAccountPermissionSubtitle2Agg.SubAccountPermissionSubtitle2", "Parent") + .WithMany("Children") + .HasForeignKey("ParentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Parent"); + }); + + modelBuilder.Entity("AccountManagement.Domain.SubAccountPermissionSubtitle4Agg.SubAccountPermissionSubtitle4", b => + { + b.HasOne("AccountManagement.Domain.SubAccountPermissionSubtitle3Agg.SubAccountPermissionSubtitle3", "Parent") + .WithMany("Children") + .HasForeignKey("ParentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Parent"); + }); + + modelBuilder.Entity("AccountManagement.Domain.SubAccountRoleAgg.SubAccountRole", b => + { + b.OwnsMany("AccountManagement.Domain.SubAccountRoleAgg.SubAccountRolePermission", "RolePermissions", b1 => + { + b1.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b1.Property("id")); + + b1.Property("PermissionCode") + .HasColumnType("int"); + + b1.Property("SubAccountRoleId") + .HasColumnType("bigint"); + + b1.HasKey("id"); + + b1.HasIndex("SubAccountRoleId"); + + b1.ToTable("SubAccountRolePermissions", (string)null); + + b1.WithOwner("SubAccountRole") + .HasForeignKey("SubAccountRoleId"); + + b1.Navigation("SubAccountRole"); + }); + + b.Navigation("RolePermissions"); + }); + modelBuilder.Entity("AccountManagement.Domain.TaskAgg.Tasks", b => { b.HasOne("AccountManagement.Domain.TaskScheduleAgg.TaskSchedule", "TaskSchedule") @@ -915,6 +1192,26 @@ namespace AccountMangement.Infrastructure.EFCore.Migrations b.Navigation("Accounts"); }); + modelBuilder.Entity("AccountManagement.Domain.SubAccountPermissionSubtitle1Agg.SubAccountPermissionSubtitle1", b => + { + b.Navigation("Children"); + }); + + modelBuilder.Entity("AccountManagement.Domain.SubAccountPermissionSubtitle2Agg.SubAccountPermissionSubtitle2", b => + { + b.Navigation("Children"); + }); + + modelBuilder.Entity("AccountManagement.Domain.SubAccountPermissionSubtitle3Agg.SubAccountPermissionSubtitle3", b => + { + b.Navigation("Children"); + }); + + modelBuilder.Entity("AccountManagement.Domain.SubAccountRoleAgg.SubAccountRole", b => + { + b.Navigation("SubAccounts"); + }); + modelBuilder.Entity("AccountManagement.Domain.TaskAgg.Tasks", b => { b.Navigation("Assigns"); diff --git a/AccountMangement.Infrastructure.EFCore/Repository/CameraAccountRepository.cs b/AccountMangement.Infrastructure.EFCore/Repository/CameraAccountRepository.cs index 432cf83f..b9e30be9 100644 --- a/AccountMangement.Infrastructure.EFCore/Repository/CameraAccountRepository.cs +++ b/AccountMangement.Infrastructure.EFCore/Repository/CameraAccountRepository.cs @@ -46,6 +46,20 @@ public class CameraAccountRepository : RepositoryBase, ICam }).FirstOrDefault(x => x.Id == id); } + public List GetAllByAccountId(long accountId) + { + return _context.CameraAccounts.Where(x => x.AccountId == accountId) + .Select(x => new CameraAccountViewModel() + { + AccountId = x.AccountId, + Id = x.id, + IsActiveString = x.IsActiveSting, + Username = x.Username, + Mobile = x.Mobile, + WorkshopId = x.WorkshopId + + }).ToList(); + } #region Safa diff --git a/AccountMangement.Infrastructure.EFCore/Repository/SubAccountPermissionSubtitle1Repository.cs b/AccountMangement.Infrastructure.EFCore/Repository/SubAccountPermissionSubtitle1Repository.cs new file mode 100644 index 00000000..8ea2044d --- /dev/null +++ b/AccountMangement.Infrastructure.EFCore/Repository/SubAccountPermissionSubtitle1Repository.cs @@ -0,0 +1,77 @@ + +using _0_Framework.InfraStructure; +using AccountManagement.Application.Contracts.SubAccountPermissionSubtitle; +using AccountManagement.Domain.SubAccountPermissionSubtitle1Agg; +using Microsoft.EntityFrameworkCore; +using System.Collections.Generic; +using System.Linq; +using AccountManagement.Domain.SubAccountAgg; + +namespace AccountMangement.Infrastructure.EFCore.Repository +{ + public class SubAccountPermissionSubtitle1Repository : RepositoryBase, + ISubAccountPermissionSubtitle1Repository + { + private readonly AccountContext _context; + + public SubAccountPermissionSubtitle1Repository(AccountContext context) : base(context) + { + _context = context; + } + + public List GetAllWithChildren() + { + return _context.SubAccountPermissionSubtitle1Collection.Include(x => x.Children) + .ThenInclude(x => x.Children) + .ThenInclude(x => x.Children).AsSplitQuery().Select(x => new SubAccountPermissionSubtitleViewModel + { + Id = x.id, + Code = x.Code, + Title = x.Title, + Children = x.Children.Select(y => new SubAccountPermissionSubtitleViewModel + { + Id = y.id, + Code = y.Code, + Title = y.Title, + Children = y.Children.Select(z => new SubAccountPermissionSubtitleViewModel + { + Id = z.id, + Code = z.Code, + Title = z.Title, + Children = z.Children.Select(w => new SubAccountPermissionSubtitleViewModel + { + Id = w.id, + Code = w.Code, + Title = w.Title, + }).OrderBy(w => w.Title).ToList() + }).OrderBy(z => z.Title).ToList(), + + }).OrderBy(y => y.Title).ToList() + }).OrderBy(x => x.Title).AsNoTracking().ToList(); + + + } + + public List GetAllPermissionCodes() + { + var data = GetAllWithChildren(); + return Flatten(data); + + } + + public List Flatten(List hierarchy) + { + var flatList = new List(); + foreach (var item in hierarchy) + { + flatList.Add(item.Code); + if (item.Children != null && item.Children.Any()) + { + flatList.AddRange(Flatten(item.Children.ToList())); + } + } + + return flatList; + } + } +} diff --git a/AccountMangement.Infrastructure.EFCore/Repository/SubAccountPermissionSubtitle2Repository.cs b/AccountMangement.Infrastructure.EFCore/Repository/SubAccountPermissionSubtitle2Repository.cs new file mode 100644 index 00000000..c31cc4e8 --- /dev/null +++ b/AccountMangement.Infrastructure.EFCore/Repository/SubAccountPermissionSubtitle2Repository.cs @@ -0,0 +1,13 @@ + +using _0_Framework.InfraStructure; +using AccountManagement.Domain.SubAccountPermissionSubtitle2Agg; + +namespace AccountMangement.Infrastructure.EFCore.Repository +{ + public class SubAccountPermissionSubtitle2Repository : RepositoryBase, ISubAccountPermissionSubtitle2Repository + { + public SubAccountPermissionSubtitle2Repository(AccountContext context) : base(context) + { + } + } +} diff --git a/AccountMangement.Infrastructure.EFCore/Repository/SubAccountPermissionSubtitle3Repository.cs b/AccountMangement.Infrastructure.EFCore/Repository/SubAccountPermissionSubtitle3Repository.cs new file mode 100644 index 00000000..8790b1d2 --- /dev/null +++ b/AccountMangement.Infrastructure.EFCore/Repository/SubAccountPermissionSubtitle3Repository.cs @@ -0,0 +1,13 @@ + +using _0_Framework.InfraStructure; +using AccountManagement.Domain.SubAccountPermissionSubtitle3Agg; + +namespace AccountMangement.Infrastructure.EFCore.Repository +{ + public class SubAccountPermissionSubtitle3Repository : RepositoryBase, ISubAccountPermissionSubtitle3Repository + { + public SubAccountPermissionSubtitle3Repository(AccountContext context) : base(context) + { + } + } +} diff --git a/AccountMangement.Infrastructure.EFCore/Repository/SubAccountPermissionSubtitle4Repository.cs b/AccountMangement.Infrastructure.EFCore/Repository/SubAccountPermissionSubtitle4Repository.cs new file mode 100644 index 00000000..9d15047b --- /dev/null +++ b/AccountMangement.Infrastructure.EFCore/Repository/SubAccountPermissionSubtitle4Repository.cs @@ -0,0 +1,13 @@ + +using _0_Framework.InfraStructure; +using AccountManagement.Domain.SubAccountPermissionSubtitle4Agg; + +namespace AccountMangement.Infrastructure.EFCore.Repository +{ + public class SubAccountPermissionSubtitle4Repository : RepositoryBase, ISubAccountPermissionSubtitle4Repository + { + public SubAccountPermissionSubtitle4Repository(AccountContext context) : base(context) + { + } + } +} diff --git a/AccountMangement.Infrastructure.EFCore/Repository/SubAccountRepository.cs b/AccountMangement.Infrastructure.EFCore/Repository/SubAccountRepository.cs new file mode 100644 index 00000000..8f54ad7a --- /dev/null +++ b/AccountMangement.Infrastructure.EFCore/Repository/SubAccountRepository.cs @@ -0,0 +1,81 @@ +using _0_Framework.Application; +using _0_Framework.InfraStructure; +using AccountManagement.Application.Contracts.SubAccount; +using AccountManagement.Domain.SubAccountAgg; +using Microsoft.EntityFrameworkCore; +using System.Collections.Generic; +using System.Linq; + +namespace AccountMangement.Infrastructure.EFCore.Repository +{ + public class SubAccountRepository : RepositoryBase, ISubAccountRepository + { + private readonly AccountContext _context; + public SubAccountRepository(AccountContext context) : base(context) + { + _context = context; + } + + + public List GetAllByAccountId(long accountId, int pageIndex) + { + + return _context.SubAccounts.Include(x => x.SubAccountRole).Where(x => x.AccountId == accountId) + .Select(x => new SubAccountViewModel + { + SubAccountFullName = x.FullName, + Id = x.id, + SubAccountRole = x.SubAccountRole.Title, + IsActive = x.IsActive, + PhoneNumber = x.PhoneNumber, + ProfilePhoto = x.ProfilePhoto, + Username = x.Username + }).Skip(pageIndex).Take(30).ToList(); + } + + public List GetSubAccountsByAccountIdGroupedByRole(long accountId) + { + var roles = _context.SubAccountRoles.Include(x => x.SubAccounts).Where(x => x.AccountId == accountId).ToList(); + return roles.Select(x => new SubAccountsGroupedByRoleViewModel + { + RoleId = x.id, + RoleTitle = x.Title, + SubAccounts = x.SubAccounts.Where(y => y.SubAccountRoleId == x.id) + .Select(y => new SubAccountViewModel + { + Id = y.id, + IsActive = y.IsActive, + PhoneNumber = y.PhoneNumber, + ProfilePhoto = y.ProfilePhoto, + Username = y.Username, + SubAccountFullName = y.FullName + }).ToList(), + }).ToList(); + } + + public SubAccount GetDetails(long subAccountId) + { + return _context.SubAccounts.Include(x => x.SubAccountRole).ThenInclude(x => x.RolePermissions) + .FirstOrDefault(x => x.id == subAccountId); + } + + public SubAccount GetBy(string username) + { + return _context.SubAccounts.FirstOrDefault(x => x.IsActive == IsActive.True && x.Username == username); + } + + public SubAccountViewModel GetByVerifyCodeAndPhoneNumber(string code, string phone) + { + var entity = _context.SubAccounts.FirstOrDefault(entity => entity.VerifyCode == code && entity.PhoneNumber == phone); + return new SubAccountViewModel + { + SubAccountFullName = entity.FullName, + Id = entity.id, + IsActive = entity.IsActive, + PhoneNumber = entity.PhoneNumber, + ProfilePhoto = "", + Username = entity.Username + }; + } + } +} diff --git a/AccountMangement.Infrastructure.EFCore/Repository/SubAccountRoleRepository.cs b/AccountMangement.Infrastructure.EFCore/Repository/SubAccountRoleRepository.cs new file mode 100644 index 00000000..bf44ee3f --- /dev/null +++ b/AccountMangement.Infrastructure.EFCore/Repository/SubAccountRoleRepository.cs @@ -0,0 +1,29 @@ + +using _0_Framework.InfraStructure; +using AccountManagement.Application.Contracts.SubAccount; +using AccountManagement.Domain.SubAccountRoleAgg; +using Microsoft.EntityFrameworkCore; +using System.Collections.Generic; +using System.Linq; + +namespace AccountMangement.Infrastructure.EFCore.Repository +{ + public class SubAccountRoleRepository : RepositoryBase, ISubAccountRoleRepository + { + private readonly AccountContext _accountContext; + public SubAccountRoleRepository(AccountContext context) : base(context) + { + _accountContext = context; + } + + public List GetSubAccountRolesByAccountId(long accountId) + { + return _accountContext.SubAccountRoles.Where(x => x.AccountId == accountId) + .Select(x => new SubAccountRoleViewModel() + { + Id = x.id, + Title = x.Title + }).ToList(); + } + } +} diff --git a/Company.Domain/CheckoutAgg/ICheckoutRepository.cs b/Company.Domain/CheckoutAgg/ICheckoutRepository.cs index 2b61e8ce..f395f43e 100644 --- a/Company.Domain/CheckoutAgg/ICheckoutRepository.cs +++ b/Company.Domain/CheckoutAgg/ICheckoutRepository.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.Threading.Tasks; using _0_Framework.Application; using _0_Framework.Domain; @@ -33,4 +34,14 @@ public interface ICheckoutRepository : IRepository List CheckHasSignature(List ids); Task> SearchForMainCheckout(CheckoutSearchModel searchModel); #endregion + + #region Pooya + + List<(long EmployeeId, DateTime CheckoutStart, DateTime CheckoutEnd)> GetLastCheckoutsByWorkshopId(long workshopId, + DateTime start, DateTime end); + + List<(long EmployeeId, DateTime CheckoutStart, DateTime CheckoutEnd)> GetLastCheckoutsByWorkshopIdForWorkFlow( + long workshopId, DateTime start, DateTime end); + + #endregion } \ No newline at end of file diff --git a/Company.Domain/CustomizeCheckoutAgg/CustomizeCheckout.cs b/Company.Domain/CustomizeCheckoutAgg/CustomizeCheckout.cs index 0c578817..9b11a8c7 100644 --- a/Company.Domain/CustomizeCheckoutAgg/CustomizeCheckout.cs +++ b/Company.Domain/CustomizeCheckoutAgg/CustomizeCheckout.cs @@ -1,8 +1,8 @@ -using _0_Framework.Domain; -using System; -using _0_Framework.Application; +using _0_Framework.Application; +using _0_Framework.Domain; using Company.Domain.EmployeeAgg; using Company.Domain.WorkshopAgg; +using System; namespace Company.Domain.CustomizeCheckoutAgg; @@ -11,15 +11,18 @@ namespace Company.Domain.CustomizeCheckoutAgg; /// public class CustomizeCheckout : EntityBase { - public CustomizeCheckout(DateTime contractStart, DateTime contractEnd, long employeeId, long workshopId, long? contractId, long employerId, double monthlySalary, double fridayPay, double overTimePay, double baseYearsPay, double bonusesPay, double nightWorkPay, double marriedAllowance, double shiftPay, double familyAllowance, double leavePay, double insuranceDeduction, double fineAbsenceDeduction, double lateToWorkDeduction, double earlyExitDeduction, double rewardPay, double salaryAidDeduction, double installmentDeduction, double fineDeduction, double taxDeduction, string sumOfWorkingDays, string totalClaims, string totalDeductions, double totalPayment) + public CustomizeCheckout(DateTime contractStart, DateTime contractEnd, long employeeId, long workshopId, long? contractId, + double monthlySalary, double fridayPay, double overTimePay, double baseYearsPay, double bonusesPay, double nightWorkPay, + double marriedAllowance, double shiftPay, double familyAllowance, double leavePay, double insuranceDeduction, double fineAbsenceDeduction, + double lateToWorkDeduction, double earlyExitDeduction, double rewardPay, double salaryAidDeduction, double installmentDeduction, + double fineDeduction, double taxDeduction, string sumOfWorkingDays, string totalClaims, string totalDeductions, double totalPayment) { - YearInt = Convert.ToInt32(contractStart.ToFarsi().Substring(0,4)); + YearInt = Convert.ToInt32(contractStart.ToFarsi().Substring(0, 4)); MonthInt = Convert.ToInt32(contractStart.ToFarsi().Substring(5, 2)); ContractStart = contractStart; ContractEnd = contractEnd; EmployeeId = employeeId; WorkshopId = workshopId; - EmployerId = employerId; MonthlySalary = monthlySalary; FridayPay = fridayPay; OverTimePay = overTimePay; @@ -44,7 +47,6 @@ public class CustomizeCheckout : EntityBase TotalDeductions = totalDeductions; TotalPayment = totalPayment; ContractId = contractId; - IsActiveString = IsActive.True; } #region Getters @@ -66,11 +68,9 @@ public class CustomizeCheckout : EntityBase #region RelationProperties public long EmployeeId { get; private set; } public long WorkshopId { get; private set; } - public long EmployerId { get; private set; } public long? ContractId { get; private set; } #endregion - public IsActive IsActiveString { get; private set; } /// /// شماره قرارداد diff --git a/Company.Domain/CustomizeCheckoutAgg/ICustomizeCheckoutRepository.cs b/Company.Domain/CustomizeCheckoutAgg/ICustomizeCheckoutRepository.cs new file mode 100644 index 00000000..f93c416c --- /dev/null +++ b/Company.Domain/CustomizeCheckoutAgg/ICustomizeCheckoutRepository.cs @@ -0,0 +1,12 @@ + +using _0_Framework.Domain; +using CompanyManagment.App.Contracts.CustomizeCheckout; +using System.Collections.Generic; + +namespace Company.Domain.CustomizeCheckoutAgg +{ + public interface ICustomizeCheckoutRepository : IRepository + { + IEnumerable Search(SearchCustomizeCheckout searchModel); + } +} diff --git a/Company.Domain/CustomizeWorkshopEmployeeSettingsAgg/Entities/CustomizeWorkshopEmployeeSettings.cs b/Company.Domain/CustomizeWorkshopEmployeeSettingsAgg/Entities/CustomizeWorkshopEmployeeSettings.cs index b10965cf..bd079dac 100644 --- a/Company.Domain/CustomizeWorkshopEmployeeSettingsAgg/Entities/CustomizeWorkshopEmployeeSettings.cs +++ b/Company.Domain/CustomizeWorkshopEmployeeSettingsAgg/Entities/CustomizeWorkshopEmployeeSettings.cs @@ -1,247 +1,210 @@ using System; using System.Collections.Generic; +using System.IO; +using System.Linq; using _0_Framework.Domain; -using _0_Framework.Domain.CustomizeCheckoutValueObjects; +using _0_Framework.Domain.CustomizeCheckoutShared.Base; +using _0_Framework.Domain.CustomizeCheckoutShared.Enums; +using _0_Framework.Domain.CustomizeCheckoutShared.ValueObjects; using Company.Domain.CustomizeWorkshopGroupSettingsAgg.Entities; using Company.Domain.EmployeeAgg; using Company.Domain.WorkshopAgg; +using CompanyManagment.App.Contracts.CustomizeWorkshopSettings.ValueObjectsViewModel; +using Microsoft.AspNetCore.Mvc; namespace Company.Domain.CustomizeWorkshopEmployeeSettingsAgg.Entities; -public class CustomizeWorkshopEmployeeSettings : EntityBase +public class CustomizeWorkshopEmployeeSettings : BaseCustomizeEntity { - 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 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; - MarriedAllowance = marriedAllowance; - ShiftPay= shiftPay; - IsChanged = false; - } - - /// - /// جمعه کاری - /// - public FridayPay FridayPay { get; private set; } - - /// - /// اضافه کاری - /// - public OverTimePay OverTimePay { get; private set; } - - /// - /// سنوات - /// - public BaseYearsPay BaseYearsPay { get; private set; } - - /// - /// عیدی - /// - public BonusesPay BonusesPay { get; private set; } - - /// - /// شب کاری - /// - public NightWorkPay NightWorkPay { get; private set; } - - /// - /// حق تاهل - /// - public MarriedAllowance MarriedAllowance { get; private set; } - - /// - /// نوبت کاری - /// - public ShiftPay ShiftPay { get; private set; } - - /// - /// حق اولاد(حق فرزند)ء - /// - public FamilyAllowance FamilyAllowance { get; private set; } - - /// - /// مزد مرخصی - /// - public LeavePay LeavePay { get; private set; } - - /// - /// حق بیمه - /// - public InsuranceDeduction InsuranceDeduction { get; private set; } - - /// - /// جریمه غیبت - /// - public FineAbsenceDeduction FineAbsenceDeduction { get; private set; } - - /// - /// تاخیر در ورود - /// - public LateToWork LateToWork { get; private set; } - - /// - /// نعجیل در خروج - /// - public EarlyExit EarlyExit { get; private set; } - - /// - /// آیا جمعه کار میکند یا نه - /// - public FridayWork FridayWork { get; set; } - - /// - /// آیا در روز های تعطیل کار میکند - /// - public HolidayWork HolidayWork { get; 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 CustomizeWorkshopEmployeeSettingsShifts { get; set; } - public CustomizeWorkshopGroupSettings CustomizeWorkshopGroupSettings { get; set; } - - - /// - /// تغییر مقادیر تنظیمات پرسنل با وضعیت بدون تغییر - /// - /// شیفت های کاری پرسنل - /// حقوق ماهیانه اختصاص داده شده - /// جمعه کاری - /// اضافه کاری - /// سنوات - /// عیدی - /// شب کاری - /// حق تاهل - /// نوبت کاری - /// حق اولاد - /// مزد مرخصی - /// حق بیمه - /// جریمه غیبت - /// تاخیر در ورود - /// تعجیل درخروج - /// آیا در روز های جمعه موظف به کار است - /// آیا در تعطیلات رسمی موظف به کار است - internal void EditEmployeesAndMakeIsChangeFalse( - ICollection 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, FridayWork fridayWork, HolidayWork holidayWork) - { - 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; - FridayWork = fridayWork; - HolidayWork = holidayWork; - CustomizeWorkshopEmployeeSettingsShifts = employeeSettingsShifts; - IsChanged = false; - } - - - /// - /// تغییر مقادیر تنظیمات پرسنل و تغییر وضعیت آن به تغییر یافته - /// - /// شیفت های کاری پرسنل - /// حقوق ماهیانه اختصاص داده شده - /// جمعه کاری - /// اضافه کاری - /// سنوات - /// عیدی - /// شب کاری - /// حق تاهل - /// نوبت کاری - /// حق اولاد - /// مزد مرخصی - /// حق بیمه - /// جریمه غیبت - /// تاخیر در ورود - /// تعجیل درخروج - /// آیا در روز های جمعه موظف به کار است - /// آیا در تعطیلات رسمی موظف به کار است - public void EditEmployeesAndMakeIsChangeTrue( - ICollection 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,FridayWork fridayWork,HolidayWork holidayWork) - { - 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; - FridayWork = fridayWork; - HolidayWork = holidayWork; - } - - public void SimpleEditAndMakeIsChangeFalse(ICollection employeeSettingsShift, double salary) - { - CustomizeWorkshopEmployeeSettingsShifts = employeeSettingsShift; - Salary = salary; - IsChanged = false; - } - - #region Vafa - - public void SimpleEditEmployeesAndMakeIsChangeTrue(ICollection employeeSettingsShifts, double salary) + 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 customizeWorkshopEmployeeSettingsShifts, + FridayWork fridayWork, + HolidayWork holidayWork, IrregularShift irregularShift, WorkshopShiftStatus workshopShiftStatus, BreakTime breakTime) : base(fridayPay, overTimePay, + baseYearsPay, bonusesPay, nightWorkPay, + marriedAllowance, shiftPay, familyAllowance, leavePay, insuranceDeduction, fineAbsenceDeduction, lateToWork, + earlyExit, fridayWork, holidayWork, breakTime) + { + CustomizeWorkshopEmployeeSettingsShifts = EmployeeSettingsShiftsConvertor(customizeWorkshopEmployeeSettingsShifts); + + CustomizeWorkshopGroupSettingId = customizeWorkshopGroupSettingId; + + IsSettingChanged = false; + IsShiftChanged = false; + EmployeeId = employeeId; + WorkshopId = workshopId; Salary = salary; - CustomizeWorkshopEmployeeSettingsShifts = employeeSettingsShifts; - IsChanged = true; + WorkshopShiftStatus = workshopShiftStatus; + IrregularShift = workshopShiftStatus == WorkshopShiftStatus.Regular ? + new IrregularShift(new TimeOnly(), new TimeOnly(), WorkshopIrregularShifts.None) + : new IrregularShift(irregularShift.StartTime, irregularShift.EndTime, irregularShift.WorkshopIrregularShifts); } - #endregion + public IrregularShift IrregularShift { get; set; } + public WorkshopShiftStatus WorkshopShiftStatus { get; private set; } + public long EmployeeId { get; private set; } + public long WorkshopId { get; private set; } + public double Salary { get; private set; } + public bool IsShiftChanged { get; private set; } + public bool IsSettingChanged { get; private set; } + public long CustomizeWorkshopGroupSettingId { get; set; } + + public ICollection CustomizeWorkshopEmployeeSettingsShifts { get; set; } + public CustomizeWorkshopGroupSettings CustomizeWorkshopGroupSettings { get; set; } + + + /// + /// تغییر مقادیر تنظیمات پرسنل + /// + /// شیفت های کاری پرسنل + /// حقوق ماهیانه اختصاص داده شده + /// جمعه کاری + /// اضافه کاری + /// سنوات + /// عیدی + /// شب کاری + /// حق تاهل + /// نوبت کاری + /// حق اولاد + /// مزد مرخصی + /// حق بیمه + /// جریمه غیبت + /// تاخیر در ورود + /// تعجیل درخروج + /// آیا در روز های جمعه موظف به کار است + /// آیا در تعطیلات رسمی موظف به کار است + /// نوع شیفت کاری + /// آیا شیفت منظم است یا نا منظم + /// + public void EditEmployees(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, + FridayWork fridayWork, HolidayWork holidayWork, IrregularShift irregularShift, + WorkshopShiftStatus workshopShiftStatus, bool isSettingChange) + { + SetValueObjects(fridayPay, overTimePay, baseYearsPay, bonusesPay + , nightWorkPay, marriedAllowance, shiftPay, familyAllowance, leavePay, insuranceDeduction, fineAbsenceDeduction, + lateToWork, earlyExit); + + Salary = salary; + IsSettingChanged = isSettingChange; + FridayWork = fridayWork; + HolidayWork = holidayWork; + IrregularShift = workshopShiftStatus == WorkshopShiftStatus.Regular ? + new IrregularShift(new TimeOnly(), new TimeOnly(), WorkshopIrregularShifts.None) + : new IrregularShift(irregularShift.StartTime, irregularShift.EndTime, irregularShift.WorkshopIrregularShifts); + WorkshopShiftStatus = workshopShiftStatus; + } + + + + + + + public void SimpleEdit( + ICollection employeeSettingsShift, + IrregularShift irregularShift, + WorkshopShiftStatus workshopShiftStatus, BreakTime breakTime, bool isShiftChange) + { + CustomizeWorkshopEmployeeSettingsShifts = EmployeeSettingsShiftsConvertor(employeeSettingsShift); + BreakTime = new BreakTime(breakTime.HasBreakTimeValue, breakTime.BreakTimeValue); + IsShiftChanged = isShiftChange; + WorkshopShiftStatus = workshopShiftStatus; + + IrregularShift = workshopShiftStatus == WorkshopShiftStatus.Regular ? + new IrregularShift(new TimeOnly(), new TimeOnly(), WorkshopIrregularShifts.None) + : new IrregularShift(irregularShift.StartTime, irregularShift.EndTime, irregularShift.WorkshopIrregularShifts); + } + + + private List EmployeeSettingsShiftsConvertor( + ICollection employeeSettingsShift) + { + var customizeWorkshopSettingShiftsList = + employeeSettingsShift.ToList(); // Handle the special case where there's only one shift + if (customizeWorkshopSettingShiftsList.Count == 1) + { + var singleShift = customizeWorkshopSettingShiftsList.First(); + return new List + { + new CustomizeWorkshopEmployeeSettingsShift(singleShift.StartTime, singleShift.EndTime, + singleShift.Placement, TimeOnly.MaxValue) + }; + } + + return customizeWorkshopSettingShiftsList.Select((x, index) => + { + + if (index == 0) + { + return new CustomizeWorkshopEmployeeSettingsShift(x.StartTime, x.EndTime, x.Placement); + + } + + // Ensure no more than three shifts + if (index >= 3) + { + throw new InvalidDataException("شیفت های پرسنل نمیتواند بیشتر از سه تا باشد"); + } + + var previousShift = customizeWorkshopSettingShiftsList[index - 1]; + var nextStart = new DateTime(DateOnly.MinValue, x.StartTime); + var previousEnd = new DateTime(DateOnly.MinValue, previousShift.EndTime); + if (nextStart < previousEnd) + { + nextStart = nextStart.AddDays(1); + } + + var differenceTimeSpan = nextStart - previousEnd; + var oneThirdOfDifference = (differenceTimeSpan / 3) * 2; + var previousTimeThreshold = TimeOnly.FromDateTime(previousEnd.AddTicks(oneThirdOfDifference.Ticks)); + return new CustomizeWorkshopEmployeeSettingsShift(x.StartTime, x.EndTime, x.Placement, + previousTimeThreshold); + }).ToList(); + + } + + + + private void SetValueObjects(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 = new(FridayPay.FridayPayType, FridayPay.Value); + OverTimePay = new(OverTimePay.OverTimePayType, OverTimePay.Value); + BaseYearsPay = new(BaseYearsPay.BaseYearsPayType, BaseYearsPay.Value, BaseYearsPay.PaymentType); + BonusesPay = new(BonusesPay.BonusesPayType, BonusesPay.Value, BonusesPay.PaymentType); + NightWorkPay = new(NightWorkPay.NightWorkingType, NightWorkPay.Value); + MarriedAllowance = new(MarriedAllowance.MarriedAllowanceType, MarriedAllowance.Value); + ShiftPay = new(ShiftType.None, ShiftPayType.None, 0); + FamilyAllowance = new(FamilyAllowance.FamilyAllowanceType, FamilyAllowance.Value); + LeavePay = new(LeavePay.LeavePayType, LeavePay.Value); + InsuranceDeduction = new(InsuranceDeduction.InsuranceDeductionType, InsuranceDeduction.Value); + FineAbsenceDeduction = new( + FineAbsenceDeduction.FineAbsenceDeductionType, FineAbsenceDeduction.Value, + FineAbsenceDeduction.FineAbsenceDayOfWeekCollection + .Select(x => new FineAbsenceDayOfWeek(x.DayOfWeek)).ToList() + ); + LateToWork = new( + LateToWork.LateToWorkType, + LateToWork.LateToWorkTimeFines.Select(x => new LateToWorkTimeFine(x.Minute, x.FineMoney)) + .ToList(), LateToWork.Value + ); + EarlyExit = new(EarlyExit.EarlyExitType, + EarlyExit.EarlyExitTimeFines.Select(x => new EarlyExitTimeFine(x.Minute, x.FineMoney)) + .ToList(), EarlyExit.Value); + } + + } \ No newline at end of file diff --git a/Company.Domain/CustomizeWorkshopEmployeeSettingsAgg/Entities/CustomizeWorkshopEmployeeSettingsShift.cs b/Company.Domain/CustomizeWorkshopEmployeeSettingsAgg/Entities/CustomizeWorkshopEmployeeSettingsShift.cs index 4ed91f3a..00e1fda6 100644 --- a/Company.Domain/CustomizeWorkshopEmployeeSettingsAgg/Entities/CustomizeWorkshopEmployeeSettingsShift.cs +++ b/Company.Domain/CustomizeWorkshopEmployeeSettingsAgg/Entities/CustomizeWorkshopEmployeeSettingsShift.cs @@ -1,28 +1,39 @@ -using _0_Framework.Domain; + using CompanyManagment.App.Contracts.CustomizeWorkshopSettings; using System; +using _0_Framework.Domain.CustomizeCheckoutShared.Base; +using _0_Framework.Domain.CustomizeCheckoutShared.Enums; +using Company.Domain.CustomizeWorkshopGroupSettingsAgg.Entities; namespace Company.Domain.CustomizeWorkshopEmployeeSettingsAgg.Entities; -public class CustomizeWorkshopEmployeeSettingsShift : EntityBase +public class CustomizeWorkshopEmployeeSettingsShift : CustomizeSifts { - private CustomizeWorkshopEmployeeSettingsShift() - { + public CustomizeWorkshopEmployeeSettingsShift(TimeOnly startTime, TimeOnly endTime, ShiftPlacement placement, TimeOnly previousShiftThreshold=new ()) : base(startTime, endTime, placement) + { + + PreviousShiftThreshold = previousShiftThreshold; + } - } - - public CustomizeWorkshopEmployeeSettingsShift(TimeOnly startTime, TimeOnly endTime, ShiftPlacement placement) - { - Placement = placement; - StartTime = startTime; - EndTime = endTime; - } - public TimeOnly StartTime { get; private set; } - public TimeOnly EndTime { get; private set; } - public ShiftPlacement Placement { get; private set; } - - public long CustomizeWorkshopEmployeeSettingsId { get; private set; } + public long CustomizeWorkshopEmployeeSettingsId { get; private set; } public CustomizeWorkshopEmployeeSettings CustomizeWorkshopEmployeeSettings { get; set; } + + /// + /// این پراپرتی مقدار یک سوم تایم بینابین با شیفت قبلیست. + ///دقت داشته باشید که درصورت خالی بودن این بخش مقدار به 23.59.9999 تغییر میکند + /// + public TimeOnly PreviousShiftThreshold { get; set; } + + public override bool Equals(object obj) + { + if (obj is CustomizeWorkshopEmployeeSettingsShift other) + { + return base.Equals(other); + + } + return false; + + } } \ No newline at end of file diff --git a/Company.Domain/CustomizeWorkshopEmployeeSettingsAgg/ICustomizeWorkshopEmployeeSettingsRepository.cs b/Company.Domain/CustomizeWorkshopEmployeeSettingsAgg/ICustomizeWorkshopEmployeeSettingsRepository.cs index 5f26f0bc..22e91dc6 100644 --- a/Company.Domain/CustomizeWorkshopEmployeeSettingsAgg/ICustomizeWorkshopEmployeeSettingsRepository.cs +++ b/Company.Domain/CustomizeWorkshopEmployeeSettingsAgg/ICustomizeWorkshopEmployeeSettingsRepository.cs @@ -1,6 +1,7 @@ using _0_Framework.Domain; using Company.Domain.CustomizeWorkshopEmployeeSettingsAgg.Entities; using CompanyManagment.App.Contracts.CustomizeWorkshopSettings; +using System.Collections.Generic; namespace Company.Domain.CustomizeWorkshopEmployeeSettingsAgg; @@ -8,4 +9,8 @@ public interface ICustomizeWorkshopEmployeeSettingsRepository : IRepository GetBy(long groupId); + List GetEmployeeSettingsByWorkshopId(long workshopId); + List GetEmployeeSettingNotInMainGroup(long entityWorkshopId); } \ No newline at end of file diff --git a/Company.Domain/CustomizeWorkshopGroupSettingsAgg/Entities/CustomizeWorkshopGroupSettings.cs b/Company.Domain/CustomizeWorkshopGroupSettingsAgg/Entities/CustomizeWorkshopGroupSettings.cs index ea33b554..d4af63c8 100644 --- a/Company.Domain/CustomizeWorkshopGroupSettingsAgg/Entities/CustomizeWorkshopGroupSettings.cs +++ b/Company.Domain/CustomizeWorkshopGroupSettingsAgg/Entities/CustomizeWorkshopGroupSettings.cs @@ -1,135 +1,118 @@ using System; using System.Collections.Generic; +using System.IO; using System.Linq; using _0_Framework.Domain; -using _0_Framework.Domain.CustomizeCheckoutValueObjects; +using _0_Framework.Domain.CustomizeCheckoutShared.Base; +using _0_Framework.Domain.CustomizeCheckoutShared.Enums; +using _0_Framework.Domain.CustomizeCheckoutShared.ValueObjects; using Company.Domain.CustomizeWorkshopEmployeeSettingsAgg.Entities; using Company.Domain.CustomizeWorkshopSettingsAgg.Entities; +using Company.Domain.WorkshopAgg; +using Newtonsoft.Json.Serialization; +using static Microsoft.EntityFrameworkCore.DbLoggerCategory.Database; namespace Company.Domain.CustomizeWorkshopGroupSettingsAgg.Entities; -public class CustomizeWorkshopGroupSettings : EntityBase +public class CustomizeWorkshopGroupSettings : BaseCustomizeEntity { - private CustomizeWorkshopGroupSettings() + public CustomizeWorkshopGroupSettings() { + } - public CustomizeWorkshopGroupSettings( string groupName, double salary, long customizeWorkshopSettingId, - ICollection customizeWorkshopGroupSettingsShifts,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, - FridayWork fridayWork,HolidayWork holidayWork) + public CustomizeWorkshopGroupSettings(string groupName, double salary, + long customizeWorkshopSettingId, ICollection customizeWorkshopGroupSettingsShifts, + 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, FridayWork fridayWork, + HolidayWork holidayWork, BreakTime breakTime, WorkshopShiftStatus workshopShiftStatus, IrregularShift irregularShift) : base(fridayPay, overTimePay, baseYearsPay, bonusesPay, nightWorkPay, + marriedAllowance, shiftPay, familyAllowance, leavePay, insuranceDeduction, fineAbsenceDeduction, lateToWork, + earlyExit, fridayWork, holidayWork, breakTime) { GroupName = groupName; Salary = salary; CustomizeWorkshopSettingId = customizeWorkshopSettingId; + GuardGroupShifts(customizeWorkshopGroupSettingsShifts); CustomizeWorkshopGroupSettingsShifts = customizeWorkshopGroupSettingsShifts; - 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; - FridayWork = fridayWork; - HolidayWork = holidayWork; + WorkshopShiftStatus = workshopShiftStatus; + IrregularShift = workshopShiftStatus == WorkshopShiftStatus.Regular ? + new IrregularShift(new TimeOnly(), new TimeOnly(), WorkshopIrregularShifts.None) + : new IrregularShift(irregularShift.StartTime, irregularShift.EndTime, irregularShift.WorkshopIrregularShifts); + } + + private void GuardGroupShifts(ICollection customizeWorkshopGroupSettingsShifts) + { + if (customizeWorkshopGroupSettingsShifts.Count >= 4) + { + throw new InvalidDataException("شما نمیتوانید بیشتر از سه ساعت کاری در کارگاه بگذارید"); + } } - /// - /// جمعه کاری - /// - public FridayPay FridayPay { get; private set; } - - /// - /// اضافه کاری - /// - public OverTimePay OverTimePay { get; private set; } - - /// - /// سنوات - /// - public BaseYearsPay BaseYearsPay { get; private set; } - - /// - /// عیدی - /// - public BonusesPay BonusesPay { get; private set; } - - /// - /// شب کاری - /// - public NightWorkPay NightWorkPay { get; private set; } - - /// - /// حق تاهل - /// - public MarriedAllowance MarriedAllowance { get; private set; } - - /// - /// نوبت کاری - /// - public ShiftPay ShiftPay { get; private set; } - - /// - /// حق اولاد(حق فرزند)ء - /// - public FamilyAllowance FamilyAllowance { get; private set; } - - /// - /// مزد مرخصی - /// - public LeavePay LeavePay { get; private set; } - - /// - /// حق بیمه - /// - public InsuranceDeduction InsuranceDeduction { get; private set; } - - /// - /// جریمه غیبت - /// - public FineAbsenceDeduction FineAbsenceDeduction { get; private set; } - - /// - /// تاخیر در ورود - /// - public LateToWork LateToWork { get; private set; } - - /// - /// نعجیل در خروج - /// - public EarlyExit EarlyExit { get; private set; } - - /// - /// آیا جمعه کار میکند یا نه - /// - public FridayWork FridayWork { get; set; } - - /// - /// آیا در روز های تعطیل کار میکند - /// - public HolidayWork HolidayWork { get; set; } - public string GroupName { get; private set; } public double Salary { get; private set; } public long CustomizeWorkshopSettingId { get; private set; } - + public WorkshopShiftStatus WorkshopShiftStatus { get; private set; } + public bool MainGroup { get; private set; } + public bool IsShiftChange { get; private set; } + public bool IsSettingChange { get; private set; } + public IrregularShift IrregularShift { get; set; } public ICollection CustomizeWorkshopGroupSettingsShifts { get; set; } public ICollection CustomizeWorkshopEmployeeSettingsCollection { get; set; } public CustomizeWorkshopSettings CustomizeWorkshopSettings { get; set; } - public void EditAndOverwriteOnEmployees(string groupName, double salary, IEnumerable employeeIds, FridayPay fridayPay, + + public CustomizeWorkshopGroupSettings CreateMainGroup(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 customizeWorkshopGroupSettingsShifts,FridayWork fridayWork,HolidayWork holidayWork) + LateToWork lateToWork, EarlyExit earlyExit, + ICollection customizeWorkshopGroupSettingsShifts, FridayWork fridayWork, + HolidayWork holidayWork, IrregularShift irregularShift, + WorkshopShiftStatus workshopShiftStatus, long customizeWorkshopSettingId,BreakTime breakTime) + { + GuardGroupShifts(customizeWorkshopGroupSettingsShifts); + GroupName = "اصلی"; + Salary = 0; + 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; + FridayWork = fridayWork; + HolidayWork = holidayWork; + CustomizeWorkshopGroupSettingsShifts = customizeWorkshopGroupSettingsShifts; + IrregularShift = workshopShiftStatus == WorkshopShiftStatus.Regular ? + new IrregularShift(new TimeOnly(), new TimeOnly(), WorkshopIrregularShifts.None) + : new IrregularShift(irregularShift.StartTime, irregularShift.EndTime, irregularShift.WorkshopIrregularShifts); + WorkshopShiftStatus = workshopShiftStatus; + CustomizeWorkshopSettingId = customizeWorkshopSettingId; + MainGroup = true; + BreakTime = breakTime; + CustomizeWorkshopEmployeeSettingsCollection = []; + + return this; + + } + + + + public void EditAndOverwriteOnEmployees(string groupName, double salary, IEnumerable 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, FridayWork fridayWork, HolidayWork holidayWork, bool isSettingChange) { GroupName = groupName; Salary = salary; @@ -148,16 +131,53 @@ public class CustomizeWorkshopGroupSettings : EntityBase EarlyExit = earlyExit; FridayWork = fridayWork; HolidayWork = holidayWork; - CustomizeWorkshopGroupSettingsShifts = customizeWorkshopGroupSettingsShifts; - var employeeSettingsShift = customizeWorkshopGroupSettingsShifts - .Select(x=>new CustomizeWorkshopEmployeeSettingsShift(x.StartTime,x.EndTime,x.Placement)).ToList(); + IsSettingChange = isSettingChange; - var permittedToOverWrite = CustomizeWorkshopEmployeeSettingsCollection.Where(x => employeeIds.Contains(x.id)); + var employeeSettingsShift = CustomizeWorkshopGroupSettingsShifts + .Select(x => new CustomizeWorkshopEmployeeSettingsShift(x.StartTime, x.EndTime, x.Placement)).ToList(); + + var permittedToOverWrite = CustomizeWorkshopEmployeeSettingsCollection.Where(x => employeeIds.Contains(x.EmployeeId)); foreach (var item in permittedToOverWrite) { - item.EditEmployeesAndMakeIsChangeFalse(employeeSettingsShift, salary, fridayPay, overTimePay, baseYearsPay, bonusesPay - , nightWorkPay, marriedAllowance, shiftPay, familyAllowance, leavePay, insuranceDeduction, fineAbsenceDeduction, - lateToWork, earlyExit,fridayWork, holidayWork); + item.EditEmployees(Salary, FridayPay, OverTimePay, BaseYearsPay, BonusesPay + , NightWorkPay, MarriedAllowance, ShiftPay, FamilyAllowance, LeavePay, InsuranceDeduction, FineAbsenceDeduction, + LateToWork, EarlyExit, FridayWork, HolidayWork, IrregularShift, WorkshopShiftStatus, false); + } + } + public void EditAndOverwriteOnAllEmployees(string groupName, double salary, + 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, FridayWork fridayWork, HolidayWork holidayWork, bool isSettingChange) + { + 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; + FridayWork = fridayWork; + HolidayWork = holidayWork; + IsSettingChange = isSettingChange; + + var employeeSettingsShift = CustomizeWorkshopGroupSettingsShifts + .Select(x => new CustomizeWorkshopEmployeeSettingsShift(x.StartTime, x.EndTime, x.Placement)).ToList(); + + foreach (var item in CustomizeWorkshopEmployeeSettingsCollection) + { + item.EditEmployees(Salary, FridayPay, OverTimePay, BaseYearsPay, BonusesPay + , NightWorkPay, MarriedAllowance, ShiftPay, FamilyAllowance, LeavePay, InsuranceDeduction, FineAbsenceDeduction, + LateToWork, EarlyExit, FridayWork, HolidayWork, IrregularShift, WorkshopShiftStatus, false); } } @@ -168,24 +188,101 @@ public class CustomizeWorkshopGroupSettings : EntityBase CustomizeWorkshopEmployeeSettingsCollection.Remove(currentItem); } - public void EditSimpleAndOverwriteOnEmployee(string groupName, double salary, IEnumerable employeeIds, - ICollection customizeWorkshopGroupSettingsShifts) + public void EditSimpleAndOverwriteOnEmployee(string groupName, IEnumerable employeeIds, + ICollection customizeWorkshopGroupSettingsShifts, WorkshopShiftStatus workshopShiftStatus, + IrregularShift irregularShift, BreakTime breakTime, bool isShiftChange) { - GroupName = groupName; - Salary = salary; + GroupName = groupName; CustomizeWorkshopGroupSettingsShifts = customizeWorkshopGroupSettingsShifts; + WorkshopShiftStatus = workshopShiftStatus; + IrregularShift = workshopShiftStatus == WorkshopShiftStatus.Regular ? + new IrregularShift(new TimeOnly(), new TimeOnly(), WorkshopIrregularShifts.None) + : new IrregularShift(irregularShift.StartTime, irregularShift.EndTime, irregularShift.WorkshopIrregularShifts); + BreakTime = new BreakTime(breakTime.HasBreakTimeValue, breakTime.BreakTimeValue); + IsShiftChange = isShiftChange; //var employeeSettingsShift = customizeWorkshopGroupSettingsShifts - // .Select(x => new CustomizeWorkshopEmployeeSettingsShift(x.StartTime, x.EndTime, x.Placement)).ToList(); + // .Select(x => new CustomizeWorkshopEmployeeSettingsShift(x.StartTime, x.EndTime, x.Placement)).ToList(); + if (isShiftChange) + { + + } var permittedToOverWrite = CustomizeWorkshopEmployeeSettingsCollection.Where(x => employeeIds.Contains(x.id)); foreach (var item in permittedToOverWrite) { - item.SimpleEditAndMakeIsChangeFalse(customizeWorkshopGroupSettingsShifts - .Select(x => new CustomizeWorkshopEmployeeSettingsShift(x.StartTime, x.EndTime, x.Placement)).ToList(), salary); + item.SimpleEdit(customizeWorkshopGroupSettingsShifts + .Select(x => new CustomizeWorkshopEmployeeSettingsShift(x.StartTime, x.EndTime, x.Placement)).ToList(), + IrregularShift, WorkshopShiftStatus, BreakTime, false); } - } + } + + public void EditSimpleAndOverwriteOnAllEmployees(string groupName, + ICollection customizeWorkshopGroupSettingsShifts, WorkshopShiftStatus workshopShiftStatus, IrregularShift irregularShift, BreakTime breakTime, bool isShiftChange) + { + GroupName = groupName; + CustomizeWorkshopGroupSettingsShifts = customizeWorkshopGroupSettingsShifts; + WorkshopShiftStatus = workshopShiftStatus; + IrregularShift = workshopShiftStatus == WorkshopShiftStatus.Regular ? + new IrregularShift(new TimeOnly(), new TimeOnly(), WorkshopIrregularShifts.None) + : new IrregularShift(irregularShift.StartTime, irregularShift.EndTime, irregularShift.WorkshopIrregularShifts); + BreakTime = new BreakTime(breakTime.HasBreakTimeValue, breakTime.BreakTimeValue); + IsShiftChange = isShiftChange; + + //var employeeSettingsShift = customizeWorkshopGroupSettingsShifts + // .Select(x => new CustomizeWorkshopEmployeeSettingsShift(x.StartTime, x.EndTime, x.Placement)).ToList(); + + foreach (var item in CustomizeWorkshopEmployeeSettingsCollection) + { + item.SimpleEdit(customizeWorkshopGroupSettingsShifts + .Select(x => new CustomizeWorkshopEmployeeSettingsShift(x.StartTime, x.EndTime, x.Placement)).ToList(), + irregularShift, workshopShiftStatus, breakTime, false); + } + + } + + public void AddEmployeeSettingToGroupWithGroupData(long employeeId, long workshopId) + { + var shifts = CustomizeWorkshopGroupSettingsShifts + .Select(x => new CustomizeWorkshopEmployeeSettingsShift(x.StartTime, x.EndTime, x.Placement)).ToList(); + + FridayPay fridayPay = new(FridayPay.FridayPayType, FridayPay.Value); + OverTimePay overTimePay = new(OverTimePay.OverTimePayType, OverTimePay.Value); + BaseYearsPay baseYearsPay = new(BaseYearsPay.BaseYearsPayType, BaseYearsPay.Value, BaseYearsPay.PaymentType); + BonusesPay bonusesPay = new(BonusesPay.BonusesPayType, BonusesPay.Value, BonusesPay.PaymentType); + NightWorkPay nightWorkPay = new(NightWorkPay.NightWorkingType, NightWorkPay.Value); + MarriedAllowance marriedAllowance = new(MarriedAllowance.MarriedAllowanceType, MarriedAllowance.Value); + ShiftPay shiftPay = new(ShiftType.None, ShiftPayType.None, 0); + FamilyAllowance familyAllowance = new(FamilyAllowance.FamilyAllowanceType, FamilyAllowance.Value); + LeavePay leavePay = new(LeavePay.LeavePayType, LeavePay.Value); + InsuranceDeduction insuranceDeduction = new(InsuranceDeduction.InsuranceDeductionType, InsuranceDeduction.Value); + FineAbsenceDeduction fineAbsenceDeduction = new( + FineAbsenceDeduction.FineAbsenceDeductionType, FineAbsenceDeduction.Value, + FineAbsenceDeduction.FineAbsenceDayOfWeekCollection + .Select(x => new FineAbsenceDayOfWeek(x.DayOfWeek)).ToList() + ); + LateToWork lateToWork = new( + LateToWork.LateToWorkType, + LateToWork.LateToWorkTimeFines.Select(x => new LateToWorkTimeFine(x.Minute, x.FineMoney)) + .ToList(), LateToWork.Value + ); + EarlyExit earlyExit = new(EarlyExit.EarlyExitType, + EarlyExit.EarlyExitTimeFines.Select(x => new EarlyExitTimeFine(x.Minute, x.FineMoney)) + .ToList(), EarlyExit.Value); + IrregularShift irregularShift = new(IrregularShift.StartTime, IrregularShift.EndTime, + IrregularShift.WorkshopIrregularShifts); + BreakTime breakTime = new(BreakTime.HasBreakTimeValue, BreakTime.BreakTimeValue); + + var customizeWorkshopEmployeeSettings = new CustomizeWorkshopEmployeeSettings(fridayPay, overTimePay, baseYearsPay, bonusesPay, nightWorkPay, + marriedAllowance, shiftPay, familyAllowance, leavePay, insuranceDeduction, fineAbsenceDeduction, lateToWork, + earlyExit, employeeId, workshopId, Salary, id, shifts, FridayWork, HolidayWork, irregularShift, + WorkshopShiftStatus, breakTime); + + CustomizeWorkshopEmployeeSettingsCollection.Add(customizeWorkshopEmployeeSettings); + } + + @@ -198,4 +295,5 @@ public class CustomizeWorkshopGroupSettings : EntityBase // } //} + } diff --git a/Company.Domain/CustomizeWorkshopGroupSettingsAgg/Entities/CustomizeWorkshopGroupSettingsShift.cs b/Company.Domain/CustomizeWorkshopGroupSettingsAgg/Entities/CustomizeWorkshopGroupSettingsShift.cs index 9e506178..14d3f7fc 100644 --- a/Company.Domain/CustomizeWorkshopGroupSettingsAgg/Entities/CustomizeWorkshopGroupSettingsShift.cs +++ b/Company.Domain/CustomizeWorkshopGroupSettingsAgg/Entities/CustomizeWorkshopGroupSettingsShift.cs @@ -1,28 +1,29 @@ using System; using _0_Framework.Domain; +using _0_Framework.Domain.CustomizeCheckoutShared.Base; +using _0_Framework.Domain.CustomizeCheckoutShared.Enums; using CompanyManagment.App.Contracts.CustomizeWorkshopSettings; namespace Company.Domain.CustomizeWorkshopGroupSettingsAgg.Entities; -public class CustomizeWorkshopGroupSettingsShift : EntityBase +public class CustomizeWorkshopGroupSettingsShift : CustomizeSifts { - private CustomizeWorkshopGroupSettingsShift() - { - - } + public CustomizeWorkshopGroupSettingsShift(TimeOnly startTime, TimeOnly endTime, ShiftPlacement placement) : base(startTime, endTime, placement) + { + } - public CustomizeWorkshopGroupSettingsShift(TimeOnly startTime, TimeOnly endTime, ShiftPlacement placement) - { - Placement = placement; - StartTime = startTime; - EndTime = endTime; - } - public TimeOnly StartTime { get; private set; } - public TimeOnly EndTime { get; private set; } - public ShiftPlacement Placement { get; private set; } public long CustomizeWorkshopGroupSettingsId { get; private set; } public CustomizeWorkshopGroupSettings CustomizeWorkshopGroupSettings { get; set; } + public override bool Equals(object obj) + { + if (obj is CustomizeSifts other) + { + return base.Equals(other); + + } return false; + + } } \ No newline at end of file diff --git a/Company.Domain/CustomizeWorkshopGroupSettingsAgg/ICustomizeWorkshopGroupSettingsRepository.cs b/Company.Domain/CustomizeWorkshopGroupSettingsAgg/ICustomizeWorkshopGroupSettingsRepository.cs index bc5da497..012fc43f 100644 --- a/Company.Domain/CustomizeWorkshopGroupSettingsAgg/ICustomizeWorkshopGroupSettingsRepository.cs +++ b/Company.Domain/CustomizeWorkshopGroupSettingsAgg/ICustomizeWorkshopGroupSettingsRepository.cs @@ -9,10 +9,16 @@ namespace Company.Domain.CustomizeWorkshopGroupSettingsAgg; public interface ICustomizeWorkshopGroupSettingsRepository : IRepository { CustomizeWorkshopGroupSettings GetIncludeWorkshopSettings(long id); + CustomizeWorkshopGroupSettings GetWorkshopMainGroup(long workshopId); List GetEmployeesWithoutGroup(long workshopId); CustomizeWorkshopGroupSettings GetWithEmployees(long groupId); - List GetChangedEmployeeSettingsByGroupSettingsId(long groupSettingsId); + List GetShiftChangedEmployeeSettingsByGroupSettingsId(long groupSettingsId); + List GetSettingChangedEmployeeSettingsByGroupSettingsId(long groupSettingsId); List GetEmployeeSettingsByGroupSettingsId(long groupSettingsId); EditCustomizeWorkshopGroupSettings GetCustomizeWorkshopGroupSettingsDetails(long groupId); + + List GetAllGroupsIncludeEmployeeSettingsByWorkshopSettingsId( + long workshopSettingsId); + void Remove(long groupId); } \ No newline at end of file diff --git a/Company.Domain/CustomizeWorkshopSettingsAgg/Entities/CustomizeWorkshopSettings.cs b/Company.Domain/CustomizeWorkshopSettingsAgg/Entities/CustomizeWorkshopSettings.cs index b3cc1a73..5fb30dbf 100644 --- a/Company.Domain/CustomizeWorkshopSettingsAgg/Entities/CustomizeWorkshopSettings.cs +++ b/Company.Domain/CustomizeWorkshopSettingsAgg/Entities/CustomizeWorkshopSettings.cs @@ -2,42 +2,55 @@ using System.Collections.Generic; using System.Linq; using _0_Framework.Domain; -using _0_Framework.Domain.CustomizeCheckoutValueObjects; +using _0_Framework.Domain.CustomizeCheckoutShared.Base; +using _0_Framework.Domain.CustomizeCheckoutShared.Enums; +using _0_Framework.Domain.CustomizeCheckoutShared.ValueObjects; using Company.Domain.CustomizeWorkshopGroupSettingsAgg.Entities; using Company.Domain.WorkshopAgg; namespace Company.Domain.CustomizeWorkshopSettingsAgg.Entities; -public class CustomizeWorkshopSettings : EntityBase +public class CustomizeWorkshopSettings : BaseCustomizeEntity { - private CustomizeWorkshopSettings() - { - } + private CustomizeWorkshopSettings() + { + } + + public CustomizeWorkshopSettings(long workshopId, + ICollection customizeWorkshopSettingsShifts, int leavePermittedDays, + WorkshopShiftStatus workshopShiftStatus) + { + FridayPay = new FridayPay(FridayPayType.None, 0); + OverTimePay = new OverTimePay(OverTimePayType.None, 0); + BaseYearsPay = new BaseYearsPay(BaseYearsPayType.None, 0, BaseYearsPaymentType.None); + BonusesPay = new BonusesPay(BonusesType.None, 0, BonusesPaymentType.None); + 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; + LeavePermittedDays = leavePermittedDays == 0 ? 2 : leavePermittedDays; + OverTimeThresholdMinute = 0; + Currency = Currency.Rial; + MaxMonthDays = MaxMonthDays.Default; + FridayWork = FridayWork.Default; + HolidayWork = HolidayWork.Default; + BonusesPaysInEndOfMonth = BonusesPaysInEndOfYear.EndOfYear; + WorkshopShiftStatus = workshopShiftStatus; + + if (workshopShiftStatus == WorkshopShiftStatus.Irregular) + return; + + if (customizeWorkshopSettingsShifts is not { Count: > 0 }) + return; + + - public CustomizeWorkshopSettings(long workshopId, - ICollection customizeWorkshopSettingsShifts, int leavePermittedDays) - { - FridayPay = new FridayPay(FridayPayType.None, 0); - OverTimePay = new OverTimePay(OverTimePayType.None, 0); - BaseYearsPay = new BaseYearsPay(BaseYearsPayType.None,0,BaseYearsPaymentType.None); - BonusesPay = new BonusesPay(BonusesType.None,0, BonusesPaymentType.None); - 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; - LeavePermittedDays = leavePermittedDays; - OverTimeThresholdMinute = 0; - Currency = Currency.Rial; - MaxMonthDays = MaxMonthDays.Default; - FridayWork = FridayWork.Default; - HolidayWork = HolidayWork.Default; - BonusesPaysInEndOfMonth = BonusesPaysInEndOfYear.EndOfYear; var date = new DateOnly(); var firstStartShift = new DateTime(date, CustomizeWorkshopSettingsShifts.MinBy(x => x.Placement).StartTime); var lastEndShift = new DateTime(date, CustomizeWorkshopSettingsShifts.MaxBy(x => x.Placement).EndTime); @@ -45,161 +58,94 @@ public class CustomizeWorkshopSettings : EntityBase firstStartShift = firstStartShift.AddDays(1); var offSet = (firstStartShift - lastEndShift).Divide(2); EndTimeOffSet = TimeOnly.FromDateTime(lastEndShift.Add(offSet)); + } - /// - /// جمعه کاری - /// - public FridayPay FridayPay { get; private set; } - - /// - /// اضافه کاری - /// - public OverTimePay OverTimePay { get; private set; } - - /// - /// سنوات - /// - public BaseYearsPay BaseYearsPay { get; private set; } - - /// - /// عیدی - /// - public BonusesPay BonusesPay { get; private set; } - - /// - /// شب کاری - /// - public NightWorkPay NightWorkPay { get; private set; } - - /// - /// حق تاهل - /// - public MarriedAllowance MarriedAllowance { get; private set; } - - /// - /// نوبت کاری - /// - public ShiftPay ShiftPay { get; private set; } - - /// - /// حق اولاد(حق فرزند)ء - /// - public FamilyAllowance FamilyAllowance { get; private set; } - - /// - /// مزد مرخصی - /// - public LeavePay LeavePay { get; private set; } - - /// - /// حق بیمه - /// - public InsuranceDeduction InsuranceDeduction { get; private set; } - - /// - /// جریمه غیبت - /// - public FineAbsenceDeduction FineAbsenceDeduction { get; private set; } - - /// - /// تاخیر در ورود - /// - public LateToWork LateToWork { get; private set; } - - /// - /// نعجیل در خروج - /// - public EarlyExit EarlyExit { get; private set; } - - /// - /// نوع محاسبه تعداد روز های ماه برای محاسبه فیش حقوقی - /// - public MaxMonthDays MaxMonthDays { get; private set; } - - /// - /// آیا جمعه کار میکند یا نه - /// - public FridayWork FridayWork { get; set; } - - /// - /// آیا در روز های تعطیل کار میکند - /// - public HolidayWork HolidayWork { get; set; } - - /// - /// تعداد روز های مجاز برای مرخصی - /// - public int LeavePermittedDays { get; private set; } - - /// - /// آیا عیدی همیشه آخر سال تعلق میگیره یا در زمان ترک کار هم تعلق میگیره - /// - public BonusesPaysInEndOfYear BonusesPaysInEndOfMonth { get; private set; } - - public BaseYearsPayInEndOfYear BaseYearsPayInEndOfYear { get; private set; } - - public long WorkshopId { get; private set; } - public Workshop Workshop { get; set; } - public TimeOnly EndTimeOffSet { get; private set; } - public Currency Currency { get; set; } - public int OverTimeThresholdMinute { get; set; } - public ICollection CustomizeWorkshopGroupSettingsCollection { get; set; } - public ICollection CustomizeWorkshopSettingsShifts { get; set; } + /// + /// نوع محاسبه تعداد روز های ماه برای محاسبه فیش حقوقی + /// + public MaxMonthDays MaxMonthDays { get; private set; } + + + /// + /// تعداد روز های مجاز برای مرخصی + /// + public int LeavePermittedDays { get; private set; } + + /// + /// آیا عیدی همیشه آخر سال تعلق میگیره یا در زمان ترک کار هم تعلق میگیره + /// + public BonusesPaysInEndOfYear BonusesPaysInEndOfMonth { get; private set; } + + public BaseYearsPayInEndOfYear BaseYearsPayInEndOfYear { get; private set; } + + public long WorkshopId { get; private set; } + public Workshop Workshop { get; set; } + public TimeOnly EndTimeOffSet { get; private set; } + public Currency Currency { get; private set; } + public int OverTimeThresholdMinute { get; private set; } + public WorkshopShiftStatus WorkshopShiftStatus { get; private set; } + + + public ICollection CustomizeWorkshopGroupSettingsCollection { get; set; } + public ICollection CustomizeWorkshopSettingsShifts { 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 customizeWorkshopSettingsShifts, - FridayWork fridayWork, HolidayWork holidayWork,BonusesPaysInEndOfYear bonusesPaysInEndOfYear, - int leavePermittedDays, BaseYearsPayInEndOfYear baseYearsPayInEndOfYear,int overTimeThresholdMinute) - { - 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; - FridayWork = fridayWork; - HolidayWork = holidayWork; - BonusesPaysInEndOfMonth = bonusesPaysInEndOfYear; - LeavePermittedDays = leavePermittedDays; - BaseYearsPayInEndOfYear= baseYearsPayInEndOfYear; - OverTimeThresholdMinute = overTimeThresholdMinute; - var date = new DateOnly(); - var firstStartShift = new DateTime(date, CustomizeWorkshopSettingsShifts.MinBy(x => x.Placement).StartTime); - var lastEndShift = new DateTime(date, CustomizeWorkshopSettingsShifts.MaxBy(x => x.Placement).EndTime); - if (lastEndShift > firstStartShift) - firstStartShift = firstStartShift.AddDays(1); - var offSet = (firstStartShift - lastEndShift).Divide(2); - - - EndTimeOffSet = TimeOnly.FromDateTime(lastEndShift.Add(offSet)); - + NightWorkPay nightWorkPay, MarriedAllowance marriedAllowance, ShiftPay shiftPay, + FamilyAllowance familyAllowance, LeavePay leavePay, InsuranceDeduction insuranceDeduction, + FineAbsenceDeduction fineAbsenceDeduction, LateToWork lateToWork, EarlyExit earlyExit, + FridayWork fridayWork, HolidayWork holidayWork, BonusesPaysInEndOfYear bonusesPaysInEndOfYear, + int leavePermittedDays, BaseYearsPayInEndOfYear baseYearsPayInEndOfYear, int overTimeThresholdMinute) + { + 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; + FridayWork = fridayWork; + HolidayWork = holidayWork; + BonusesPaysInEndOfMonth = bonusesPaysInEndOfYear; + LeavePermittedDays = leavePermittedDays; + BaseYearsPayInEndOfYear = baseYearsPayInEndOfYear; + OverTimeThresholdMinute = overTimeThresholdMinute; } - //edits the shifts of workshop - public void ChangeCurrency(Currency currency) - { - if (currency == Currency) - return; + //edits the shifts of workshop + public void ChangeCurrency(Currency currency) + { + if (currency == Currency) + return; - Currency = currency; - } - - public void ChangeWorkshopShifts(List customizeWorkshopSettingsShifts) - { - CustomizeWorkshopSettingsShifts = customizeWorkshopSettingsShifts; + Currency = currency; } + + public void ChangeWorkshopShifts(ICollection customizeWorkshopSettingsShifts, WorkshopShiftStatus workshopShiftStatus) + { + WorkshopShiftStatus = workshopShiftStatus; + CustomizeWorkshopSettingsShifts = workshopShiftStatus == WorkshopShiftStatus.Regular ? customizeWorkshopSettingsShifts : new List(); + if (workshopShiftStatus == WorkshopShiftStatus.Regular) + { + var date = new DateOnly(); + var firstStartShift = new DateTime(date, CustomizeWorkshopSettingsShifts.MinBy(x => x.Placement).StartTime); + var lastEndShift = new DateTime(date, CustomizeWorkshopSettingsShifts.MaxBy(x => x.Placement).EndTime); + + + if (lastEndShift > firstStartShift) + firstStartShift = firstStartShift.AddDays(1); + var offSet = (firstStartShift - lastEndShift).Divide(2); + EndTimeOffSet = TimeOnly.FromDateTime(lastEndShift.Add(offSet)); + } + } + + } \ No newline at end of file diff --git a/Company.Domain/CustomizeWorkshopSettingsAgg/Entities/CustomizeWorkshopSettingsShift.cs b/Company.Domain/CustomizeWorkshopSettingsAgg/Entities/CustomizeWorkshopSettingsShift.cs index 07b86a2a..308c14ad 100644 --- a/Company.Domain/CustomizeWorkshopSettingsAgg/Entities/CustomizeWorkshopSettingsShift.cs +++ b/Company.Domain/CustomizeWorkshopSettingsAgg/Entities/CustomizeWorkshopSettingsShift.cs @@ -1,30 +1,32 @@ using System; using System.IO; using _0_Framework.Domain; +using _0_Framework.Domain.CustomizeCheckoutShared.Base; +using _0_Framework.Domain.CustomizeCheckoutShared.Enums; +using Company.Domain.CustomizeWorkshopGroupSettingsAgg.Entities; using CompanyManagment.App.Contracts.CustomizeWorkshopSettings; namespace Company.Domain.CustomizeWorkshopSettingsAgg.Entities; -public class CustomizeWorkshopSettingsShift : EntityBase +public class CustomizeWorkshopSettingsShift : CustomizeSifts { - private CustomizeWorkshopSettingsShift() - { - - } - - public CustomizeWorkshopSettingsShift(TimeOnly startTime, TimeOnly endTime, ShiftPlacement placement) - { - Placement = placement; - StartTime = startTime; - EndTime = endTime; - - } - - public TimeOnly StartTime { get; private set; } - public TimeOnly EndTime { get; private set; } - public ShiftPlacement Placement { get; private set; } - public long CustomizeWorkshopSettingsId { get; private set; } + public CustomizeWorkshopSettingsShift(TimeOnly startTime, TimeOnly endTime, ShiftPlacement placement) : base(startTime, endTime, placement) + { + } - public CustomizeWorkshopSettings CustomizeWorkshopSettings { get; set; } + public long CustomizeWorkshopSettingsId { get; private set; } + public CustomizeWorkshopSettings CustomizeWorkshopSettings { get; set; } + + public override bool Equals(object obj) + { + if (obj is CustomizeSifts other) + { + return base.Equals(other); + + } + return false; + + } + } \ No newline at end of file diff --git a/Company.Domain/CustomizeWorkshopSettingsAgg/ICustomizeWorkshopSettingsRepository.cs b/Company.Domain/CustomizeWorkshopSettingsAgg/ICustomizeWorkshopSettingsRepository.cs index 7a4ed799..6937fec9 100644 --- a/Company.Domain/CustomizeWorkshopSettingsAgg/ICustomizeWorkshopSettingsRepository.cs +++ b/Company.Domain/CustomizeWorkshopSettingsAgg/ICustomizeWorkshopSettingsRepository.cs @@ -1,4 +1,6 @@ -using _0_Framework.Domain; +using System.Collections.Generic; +using _0_Framework.Application; +using _0_Framework.Domain; using Company.Domain.CustomizeWorkshopSettingsAgg.Entities; using CompanyManagment.App.Contracts.CustomizeWorkshopSettings; @@ -6,12 +8,15 @@ namespace Company.Domain.CustomizeWorkshopSettingsAgg; public interface ICustomizeWorkshopSettingsRepository : IRepository { - // It will Get the Workshop Settings with its groups and the employees of groups. - CustomizeWorkshopSettingsViewModel GetWorkshopSettingsByWorkshopId(long workshopId); + // It will Get the Workshop Settings with its groups and the employees of groups. + CustomizeWorkshopSettingsViewModel GetWorkshopSettingsByWorkshopId(long workshopId, AuthViewModel auth); - CustomizeWorkshopEmployeeSettingsViewModel GetEmployeeSettingsByWorkshopIdGroupSettingsId(long workshopId, + + CustomizeWorkshopEmployeeSettingsViewModel GetEmployeeSettingsByWorkshopIdGroupSettingsId(long workshopId, long employeeId); + CustomizeWorkshopSettingsViewModel GetWorkshopSettingsByWorkshopIdForAdmin(long workshopId); - EditCustomizeWorkshopSettings GetWorkshopSettingsDetails(long workshopId); + EditCustomizeWorkshopSettings GetWorkshopSettingsDetails(long workshopId); EditCustomizeWorkshopSettings GetSimpleWorkshopSettings(long workshopId); + List GetShiftChangesGroupAndEmployees(long customizeWorkshopSettingsId); } \ No newline at end of file diff --git a/Company.Domain/EmployeeAgg/IEmployeeRepository.cs b/Company.Domain/EmployeeAgg/IEmployeeRepository.cs index 946ad162..c286a936 100644 --- a/Company.Domain/EmployeeAgg/IEmployeeRepository.cs +++ b/Company.Domain/EmployeeAgg/IEmployeeRepository.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.Threading.Tasks; using _0_Framework.Domain; using Company.Domain.EmployeeInsuranceRecordAgg; @@ -42,4 +43,17 @@ public interface IEmployeeRepository : IRepository #endregion + #region Mahan + List GetBy(List employeeIds); + + #endregion + + #region Pooya + List GetRangeByIds(IEnumerable newEmployeeIds); + List GetWorkingEmployeesByWorkshopIdsAndNationalCodeAndDate(List workshopIds, string nationalCode, DateTime date); + List GetWorkingEmployeesByWorkshopId(long workshopId); + + List<(long Id, string Name)> SimpleGetRangeByIds(IEnumerable newEmployeeIds); + #endregion + } \ No newline at end of file diff --git a/Company.Domain/FineAgg/IFineRepository.cs b/Company.Domain/FineAgg/IFineRepository.cs index 36835ad2..421da448 100644 --- a/Company.Domain/FineAgg/IFineRepository.cs +++ b/Company.Domain/FineAgg/IFineRepository.cs @@ -6,6 +6,10 @@ namespace Company.Domain.FineAgg; public interface IFineRepository : IRepository { - List GetSearchList(FineSearchViewModel searchModel); + List GetSearchList(FineSearchViewModel searchModel); + List GetBy(IEnumerable ids); EditFineViewModel GetDetails(long id); + void Remove(Fine entity); + void RemoveRange(IEnumerable entityEnumerable); + } \ No newline at end of file diff --git a/Company.Domain/FineSubjectAgg/FineSubject.cs b/Company.Domain/FineSubjectAgg/FineSubject.cs new file mode 100644 index 00000000..dc637b4c --- /dev/null +++ b/Company.Domain/FineSubjectAgg/FineSubject.cs @@ -0,0 +1,23 @@ +using _0_Framework.Domain; + +namespace Company.Domain.FineSubjectAgg; + +public class FineSubject:EntityBase +{ + public FineSubject(string title, string amount, long workshopId) + { + Title = title; + Amount = amount; + WorkshopId = workshopId; + } + + public string Title { get; private set; } + public string Amount { get; private set; } + public long WorkshopId { get; private set; } + + public void Edit(string title, string amount) + { + Title=title; + Amount=amount; + } +} \ No newline at end of file diff --git a/Company.Domain/FineSubjectAgg/IFineSubjectRepository.cs b/Company.Domain/FineSubjectAgg/IFineSubjectRepository.cs new file mode 100644 index 00000000..35154204 --- /dev/null +++ b/Company.Domain/FineSubjectAgg/IFineSubjectRepository.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; +using _0_Framework.Domain; +using CompanyManagment.App.Contracts.FineSubject; + +namespace Company.Domain.FineSubjectAgg; + +public interface IFineSubjectRepository:IRepository +{ + void Remove(FineSubject entity); + List GetAll(long workshopId); +} \ No newline at end of file diff --git a/Company.Domain/LeftWorkAgg/ILeftWorkRepository.cs b/Company.Domain/LeftWorkAgg/ILeftWorkRepository.cs index a65b3c64..f3df1ea0 100644 --- a/Company.Domain/LeftWorkAgg/ILeftWorkRepository.cs +++ b/Company.Domain/LeftWorkAgg/ILeftWorkRepository.cs @@ -34,4 +34,7 @@ public interface ILeftWorkRepository : IRepository OperationResult CreateLeftWorkByLeftWorkGroups(string employeeFullName, long commandEmployeeId, List commandPersonnelCode, List leftWorkGroups); OperationResult CheckDeleteLeftWork(long workshopId, long employeeId, DateTime date, int type); OperationResult CheckEditLeftWork(long workshopId, long employeeId, DateTime date, int type); + #region Pooya + List GetByWorkshopIdInDates(long workshopId, DateTime startDateGr, DateTime endDateGr); + #endregion } \ No newline at end of file diff --git a/Company.Domain/LoanAgg/Entities/Loan.cs b/Company.Domain/LoanAgg/Entities/Loan.cs index ac7496b9..c598edef 100644 --- a/Company.Domain/LoanAgg/Entities/Loan.cs +++ b/Company.Domain/LoanAgg/Entities/Loan.cs @@ -9,19 +9,22 @@ namespace Company.Domain.LoanAgg.Entities; public class Loan : EntityBase { - private Loan(){} + private Loan() + { + } public Loan(long employeeId, long workshopId, DateTime startDateTime, - string count, double amount, double amountPerMonth,ICollection loanInstallments, bool getRounded) + string count, double amount, double amountPerMonth,ICollection loanInstallments, bool getRounded, DateTime loanGrantDate) { EmployeeId = employeeId; WorkshopId = workshopId; - StartDateTime = startDateTime; + StartInstallmentPayment = startDateTime; Count = count; Amount = amount; AmountPerMonth = amountPerMonth; LoanInstallments = loanInstallments; GetRounded = getRounded; + LoanGrantDate = loanGrantDate; //for (int i = 0; i < Convert.ToInt32(count); i++) //{ // LoanInstallment newInstallment = new(amountPerMonth, month.ToString("00"), year.ToString("0000")); @@ -43,9 +46,18 @@ public class Loan : EntityBase public long EmployeeId { get; private set; } public long WorkshopId { get; private set; } - public DateTime StartDateTime { get; private set; } - public string StartDateMonth => StartDateTime.ToFarsiMonth(); - public string StartDateYear => StartDateTime.ToFarsiYear(); + /// + /// تاریخ شروع اقساط + /// + public DateTime StartInstallmentPayment { get; private set; } + public string StartDateMonth => StartInstallmentPayment.ToFarsiMonth(); + public string StartDateYear => StartInstallmentPayment.ToFarsiYear(); + + /// + /// تاریخ اعطای وام + /// + public DateTime LoanGrantDate { get; private set; } + public string Count { get; private set; } public double Amount { get; private set; } public double AmountPerMonth { get; private set; } @@ -54,6 +66,7 @@ public class Loan : EntityBase public void DeActiveInstallment(string year, string month) { + var installment = LoanInstallments.FirstOrDefault(x => x.Month == month && x.Year == year); if (installment == null) @@ -68,9 +81,11 @@ public class Loan : EntityBase string newMonth; string newYear; + string newDay = installment.InstallmentDate.ToFarsi().Substring(8, 2); int lastMonth = Convert.ToInt32(lastInstallment.Month); int lastYear = Convert.ToInt32(lastInstallment.Year); + if (lastMonth == 12) { @@ -84,8 +99,8 @@ public class Loan : EntityBase } - LoanInstallment newInstallment = new LoanInstallment(installment.AmountForMonth, newMonth, newYear); - LoanInstallments.Add(newInstallment); + //LoanInstallment newInstallment = new LoanInstallment(installment.AmountForMonth, newMonth, newYear); + //LoanInstallments.Add(newInstallment); } @@ -97,11 +112,12 @@ public class Loan : EntityBase public class LoanInstallment { - public LoanInstallment(double amountForMonth, string month, string year) + public LoanInstallment(double amountForMonth, string month, string year, DateTime installmentDate) { AmountForMonth = amountForMonth; Month = month; Year = year; + InstallmentDate = installmentDate; IsActive = IsActive.True; } @@ -109,6 +125,7 @@ public class LoanInstallment public double AmountForMonth { get; private set; } public string Month { get; private set; } public string Year { get; private set; } + public DateTime InstallmentDate { get; set; } public IsActive IsActive { get; private set; } internal void DeActive() diff --git a/Company.Domain/LoanAgg/ILoanRepository.cs b/Company.Domain/LoanAgg/ILoanRepository.cs index e19da08e..324b0951 100644 --- a/Company.Domain/LoanAgg/ILoanRepository.cs +++ b/Company.Domain/LoanAgg/ILoanRepository.cs @@ -9,4 +9,7 @@ public interface ILoanRepository:IRepository { List GetSearchList(LoanSearchViewModel searchViewModel); LoanViewModel GetDetails(long id); + void Remove(Loan entity); + List GetBy(IEnumerable ids); + void RemoveRange(IEnumerable loans); } \ No newline at end of file diff --git a/Company.Domain/RewardAgg/IRewardRepository.cs b/Company.Domain/RewardAgg/IRewardRepository.cs index 899c5f8f..d2405e5a 100644 --- a/Company.Domain/RewardAgg/IRewardRepository.cs +++ b/Company.Domain/RewardAgg/IRewardRepository.cs @@ -6,6 +6,9 @@ namespace Company.Domain.RewardAgg; public interface IRewardRepository : IRepository { - List GetSearchList(RewardSearchViewModel searchViewModel); + List GetSearchList(RewardSearchModel searchViewModel); EditRewardViewModel GetDetails(long id); + void Remove(Reward entity); + List GetBy(IEnumerable ids); + void RemoveRange(IEnumerable rewards); } \ No newline at end of file diff --git a/Company.Domain/RewardAgg/Reward.cs b/Company.Domain/RewardAgg/Reward.cs index 635eb999..f507d70e 100644 --- a/Company.Domain/RewardAgg/Reward.cs +++ b/Company.Domain/RewardAgg/Reward.cs @@ -1,19 +1,23 @@ -using _0_Framework.Application; +using System; +using _0_Framework.Application; using _0_Framework.Domain; namespace Company.Domain.RewardAgg; public class Reward:EntityBase { - private Reward(){} + private Reward() + { + } - public Reward(long employeeId, long workshopId, double amount, string description, long rewardedByAccountId) + public Reward(long employeeId, long workshopId, double amount, string description, long rewardedByAccountId, DateTime grantDate) { EmployeeId = employeeId; WorkshopId = workshopId; Amount = amount; Description = description; RewardedByAccountId = rewardedByAccountId; + GrantDate = grantDate; IsActive = IsActive.True; } @@ -35,14 +39,20 @@ public class Reward:EntityBase /// public long RewardedByAccountId { get; private set; } + /// + /// تاریخ اعطای پاداش + /// + public DateTime GrantDate { get; set; } + public IsActive IsActive { get; private set; } - public void Edit(double amount, string description, long rewardedByAccountId) + public void Edit(double amount, string description, long rewardedByAccountId, DateTime grantDate) { Amount = amount; Description = description; RewardedByAccountId = rewardedByAccountId; + GrantDate = grantDate; } public void Active() diff --git a/Company.Domain/RollCallAgg/IRollCallRepository.cs b/Company.Domain/RollCallAgg/IRollCallRepository.cs index 3956bf3b..135124c7 100644 --- a/Company.Domain/RollCallAgg/IRollCallRepository.cs +++ b/Company.Domain/RollCallAgg/IRollCallRepository.cs @@ -16,10 +16,12 @@ namespace Company.Domain.RollCallAgg List Search(RollCallSearchModel searchModel); - + #region Pooya + List GetWorkshopAbsentHistory(long workshopId, DateTime startSearch, + DateTime endSearch); void RemoveEmployeeRollCallsInDate(long workshopId, long employeeId, DateTime date); RollCallsByDateViewModel GetWorkshopRollCallHistory(RollCallSearchModel searchModel); CurrentDayRollCall GetWorkshopCurrentDayRollCalls(long workshopId); @@ -29,9 +31,33 @@ namespace Company.Domain.RollCallAgg DateTime? startDateTime, DateTime? endDateTime, DateTime? exactDateTime, DateTime? monthIndex); void AddRange(List rollCalls); - + List GetWorkshopEmployeeRollCallsForDate(long workshopId, long employeeId, DateTime date); + + + + /// + /// این متد تمام حضور غیاب های کات شده توسط بک گراند سرویس را به صورت تعداد روزانه برمیگرداند + /// + /// + /// + /// + /// لیستی از تعداد و روز آن + List GetRollCallWorkFlowsCutByBgService(long workshopId, DateTime start, DateTime end); + + /// + /// تمامی حضور غیاب های کات شده توسط بک گراند سرویس را برمیگرداند + /// + /// + /// + /// + int GetCountCutRollCallByBgService(long accId, long workshopId); + + IEnumerable GetNotSlicedRollCallsByWorkshopId(long workshopId, DateTime durationStart, DateTime durationEnd); + + RollCallViewModel GetDetails(long rollCallId); + #endregion long Flag(long employeeId, long workshopId); diff --git a/Company.Domain/RollCallEmployeeStatusAgg/IRollCallEmployeeStatusRepository.cs b/Company.Domain/RollCallEmployeeStatusAgg/IRollCallEmployeeStatusRepository.cs index 158b30b0..8bb17be4 100644 --- a/Company.Domain/RollCallEmployeeStatusAgg/IRollCallEmployeeStatusRepository.cs +++ b/Company.Domain/RollCallEmployeeStatusAgg/IRollCallEmployeeStatusRepository.cs @@ -22,5 +22,7 @@ namespace Company.Domain.RollCallEmployeeStatusAgg /// /// RollCallEmployeeStatus GetByRollCallEmployeeIdAndDate(long rollCallEmployeeId, DateTime date); + List GetActiveByWorkshopIdInDate(long workshopId, DateTime startDateGr, DateTime endDateGr); + } } diff --git a/Company.Domain/SalaryAidAgg/ISalaryAidRepository.cs b/Company.Domain/SalaryAidAgg/ISalaryAidRepository.cs index 666c9b7a..9fc54bd7 100644 --- a/Company.Domain/SalaryAidAgg/ISalaryAidRepository.cs +++ b/Company.Domain/SalaryAidAgg/ISalaryAidRepository.cs @@ -6,6 +6,9 @@ namespace Company.Domain.SalaryAidAgg; public interface ISalaryAidRepository:IRepository { - List GetSearchList(SalaryAidSearchViewModel searchViewModel); + List GetSearchList(SalaryAidSearchViewModel searchViewModel); EditSalaryAidViewModel GetDetails(long id); + void Remove(SalaryAid entity); + List GetBy(IEnumerable ids); + void RemoveRange(IEnumerable salaryAids); } \ No newline at end of file diff --git a/Company.Domain/SalaryAidAgg/SalaryAid.cs b/Company.Domain/SalaryAidAgg/SalaryAid.cs index 7d406338..d0526626 100644 --- a/Company.Domain/SalaryAidAgg/SalaryAid.cs +++ b/Company.Domain/SalaryAidAgg/SalaryAid.cs @@ -22,8 +22,10 @@ public class SalaryAid:EntityBase public double Amount { get; private set; } public DateTime SalaryAidDateTime { get; private set; } - public void Edit(double amount) + public void Edit(double amount, DateTime salaryAidDatetime) { Amount = amount; + SalaryAidDateTime = salaryAidDatetime; + } } \ No newline at end of file diff --git a/Company.Domain/WorkshopAgg/Workshop.cs b/Company.Domain/WorkshopAgg/Workshop.cs index 1daccb68..51f7e8b7 100644 --- a/Company.Domain/WorkshopAgg/Workshop.cs +++ b/Company.Domain/WorkshopAgg/Workshop.cs @@ -19,6 +19,7 @@ using Company.Domain.RollCallServiceAgg; using Company.Domain.TaxLeftWorkCategoryAgg; using Company.Domain.WorkshopAccountAgg; using Company.Domain.WorkshopEmployerAgg; +using Company.Domain.WorkshopSubAccountAgg; namespace Company.Domain.WorkshopAgg; @@ -221,6 +222,11 @@ public class Workshop : EntityBase public List CustomizeCheckouts { get; set; } public CustomizeWorkshopSettings CustomizeWorkshopSettings { get; set; } + #region Pooya + + public List WorkshopSubAccounts { get; set; } = []; + #endregion + 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, string agreementNumber, bool fixedSalary, string population, long? insuranceJobId, string zoneName, bool addBonusesPay, bool addYearsPay, bool addLeavePay,bool totalPaymentHide, bool isClassified, string computeOptions, string bonusesOptions, string yearsOptions, string hasRollCallFreeVip, bool workshopHolidayWorking) diff --git a/Company.Domain/WorkshopSubAccountAgg/IWorkshopSubAccountRepository.cs b/Company.Domain/WorkshopSubAccountAgg/IWorkshopSubAccountRepository.cs new file mode 100644 index 00000000..009c34aa --- /dev/null +++ b/Company.Domain/WorkshopSubAccountAgg/IWorkshopSubAccountRepository.cs @@ -0,0 +1,13 @@ +using _0_Framework.Domain; +using CompanyManagment.App.Contracts.Workshop; +using System.Collections.Generic; + +namespace Company.Domain.WorkshopSubAccountAgg +{ + public interface IWorkshopSubAccountRepository : IRepository + { + List GetWorkshopsBySubAccountId(long subAccountId); + List GetWorkshopsSubAccountEntityBySubAccountId(long subAccountId); + void Remove(WorkshopSubAccount entity); + } +} diff --git a/Company.Domain/WorkshopSubAccountAgg/WorkshopSubAccount.cs b/Company.Domain/WorkshopSubAccountAgg/WorkshopSubAccount.cs new file mode 100644 index 00000000..8dc6e8e6 --- /dev/null +++ b/Company.Domain/WorkshopSubAccountAgg/WorkshopSubAccount.cs @@ -0,0 +1,28 @@ +using _0_Framework.Application; +using Company.Domain.WorkshopAgg; + +namespace Company.Domain.WorkshopSubAccountAgg +{ + public class WorkshopSubAccount + { + public long WorkshopId { get; private set; } + public Workshop Workshop { get; private set; } + public long SubAccountId { get; private set; } + public IsActive IsActive { get; private set; } + + public WorkshopSubAccount(long workshopId, long subAccountId) + { + WorkshopId = workshopId; + SubAccountId = subAccountId; + IsActive = IsActive.True; + } + public void Deactivate() + { + IsActive = IsActive.False; + } + public void Activate() + { + IsActive = IsActive.True; + } + } +} diff --git a/CompanyManagment.App.Contracts/Checkout/ICheckoutApplication.cs b/CompanyManagment.App.Contracts/Checkout/ICheckoutApplication.cs index d531082e..3cb8f132 100644 --- a/CompanyManagment.App.Contracts/Checkout/ICheckoutApplication.cs +++ b/CompanyManagment.App.Contracts/Checkout/ICheckoutApplication.cs @@ -32,5 +32,15 @@ public interface ICheckoutApplication OperationResult DeleteAllCheckouts(List ids); OperationResult DeleteCheckout(long id); Task> SearchForMainCheckout(CheckoutSearchModel searchModel); - #endregion + #endregion + + #region Pooya + + List<(long EmployeeId, DateTime CheckoutStart, DateTime CheckoutEnd)> GetLastCheckoutsByWorkshopId(long workshopId, + DateTime start, DateTime end); + + List<(long EmployeeId, DateTime CheckoutStart, DateTime CheckoutEnd)> GetLastCheckoutsByWorkshopIdForWorkFlow( + long workshopId, DateTime start, DateTime end); + + #endregion } \ No newline at end of file diff --git a/CompanyManagment.App.Contracts/CompanyManagment.App.Contracts.csproj b/CompanyManagment.App.Contracts/CompanyManagment.App.Contracts.csproj index cbbc7ba3..2759a76d 100644 --- a/CompanyManagment.App.Contracts/CompanyManagment.App.Contracts.csproj +++ b/CompanyManagment.App.Contracts/CompanyManagment.App.Contracts.csproj @@ -14,8 +14,4 @@ - - - - diff --git a/CompanyManagment.App.Contracts/CustomizeCheckout/CreateCustomizeCheckout.cs b/CompanyManagment.App.Contracts/CustomizeCheckout/CreateCustomizeCheckout.cs new file mode 100644 index 00000000..26fa8e9c --- /dev/null +++ b/CompanyManagment.App.Contracts/CustomizeCheckout/CreateCustomizeCheckout.cs @@ -0,0 +1,9 @@ +namespace CompanyManagment.App.Contracts.CustomizeCheckout; + +public class CreateCustomizeCheckout +{ + public int Year { get; set; } + public int Month { get; set; } + public long EmployeeId { get; set; } + public long WorkshopId { get; set; } +} \ No newline at end of file diff --git a/CompanyManagment.App.Contracts/CustomizeCheckout/CustomizeCheckoutMandatoryViewModel.cs b/CompanyManagment.App.Contracts/CustomizeCheckout/CustomizeCheckoutMandatoryViewModel.cs index fdee0ea4..78232075 100644 --- a/CompanyManagment.App.Contracts/CustomizeCheckout/CustomizeCheckoutMandatoryViewModel.cs +++ b/CompanyManagment.App.Contracts/CustomizeCheckout/CustomizeCheckoutMandatoryViewModel.cs @@ -1,5 +1,4 @@ -using System; - + namespace CompanyManagment.App.Contracts.CustomizeCheckout; public class CustomizeCheckoutMandatoryViewModel @@ -118,4 +117,24 @@ public class CustomizeCheckoutMandatoryViewModel /// مجموع پرداختی /// public double TotalPayment { get; set; } -} \ No newline at end of file + + #region Employee Information + + public long PersonnelCode { get; set; } + public string EmployeeName { get; set; } + + #endregion + + #region Contract Information + + public string ContractNo { get; set; } + public string ContractStartFa { get; set; } + public string ContractEndFa { get; set; } + + + public int Year { get; set; } + public int Month { get; set; } + + #endregion +} + diff --git a/CompanyManagment.App.Contracts/CustomizeCheckout/ICustomizeCheckoutApplication.cs b/CompanyManagment.App.Contracts/CustomizeCheckout/ICustomizeCheckoutApplication.cs new file mode 100644 index 00000000..29578513 --- /dev/null +++ b/CompanyManagment.App.Contracts/CustomizeCheckout/ICustomizeCheckoutApplication.cs @@ -0,0 +1,10 @@ +using System.Collections.Generic; + +namespace CompanyManagment.App.Contracts.CustomizeCheckout +{ + public interface ICustomizeCheckoutApplication + { + public IEnumerable Search(SearchCustomizeCheckout searchModel); + List<(long Id, string Name)> GetWorkshopEmployeesEligibleForCheckoutInDates(long workshopId, int yearFa, int monthFa); + } +} diff --git a/CompanyManagment.App.Contracts/CustomizeCheckout/SearchCustomizeCheckout.cs b/CompanyManagment.App.Contracts/CustomizeCheckout/SearchCustomizeCheckout.cs new file mode 100644 index 00000000..bcaabb0b --- /dev/null +++ b/CompanyManagment.App.Contracts/CustomizeCheckout/SearchCustomizeCheckout.cs @@ -0,0 +1,34 @@ +namespace CompanyManagment.App.Contracts.CustomizeCheckout; + +public class SearchCustomizeCheckout +{ + + public long WorkshopId { get; set; } + + + + public int Month { get; set; } + public int Year { get; set; } + + public string SearchStartFa { get; set; } + public string SearchEndFa { get; set; } + + public long EmployeeId { get; set; } + public CustomizeCheckoutOrderByEnum OrderBy { get; set; } + /// + /// نشان دهنده این که چند ماه عقب تر از ماه انتخاب شده نمایش داده شود Paginate + /// + public int MonthIndex { get; set; } + public SearchCustomizeCheckout(long workshopId) + { + WorkshopId = workshopId; + } +} + +public enum CustomizeCheckoutOrderByEnum +{ + ContractStart, + ContractStartDesc, + ContractNoDesc, + ContractNo, +} diff --git a/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/ChangedGroupedViewModel.cs b/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/ChangedGroupedViewModel.cs new file mode 100644 index 00000000..35cc8bf9 --- /dev/null +++ b/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/ChangedGroupedViewModel.cs @@ -0,0 +1,9 @@ +using System.Collections.Generic; + +namespace CompanyManagment.App.Contracts.CustomizeWorkshopSettings; + +public class ChangedGroupedViewModel +{ + public string GroupName { get; set; } + public List EmployeeName { get; set; } +} \ No newline at end of file diff --git a/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/CreateCustomizeEmployeeSettings.cs b/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/CreateCustomizeEmployeeSettings.cs index 5ebddc1c..87fbc6a9 100644 --- a/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/CreateCustomizeEmployeeSettings.cs +++ b/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/CreateCustomizeEmployeeSettings.cs @@ -1,6 +1,7 @@ -using _0_Framework.Domain.CustomizeCheckoutValueObjects; +using _0_Framework.Domain.CustomizeCheckoutShared.Enums; using CompanyManagment.App.Contracts.CustomizeWorkshopSettings.ValueObjectsViewModel; using System.Collections.Generic; +using _0_Framework.Domain.CustomizeCheckoutShared.ValueObjects; namespace CompanyManagment.App.Contracts.CustomizeWorkshopSettings; @@ -11,4 +12,7 @@ public class CreateCustomizeEmployeeSettings public long GroupId { get; set; } public long WorkshopSettingId { get; set; } public long WorkshopId { get; set; } + + public WorkshopShiftStatus WorkshopShiftStatus { get; set; } + public IrregularShift IrregularShift { get; set; } } \ No newline at end of file diff --git a/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/CreateCustomizeWorkshopGroupSettings.cs b/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/CreateCustomizeWorkshopGroupSettings.cs index 06e841b0..b75f9d57 100644 --- a/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/CreateCustomizeWorkshopGroupSettings.cs +++ b/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/CreateCustomizeWorkshopGroupSettings.cs @@ -1,5 +1,7 @@  using System.Collections.Generic; +using _0_Framework.Domain.CustomizeCheckoutShared.Enums; +using _0_Framework.Domain.CustomizeCheckoutShared.ValueObjects; namespace CompanyManagment.App.Contracts.CustomizeWorkshopSettings; @@ -10,5 +12,7 @@ public class CreateCustomizeWorkshopGroupSettings public string Salary { get; set; } public long CustomizeWorkshopSettingId { get; set; } public IEnumerable ShiftViewModel { get; set; } - + public WorkshopShiftStatus WorkshopShiftStatus { get; set; } + public IrregularShift IrregularShift { get; set; } + public BreakTime BreakTime { get; set; } } \ No newline at end of file diff --git a/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/CreateCustomizeWorkshopSettings.cs b/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/CreateCustomizeWorkshopSettings.cs index 4ba2ef18..0115e0c7 100644 --- a/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/CreateCustomizeWorkshopSettings.cs +++ b/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/CreateCustomizeWorkshopSettings.cs @@ -1,15 +1,25 @@ -using CompanyManagment.App.Contracts.CustomizeWorkshopSettings.ValueObjectsViewModel; +using _0_Framework.Domain.CustomizeCheckoutShared.Enums; +using CompanyManagment.App.Contracts.CustomizeWorkshopSettings.ValueObjectsViewModel; using System.Collections.Generic; +using _0_Framework.Domain.CustomizeCheckoutShared.Enums; +using _0_Framework.Domain.CustomizeCheckoutShared.ValueObjects; namespace CompanyManagment.App.Contracts.CustomizeWorkshopSettings; public class CreateCustomizeWorkshopSettings { + public WorkshopShiftStatus WorkshopShiftStatus { get; set; } + + public List ShiftsList { get; set; } /// /// تعداد روز های مجاز برای مرخصی /// public int LeavePermittedDays { get; set; } + public BreakTime BreakTime { get; set; } + + + } \ No newline at end of file diff --git a/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/CustomizeWorkshopEmployeeSettingsViewModel.cs b/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/CustomizeWorkshopEmployeeSettingsViewModel.cs index c8e6296a..cfe43275 100644 --- a/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/CustomizeWorkshopEmployeeSettingsViewModel.cs +++ b/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/CustomizeWorkshopEmployeeSettingsViewModel.cs @@ -1,14 +1,24 @@ -using System.Collections.Generic; +using _0_Framework.Domain.CustomizeCheckoutShared.Enums; +using System; +using System.Collections.Generic; +using _0_Framework.Domain.CustomizeCheckoutShared.Enums; +using _0_Framework.Domain.CustomizeCheckoutShared.ValueObjects; namespace CompanyManagment.App.Contracts.CustomizeWorkshopSettings; public class CustomizeWorkshopEmployeeSettingsViewModel { - public long Id { get; set; } - public long EmployeeId { get; set; } - public string EmployeeFullName { get; set; } - public double Salary { get; set;} - public bool IsChanged { get; set; } + public long Id { get; set; } + public long EmployeeId { get; set; } + public string EmployeeFullName { get; set; } + public double Salary { get; set; } + public bool IsSettingChanged { get; set; } + public bool IsShiftChanged { get; set; } public string Name { get; set; } public List RollCallWorkshopShifts { get; set; } + public WorkshopShiftStatus WorkshopShiftStatus { get; set; } + public IrregularShift IrregularShift { get; set; } + + public bool ChangeSettingEmployeeShiftIsChange { get; set; } + public BreakTime BreakTime { get; set; } } \ No newline at end of file diff --git a/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/CustomizeWorkshopGroupSettingsViewModel.cs b/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/CustomizeWorkshopGroupSettingsViewModel.cs index cac57e60..cc11e91e 100644 --- a/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/CustomizeWorkshopGroupSettingsViewModel.cs +++ b/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/CustomizeWorkshopGroupSettingsViewModel.cs @@ -1,4 +1,6 @@ using System.Collections.Generic; +using _0_Framework.Domain.CustomizeCheckoutShared.Enums; +using _0_Framework.Domain.CustomizeCheckoutShared.ValueObjects; namespace CompanyManagment.App.Contracts.CustomizeWorkshopSettings; @@ -7,6 +9,9 @@ public class CustomizeWorkshopGroupSettingsViewModel public long Id { get; set; } public double Salary { get; set; } public string GroupName { get; set; } + public bool MainGroup { get; set; } public List RollCallWorkshopShifts { get; set; } public List RollCallWorkshopEmployeesSettings { get; set; } + public WorkshopShiftStatus WorkshopShiftStatus { get; set; } + public IrregularShift IrregularShift { get; set; } } \ No newline at end of file diff --git a/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/CustomizeWorkshopShiftViewModel.cs b/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/CustomizeWorkshopShiftViewModel.cs index d2a0b700..67524c08 100644 --- a/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/CustomizeWorkshopShiftViewModel.cs +++ b/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/CustomizeWorkshopShiftViewModel.cs @@ -1,4 +1,6 @@ -namespace CompanyManagment.App.Contracts.CustomizeWorkshopSettings; +using _0_Framework.Domain.CustomizeCheckoutShared.Enums; + +namespace CompanyManagment.App.Contracts.CustomizeWorkshopSettings; public class CustomizeWorkshopShiftViewModel { diff --git a/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/EditCustomizeEmployeeSettings.cs b/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/EditCustomizeEmployeeSettings.cs index cceda50a..fa50f043 100644 --- a/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/EditCustomizeEmployeeSettings.cs +++ b/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/EditCustomizeEmployeeSettings.cs @@ -1,6 +1,7 @@ -using _0_Framework.Domain.CustomizeCheckoutValueObjects; +using _0_Framework.Domain.CustomizeCheckoutShared.Enums; using CompanyManagment.App.Contracts.CustomizeWorkshopSettings.ValueObjectsViewModel; using System.Collections.Generic; +using _0_Framework.Domain.CustomizeCheckoutShared.ValueObjects; namespace CompanyManagment.App.Contracts.CustomizeWorkshopSettings; @@ -85,5 +86,8 @@ public class EditCustomizeEmployeeSettings:CreateCustomizeEmployeeSettings public string Salary { get; set; } public string NameGroup { get; set; } public string EmployeeFullName { get; set; } + public bool IsShiftChanged { get; set; } + public bool IsSettingChanged { get; set; } public IEnumerable ShiftViewModel { get; set; } + public BreakTime BreakTime { get; set; } } \ No newline at end of file diff --git a/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/EditCustomizeWorkshopGroupSettings.cs b/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/EditCustomizeWorkshopGroupSettings.cs index afb55aff..37652094 100644 --- a/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/EditCustomizeWorkshopGroupSettings.cs +++ b/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/EditCustomizeWorkshopGroupSettings.cs @@ -1,6 +1,7 @@ -using _0_Framework.Domain.CustomizeCheckoutValueObjects; +using _0_Framework.Domain.CustomizeCheckoutShared.Enums; using CompanyManagment.App.Contracts.CustomizeWorkshopSettings.ValueObjectsViewModel; using System.Collections.Generic; +using _0_Framework.Domain.CustomizeCheckoutShared.ValueObjects; namespace CompanyManagment.App.Contracts.CustomizeWorkshopSettings; @@ -84,5 +85,6 @@ public class EditCustomizeWorkshopGroupSettings : CreateCustomizeWorkshopGroupSe /// public HolidayWork HolidayWork { get; set; } - public bool ChangeSettingEmployeeIsChange { get; set; } + public bool IsShiftChanged { get; set; } + public bool IsSettingChanged { get; set; } } \ No newline at end of file diff --git a/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/EditCustomizeWorkshopSettings.cs b/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/EditCustomizeWorkshopSettings.cs index 36d5a36a..1b917a24 100644 --- a/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/EditCustomizeWorkshopSettings.cs +++ b/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/EditCustomizeWorkshopSettings.cs @@ -1,14 +1,14 @@ -using _0_Framework.Domain.CustomizeCheckoutValueObjects; +using _0_Framework.Domain.CustomizeCheckoutShared.Enums; using AccountManagement.Application.Contracts.CameraAccount; using CompanyManagment.App.Contracts.CustomizeWorkshopSettings.ValueObjectsViewModel; namespace CompanyManagment.App.Contracts.CustomizeWorkshopSettings; -public class EditCustomizeWorkshopSettings:CreateCustomizeWorkshopSettings +public class EditCustomizeWorkshopSettings : CreateCustomizeWorkshopSettings { public long Id { get; set; } public long WorkshopId { get; set; } - public Currency Currency { get; set; } + public Currency Currency { get; set; } /// /// نوع محاسبه تعداد روز های ماه برای محاسبه فیش حقوقی @@ -18,67 +18,67 @@ public class EditCustomizeWorkshopSettings:CreateCustomizeWorkshopSettings /// /// جمعه کاری /// - public FridayPayViewModel FridayPay { get; set; } + public FridayPayViewModel FridayPay { get; set; } /// /// اضافه کاری /// - public OverTimePayViewModel OverTimePay { get; set; } + public OverTimePayViewModel OverTimePay { get; set; } /// /// سنوات /// - public BaseYearsPayViewModel BaseYearsPay { get; set; } + public BaseYearsPayViewModel BaseYearsPay { get; set; } /// /// عیدی /// - public BonusesPayViewModel BonusesPay { get; set; } + public BonusesPayViewModel BonusesPay { get; set; } /// /// شب کاری /// - public NightWorkPayViewModel NightWorkPay { get; set; } + public NightWorkPayViewModel NightWorkPay { get; set; } /// /// حق تاهل /// - public MarriedAllowanceViewModel MarriedAllowance { get; set; } + public MarriedAllowanceViewModel MarriedAllowance { get; set; } /// /// نوبت کاری /// - public ShiftPayViewModel ShiftPay { get; set; } + public ShiftPayViewModel ShiftPay { get; set; } /// /// حق اولاد(حق فرزند)ء /// - public FamilyAllowanceViewModel FamilyAllowance { get; set; } + public FamilyAllowanceViewModel FamilyAllowance { get; set; } /// /// مزد مرخصی /// - public LeavePayViewModel LeavePay { get; set; } + public LeavePayViewModel LeavePay { get; set; } /// /// حق بیمه /// - public InsuranceDeductionViewModel InsuranceDeduction { get; set; } + public InsuranceDeductionViewModel InsuranceDeduction { get; set; } /// /// جریمه غیبت /// - public FineAbsenceDeductionViewModel FineAbsenceDeduction { get; set; } + public FineAbsenceDeductionViewModel FineAbsenceDeduction { get; set; } /// /// تاخیر در ورود /// - public LateToWorkViewModel LateToWork { get; set; } + public LateToWorkViewModel LateToWork { get; set; } /// /// نعجیل در خروج /// - public EarlyExitViewModel EarlyExit { get; set; } + public EarlyExitViewModel EarlyExit { get; set; } /// @@ -94,7 +94,7 @@ public class EditCustomizeWorkshopSettings:CreateCustomizeWorkshopSettings /// /// آیا عیدی همیشه آخر سال تعلق میگیره یا در زمان ترک کار هم تعلق میگیره /// - public BonusesPaysInEndOfYear BonusesPaysInEndOfMonth { get; set; } + public BonusesPaysInEndOfYear BonusesPaysInEndOfMonth { get; set; } public BaseYearsPayInEndOfYear BaseYearsPayInEndOfYear { get; set; } @@ -104,4 +104,5 @@ public class EditCustomizeWorkshopSettings:CreateCustomizeWorkshopSettings public int OverTimeThresholdMinute { get; set; } #endregion + } \ No newline at end of file diff --git a/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/EditCustomizeWorkshopSettingsModalViewModel.cs b/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/EditCustomizeWorkshopSettingsModalViewModel.cs index f0583769..a49c41e4 100644 --- a/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/EditCustomizeWorkshopSettingsModalViewModel.cs +++ b/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/EditCustomizeWorkshopSettingsModalViewModel.cs @@ -1,10 +1,9 @@ - -using _0_Framework.Domain.CustomizeCheckoutValueObjects; +using _0_Framework.Domain.CustomizeCheckoutShared.Enums; using CompanyManagment.App.Contracts.CustomizeWorkshopSettings.ValueObjectsViewModel; namespace CompanyManagment.App.Contracts.CustomizeWorkshopSettings { - public class EditCustomizeWorkshopSettingsModalViewModel + public class EditCustomizeWorkshopSettingsModalViewModel { public long Id { get; set; } public Currency Currency { get; set; } diff --git a/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/ICustomizeWorkshopSettingsApplication.cs b/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/ICustomizeWorkshopSettingsApplication.cs index c3a69da3..fde3fe54 100644 --- a/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/ICustomizeWorkshopSettingsApplication.cs +++ b/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/ICustomizeWorkshopSettingsApplication.cs @@ -1,6 +1,9 @@ -using System.Collections.Generic; -using _0_Framework.Application; +using _0_Framework.Application; +using _0_Framework.Domain.CustomizeCheckoutShared.Enums; +using _0_Framework.Domain.CustomizeCheckoutShared.ValueObjects; using CompanyManagment.App.Contracts.Employee; +using System.Collections.Generic; +using System.ComponentModel; namespace CompanyManagment.App.Contracts.CustomizeWorkshopSettings; @@ -9,58 +12,75 @@ public interface ICustomizeWorkshopSettingsApplication //Create workshop settings OperationResult CreateWorkshopSettings(CreateCustomizeWorkshopSettings command); - //create group settings with workshopSettingsId. - OperationResult CreateGroupSettingsByRollCallWorkshopSettingId(CreateCustomizeWorkshopGroupSettings command); + CustomizeWorkshopSettingsViewModel GetWorkshopSettingsByWorkshopIdForAdmin(long workshopId); + //create group settings with workshopSettingsId. + OperationResult CreateGroupSettingsByRollCallWorkshopSettingId(CreateCustomizeWorkshopGroupSettings command); - OperationResult CreateRollCallEmployeeSettings(CreateCustomizeEmployeeSettings command); + OperationResult CreateEmployeeSettings(CreateCustomizeEmployeeSettings command); //Edit the Workshop Settings Data - OperationResult EditWorkshopSetting(EditCustomizeWorkshopSettings command); + OperationResult EditWorkshopSetting(EditCustomizeWorkshopSettings command, bool replaceInAllGroups); //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); + OperationResult RemoveEmployeeFromRollCallWorkshopGroup(long employeeId, long groupId, long workshopId); + + OperationResult EditSimpleRollCallGroupSetting(EditCustomizeWorkshopGroupSettings command); + + #region Vafa + OperationResult EditSimpleRollCallEmployeeSetting(EditCustomizeEmployeeSettings command); + #endregion + + OperationResult RemoveGroupSettings(long employeeSettingsId); + + OperationResult AddEmployeeToMainGroupSettings(long workshopId, long employeeId); /// /// این متد تاریخ شیفت تنظیمات کارگاه را تغییر میدهد /// /// شیفت هت /// آیدی تنظیمات کارگاه + /// + /// /// - OperationResult EditWorkshopSettingShifts(List shiftViewModels, long customizeWorkshopSettingsId); + OperationResult EditWorkshopSettingShifts(List shiftViewModels, + long customizeWorkshopSettingsId,WorkshopShiftStatus workshopShiftStatus); // It will Get the Workshop Settings with its groups and the employees of groups. - CustomizeWorkshopSettingsViewModel GetWorkshopSettingsByWorkshopId(long workshopId); + CustomizeWorkshopSettingsViewModel GetWorkshopSettingsByWorkshopId(long workshopId, AuthViewModel auth); - List GetChangedEmployeeSettingsByGroupSettingsId( - long groupSettingsId); - List GetEmployeesWithoutGroup(long rollCallWorkshopSettingId); - CustomizeWorkshopEmployeeSettingsViewModel GetEmployeeSettingsByEmployeeIdGroupSettingsId(long workshopId,long employeeId); + public CustomizeWorkshopEmployeeSettingsViewModel GetEmployeeSettingsByEmployeeIdWorkshopId(long workshopId, + long employeeId); + + + List GetChangedEmployeeSettingsByGroupSettingsId(long groupSettingsId); + + List GetEmployeesWithoutGroup(long customizeWorkshopSettingId); + + CustomizeWorkshopEmployeeSettingsViewModel GetEmployeeSettingsByEmployeeIdGroupSettingsId(long workshopId, long employeeId); List GetEmployeeSettingsByGroupSettingsId(long groupSettingsId); + EditCustomizeWorkshopSettings GetWorkshopSettingsDetails(long workshopId); - EditCustomizeWorkshopGroupSettings GetCustomizeWorkshopGroupSettingsDetails(long groupId); - + /// /// این متد فقط شیفت و مشخصات ساده را برمیگردانید /// /// /// EditCustomizeWorkshopSettings GetSimpleWorkshopSettings(long workshopId); - EditCustomizeEmployeeSettings GetCustomizeEmployeeSettingsDetails(long customizeEmployeeId); - OperationResult EditSimpleRollCallGroupSetting(EditCustomizeWorkshopGroupSettings command); - #region Vafa + EditCustomizeWorkshopGroupSettings GetCustomizeWorkshopGroupSettingsDetails(long groupId); - OperationResult EditSimpleRollCallEmployeeGroupSetting(EditCustomizeEmployeeSettings command); + EditCustomizeEmployeeSettings GetCustomizeEmployeeSettingsDetails(long customizeEmployeeId); - #endregion - OperationResult RemoveGroupSettings(long employeeSettingsId); + List GetShiftChangesGroupAndEmployees(long customizeWorkshopSettingsId); + List GetEmployeeSettingsByWorkshopId(long workshopId); } \ No newline at end of file diff --git a/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/ShiftPlacement.cs b/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/ShiftPlacement.cs deleted file mode 100644 index 0e343168..00000000 --- a/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/ShiftPlacement.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace CompanyManagment.App.Contracts.CustomizeWorkshopSettings; - -public enum ShiftPlacement -{ - First, - Second, - Third -} \ No newline at end of file diff --git a/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/ValueObjectsViewModel/BaseYearsPayViewModel.cs b/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/ValueObjectsViewModel/BaseYearsPayViewModel.cs index 3d898b5b..3fee3653 100644 --- a/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/ValueObjectsViewModel/BaseYearsPayViewModel.cs +++ b/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/ValueObjectsViewModel/BaseYearsPayViewModel.cs @@ -1,4 +1,4 @@ -using _0_Framework.Domain.CustomizeCheckoutValueObjects; +using _0_Framework.Domain.CustomizeCheckoutShared.Enums; namespace CompanyManagment.App.Contracts.CustomizeWorkshopSettings.ValueObjectsViewModel; diff --git a/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/ValueObjectsViewModel/BonusesPayViewModel.cs b/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/ValueObjectsViewModel/BonusesPayViewModel.cs index b046f9f4..a2c2d2c2 100644 --- a/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/ValueObjectsViewModel/BonusesPayViewModel.cs +++ b/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/ValueObjectsViewModel/BonusesPayViewModel.cs @@ -1,4 +1,4 @@ -using _0_Framework.Domain.CustomizeCheckoutValueObjects; +using _0_Framework.Domain.CustomizeCheckoutShared.Enums; namespace CompanyManagment.App.Contracts.CustomizeWorkshopSettings.ValueObjectsViewModel; diff --git a/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/ValueObjectsViewModel/EarlyExitViewModel.cs b/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/ValueObjectsViewModel/EarlyExitViewModel.cs index 25956234..7b61a732 100644 --- a/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/ValueObjectsViewModel/EarlyExitViewModel.cs +++ b/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/ValueObjectsViewModel/EarlyExitViewModel.cs @@ -1,5 +1,5 @@ using System.Collections.Generic; -using _0_Framework.Domain.CustomizeCheckoutValueObjects; +using _0_Framework.Domain.CustomizeCheckoutShared.Enums; namespace CompanyManagment.App.Contracts.CustomizeWorkshopSettings.ValueObjectsViewModel; @@ -13,7 +13,7 @@ public class EarlyExitViewModel /// /// جریمه های اختصاصی پله ای /// - public List EarlyExitTimeFinesViewModels { get; set; } + public List EarlyExitTimeFinesViewModels { get; set; } = new(); ///// ///// نوع محاسبه جریمه های اختصاصی پله ای. این بخش میتواند نال باشد چون ممکن است شخص جریمه ای اختصاص ندهد diff --git a/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/ValueObjectsViewModel/FamilyAllowanceViewModel.cs b/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/ValueObjectsViewModel/FamilyAllowanceViewModel.cs index 777ace78..2b39da94 100644 --- a/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/ValueObjectsViewModel/FamilyAllowanceViewModel.cs +++ b/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/ValueObjectsViewModel/FamilyAllowanceViewModel.cs @@ -1,4 +1,4 @@ -using _0_Framework.Domain.CustomizeCheckoutValueObjects; +using _0_Framework.Domain.CustomizeCheckoutShared.Enums; namespace CompanyManagment.App.Contracts.CustomizeWorkshopSettings.ValueObjectsViewModel; diff --git a/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/ValueObjectsViewModel/FineAbsenceDayOfWeekViewModel.cs b/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/ValueObjectsViewModel/FineAbsenceDayOfWeekViewModel.cs index 92f57e21..89fbdd5d 100644 --- a/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/ValueObjectsViewModel/FineAbsenceDayOfWeekViewModel.cs +++ b/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/ValueObjectsViewModel/FineAbsenceDayOfWeekViewModel.cs @@ -1,5 +1,4 @@ using System; -using _0_Framework.Domain.CustomizeCheckoutValueObjects; namespace CompanyManagment.App.Contracts.CustomizeWorkshopSettings.ValueObjectsViewModel; diff --git a/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/ValueObjectsViewModel/FineAbsenceDeductionViewModel.cs b/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/ValueObjectsViewModel/FineAbsenceDeductionViewModel.cs index efcd265b..08500d70 100644 --- a/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/ValueObjectsViewModel/FineAbsenceDeductionViewModel.cs +++ b/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/ValueObjectsViewModel/FineAbsenceDeductionViewModel.cs @@ -1,5 +1,5 @@ using System.Collections.Generic; -using _0_Framework.Domain.CustomizeCheckoutValueObjects; +using _0_Framework.Domain.CustomizeCheckoutShared.Enums; namespace CompanyManagment.App.Contracts.CustomizeWorkshopSettings.ValueObjectsViewModel; @@ -15,5 +15,5 @@ public class FineAbsenceDeductionViewModel /// /// جریمه های اختصاصی به ازای روز های هفته /// - public List FineAbsenceDayOfWeekViewModels { get; set; } + public List FineAbsenceDayOfWeekViewModels { get; set; } = new(); } \ No newline at end of file diff --git a/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/ValueObjectsViewModel/FridayPayViewModel.cs b/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/ValueObjectsViewModel/FridayPayViewModel.cs index a0704aad..3008cab7 100644 --- a/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/ValueObjectsViewModel/FridayPayViewModel.cs +++ b/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/ValueObjectsViewModel/FridayPayViewModel.cs @@ -1,4 +1,4 @@ -using _0_Framework.Domain.CustomizeCheckoutValueObjects; +using _0_Framework.Domain.CustomizeCheckoutShared.Enums; namespace CompanyManagment.App.Contracts.CustomizeWorkshopSettings.ValueObjectsViewModel; diff --git a/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/ValueObjectsViewModel/InsuranceDeductionViewModel.cs b/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/ValueObjectsViewModel/InsuranceDeductionViewModel.cs index 3f396b31..9ddda9fa 100644 --- a/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/ValueObjectsViewModel/InsuranceDeductionViewModel.cs +++ b/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/ValueObjectsViewModel/InsuranceDeductionViewModel.cs @@ -1,4 +1,4 @@ -using _0_Framework.Domain.CustomizeCheckoutValueObjects; +using _0_Framework.Domain.CustomizeCheckoutShared.Enums; namespace CompanyManagment.App.Contracts.CustomizeWorkshopSettings.ValueObjectsViewModel; diff --git a/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/ValueObjectsViewModel/LateToWorkViewModel.cs b/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/ValueObjectsViewModel/LateToWorkViewModel.cs index bb5f9866..31f3af3a 100644 --- a/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/ValueObjectsViewModel/LateToWorkViewModel.cs +++ b/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/ValueObjectsViewModel/LateToWorkViewModel.cs @@ -1,5 +1,5 @@ using System.Collections.Generic; -using _0_Framework.Domain.CustomizeCheckoutValueObjects; +using _0_Framework.Domain.CustomizeCheckoutShared.Enums; namespace CompanyManagment.App.Contracts.CustomizeWorkshopSettings.ValueObjectsViewModel; @@ -18,7 +18,7 @@ public class LateToWorkViewModel /// /// جریمه های اختصاصی پله ای /// - public List LateToWorkTimeFinesVewModels { get; set; } + public List LateToWorkTimeFinesVewModels { get; set; } = new(); ///// ///// نوع محاسبه جریمه های اختصاصی پله ای. این بخش میتواند نال باشد چون ممکن است شخص جریمه ای اختصاص ندهد diff --git a/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/ValueObjectsViewModel/LeavePayViewModel.cs b/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/ValueObjectsViewModel/LeavePayViewModel.cs index 0e564f3b..0dc73dae 100644 --- a/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/ValueObjectsViewModel/LeavePayViewModel.cs +++ b/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/ValueObjectsViewModel/LeavePayViewModel.cs @@ -1,4 +1,4 @@ -using _0_Framework.Domain.CustomizeCheckoutValueObjects; +using _0_Framework.Domain.CustomizeCheckoutShared.Enums; namespace CompanyManagment.App.Contracts.CustomizeWorkshopSettings.ValueObjectsViewModel; diff --git a/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/ValueObjectsViewModel/MarriedAllowanceViewModel.cs b/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/ValueObjectsViewModel/MarriedAllowanceViewModel.cs index 48b83d95..bc14dbaa 100644 --- a/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/ValueObjectsViewModel/MarriedAllowanceViewModel.cs +++ b/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/ValueObjectsViewModel/MarriedAllowanceViewModel.cs @@ -1,4 +1,5 @@ -using _0_Framework.Domain.CustomizeCheckoutValueObjects; +using _0_Framework.Domain.CustomizeCheckoutShared; +using _0_Framework.Domain.CustomizeCheckoutShared.Enums; namespace CompanyManagment.App.Contracts.CustomizeWorkshopSettings.ValueObjectsViewModel; diff --git a/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/ValueObjectsViewModel/NightWorkPayViewModel.cs b/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/ValueObjectsViewModel/NightWorkPayViewModel.cs index c5f4f6f2..4b3569a4 100644 --- a/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/ValueObjectsViewModel/NightWorkPayViewModel.cs +++ b/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/ValueObjectsViewModel/NightWorkPayViewModel.cs @@ -1,4 +1,4 @@ -using _0_Framework.Domain.CustomizeCheckoutValueObjects; +using _0_Framework.Domain.CustomizeCheckoutShared.Enums; namespace CompanyManagment.App.Contracts.CustomizeWorkshopSettings.ValueObjectsViewModel; diff --git a/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/ValueObjectsViewModel/OverTimePayViewModel.cs b/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/ValueObjectsViewModel/OverTimePayViewModel.cs index a80a04a3..4c73983c 100644 --- a/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/ValueObjectsViewModel/OverTimePayViewModel.cs +++ b/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/ValueObjectsViewModel/OverTimePayViewModel.cs @@ -1,4 +1,4 @@ -using _0_Framework.Domain.CustomizeCheckoutValueObjects; +using _0_Framework.Domain.CustomizeCheckoutShared.Enums; namespace CompanyManagment.App.Contracts.CustomizeWorkshopSettings.ValueObjectsViewModel; diff --git a/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/ValueObjectsViewModel/ShiftPayViewModel.cs b/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/ValueObjectsViewModel/ShiftPayViewModel.cs index 134435be..f85fb569 100644 --- a/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/ValueObjectsViewModel/ShiftPayViewModel.cs +++ b/CompanyManagment.App.Contracts/CustomizeWorkshopSettings/ValueObjectsViewModel/ShiftPayViewModel.cs @@ -1,4 +1,4 @@ -using _0_Framework.Domain.CustomizeCheckoutValueObjects; +using _0_Framework.Domain.CustomizeCheckoutShared.Enums; namespace CompanyManagment.App.Contracts.CustomizeWorkshopSettings.ValueObjectsViewModel; diff --git a/CompanyManagment.App.Contracts/Employee/IEmployeeApplication.cs b/CompanyManagment.App.Contracts/Employee/IEmployeeApplication.cs index 195e0283..cc493a21 100644 --- a/CompanyManagment.App.Contracts/Employee/IEmployeeApplication.cs +++ b/CompanyManagment.App.Contracts/Employee/IEmployeeApplication.cs @@ -37,6 +37,13 @@ public interface IEmployeeApplication #region NewByHeydari List SearchForMain(EmployeeSearchModel searchModel); #endregion + #region Pooya + List GetRangeByIds(IEnumerable employeeIds); + EmployeeViewModel GetEmployeeByNationalCodeIfHasActiveLeftWork(string nationalCode, List workshopIds); + List GetWorkingEmployeesByWorkshopId(long workshopId); + + + #endregion } \ No newline at end of file diff --git a/CompanyManagment.App.Contracts/Fine/EditFineViewModel.cs b/CompanyManagment.App.Contracts/Fine/EditFineViewModel.cs index 92caee2a..8b71fa72 100644 --- a/CompanyManagment.App.Contracts/Fine/EditFineViewModel.cs +++ b/CompanyManagment.App.Contracts/Fine/EditFineViewModel.cs @@ -2,6 +2,7 @@ public class EditFineViewModel:CreateFineViewModel { + public string EmployeeFullname { get; set; } public long EmployeeId { get; set; } public long Id { get; set; } } \ No newline at end of file diff --git a/CompanyManagment.App.Contracts/Fine/FineSearchViewModel.cs b/CompanyManagment.App.Contracts/Fine/FineSearchViewModel.cs index ab4c760b..add2fb34 100644 --- a/CompanyManagment.App.Contracts/Fine/FineSearchViewModel.cs +++ b/CompanyManagment.App.Contracts/Fine/FineSearchViewModel.cs @@ -1,9 +1,5 @@ using _0_Framework.Application; using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace CompanyManagment.App.Contracts.Fine; public class FineSearchViewModel diff --git a/CompanyManagment.App.Contracts/Fine/FineViewModel.cs b/CompanyManagment.App.Contracts/Fine/FineViewModel.cs new file mode 100644 index 00000000..21eab628 --- /dev/null +++ b/CompanyManagment.App.Contracts/Fine/FineViewModel.cs @@ -0,0 +1,17 @@ +using _0_Framework.Application; + +namespace CompanyManagment.App.Contracts.Fine; + +public class FineViewModel +{ + public long Id { get; set; } + public long WorkshopId { get; set; } + public long EmployeeId { get; set; } + public string EmployeeFullName { get; set; } + public string PersonnelCode { get; set; } + public string Title { get; set; } + public string Amount { get; set; } + public string FineDate { get; set; } + public IsActive IsActive { get; set; } + public string CreationDate { get; set; } +} \ No newline at end of file diff --git a/CompanyManagment.App.Contracts/Fine/IFineApplication.cs b/CompanyManagment.App.Contracts/Fine/IFineApplication.cs index 8465c7cd..fa943900 100644 --- a/CompanyManagment.App.Contracts/Fine/IFineApplication.cs +++ b/CompanyManagment.App.Contracts/Fine/IFineApplication.cs @@ -7,6 +7,8 @@ public interface IFineApplication { OperationResult Create(CreateFineViewModel command); OperationResult Edit (EditFineViewModel command); - List GetSearchList(FineSearchViewModel searchModel); + List GetSearchList(FineSearchViewModel searchModel); EditFineViewModel GetDetails(long id); + OperationResult Remove(long id); + OperationResult RemoveRange(List ids); } \ No newline at end of file diff --git a/CompanyManagment.App.Contracts/FineSubject/CreateFineSubjectViewModel.cs b/CompanyManagment.App.Contracts/FineSubject/CreateFineSubjectViewModel.cs new file mode 100644 index 00000000..2ea61689 --- /dev/null +++ b/CompanyManagment.App.Contracts/FineSubject/CreateFineSubjectViewModel.cs @@ -0,0 +1,8 @@ +namespace CompanyManagment.App.Contracts.FineSubject; + +public class CreateFineSubjectViewModel +{ + public string Subject { get; set; } + public string Amount { get; set; } + public long WorkshopId { get; set; } +} \ No newline at end of file diff --git a/CompanyManagment.App.Contracts/FineSubject/EditFineSubjectViewModel.cs b/CompanyManagment.App.Contracts/FineSubject/EditFineSubjectViewModel.cs new file mode 100644 index 00000000..360f84b2 --- /dev/null +++ b/CompanyManagment.App.Contracts/FineSubject/EditFineSubjectViewModel.cs @@ -0,0 +1,6 @@ +namespace CompanyManagment.App.Contracts.FineSubject; + +public class EditFineSubjectViewModel:CreateFineSubjectViewModel +{ + public long Id { get; set; } +} \ No newline at end of file diff --git a/CompanyManagment.App.Contracts/FineSubject/FineSubjectViewModel.cs b/CompanyManagment.App.Contracts/FineSubject/FineSubjectViewModel.cs new file mode 100644 index 00000000..3c9f36dd --- /dev/null +++ b/CompanyManagment.App.Contracts/FineSubject/FineSubjectViewModel.cs @@ -0,0 +1,9 @@ +namespace CompanyManagment.App.Contracts.FineSubject; + +public class FineSubjectViewModel +{ + public long Id { get; set; } + public string Subject { get; set; } + public string Amount { get; set; } + +} \ No newline at end of file diff --git a/CompanyManagment.App.Contracts/FineSubject/IFineSubjectApplication.cs b/CompanyManagment.App.Contracts/FineSubject/IFineSubjectApplication.cs new file mode 100644 index 00000000..37222a14 --- /dev/null +++ b/CompanyManagment.App.Contracts/FineSubject/IFineSubjectApplication.cs @@ -0,0 +1,12 @@ +using System.Collections.Generic; +using _0_Framework_b.Application; + +namespace CompanyManagment.App.Contracts.FineSubject; + +public interface IFineSubjectApplication +{ + OperationResult Create(CreateFineSubjectViewModel command); + OperationResult Delete(long id); + OperationResult Edit(EditFineSubjectViewModel command); + List GetAll(long workshopId); +} \ No newline at end of file diff --git a/CompanyManagment.App.Contracts/Loan/CreateLoanViewModel.cs b/CompanyManagment.App.Contracts/Loan/CreateLoanViewModel.cs index db072bc7..59cc88d5 100644 --- a/CompanyManagment.App.Contracts/Loan/CreateLoanViewModel.cs +++ b/CompanyManagment.App.Contracts/Loan/CreateLoanViewModel.cs @@ -6,8 +6,10 @@ public class CreateLoanViewModel { public List EmployeeIds { get; set; } public long WorkshopId { get; set; } - public string StartDateTime { get; set; } - public int Count { get; set; } + public string StartInstallmentPayment { get; set; } + public string LoanGrantDate { get; set; } + + public int Count { get; set; } public string Amount { get; set; } public bool GetRounded { get; set; } } \ No newline at end of file diff --git a/CompanyManagment.App.Contracts/Loan/EditLoanViewModel.cs b/CompanyManagment.App.Contracts/Loan/EditLoanViewModel.cs index 15ae316f..fe70d93d 100644 --- a/CompanyManagment.App.Contracts/Loan/EditLoanViewModel.cs +++ b/CompanyManagment.App.Contracts/Loan/EditLoanViewModel.cs @@ -1,6 +1,4 @@ -using Microsoft.EntityFrameworkCore.Metadata.Builders; - -namespace CompanyManagment.App.Contracts.Loan; +namespace CompanyManagment.App.Contracts.Loan; public class EditLoanViewModel:CreateLoanViewModel { diff --git a/CompanyManagment.App.Contracts/Loan/ILoanApplication.cs b/CompanyManagment.App.Contracts/Loan/ILoanApplication.cs index 7cae0d71..ce3ada56 100644 --- a/CompanyManagment.App.Contracts/Loan/ILoanApplication.cs +++ b/CompanyManagment.App.Contracts/Loan/ILoanApplication.cs @@ -1,6 +1,5 @@ -using _0_Framework_b.Application; -using System; -using System.Collections.Generic; +using System.Collections.Generic; +using _0_Framework.Application; namespace CompanyManagment.App.Contracts.Loan; @@ -9,6 +8,7 @@ public interface ILoanApplication List GetSearchList(LoanSearchViewModel searchViewModel); LoanViewModel GetDetails(long id); OperationResult Create(CreateLoanViewModel command); - OperationResult Edit(EditLoanViewModel command); List CalculateLoanInstallment(string amount , int installmentCount,string loanStartDate,bool getRounded); + OperationResult Remove(long id); + OperationResult RemoveRange(IEnumerable ids); } \ No newline at end of file diff --git a/CompanyManagment.App.Contracts/Loan/LoanInstallmentViewModel.cs b/CompanyManagment.App.Contracts/Loan/LoanInstallmentViewModel.cs index 19d6ad61..875fc0d2 100644 --- a/CompanyManagment.App.Contracts/Loan/LoanInstallmentViewModel.cs +++ b/CompanyManagment.App.Contracts/Loan/LoanInstallmentViewModel.cs @@ -1,8 +1,13 @@ -namespace CompanyManagment.App.Contracts.Loan; +using System; + +namespace CompanyManagment.App.Contracts.Loan; public class LoanInstallmentViewModel { public string Year { get; set; } public string Month { get; set; } public string Amount { get; set; } + public string Day { get; set; } + public string DateFa { get; set; } + public DateTime DateGr { get; set; } } \ No newline at end of file diff --git a/CompanyManagment.App.Contracts/Loan/LoanSearchViewModel.cs b/CompanyManagment.App.Contracts/Loan/LoanSearchViewModel.cs index 38a9dafb..3f2978ee 100644 --- a/CompanyManagment.App.Contracts/Loan/LoanSearchViewModel.cs +++ b/CompanyManagment.App.Contracts/Loan/LoanSearchViewModel.cs @@ -1,9 +1,5 @@  using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace CompanyManagment.App.Contracts.Loan; diff --git a/CompanyManagment.App.Contracts/Loan/LoanViewModel.cs b/CompanyManagment.App.Contracts/Loan/LoanViewModel.cs index 5279f0b6..878f6bd9 100644 --- a/CompanyManagment.App.Contracts/Loan/LoanViewModel.cs +++ b/CompanyManagment.App.Contracts/Loan/LoanViewModel.cs @@ -1,16 +1,10 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Microsoft.EntityFrameworkCore.Metadata.Builders; - -namespace CompanyManagment.App.Contracts.Loan; +namespace CompanyManagment.App.Contracts.Loan; public class LoanViewModel { public long Id { get; set; } public long EmployeeId { get; set; } public long WorkshopId { get; set; } + public string EmployeeFullName { get; set; } public string StartDateTime { get; set; } public string Count { get; set; } public string Amount { get; set; } diff --git a/CompanyManagment.App.Contracts/Reward/CreateRewardViewModel.cs b/CompanyManagment.App.Contracts/Reward/CreateRewardViewModel.cs index fe96f3ab..e41524fe 100644 --- a/CompanyManagment.App.Contracts/Reward/CreateRewardViewModel.cs +++ b/CompanyManagment.App.Contracts/Reward/CreateRewardViewModel.cs @@ -10,7 +10,7 @@ public class CreateRewardViewModel /// /// مبلغ پاداش /// - public double Amount { get; set; } + public string Amount { get; set; } /// /// توضیحات @@ -21,4 +21,6 @@ public class CreateRewardViewModel /// public long RewardedByAccountId { get; set; } + public string GrantDate { get; set; } + } \ No newline at end of file diff --git a/CompanyManagment.App.Contracts/Reward/EditRewardViewModel.cs b/CompanyManagment.App.Contracts/Reward/EditRewardViewModel.cs index 0c555852..f0c410f6 100644 --- a/CompanyManagment.App.Contracts/Reward/EditRewardViewModel.cs +++ b/CompanyManagment.App.Contracts/Reward/EditRewardViewModel.cs @@ -8,4 +8,5 @@ public class EditRewardViewModel:CreateRewardViewModel public IsActive IsActive { get; set; } public long EmployeeId { get; set; } + public string EmployeeFullName { get; set; } } \ No newline at end of file diff --git a/CompanyManagment.App.Contracts/Reward/IRewardApplication.cs b/CompanyManagment.App.Contracts/Reward/IRewardApplication.cs index e2c740f9..322404c0 100644 --- a/CompanyManagment.App.Contracts/Reward/IRewardApplication.cs +++ b/CompanyManagment.App.Contracts/Reward/IRewardApplication.cs @@ -7,6 +7,10 @@ public interface IRewardApplication { OperationResult Create(CreateRewardViewModel command); OperationResult Edit(EditRewardViewModel command); - List GetSearchList(RewardSearchViewModel searchViewModel); + List GetSearchList(RewardSearchModel searchViewModel); EditRewardViewModel GetDetails(long id); -} \ No newline at end of file + OperationResult Remove(long id); + OperationResult RemoveRange(IEnumerable ids); + + +} diff --git a/CompanyManagment.App.Contracts/Reward/RewardSearchModel.cs b/CompanyManagment.App.Contracts/Reward/RewardSearchModel.cs new file mode 100644 index 00000000..25167a13 --- /dev/null +++ b/CompanyManagment.App.Contracts/Reward/RewardSearchModel.cs @@ -0,0 +1,8 @@ +namespace CompanyManagment.App.Contracts.Reward; +public class RewardSearchModel +{ + public long EmployeeId { get; set; } + public long WorkshopId { get; set; } + public string PersonnelCode { get; set; } + public int PageIndex { get; set; } +} \ No newline at end of file diff --git a/CompanyManagment.App.Contracts/Reward/RewardSearchViewModel.cs b/CompanyManagment.App.Contracts/Reward/RewardSearchViewModel.cs index 38cba787..e738a8f2 100644 --- a/CompanyManagment.App.Contracts/Reward/RewardSearchViewModel.cs +++ b/CompanyManagment.App.Contracts/Reward/RewardSearchViewModel.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace CompanyManagment.App.Contracts.Reward; public class RewardSearchViewModel diff --git a/CompanyManagment.App.Contracts/Reward/RewardViewModel.cs b/CompanyManagment.App.Contracts/Reward/RewardViewModel.cs new file mode 100644 index 00000000..3d988b5a --- /dev/null +++ b/CompanyManagment.App.Contracts/Reward/RewardViewModel.cs @@ -0,0 +1,14 @@ +namespace CompanyManagment.App.Contracts.Reward; + +public class RewardViewModel +{ + public long Id { get; set; } + public long EmployeeId { get; set; } + public long WorkshopId { get; set; } + public string EmployeeFullName { get; set; } + public string PersonnelCode { get; set; } + public string Amount { get; set; } + public string GrantDate { get; set; } + public string Description { get; set; } + public string CreationDate { get; set; } +} \ No newline at end of file diff --git a/CompanyManagment.App.Contracts/RollCall/IRollCallApplication.cs b/CompanyManagment.App.Contracts/RollCall/IRollCallApplication.cs index 359b2985..78eccf8f 100644 --- a/CompanyManagment.App.Contracts/RollCall/IRollCallApplication.cs +++ b/CompanyManagment.App.Contracts/RollCall/IRollCallApplication.cs @@ -29,6 +29,8 @@ namespace CompanyManagment.App.Contracts.RollCall /// /// string CheckRepeat(long employeeId, long workshopId); + + #region Pooya OperationResult RemoveEmployeeRollCallsInDate(long workshopId, long employeeId, string dateFa); @@ -72,6 +74,32 @@ namespace CompanyManagment.App.Contracts.RollCall /// OperationResult ManualEdit(CreateOrEditEmployeeRollCall command); + + + + + /// + /// این متد تمام حضور غیاب های کات شده توسط بک گراند سرویس را به صورت تعداد روزانه برمیگرداند + /// + /// + /// لیستی از تعداد و روز آن + List GetRollCallWorkFlowsCutByBgService(long workshopId, DateTime start, DateTime end); + + /// + /// تمامی حضور غیاب های کات شده توسط بک گراند سرویس را برمیگرداند + /// + /// + /// + /// + int GetCountCutRollCallByBgService(long accId, long workshopId); + + IEnumerable GetNotSlicedRollCallsByWorkshopId(long workshopId, DateTime durationStart, DateTime durationEnd); + RollCallViewModel GetDetails(long rollCallId); #endregion + + List GetWorkshopAbsentHistory(long workshopId, DateTime startSearch, + DateTime endSearch); + OperationResult SetModifyTypeToNone(long rollCallId); + OperationResult SetModifyTypeToEditByEmployer(long rollCallId); } } diff --git a/CompanyManagment.App.Contracts/RollCall/RollCallsByDateViewModel.cs b/CompanyManagment.App.Contracts/RollCall/RollCallsByDateViewModel.cs index 6f9c54e6..bf76a815 100644 --- a/CompanyManagment.App.Contracts/RollCall/RollCallsByDateViewModel.cs +++ b/CompanyManagment.App.Contracts/RollCall/RollCallsByDateViewModel.cs @@ -10,5 +10,6 @@ namespace CompanyManagment.App.Contracts.RollCall public IEnumerable ActiveEmployees { get; set; } public string DayOfWeekFa { get; set; } public bool IsHoliday { get; set; } - } + public bool IsFriday { get; set; } + } } diff --git a/CompanyManagment.App.Contracts/RollCallEmployeeStatus/IRollCallEmployeeStatusApplication.cs b/CompanyManagment.App.Contracts/RollCallEmployeeStatus/IRollCallEmployeeStatusApplication.cs index 341b2902..6475efb4 100644 --- a/CompanyManagment.App.Contracts/RollCallEmployeeStatus/IRollCallEmployeeStatusApplication.cs +++ b/CompanyManagment.App.Contracts/RollCallEmployeeStatus/IRollCallEmployeeStatusApplication.cs @@ -1,5 +1,6 @@ using _0_Framework.Application; using System; +using System.Collections.Generic; namespace CompanyManagment.App.Contracts.RollCallEmployeeStatus { @@ -13,5 +14,6 @@ namespace CompanyManagment.App.Contracts.RollCallEmployeeStatus /// bool HasRollCallRecord(long employeeId, long workshopId, DateTime contractStart, DateTime contractEnd); + List GetActiveByWorkshopIdInDate(long workshopId, DateTime startDateGr, DateTime endDateGr); } } diff --git a/CompanyManagment.App.Contracts/RollCallEmployeeStatus/RollCallEmployeeStatusViewModel.cs b/CompanyManagment.App.Contracts/RollCallEmployeeStatus/RollCallEmployeeStatusViewModel.cs index f515f025..830bfd08 100644 --- a/CompanyManagment.App.Contracts/RollCallEmployeeStatus/RollCallEmployeeStatusViewModel.cs +++ b/CompanyManagment.App.Contracts/RollCallEmployeeStatus/RollCallEmployeeStatusViewModel.cs @@ -4,9 +4,11 @@ namespace CompanyManagment.App.Contracts.RollCallEmployeeStatus { public class RollCallEmployeeStatusViewModel { - public long Id { get; set; } - public string StartDate { get; set; } - public string EndDate { get; set; } + public long Id { get; set; } + public long EmployeeId { get; set; } + public string EmployeeName { get; set; } + public string StartDate { get; set; } + public string EndDate { get; set; } public DateTime StartDateGr { get; set; } public DateTime EndDateGr { get; set; } } diff --git a/CompanyManagment.App.Contracts/SalaryAid/EditSalaryAidViewModel.cs b/CompanyManagment.App.Contracts/SalaryAid/EditSalaryAidViewModel.cs index 94bc36b7..607020c7 100644 --- a/CompanyManagment.App.Contracts/SalaryAid/EditSalaryAidViewModel.cs +++ b/CompanyManagment.App.Contracts/SalaryAid/EditSalaryAidViewModel.cs @@ -4,4 +4,5 @@ public class EditSalaryAidViewModel:CreateSalaryAidViewModel { public long Id { get; set; } public long EmployeeId { get; set; } + public string EmployeeFullName { get; set; } } \ No newline at end of file diff --git a/CompanyManagment.App.Contracts/SalaryAid/ISalaryAidApplication.cs b/CompanyManagment.App.Contracts/SalaryAid/ISalaryAidApplication.cs index 27e9309d..5cc91e72 100644 --- a/CompanyManagment.App.Contracts/SalaryAid/ISalaryAidApplication.cs +++ b/CompanyManagment.App.Contracts/SalaryAid/ISalaryAidApplication.cs @@ -1,12 +1,15 @@ -using _0_Framework_b.Application; + using System.Collections.Generic; +using _0_Framework.Application; namespace CompanyManagment.App.Contracts.SalaryAid; public interface ISalaryAidApplication { - List GetSearchList(SalaryAidSearchViewModel searchViewModel); + List GetSearchList(SalaryAidSearchViewModel searchViewModel); EditSalaryAidViewModel GetDetails(long id); OperationResult Create(CreateSalaryAidViewModel command); OperationResult Edit(EditSalaryAidViewModel command); + OperationResult Remove(long id); + OperationResult RemoveRange(IEnumerable ids); } \ No newline at end of file diff --git a/CompanyManagment.App.Contracts/SalaryAid/SalaryAidSearchViewModel.cs b/CompanyManagment.App.Contracts/SalaryAid/SalaryAidSearchViewModel.cs index 42965bae..2dfc66bd 100644 --- a/CompanyManagment.App.Contracts/SalaryAid/SalaryAidSearchViewModel.cs +++ b/CompanyManagment.App.Contracts/SalaryAid/SalaryAidSearchViewModel.cs @@ -1,13 +1,9 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace CompanyManagment.App.Contracts.SalaryAid; public class SalaryAidSearchViewModel { - public long Id; + public long Id { get; set; } public long EmployeeId { get; set; } public long WorkshopId { get; set; } public string EmployeeFullName { get; set; } diff --git a/CompanyManagment.App.Contracts/SalaryAid/SalaryAidViewModel.cs b/CompanyManagment.App.Contracts/SalaryAid/SalaryAidViewModel.cs new file mode 100644 index 00000000..c9c2e2f7 --- /dev/null +++ b/CompanyManagment.App.Contracts/SalaryAid/SalaryAidViewModel.cs @@ -0,0 +1,17 @@ +using System; + +namespace CompanyManagment.App.Contracts.SalaryAid; + +public class SalaryAidViewModel +{ + public long Id { get; set; } + public long EmployeeId { get; set; } + public string Amount { get; set; } + public long WorkshopId { get; set; } + public string CreationDate { get; set; } + public string SalaryAidDateTimeFa { get; set; } + public DateTime SalaryAidDateTimeGe { get; set; } + + public string EmployeeFullName { get; set; } + public string PersonnelCode { get; set; } +} \ No newline at end of file diff --git a/CompanyManagment.App.Contracts/Workshop/WorkshopSubAccountViewModel.cs b/CompanyManagment.App.Contracts/Workshop/WorkshopSubAccountViewModel.cs new file mode 100644 index 00000000..3e5fd6ca --- /dev/null +++ b/CompanyManagment.App.Contracts/Workshop/WorkshopSubAccountViewModel.cs @@ -0,0 +1,11 @@ + +namespace CompanyManagment.App.Contracts.Workshop +{ + public class WorkshopSubAccountViewModel + { + public long WorkshopId { get; set; } + public string WorkshopName { get; set; } + public long SubAccountId { get; set; } + public string IsActive { get; set; } + } +} diff --git a/CompanyManagment.Application/CheckoutApplication.cs b/CompanyManagment.Application/CheckoutApplication.cs index 79685e75..64a2b0b1 100644 --- a/CompanyManagment.Application/CheckoutApplication.cs +++ b/CompanyManagment.Application/CheckoutApplication.cs @@ -384,5 +384,17 @@ public class CheckoutApplication : ICheckoutApplication { return await _checkoutRepository.SearchForMainCheckout(searchModel); } - #endregion + #endregion + #region Pooya + public List<(long EmployeeId, DateTime CheckoutStart, DateTime CheckoutEnd)> GetLastCheckoutsByWorkshopId(long workshopId, DateTime start, DateTime end) + { + return _checkoutRepository.GetLastCheckoutsByWorkshopId(workshopId, start, end); + } + + public List<(long EmployeeId, DateTime CheckoutStart, DateTime CheckoutEnd)> GetLastCheckoutsByWorkshopIdForWorkFlow(long workshopId, DateTime start, DateTime end) + { + return _checkoutRepository.GetLastCheckoutsByWorkshopIdForWorkFlow(workshopId, start, end); + } + + #endregion } \ No newline at end of file diff --git a/CompanyManagment.Application/CustomizeCheckoutApplication.cs b/CompanyManagment.Application/CustomizeCheckoutApplication.cs new file mode 100644 index 00000000..d8df3c98 --- /dev/null +++ b/CompanyManagment.Application/CustomizeCheckoutApplication.cs @@ -0,0 +1,125 @@ + + +using _0_Framework.Application; +using Company.Domain.CustomizeCheckoutAgg; +using Company.Domain.EmployeeAgg; +using Company.Domain.LeftWorkAgg; +using Company.Domain.RollCallEmployeeAgg; +using Company.Domain.RollCallEmployeeStatusAgg; +using Company.Domain.WorkshopAgg; +using CompanyManagment.App.Contracts.CustomizeCheckout; +using CompanyManagment.App.Contracts.LeftWork; +using CompanyManagment.App.Contracts.RollCallEmployeeStatus; +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; + +namespace CompanyManagment.Application +{ + public class CustomizeCheckoutApplication : ICustomizeCheckoutApplication + { + private readonly ICustomizeCheckoutRepository _customizeCheckoutRepository; + private readonly IEmployeeRepository _employeeRepository; + private readonly ILeftWorkRepository _leftWorkRepository; + private readonly IRollCallEmployeeStatusRepository _rollCallEmployeeStatusRepository; + public CustomizeCheckoutApplication(ICustomizeCheckoutRepository customizeCheckoutRepository, IRollCallEmployeeStatusRepository rollCallEmployeeStatusRepository, ILeftWorkRepository leftWorkRepository, IEmployeeRepository employeeRepository) + { + _customizeCheckoutRepository = customizeCheckoutRepository; + _rollCallEmployeeStatusRepository = rollCallEmployeeStatusRepository; + _leftWorkRepository = leftWorkRepository; + _employeeRepository = employeeRepository; + } + + public IEnumerable Search(SearchCustomizeCheckout searchModel) + { + return _customizeCheckoutRepository.Search(searchModel); + } + //public OperationResult Create(CreateCustomizeCheckout command) + //{ + + // OperationResult op = new(); + + // //validate employee + + // //validate workshop + + + // //validate month and year + // if (command.Year < 1398 || command.Year > 1500 || command.Month < 1 || command.Month > 12) + // return op.Failed("خطای سیستمی"); + + // //validate parsed datetime + // var date = new DateTime(command.Year, command.Month, 1, new PersianCalendar()); + + // //get contract + + + // //validate employee rollCallStatus + // if ( + + + // //get employeeSettings + + // //get workshopSettings + + // //get rewardPay + + // //get loan + + // //get salaryAidDeduction + + // //get fineDeduction + + + // //get sumOfWorkingDays + + // var entity = new CustomizeCheckout(contract.End, contract.Start, command.EmployeeId, command.WorkshopId, contract.Id, + // employeeSettings.Salary, employeeSettings.FridayPay, employeeSettings.OverTimePay, employeeSettings.BaseYearsPay, + // employeeSettings.BonusesPay, employeeSettings.NightWorkPay, employeeSettings.MarriedAllowance, employeeSettings.ShiftPay, + // employeeSettings.FamilyAllowance, employeeSettings.LeavePay, employeeSettings.InsuranceDeduction, employeeSettings.FineAbsenceDeduction, + // employeeSettings.LateToWork, employeeSettings.EarlyExit, rewardPay, salaryAidDeduction, installmentDeduction, fineDeduction, taxDeduction, + // sumOfWorkingDays, 0, 0, 0); + + + // _customizeCheckoutRepository.Create(entity); + // _customizeCheckoutRepository.SaveChanges(); + // return op.Succeeded(); + + + + + //} + + public List<(long Id, string Name)> GetWorkshopEmployeesEligibleForCheckoutInDates(long workshopId, int yearFa, int monthFa) + { + + var startDateFa = $"{yearFa:0000}/{monthFa:00}/01"; + if (startDateFa.TryToGeorgianDateTime(out var startDateGr) == false) + return new(); + + startDateGr.FindFirstDayOfNextMonth(out var endDateGr); + endDateGr = endDateGr.AddDays(-1); + + + if (startDateGr.Date > DateTime.Now.Date) + return new(); + + if (endDateGr.Date > DateTime.Now.Date) + endDateGr = DateTime.Now.Date; + + + List rollCallEmployeeStatus = _rollCallEmployeeStatusRepository.GetActiveByWorkshopIdInDate(workshopId, startDateGr, endDateGr); + + List leftWorks = _leftWorkRepository.GetByWorkshopIdInDates(workshopId, startDateGr, endDateGr); + + rollCallEmployeeStatus = rollCallEmployeeStatus + .Where(x => leftWorks.Any(y => y.EmployeeId == x.EmployeeId && y.StartWorkDateGr.Date <= x.StartDateGr.Date && + y.LeftWorkDateGr.Date > x.EndDateGr.Date)).ToList(); + + var employees = _employeeRepository.SimpleGetRangeByIds(rollCallEmployeeStatus.Select(x => x.EmployeeId)); + return employees; + } + + } +} diff --git a/CompanyManagment.Application/CustomizeWorkshopSettingsApplication.cs b/CompanyManagment.Application/CustomizeWorkshopSettingsApplication.cs index ba9b44e4..8d1a4aca 100644 --- a/CompanyManagment.Application/CustomizeWorkshopSettingsApplication.cs +++ b/CompanyManagment.Application/CustomizeWorkshopSettingsApplication.cs @@ -1,5 +1,7 @@ using _0_Framework.Application; -using _0_Framework.Domain.CustomizeCheckoutValueObjects; +using _0_Framework.Domain.CustomizeCheckoutShared.Base; +using _0_Framework.Domain.CustomizeCheckoutShared.Enums; +using _0_Framework.Domain.CustomizeCheckoutShared.ValueObjects; using AccountManagement.Application.Contracts.Account; using AccountManagement.Application.Contracts.CameraAccount; using Company.Domain.CustomizeWorkshopEmployeeSettingsAgg; @@ -11,12 +13,18 @@ using Company.Domain.CustomizeWorkshopSettingsAgg.Entities; using Company.Domain.EmployeeAgg; using CompanyManagment.App.Contracts.CustomizeWorkshopSettings; using CompanyManagment.App.Contracts.Employee; +using CompanyManagment.App.Contracts.RollCallEmployee; +using CompanyManagment.App.Contracts.Workshop; +using CompanyManagment.EFCore.Migrations; +using Microsoft.EntityFrameworkCore; using System; +using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; -using static Microsoft.EntityFrameworkCore.DbLoggerCategory.Database; -using Version = _0_Framework.Application.Version; +using System.Runtime.CompilerServices; +using System.Runtime.ExceptionServices; +using System.Transactions; namespace CompanyManagment.Application; @@ -24,7 +32,8 @@ namespace CompanyManagment.Application; public class CustomizeWorkshopSettingsApplication(ICustomizeWorkshopSettingsRepository customizeWorkshopSettingsRepository, IAuthHelper authHelper, IPasswordHasher passwordHasher, ICameraAccountApplication cameraAccountApplication, ICustomizeWorkshopGroupSettingsRepository customizeWorkshopGroupSettingsRepository, IEmployeeRepository employeeRepository, - ICustomizeWorkshopEmployeeSettingsRepository customizeWorkshopEmployeeSettingsRepository) + ICustomizeWorkshopEmployeeSettingsRepository customizeWorkshopEmployeeSettingsRepository, + IRollCallEmployeeApplication rollCallEmployeeApplication) : ICustomizeWorkshopSettingsApplication { private readonly ICustomizeWorkshopSettingsRepository _customizeWorkshopSettingsRepository = customizeWorkshopSettingsRepository; @@ -34,111 +43,152 @@ public class CustomizeWorkshopSettingsApplication(ICustomizeWorkshopSettingsRepo private readonly IEmployeeRepository _employeeRepository = employeeRepository; private readonly IPasswordHasher _passwordHasher = passwordHasher; private readonly ICameraAccountApplication _cameraAccountApplication = cameraAccountApplication; + private readonly IRollCallEmployeeApplication _rollCallEmployeeApplication = rollCallEmployeeApplication; + + #region RollCallShifts //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("ساعات کاری شروع و پایان نمیتواند خالی باشد"); - - //تبدیل شیفت های ویو مدل به انتیتی - List shiftCollection = new List(); - - #region Validation - try - { - shiftCollection = - command.ShiftsList.Select(x => - { - var placement = x.Placement switch - { - ShiftPlacement.First => "اول", - ShiftPlacement.Second => "دوم", - ShiftPlacement.Third => "سوم" - }; - if (!TimeOnly.TryParseExact(x.StartTime, "HH:mm", out TimeOnly start)) - throw new InvalidDataException($"فرمت شروع نوبت{placement}نادرست است"); - if (!TimeOnly.TryParseExact(x.EndTime, "HH:mm", out TimeOnly end)) - throw new InvalidDataException($"فرمت پایان نوبت{placement}نادرست است"); + //تبدیل شیفت های ویو مدل به انتیتی + List shiftCollection = new List(); + if (command.WorkshopShiftStatus == WorkshopShiftStatus.Regular) + { + #region Validation + if (command.ShiftsList.Any(x => string.IsNullOrWhiteSpace(x.StartTime) || string.IsNullOrWhiteSpace(x.EndTime))) + return op.Failed("ساعات کاری شروع و پایان نمیتواند خالی باشد"); + try + { + shiftCollection = + command.ShiftsList.Select(x => + { + var placement = x.Placement switch + { + ShiftPlacement.First => "اول", + ShiftPlacement.Second => "دوم", + ShiftPlacement.Third => "سوم" + }; + if (!TimeOnly.TryParseExact(x.StartTime, "HH:mm", out TimeOnly start)) + throw new InvalidDataException($"فرمت شروع نوبت{placement}نادرست است"); + if (!TimeOnly.TryParseExact(x.EndTime, "HH:mm", out TimeOnly end)) + throw new InvalidDataException($"فرمت پایان نوبت{placement}نادرست است"); - return new CustomizeWorkshopSettingsShift(start, end, x.Placement); + return new CustomizeWorkshopSettingsShift(start, end, x.Placement); - }).ToList(); - } - catch (InvalidDataException e) - { + }).ToList(); + } + catch (InvalidDataException e) + { - return op.Failed(e.Message); - } - if (workshopId < 1) - { - return op.Failed("خطای سیستمی"); - } - DateTime day = DateTime.Now; - DateTime previousEnd = new DateTime(); - var finalShiftList = new List<(DateTime start, DateTime end, ShiftPlacement placement)>(); + return op.Failed(e.Message); + } + if (workshopId < 1) + { + return op.Failed("خطای سیستمی"); + } + DateTime day = DateTime.Now; + DateTime previousEnd = new DateTime(); + var finalShiftList = new List<(DateTime start, DateTime end, ShiftPlacement placement)>(); - shiftCollection = shiftCollection.OrderBy(x => x.Placement).ToList(); + shiftCollection = shiftCollection.OrderBy(x => x.Placement).ToList(); - foreach (var shift in shiftCollection) - { - (DateTime start, DateTime end, ShiftPlacement placement) newShift = - new() - { - placement = shift.Placement, - start = new DateTime(DateOnly.FromDateTime(day), shift.StartTime), - end = new DateTime(DateOnly.FromDateTime(day), shift.EndTime) + foreach (var shift in shiftCollection) + { + (DateTime start, DateTime end, ShiftPlacement placement) newShift = + new() + { + placement = shift.Placement, + start = new DateTime(DateOnly.FromDateTime(day), shift.StartTime), + end = new DateTime(DateOnly.FromDateTime(day), shift.EndTime) - }; + }; - if (previousEnd != new DateTime()) - { - if (newShift.start <= previousEnd) - { - newShift.start = newShift.start.AddDays(1); - } - } - while (newShift.start >= newShift.end) - { - newShift.end = newShift.end.AddDays(1); - } - finalShiftList.Add(newShift); - previousEnd = newShift.end; - } + if (previousEnd != new DateTime()) + { + if (newShift.start <= previousEnd) + { + newShift.start = newShift.start.AddDays(1); + } + } + while (newShift.start >= newShift.end) + { + newShift.end = newShift.end.AddDays(1); + } + finalShiftList.Add(newShift); + previousEnd = newShift.end; + } - var firstShiftStart = finalShiftList.FirstOrDefault(x => x.placement == ShiftPlacement.First).start; - var lastShiftEnd = finalShiftList.OrderByDescending(x => x.placement).FirstOrDefault().end; - if (firstShiftStart.AddDays(1) < lastShiftEnd) - return op.Failed("بازه زمانی کارگاه نامعتبر است"); - var total = finalShiftList.Sum(x => (x.end - x.start).TotalHours); - if (total >= 24) - { - return op.Failed("بازه زمانی کارگاه نمیتواند بیشتر از 24 ساعت باشد"); - } + var firstShiftStart = finalShiftList.FirstOrDefault(x => x.placement == ShiftPlacement.First).start; + var lastShiftEnd = finalShiftList.OrderByDescending(x => x.placement).FirstOrDefault().end; + if (firstShiftStart.AddDays(1) < lastShiftEnd) + return op.Failed("بازه زمانی کارگاه نامعتبر است"); + var total = finalShiftList.Sum(x => (x.end - x.start).TotalHours); + if (total >= 24) + { + return op.Failed("بازه زمانی کارگاه نمیتواند بیشتر از 24 ساعت باشد"); + } + #endregion + } + else + { + command.ShiftsList = []; + shiftCollection = []; + } - #endregion + var record = new CustomizeWorkshopSettings(workshopId, shiftCollection, command.LeavePermittedDays, + command.WorkshopShiftStatus); + using (var transaction = new TransactionScope()) + { + try + { + _customizeWorkshopSettingsRepository.Create(record); + _customizeWorkshopSettingsRepository.SaveChanges(); + OperationResult result = new OperationResult(); + + result = command.WorkshopShiftStatus == WorkshopShiftStatus.Regular ? CreateGeneralGroup(record) : result.Succcedded(); + + if (result.IsSuccedded) + { + transaction.Complete(); + } + else + { + op = result; + transaction.Dispose(); + } + } + catch + { + transaction.Dispose(); + // ignored + } + } + + return string.IsNullOrWhiteSpace(op.Message) ? op.Succcedded() : op; - var record = new CustomizeWorkshopSettings(workshopId, shiftCollection, command.LeavePermittedDays); - _customizeWorkshopSettingsRepository.Create(record); - _customizeWorkshopSettingsRepository.SaveChanges(); - return op.Succcedded(record.id); } + //create group settings with workshopSettingsId. public OperationResult CreateGroupSettingsByRollCallWorkshopSettingId(CreateCustomizeWorkshopGroupSettings command) { OperationResult op = new(); + CustomizeWorkshopSettings workshopSettings = + _customizeWorkshopSettingsRepository.Get(command.CustomizeWorkshopSettingId); + List shiftCollection = new List(); #region validation + if (workshopSettings == null) + return op.Failed("خطای سیستمی"); + if (string.IsNullOrWhiteSpace(command.Name)) return op.Failed("لطفا نام گروه را وارد کنید"); @@ -148,29 +198,126 @@ public class CustomizeWorkshopSettingsApplication(ICustomizeWorkshopSettingsRepo if (!_customizeWorkshopSettingsRepository.Exists(x => x.id == command.CustomizeWorkshopSettingId)) return op.Failed("چنین ساعت کاری برای کارگاهی وجود ندارد"); + if (command.WorkshopShiftStatus == WorkshopShiftStatus.Regular) + { + if (command.ShiftViewModel.Any(x => string.IsNullOrWhiteSpace(x.StartTime) || string.IsNullOrWhiteSpace(x.EndTime))) + return op.Failed("ساعات کاری شروع و پایان نمیتواند خالی باشد"); + try + { + shiftCollection = + command.ShiftViewModel.Select(x => + { + var placement = x.Placement switch + { + ShiftPlacement.First => "اول", + ShiftPlacement.Second => "دوم", + ShiftPlacement.Third => "سوم" + }; + if (!TimeOnly.TryParseExact(x.StartTime, "HH:mm", out TimeOnly start)) + throw new InvalidDataException($"فرمت شروع نوبت{placement}نادرست است"); + if (!TimeOnly.TryParseExact(x.EndTime, "HH:mm", out TimeOnly end)) + throw new InvalidDataException($"فرمت پایان نوبت{placement}نادرست است"); + + + return new CustomizeWorkshopGroupSettingsShift(start, end, x.Placement); + + }).ToList(); + } + catch (InvalidDataException e) + { + + return op.Failed(e.Message); + } + DateTime previousEnd = new DateTime(); + var finalShiftList = new List<(DateTime start, DateTime end, ShiftPlacement placement)>(); + + shiftCollection = shiftCollection.OrderBy(x => x.Placement).ToList(); + + foreach (var shift in shiftCollection) + { + (DateTime start, DateTime end, ShiftPlacement placement) newShift = + new() + { + placement = shift.Placement, + start = new DateTime(DateOnly.MinValue, shift.StartTime), + end = new DateTime(DateOnly.MinValue, shift.EndTime) + + + }; + + if (previousEnd != new DateTime()) + { + if (newShift.start <= previousEnd) + { + newShift.start = newShift.start.AddDays(1); + } + } + while (newShift.start >= newShift.end) + { + newShift.end = newShift.end.AddDays(1); + } + finalShiftList.Add(newShift); + previousEnd = newShift.end; + } + //var firstWorkshopTimeShift = workshopSettings.CustomizeWorkshopSettingsShifts.MinBy(x => x.Placement).StartTime; + //var lastWorkshopTimeShift = workshopSettings.CustomizeWorkshopSettingsShifts.MaxBy(x => x.Placement).EndTime; + + //var startDateTime = new DateTime(DateOnly.MinValue, firstWorkshopTimeShift); + //var lastDateTime = new DateTime(DateOnly.MinValue, lastWorkshopTimeShift); + //if (lastDateTime < startDateTime) + //{ + // lastDateTime = lastDateTime.AddDays(1); + //} + + //var lastGroupShift = finalShiftList.MaxBy(x => x.placement).end; + //var firstGroupShift = finalShiftList.MinBy(x => x.placement).start; + //if (lastDateTime < lastGroupShift || firstGroupShift < startDateTime) + //{ + // return op.Failed("ساعت کاری گروه باید بین ساعت کاری کارگاه باشد"); + //} + } + else + { + var irregularShiftStartTime = new DateTime(DateOnly.MinValue, command.IrregularShift.StartTime); + + var irregularShiftEndTime = new DateTime(DateOnly.MinValue, command.IrregularShift.EndTime); + + if (irregularShiftEndTime < irregularShiftStartTime) + { + irregularShiftEndTime = irregularShiftEndTime.AddDays(1); + } + + switch (command.IrregularShift.WorkshopIrregularShifts) + { + case WorkshopIrregularShifts.TwelveThirtySix: + + if ((irregularShiftEndTime - irregularShiftStartTime).TotalHours > 12) + { + return op.Failed("ساعت کاری شما نمیتواند بیشتر از 12 ساعت باشد"); + } + break; + case WorkshopIrregularShifts.TwelveTwentyFour: + if ((irregularShiftEndTime - irregularShiftStartTime).TotalHours > 12) + { + return op.Failed("ساعت کاری شما نمیتواند بیشتر از 12 ساعت باشد"); + } + break; + } + } + #endregion - CustomizeWorkshopSettings workshopSettings = - _customizeWorkshopSettingsRepository.Get(command.CustomizeWorkshopSettingId); + var breakTime = new BreakTime(command.BreakTime.HasBreakTimeValue, command.BreakTime.BreakTimeValue); double salary = command.Salary.MoneyToDouble(); - var collection = - command.ShiftViewModel.Select(x => - { - if (!TimeOnly.TryParseExact(x.StartTime, "HH:mm", out TimeOnly start)) - throw new InvalidDataException(); - if (!TimeOnly.TryParseExact(x.EndTime, "HH:mm", out TimeOnly end)) - throw new InvalidDataException(); - return new CustomizeWorkshopGroupSettingsShift(start, end, x.Placement); - }).ToList(); - - var entity = new CustomizeWorkshopGroupSettings(command.Name, salary, command.CustomizeWorkshopSettingId, collection, workshopSettings.FridayPay, workshopSettings.OverTimePay, + var entity = new CustomizeWorkshopGroupSettings(command.Name, salary, command.CustomizeWorkshopSettingId, shiftCollection, workshopSettings.FridayPay, workshopSettings.OverTimePay, workshopSettings.BaseYearsPay, workshopSettings.BonusesPay, workshopSettings.NightWorkPay, workshopSettings.MarriedAllowance, workshopSettings.ShiftPay, workshopSettings.FamilyAllowance, workshopSettings.LeavePay, workshopSettings.InsuranceDeduction, workshopSettings.FineAbsenceDeduction, - workshopSettings.LateToWork, workshopSettings.EarlyExit, workshopSettings.FridayWork, workshopSettings.HolidayWork); + workshopSettings.LateToWork, workshopSettings.EarlyExit, workshopSettings.FridayWork, + workshopSettings.HolidayWork, breakTime, command.WorkshopShiftStatus, command.IrregularShift); _customizeWorkshopGroupSettingsRepository.Create(entity); @@ -179,24 +326,464 @@ public class CustomizeWorkshopSettingsApplication(ICustomizeWorkshopSettingsRepo } //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) + public OperationResult EditWorkshopSettingShifts(List shiftViewModels, long customizeWorkshopSettingsId, WorkshopShiftStatus workshopShiftStatus) + { + OperationResult op = new OperationResult(); + var entity = _customizeWorkshopSettingsRepository.Get(customizeWorkshopSettingsId); + if (entity == null) + return op.Failed("چنین آیتمی وجود ندارد"); + + //تبدیل شیفت های ویو مدل به انتیتی + List shiftCollection = []; + + #region Validation + if (workshopShiftStatus == WorkshopShiftStatus.Regular) + { + try + { + shiftCollection = + shiftViewModels.Select(x => + { + var placement = x.Placement switch + { + ShiftPlacement.First => "اول", + ShiftPlacement.Second => "دوم", + ShiftPlacement.Third => "سوم", + _ => throw new ArgumentOutOfRangeException() + }; + if (!TimeOnly.TryParseExact(x.StartTime, "HH:mm", out TimeOnly start)) + throw new InvalidDataException($"فرمت شروع نوبت{placement}نادرست است"); + if (!TimeOnly.TryParseExact(x.EndTime, "HH:mm", out TimeOnly end)) + throw new InvalidDataException($"فرمت پایان نوبت{placement}نادرست است"); + + + return new CustomizeWorkshopSettingsShift(start, end, x.Placement); + + }).ToList(); + } + catch (InvalidDataException e) + { + + return op.Failed(e.Message); + } + + DateTime day = DateTime.Now; + DateTime previousEnd = new DateTime(); + var finalShiftList = new List<(DateTime start, DateTime end, ShiftPlacement placement)>(); + + shiftCollection = shiftCollection.OrderBy(x => x.Placement).ToList(); + + foreach (var shift in shiftCollection) + { + (DateTime start, DateTime end, ShiftPlacement placement) newShift = + new() + { + placement = shift.Placement, + start = new DateTime(DateOnly.FromDateTime(day), shift.StartTime), + end = new DateTime(DateOnly.FromDateTime(day), shift.EndTime) + + + }; + + if (previousEnd != new DateTime()) + { + if (newShift.start <= previousEnd) + { + newShift.start = newShift.start.AddDays(1); + } + } + while (newShift.start >= newShift.end) + { + newShift.end = newShift.end.AddDays(1); + } + finalShiftList.Add(newShift); + previousEnd = newShift.end; + } + + var firstShiftStart = finalShiftList.FirstOrDefault(x => x.placement == ShiftPlacement.First).start; + var lastShiftEnd = finalShiftList.OrderByDescending(x => x.placement).FirstOrDefault().end; + if (firstShiftStart.AddDays(1) < lastShiftEnd) + return op.Failed("بازه زمانی کارگاه نامعتبر است"); + var total = finalShiftList.Sum(x => (x.end - x.start).TotalHours); + if (total >= 24) + { + return op.Failed("بازه زمانی کارگاه نمیتواند بیشتر از 24 ساعت باشد"); + } + } + + #endregion + + using var transActionScope = new TransactionScope(); + entity.ChangeWorkshopShifts(shiftCollection, workshopShiftStatus); + + + //op = ChangeAllGroupsShiftsWithEmployees(entity, replaceChangedGroups); + //if (!op.IsSuccedded) + //{ + // return op; + //} + _customizeWorkshopSettingsRepository.SaveChanges(); + + if (!(_customizeWorkshopGroupSettingsRepository.Exists(x => x.CustomizeWorkshopSettingId == entity.id && x.MainGroup)) && entity.WorkshopShiftStatus == WorkshopShiftStatus.Regular) + { + var operationResult = CreateGeneralGroup(entity); + if (!operationResult.IsSuccedded) + return operationResult; + } + transActionScope.Complete(); + return op.Succcedded(); + } + public OperationResult EditSimpleRollCallGroupSetting(EditCustomizeWorkshopGroupSettings 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("چنین پرسنلی وجود ندارد"); + if (string.IsNullOrWhiteSpace(command.Name)) + return op.Failed("لطفا نام گروه را وارد کنید"); + + if (!_customizeWorkshopGroupSettingsRepository.Exists(x => x.id == command.Id)) + 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 = _customizeWorkshopGroupSettingsRepository.GetWithEmployees(command.Id); + + var workshopSettings = _customizeWorkshopSettingsRepository.Get(entity.CustomizeWorkshopSettingId); + + var employeeIds = command.IsShiftChanged ? entity.CustomizeWorkshopEmployeeSettingsCollection + .Select(x => x.id).ToList() : entity.CustomizeWorkshopEmployeeSettingsCollection.Where(x => !x.IsShiftChanged) + .Select(x => x.id).ToList(); + var groupSettingsShifts = new List(); + bool isChanged; + if (command.WorkshopShiftStatus == WorkshopShiftStatus.Regular) { + groupSettingsShifts = command.ShiftViewModel.Select(x => + { + if (!TimeOnly.TryParseExact(x.StartTime, "HH:mm", out TimeOnly start)) + throw new InvalidDataException(); + if (!TimeOnly.TryParseExact(x.EndTime, "HH:mm", out TimeOnly end)) + throw new InvalidDataException(); + + return new CustomizeWorkshopGroupSettingsShift(start, end, x.Placement); + + }).ToList(); + ; + if (groupSettingsShifts.All(x => workshopSettings.CustomizeWorkshopSettingsShifts.Any(y => x.Equals(y))) + && command.WorkshopShiftStatus == workshopSettings.WorkshopShiftStatus && + command.BreakTime == workshopSettings.BreakTime) + { + isChanged = false; + } + else + { + isChanged = true; + } + } + else + { + var irregularShiftStartTime = new DateTime(DateOnly.MinValue, command.IrregularShift.StartTime); + + var irregularShiftEndTime = new DateTime(DateOnly.MinValue, command.IrregularShift.EndTime); + + if (irregularShiftEndTime < irregularShiftStartTime) + { + irregularShiftEndTime = irregularShiftEndTime.AddDays(1); + } + + switch (command.IrregularShift.WorkshopIrregularShifts) + { + case WorkshopIrregularShifts.TwelveThirtySix: + + if ((irregularShiftEndTime - irregularShiftStartTime).TotalHours > 12) + { + return op.Failed("ساعت کاری شما نمیتواند بیشتر از 12 ساعت باشد"); + } + break; + case WorkshopIrregularShifts.TwelveTwentyFour: + if ((irregularShiftEndTime - irregularShiftStartTime).TotalHours > 12) + { + return op.Failed("ساعت کاری شما نمیتواند بیشتر از 12 ساعت باشد"); + } + break; + } + if (command.WorkshopShiftStatus == workshopSettings.WorkshopShiftStatus && command.BreakTime == workshopSettings.BreakTime) + { + isChanged = false; + } + else + { + isChanged = true; + } + } + + var breakTime = new BreakTime(command.BreakTime.HasBreakTimeValue, command.BreakTime.BreakTimeValue); + + entity.EditSimpleAndOverwriteOnEmployee(command.Name, employeeIds, groupSettingsShifts, command.WorkshopShiftStatus, + command.IrregularShift, breakTime, isChanged); + + _customizeWorkshopGroupSettingsRepository.SaveChanges(); + return op.Succcedded(); + } + public OperationResult EditSimpleRollCallEmployeeSetting(EditCustomizeEmployeeSettings command) + { + OperationResult op = new(); + + var entity = _customizeWorkshopEmployeeSettingsRepository.Get(command.Id); + + #region Validation + + if (entity == null) + return op.Failed("چنین پرسنلی وجود ندارد"); + + #endregion + + List employeesShifts = new(); + + if (command.WorkshopShiftStatus == WorkshopShiftStatus.Regular) + { + + #region Validation + if (command.ShiftViewModel.Any(x => string.IsNullOrWhiteSpace(x.StartTime) || string.IsNullOrWhiteSpace(x.EndTime))) + return op.Failed("ساعات کاری شروع و پایان نمیتواند خالی باشد"); + try + { + employeesShifts = + command.ShiftViewModel.Select(x => + { + var placement = x.Placement switch + { + ShiftPlacement.First => "اول", + ShiftPlacement.Second => "دوم", + ShiftPlacement.Third => "سوم" + }; + if (!TimeOnly.TryParseExact(x.StartTime, "HH:mm", out TimeOnly start)) + throw new InvalidDataException($"فرمت شروع نوبت{placement}نادرست است"); + if (!TimeOnly.TryParseExact(x.EndTime, "HH:mm", out TimeOnly end)) + throw new InvalidDataException($"فرمت پایان نوبت{placement}نادرست است"); + + + return new CustomizeWorkshopEmployeeSettingsShift(start, end, x.Placement); + + }).ToList(); + } + catch (InvalidDataException e) + { + + return op.Failed(e.Message); + } + if (command.WorkshopId < 1) + { + return op.Failed("خطای سیستمی"); + } + DateTime day = DateTime.Now; + DateTime previousEnd = new DateTime(); + var finalShiftList = new List<(DateTime start, DateTime end, ShiftPlacement placement)>(); + + employeesShifts = employeesShifts.OrderBy(x => x.Placement).ToList(); + + foreach (var shift in employeesShifts) + { + (DateTime start, DateTime end, ShiftPlacement placement) newShift = + new() + { + placement = shift.Placement, + start = new DateTime(DateOnly.FromDateTime(day), shift.StartTime), + end = new DateTime(DateOnly.FromDateTime(day), shift.EndTime) + + + }; + + if (previousEnd != new DateTime()) + { + if (newShift.start <= previousEnd) + { + newShift.start = newShift.start.AddDays(1); + } + } + while (newShift.start >= newShift.end) + { + newShift.end = newShift.end.AddDays(1); + } + finalShiftList.Add(newShift); + previousEnd = newShift.end; + } + + var firstShiftStart = finalShiftList.FirstOrDefault(x => x.placement == ShiftPlacement.First).start; + var lastShiftEnd = finalShiftList.OrderByDescending(x => x.placement).FirstOrDefault().end; + if (firstShiftStart.AddDays(1) < lastShiftEnd) + return op.Failed("بازه زمانی کارگاه نامعتبر است"); + var total = finalShiftList.Sum(x => (x.end - x.start).TotalHours); + if (total >= 24) + { + return op.Failed("بازه زمانی کارگاه نمیتواند بیشتر از 24 ساعت باشد"); + } + #endregion + } + else + { + var irregularShiftStartTime = new DateTime(DateOnly.MinValue, command.IrregularShift.StartTime); + + var irregularShiftEndTime = new DateTime(DateOnly.MinValue, command.IrregularShift.EndTime); + + if (irregularShiftEndTime < irregularShiftStartTime) + { + irregularShiftEndTime = irregularShiftEndTime.AddDays(1); + } + + switch (command.IrregularShift.WorkshopIrregularShifts) + { + case WorkshopIrregularShifts.TwelveThirtySix: + + if ((irregularShiftEndTime - irregularShiftStartTime).TotalHours > 12) + { + return op.Failed("ساعت کاری شما نمیتواند بیشتر از 12 ساعت باشد"); + } + break; + case WorkshopIrregularShifts.TwelveTwentyFour: + if ((irregularShiftEndTime - irregularShiftStartTime).TotalHours > 12) + { + return op.Failed("ساعت کاری شما نمیتواند بیشتر از 12 ساعت باشد"); + } + break; + } + } + + + entity.SimpleEdit(employeesShifts, command.IrregularShift, command.WorkshopShiftStatus, command.BreakTime, true); + + _customizeWorkshopGroupSettingsRepository.SaveChanges(); + return op.Succcedded(); + } + + //Remove the Employee From the Group Settings + public OperationResult RemoveEmployeeFromRollCallWorkshopGroup(long employeeId, long groupId, long workshopId) + { + OperationResult op = new(); + var groupEntity = _customizeWorkshopGroupSettingsRepository.GetWithEmployees(groupId); + + #region Validation + + if (groupEntity == null) + { + return op.Failed("چنین گروهی وجود ندارد"); + } + + #endregion + + using var transaction = new TransactionScope(); + groupEntity.RemoveEmployeeFromGroup(employeeId); + _customizeWorkshopGroupSettingsRepository.SaveChanges(); + var res = AddEmployeeToMainGroupSettings(workshopId, employeeId); + if (res.IsSuccedded) + { + transaction.Complete(); + return op.Succcedded(); + + } + + return res; + + } + + public OperationResult AddEmployeeToMainGroupSettings(long workshopId, long employeeId) + { + var op = new OperationResult(); + + var mainGroup = _customizeWorkshopGroupSettingsRepository.GetWorkshopMainGroup(workshopId); + + mainGroup.AddEmployeeSettingToGroupWithGroupData(employeeId, workshopId); + + _customizeWorkshopEmployeeSettingsRepository.SaveChanges(); + + return op.Succcedded(); + } + + #endregion + + #region CustomizeCheckoutSettings + public OperationResult CreateEmployeeSettings(CreateCustomizeEmployeeSettings command) + { + OperationResult op = new(); + CustomizeWorkshopGroupSettings mainGroup = new CustomizeWorkshopGroupSettings(); + + #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); + if (groupData == null) + return op.Failed("خطای سیستمی"); + var workshopSettings = _customizeWorkshopSettingsRepository.Get(groupData.CustomizeWorkshopSettingId); + var employeesInMainGroup = new List(); + + mainGroup = _customizeWorkshopGroupSettingsRepository.GetWorkshopMainGroup(command.WorkshopId); + + if (workshopSettings.WorkshopShiftStatus == WorkshopShiftStatus.Regular) + { + if (mainGroup != null) + { + + employeesInMainGroup = _customizeWorkshopEmployeeSettingsRepository.GetBy(mainGroup.id); + if (_customizeWorkshopEmployeeSettingsRepository.Exists(x => x.WorkshopId == command.WorkshopId + && command.EmployeeIds.Contains(x.EmployeeId) && x.CustomizeWorkshopGroupSettingId != mainGroup.id)) + { + return op.Failed("این پرسنل در گروه دیگری وجود دارد"); + } + } + else + { + if (_customizeWorkshopEmployeeSettingsRepository.Exists(x => x.WorkshopId == command.WorkshopId + && command.EmployeeIds.Contains(x.EmployeeId))) + { + return op.Failed("این پرسنل در گروه دیگری وجود دارد"); + } + } + } + else + { + if (mainGroup != null) + { + employeesInMainGroup = _customizeWorkshopEmployeeSettingsRepository.GetBy(mainGroup.id); + if (_customizeWorkshopEmployeeSettingsRepository.Exists(x => x.WorkshopId == command.WorkshopId + && command.EmployeeIds.Contains( + x.EmployeeId) && + x.CustomizeWorkshopGroupSettingId != + mainGroup.id)) + { + return op.Failed("این پرسنل در گروه دیگری وجود دارد"); + } + } + else + { + if (_customizeWorkshopEmployeeSettingsRepository.Exists(x => x.WorkshopId == command.WorkshopId + && command.EmployeeIds.Contains(x.EmployeeId))) + { + return op.Failed("این پرسنل در گروه دیگری وجود دارد"); + } + } + } + + + + var shifts = groupData.CustomizeWorkshopGroupSettingsShifts + .Select(x => new CustomizeWorkshopEmployeeSettingsShift(x.StartTime, x.EndTime, x.Placement)).ToList(); + + + foreach (var id in command.EmployeeIds) + { + var employeeSettings = employeesInMainGroup.FirstOrDefault(x => x.EmployeeId == id); + if (employeeSettings != null) + { + _customizeWorkshopEmployeeSettingsRepository.Remove(employeeSettings.id); + } var entity = new CustomizeWorkshopEmployeeSettings( new(groupData.FridayPay.FridayPayType, groupData.FridayPay.Value), new(groupData.OverTimePay.OverTimePayType, groupData.OverTimePay.Value), @@ -216,22 +803,31 @@ public class CustomizeWorkshopSettingsApplication(ICustomizeWorkshopSettingsRepo .ToList(), groupData.LateToWork.Value), new(groupData.EarlyExit.EarlyExitType, groupData.EarlyExit.EarlyExitTimeFines.Select(x => new EarlyExitTimeFine(x.Minute, x.FineMoney)) - .ToList(), groupData.EarlyExit.Value), id, - groupData.CustomizeWorkshopSettings.WorkshopId, groupData.Salary, groupData.id, + .ToList(), groupData.EarlyExit.Value), + id, + groupData.CustomizeWorkshopSettings.WorkshopId, + groupData.Salary, + groupData.id, shifts.Select(x => new CustomizeWorkshopEmployeeSettingsShift(x.StartTime, x.EndTime, x.Placement)) - .ToList()); + .ToList(), + groupData.FridayWork, + groupData.HolidayWork, + groupData.IrregularShift, + groupData.WorkshopShiftStatus, + new(groupData.BreakTime.HasBreakTimeValue, groupData.BreakTime.BreakTimeValue) + ); - _customizeWorkshopEmployeeSettingsRepository.Create(entity); + _customizeWorkshopEmployeeSettingsRepository.Create(entity); - } + } _customizeWorkshopEmployeeSettingsRepository.SaveChanges(); return op.Succcedded(); - } + } //Edit the Workshop Settings Data - public OperationResult EditWorkshopSetting(EditCustomizeWorkshopSettings command) + public OperationResult EditWorkshopSetting(EditCustomizeWorkshopSettings command, bool replaceInAllGroups) { OperationResult op = new(); @@ -244,6 +840,9 @@ public class CustomizeWorkshopSettingsApplication(ICustomizeWorkshopSettingsRepo var entity = _customizeWorkshopSettingsRepository.Get(command.Id); + if (entity == null) + return op.Failed("چنین آیتمی وجود ندارد"); + FridayPay fridayPay = new(command.FridayPay.FridayPayType, command.FridayPay.Value); OverTimePay overTimePay = new(command.OverTimePay.OverTimePayType, command.OverTimePay.Value); @@ -271,26 +870,61 @@ public class CustomizeWorkshopSettingsApplication(ICustomizeWorkshopSettingsRepo command.EarlyExit.EarlyExitTimeFinesViewModels?.Select(x => new EarlyExitTimeFine(x.Minute, x.FineMoney)).ToList() ?? new List() , command.EarlyExit.Value); - var shifts = - command.ShiftsList.Select(x => + + var groups = _customizeWorkshopGroupSettingsRepository.GetAllGroupsIncludeEmployeeSettingsByWorkshopSettingsId(entity.id); + + using (var transaction = new TransactionScope()) + { + + try { - if (!TimeOnly.TryParseExact(x.StartTime, "HH:mm", out TimeOnly start)) - throw new InvalidDataException(); - if (!TimeOnly.TryParseExact(x.EndTime, "HH:mm", out TimeOnly end)) - throw new InvalidDataException(); + entity.Edit(fridayPay, overTimePay, baseYearsPay, bonusesPay, nightWorkPay, marriedAllowance, shiftPay, + familyAllowance, leavePay, insuranceDeduction, + fineAbsenceDeduction, lateToWork, earlyExit, command.FridayWork, command.HolidayWork, + command.BonusesPaysInEndOfMonth, command.LeavePermittedDays, command.BaseYearsPayInEndOfYear, + command.OverTimeThresholdMinute); - return new CustomizeWorkshopSettingsShift(start, end, x.Placement); + _customizeWorkshopSettingsRepository.SaveChanges(); + var editViewModel = new EditCustomizeWorkshopGroupSettings() + { - }).ToList(); + }; + OperationResult result = new OperationResult(); + if (entity.WorkshopShiftStatus == WorkshopShiftStatus.Regular) + { + //foreach (var group in groups) + //{ + // var employeeIds = group.CustomizeWorkshopEmployeeSettingsCollection.Select(x => x.EmployeeId) + // .ToList(); + // group.EditAndOverwriteOnEmployees(group.GroupName,group.Salary,employeeIds,group.FridayPay,group.OverTimePay,group.BaseYearsPay,group.BonusesPay, + // group.ShiftPay,group.NightWorkPay,group.MarriedAllowance,group.FamilyAllowance,group.LeavePay,group.InsuranceDeduction, + // group.FineAbsenceDeduction,); + //} + } + else + { + result = result.Succcedded(); + } - entity.Edit(fridayPay, overTimePay, baseYearsPay, bonusesPay, nightWorkPay, marriedAllowance, shiftPay, familyAllowance, leavePay, insuranceDeduction, - fineAbsenceDeduction, lateToWork, earlyExit, shifts, command.FridayWork, command.HolidayWork, command.BonusesPaysInEndOfMonth, command.LeavePermittedDays, command.BaseYearsPayInEndOfYear,command.OverTimeThresholdMinute); + ChangeAllSettingsGroups(entity, replaceInAllGroups); - _customizeWorkshopSettingsRepository.SaveChanges(); + result.Succcedded(); - return op.Succcedded(); + + transaction.Complete(); + + } + catch + { + // ignored + } + } + + return string.IsNullOrWhiteSpace(op.Message) ? op.Succcedded() : op; } + + //Edit the Group Settings Data public OperationResult EditRollCallGroupSetting(EditCustomizeWorkshopGroupSettings command) { @@ -339,20 +973,24 @@ public class CustomizeWorkshopSettingsApplication(ICustomizeWorkshopSettingsRepo double salary = command.Salary.MoneyToDouble(); - var employeesShifts = - command.ShiftViewModel.Select(x => - { - if (!TimeOnly.TryParseExact(x.StartTime, "HH:mm", out TimeOnly start)) - throw new InvalidDataException(); - if (!TimeOnly.TryParseExact(x.EndTime, "HH:mm", out TimeOnly end)) - throw new InvalidDataException(); - return new CustomizeWorkshopGroupSettingsShift(start, end, x.Placement); - - }).ToList(); + bool isChanged; + if (fridayPay == entity.FridayPay && overTimePay == entity.OverTimePay && baseYearsPay == entity.BaseYearsPay && bonusesPay == entity.BonusesPay + && shiftPay == entity.ShiftPay && nightWorkPay == entity.NightWorkPay && marriedAllowance == entity.MarriedAllowance + && familyAllowance == entity.FamilyAllowance && leavePay == entity.LeavePay && insuranceDeduction == entity.InsuranceDeduction + && fineAbsenceDeduction == entity.FineAbsenceDeduction && lateToWork == entity.LateToWork && earlyExit == entity.EarlyExit && command.FridayWork == entity.FridayWork + && command.HolidayWork == entity.HolidayWork && command.IrregularShift == entity.IrregularShift && command.WorkshopShiftStatus == entity.WorkshopShiftStatus) + { + isChanged = false; + } + else + { + isChanged = true; + } entity.EditAndOverwriteOnEmployees(command.Name, salary, command.EmployeeIds, fridayPay, overTimePay, baseYearsPay, bonusesPay, shiftPay, nightWorkPay, marriedAllowance, familyAllowance, - leavePay, insuranceDeduction, fineAbsenceDeduction, lateToWork, earlyExit, employeesShifts, command.FridayWork, command.HolidayWork); + leavePay, insuranceDeduction, fineAbsenceDeduction, lateToWork, earlyExit, + command.FridayWork, command.HolidayWork, isChanged); _customizeWorkshopGroupSettingsRepository.SaveChanges(); @@ -412,133 +1050,54 @@ public class CustomizeWorkshopSettingsApplication(ICustomizeWorkshopSettingsRepo }).ToList(); + bool isChanged; + if (fridayPay == entity.FridayPay && overTimePay == entity.OverTimePay && baseYearsPay == entity.BaseYearsPay && bonusesPay == entity.BonusesPay + && shiftPay == entity.ShiftPay && nightWorkPay == entity.NightWorkPay && marriedAllowance == entity.MarriedAllowance + && familyAllowance == entity.FamilyAllowance && leavePay == entity.LeavePay && insuranceDeduction == entity.InsuranceDeduction + && fineAbsenceDeduction == entity.FineAbsenceDeduction && lateToWork == entity.LateToWork && earlyExit == entity.EarlyExit && command.FridayWork == entity.FridayWork + && command.HolidayWork == entity.HolidayWork && command.IrregularShift == entity.IrregularShift && command.WorkshopShiftStatus == entity.WorkshopShiftStatus) + { + isChanged = false; + } + else + { + isChanged = true; + } + //change employee data manually. It changes the 'IsChanged' property to true. - entity.EditEmployeesAndMakeIsChangeTrue(employeesShifts, salary, fridayPay, overTimePay, baseYearsPay, + entity.EditEmployees(salary, fridayPay, overTimePay, baseYearsPay, bonusesPay, nightWorkPay, marriedAllowance, shiftPay, familyAllowance, leavePay, - insuranceDeduction, fineAbsenceDeduction, lateToWork, earlyExit, command.FridayWork, command.HolidayWork); + insuranceDeduction, fineAbsenceDeduction, lateToWork, earlyExit, command.FridayWork, command.HolidayWork, command.IrregularShift, + command.WorkshopShiftStatus, isChanged); _customizeWorkshopEmployeeSettingsRepository.SaveChanges(); return op.Succcedded(); } + public OperationResult RemoveGroupSettings(long groupSettingsId) + { + OperationResult op = new OperationResult(); + var entity = _customizeWorkshopGroupSettingsRepository.GetWithEmployees(groupSettingsId); + if (entity.CustomizeWorkshopEmployeeSettingsCollection.Any()) + return op.Failed("نمیتونید گروهی که پرسنل در آن وجود دارد را حذف کنید"); + + _customizeWorkshopGroupSettingsRepository.Remove(entity.id); + return op.Succcedded(); + } + #endregion + + #region Queries + public List GetChangedEmployeeSettingsByGroupSettingsId(long groupSettingsId) { - return _customizeWorkshopGroupSettingsRepository.GetChangedEmployeeSettingsByGroupSettingsId( + return _customizeWorkshopGroupSettingsRepository.GetShiftChangedEmployeeSettingsByGroupSettingsId( 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(); - } - - public OperationResult EditWorkshopSettingShifts(List shiftViewModels, long customizeWorkshopSettingsId) - { - OperationResult op = new OperationResult(); - var entity = _customizeWorkshopSettingsRepository.Get(customizeWorkshopSettingsId); - if (entity == null) - return op.Failed("چنین آیتمی وجود ندارد"); - - //تبدیل شیفت های ویو مدل به انتیتی - List shiftCollection = new List(); - - #region Validation - try - { - shiftCollection = - shiftViewModels.Select(x => - { - var placement = x.Placement switch - { - ShiftPlacement.First => "اول", - ShiftPlacement.Second => "دوم", - ShiftPlacement.Third => "سوم", - _ => throw new ArgumentOutOfRangeException() - }; - if (!TimeOnly.TryParseExact(x.StartTime, "HH:mm", out TimeOnly start)) - throw new InvalidDataException($"فرمت شروع نوبت{placement}نادرست است"); - if (!TimeOnly.TryParseExact(x.EndTime, "HH:mm", out TimeOnly end)) - throw new InvalidDataException($"فرمت پایان نوبت{placement}نادرست است"); - - - return new CustomizeWorkshopSettingsShift(start, end, x.Placement); - - }).ToList(); - } - catch (InvalidDataException e) - { - - return op.Failed(e.Message); - } - - DateTime day = DateTime.Now; - DateTime previousEnd = new DateTime(); - var finalShiftList = new List<(DateTime start, DateTime end, ShiftPlacement placement)>(); - - shiftCollection = shiftCollection.OrderBy(x => x.Placement).ToList(); - - foreach (var shift in shiftCollection) - { - (DateTime start, DateTime end, ShiftPlacement placement) newShift = - new() - { - placement = shift.Placement, - start = new DateTime(DateOnly.FromDateTime(day), shift.StartTime), - end = new DateTime(DateOnly.FromDateTime(day), shift.EndTime) - - - }; - - if (previousEnd != new DateTime()) - { - if (newShift.start <= previousEnd) - { - newShift.start = newShift.start.AddDays(1); - } - } - while (newShift.start >= newShift.end) - { - newShift.end = newShift.end.AddDays(1); - } - finalShiftList.Add(newShift); - previousEnd = newShift.end; - } - - var firstShiftStart = finalShiftList.FirstOrDefault(x => x.placement == ShiftPlacement.First).start; - var lastShiftEnd = finalShiftList.OrderByDescending(x=>x.placement).FirstOrDefault().end; - if (firstShiftStart.AddDays(1) < lastShiftEnd) - return op.Failed("بازه زمانی کارگاه نامعتبر است"); - var total = finalShiftList.Sum(x => (x.end - x.start).TotalHours); - if (total >= 24) - { - return op.Failed("بازه زمانی کارگاه نمیتواند بیشتر از 24 ساعت باشد"); - } - #endregion - - entity.ChangeWorkshopShifts(shiftCollection); - _customizeWorkshopSettingsRepository.SaveChanges(); - return op.Succcedded(); - } - // It will Get the Workshop Settings with its groups and the employees of groups. - public CustomizeWorkshopSettingsViewModel GetWorkshopSettingsByWorkshopId(long workshopId) + public CustomizeWorkshopSettingsViewModel GetWorkshopSettingsByWorkshopId(long workshopId, AuthViewModel auth) { @@ -549,7 +1108,7 @@ public class CustomizeWorkshopSettingsApplication(ICustomizeWorkshopSettingsRepo #endregion - var record = _customizeWorkshopSettingsRepository.GetWorkshopSettingsByWorkshopId(workshopId); + var record = _customizeWorkshopSettingsRepository.GetWorkshopSettingsByWorkshopId(workshopId, auth); return record; } @@ -566,10 +1125,14 @@ public class CustomizeWorkshopSettingsApplication(ICustomizeWorkshopSettingsRepo { EmployeeId = entity.EmployeeId, Id = entity.id, - IsChanged = entity.IsChanged, + IsSettingChanged = entity.IsSettingChanged, + IsShiftChanged = entity.IsShiftChanged, Name = entity.CustomizeWorkshopGroupSettings.GroupName, EmployeeFullName = employeeFullName, Salary = entity.Salary, + BreakTime = entity.BreakTime, + WorkshopShiftStatus = entity.WorkshopShiftStatus, + IrregularShift = entity.IrregularShift, RollCallWorkshopShifts = entity.CustomizeWorkshopEmployeeSettingsShifts.Select(x => new CustomizeWorkshopShiftViewModel() { @@ -603,6 +1166,12 @@ public class CustomizeWorkshopSettingsApplication(ICustomizeWorkshopSettingsRepo { return _customizeWorkshopSettingsRepository.GetEmployeeSettingsByWorkshopIdGroupSettingsId(workshopId, employeeId); } + + public CustomizeWorkshopSettingsViewModel GetWorkshopSettingsByWorkshopIdForAdmin(long workshopId) + { + return _customizeWorkshopSettingsRepository.GetWorkshopSettingsByWorkshopIdForAdmin(workshopId); + + } public EditCustomizeWorkshopSettings GetWorkshopSettingsDetails(long workshopId) { return _customizeWorkshopSettingsRepository.GetWorkshopSettingsDetails(workshopId); @@ -615,103 +1184,119 @@ public class CustomizeWorkshopSettingsApplication(ICustomizeWorkshopSettingsRepo public EditCustomizeWorkshopSettings GetSimpleWorkshopSettings(long workshopId) { - return _customizeWorkshopSettingsRepository.GetSimpleWorkshopSettings(workshopId); - } + return _customizeWorkshopSettingsRepository.GetSimpleWorkshopSettings(workshopId); + } public EditCustomizeEmployeeSettings GetCustomizeEmployeeSettingsDetails(long customizeEmployeeId) { return _customizeWorkshopEmployeeSettingsRepository.GetCustomizeEmployeeSettingsDetails(customizeEmployeeId); } - public OperationResult EditSimpleRollCallGroupSetting(EditCustomizeWorkshopGroupSettings command) + public List GetShiftChangesGroupAndEmployees(long customizeWorkshopSettingsId) { - OperationResult op = new(); + return _customizeWorkshopSettingsRepository.GetShiftChangesGroupAndEmployees(customizeWorkshopSettingsId); + } - #region Validation + public List GetEmployeeSettingsByWorkshopId(long workshopId) + { + return _customizeWorkshopEmployeeSettingsRepository.GetEmployeeSettingsByWorkshopId(workshopId); + } - if (string.IsNullOrWhiteSpace(command.Name)) - return op.Failed("لطفا نام گروه را وارد کنید"); + private OperationResult CreateGeneralGroup(CustomizeWorkshopSettings entity) + { + var op = new OperationResult(); - if (string.IsNullOrWhiteSpace(command.Salary)) - return op.Failed("لطفا حقوق مورد نظر خود را وارد کنید"); + if (_customizeWorkshopGroupSettingsRepository.Exists(x => x.CustomizeWorkshopSettingId == entity.id && x.MainGroup)) + { + return op.Succcedded(); + } - if (!_customizeWorkshopGroupSettingsRepository.Exists(x => x.id == command.Id)) - return op.Failed("چنین ساعت کاری برای گروه وجود ندارد"); + try + { + var shifts = + entity.CustomizeWorkshopSettingsShifts.Select(x => + new CustomizeWorkshopGroupSettingsShift(x.StartTime, x.EndTime, x.Placement)).ToList(); + var irregularShift = new IrregularShift(new TimeOnly(), new TimeOnly(), WorkshopIrregularShifts.None); - #endregion + var customizeWorkshopGroupSettings = new CustomizeWorkshopGroupSettings().CreateMainGroup(entity.FridayPay, entity.OverTimePay, + entity.BaseYearsPay, entity.BonusesPay, entity.ShiftPay, entity.NightWorkPay, entity.MarriedAllowance, + entity.FamilyAllowance, entity.LeavePay, entity.InsuranceDeduction, entity.FineAbsenceDeduction, + entity.LateToWork, entity.EarlyExit, shifts, entity.FridayWork, entity.HolidayWork, + irregularShift, entity.WorkshopShiftStatus, entity.id,new BreakTime(false,new TimeOnly())); + _customizeWorkshopGroupSettingsRepository.Create(customizeWorkshopGroupSettings); - var entity = _customizeWorkshopGroupSettingsRepository.GetWithEmployees(command.Id); - var employeeIds = command.ChangeSettingEmployeeIsChange ? entity.CustomizeWorkshopEmployeeSettingsCollection.Select(x => x.id).ToList() : entity.CustomizeWorkshopEmployeeSettingsCollection.Where(x => !x.IsChanged).Select(x => x.id).ToList(); + _customizeWorkshopGroupSettingsRepository.SaveChanges(); - double salary = command.Salary.MoneyToDouble(); + var employeesHasSettings = _customizeWorkshopEmployeeSettingsRepository + .GetEmployeeSettingNotInMainGroup(entity.WorkshopId).Select(x => x.EmployeeId); - var employeesShifts = - command.ShiftViewModel.Select(x => + var rollCallEmployeeViewModels = _rollCallEmployeeApplication.GetByWorkshopId(entity.WorkshopId).Where(x => !employeesHasSettings.Contains(x.EmployeeId)); + + foreach (var rollCallEmployeeViewModel in rollCallEmployeeViewModels) { - if (!TimeOnly.TryParseExact(x.StartTime, "HH:mm", out TimeOnly start)) - throw new InvalidDataException(); - if (!TimeOnly.TryParseExact(x.EndTime, "HH:mm", out TimeOnly end)) - throw new InvalidDataException(); + customizeWorkshopGroupSettings.AddEmployeeSettingToGroupWithGroupData( + rollCallEmployeeViewModel.EmployeeId, entity.WorkshopId); + } + _customizeWorkshopGroupSettingsRepository.SaveChanges(); + return op.Succcedded(); + } + catch (Exception e) + { + return op.Failed(e.Message); + } - return new CustomizeWorkshopGroupSettingsShift(start, end, x.Placement); - }).ToList(); + } - entity.EditSimpleAndOverwriteOnEmployee(command.Name, salary, employeeIds, employeesShifts); + private OperationResult ChangeAllGroupsShiftsWithEmployees(CustomizeWorkshopSettings entity, bool replaceChangedGroups) + { + var op = new OperationResult(); + var groupSettings = _customizeWorkshopGroupSettingsRepository.GetAllGroupsIncludeEmployeeSettingsByWorkshopSettingsId(entity.id); + if (!replaceChangedGroups) + { + groupSettings = groupSettings.Where(x => !x.IsShiftChange).ToList(); + } + + var groupShifts = entity.CustomizeWorkshopSettingsShifts + .Select(x => new CustomizeWorkshopGroupSettingsShift(x.StartTime, x.EndTime, x.Placement)).ToList(); + + var irregularShift = new IrregularShift(new TimeOnly(), new TimeOnly(), WorkshopIrregularShifts.None); + foreach (var customizeWorkshopGroupSettings in groupSettings) + { + customizeWorkshopGroupSettings.EditSimpleAndOverwriteOnAllEmployees(customizeWorkshopGroupSettings.GroupName, + groupShifts, WorkshopShiftStatus.Regular, irregularShift, new BreakTime(false, new TimeOnly()), false); + } _customizeWorkshopGroupSettingsRepository.SaveChanges(); return op.Succcedded(); } - - #region Vafa - - public OperationResult EditSimpleRollCallEmployeeGroupSetting(EditCustomizeEmployeeSettings command) + private void ChangeAllSettingsGroups(CustomizeWorkshopSettings customizeWorkshopSettings, bool replaceInAllGroups) { - OperationResult op = new(); + var op = new OperationResult(); + var groupSettings = _customizeWorkshopGroupSettingsRepository.GetAllGroupsIncludeEmployeeSettingsByWorkshopSettingsId(customizeWorkshopSettings.id); - var entity = _customizeWorkshopEmployeeSettingsRepository.Get(command.Id); + if (!replaceInAllGroups) + { + groupSettings = groupSettings.Where(x => !x.IsSettingChange).ToList(); + } - #region Validation - if (entity == null) - return op.Failed("چنین پرسنلی وجود ندارد"); - if (string.IsNullOrWhiteSpace(command.Salary)) - return op.Failed("لطفا حقوق مورد نظر خود را وارد کنید"); - - #endregion - - double salary = command.Salary.MoneyToDouble(); - - var employeesShifts = - command.ShiftViewModel.Select(x => - { - if (!TimeOnly.TryParseExact(x.StartTime, "HH:mm", out TimeOnly start)) - throw new InvalidDataException(); - if (!TimeOnly.TryParseExact(x.EndTime, "HH:mm", out TimeOnly end)) - throw new InvalidDataException(); - - return new CustomizeWorkshopEmployeeSettingsShift(start, end, x.Placement); - - }).ToList(); - - entity.SimpleEditEmployeesAndMakeIsChangeTrue(employeesShifts, salary); - - _customizeWorkshopGroupSettingsRepository.SaveChanges(); - return op.Succcedded(); + foreach (var groupSetting in groupSettings) + { + groupSetting.EditAndOverwriteOnAllEmployees(groupSetting.GroupName, groupSetting.Salary, + customizeWorkshopSettings.FridayPay, + customizeWorkshopSettings.OverTimePay, customizeWorkshopSettings.BaseYearsPay, + customizeWorkshopSettings.BonusesPay, customizeWorkshopSettings.ShiftPay, + customizeWorkshopSettings.NightWorkPay, customizeWorkshopSettings.MarriedAllowance, + customizeWorkshopSettings.FamilyAllowance, customizeWorkshopSettings.LeavePay, + customizeWorkshopSettings.InsuranceDeduction, customizeWorkshopSettings.FineAbsenceDeduction, + customizeWorkshopSettings.LateToWork, customizeWorkshopSettings.EarlyExit, + customizeWorkshopSettings.FridayWork, customizeWorkshopSettings.HolidayWork, replaceInAllGroups); + } + _customizeWorkshopSettingsRepository.SaveChanges(); } #endregion - - public OperationResult RemoveGroupSettings(long groupSettingsId) - { - OperationResult op = new OperationResult(); - var entity = _customizeWorkshopGroupSettingsRepository.GetWithEmployees(groupSettingsId); - if (!entity.CustomizeWorkshopEmployeeSettingsCollection.Any()) - return op.Failed("نمیتونید گروهی که پرسنل در آن وجود ارد را حذف کنید"); - - _customizeWorkshopGroupSettingsRepository.Remove(entity.id); - return op.Succcedded(); - } } \ No newline at end of file diff --git a/CompanyManagment.Application/EmployeeAplication.cs b/CompanyManagment.Application/EmployeeAplication.cs index 9cad20ec..034df39d 100644 --- a/CompanyManagment.Application/EmployeeAplication.cs +++ b/CompanyManagment.Application/EmployeeAplication.cs @@ -849,4 +849,57 @@ public class EmployeeAplication : RepositoryBase, IEmployeeAppli return res; } #endregion + + + #region Pooya + + public EmployeeViewModel GetEmployeeByNationalCodeIfHasActiveLeftWork(string nationalCode, List workshopIds) + { + if (nationalCode.NationalCodeValid() != "valid") + return new(); + var workshopEmployeesWithLeftWork = _EmployeeRepository.GetWorkingEmployeesByWorkshopIdsAndNationalCodeAndDate(workshopIds, nationalCode, DateTime.Now.Date); + return workshopEmployeesWithLeftWork.FirstOrDefault(); + } + + public List GetWorkingEmployeesByWorkshopId(long workshopId) + { + return _EmployeeRepository.GetWorkingEmployeesByWorkshopId(workshopId); + + } + + public List GetRangeByIds(IEnumerable employeeIds) + { + return _EmployeeRepository.GetRangeByIds(employeeIds).Select(x => new EmployeeViewModel + { + Id = x.id, + FName = x.FName, + LName = x.LName, + Gender = x.Gender, + NationalCode = x.NationalCode, + IdNumber = x.IdNumber, + Nationality = x.Nationality, + FatherName = x.FatherName, + DateOfBirth = x.DateOfBirth.ToFarsi(), + DateOfIssue = x.DateOfIssue.ToFarsi(), + PlaceOfIssue = x.PlaceOfIssue, + Phone = x.Phone, + Address = x.Address, + State = x.State, + City = x.City, + MaritalStatus = x.MaritalStatus, + MilitaryService = x.MilitaryService, + LevelOfEducation = x.LevelOfEducation, + FieldOfStudy = x.FieldOfStudy, + BankCardNumber = x.BankCardNumber, + BankBranch = x.BankBranch, + InsuranceCode = x.InsuranceCode, + InsuranceHistoryByYear = x.InsuranceHistoryByYear, + InsuranceHistoryByMonth = x.InsuranceHistoryByMonth, + NumberOfChildren = x.NumberOfChildren, + OfficePhone = x.OfficePhone, + EmployeeFullName = x.FName + " " + x.LName + }).ToList(); + } + + #endregion } \ No newline at end of file diff --git a/CompanyManagment.Application/FineApplication.cs b/CompanyManagment.Application/FineApplication.cs index a9395480..274b5c0f 100644 --- a/CompanyManagment.Application/FineApplication.cs +++ b/CompanyManagment.Application/FineApplication.cs @@ -2,11 +2,14 @@ using System.Collections.Generic; using System.Linq; using _0_Framework.Application; +using Company.Domain.CheckoutAgg; +using Company.Domain.CustomizeCheckoutAgg; using Company.Domain.EmployeeAgg; using Company.Domain.File1; using Company.Domain.FineAgg; using Company.Domain.WorkshopAgg; using CompanyManagment.App.Contracts.Fine; +using static Microsoft.EntityFrameworkCore.DbLoggerCategory.Database; namespace CompanyManagment.Application; @@ -15,15 +18,17 @@ public class FineApplication : IFineApplication private readonly IFineRepository _fineRepository; private readonly IWorkshopRepository _workshopRepository; private readonly IEmployeeRepository _employeeRepository; + private readonly ICustomizeCheckoutRepository _customizeCheckoutRepository; - public FineApplication(IFineRepository fineRepository, IEmployeeRepository employeeRepository, IWorkshopRepository workshopRepository) + public FineApplication(IFineRepository fineRepository, IEmployeeRepository employeeRepository, IWorkshopRepository workshopRepository, ICustomizeCheckoutRepository customizeCheckoutRepository) { _fineRepository = fineRepository; _employeeRepository = employeeRepository; _workshopRepository = workshopRepository; - } + _customizeCheckoutRepository = customizeCheckoutRepository; + } - public List GetSearchList(FineSearchViewModel searchModel) + public List GetSearchList(FineSearchViewModel searchModel) { return _fineRepository.GetSearchList(searchModel); } @@ -33,6 +38,38 @@ public class FineApplication : IFineApplication return _fineRepository.GetDetails(id); } + public OperationResult Remove(long id) + { + OperationResult op = new OperationResult(); + var entity = _fineRepository.Get(id); + if (entity == null) + return op.Failed("چنین آیتمی وجود ندارد"); + + var month = Convert.ToInt32(entity.FineDate.ToFarsi().Substring(5, 2)); + var year = Convert.ToInt32(entity.FineDate.ToFarsi().Substring(0, 4)); + + + + if (_customizeCheckoutRepository.Exists(x => x.WorkshopId == entity.WorkshopId && entity.EmployeeId==x.EmployeeId && x.YearInt == year && x.MonthInt == month)) + { + return op.Failed("این پرسنل در این تاریخ دارای فیش حقوقی است"); + } + + + _fineRepository.Remove(entity); + _fineRepository.SaveChanges(); + return op.Succcedded(); + } + + public OperationResult RemoveRange(List ids) + { + OperationResult op = new OperationResult(); + var fines = _fineRepository.GetBy(ids); + _fineRepository.RemoveRange(fines); + _fineRepository.SaveChanges(); + return op.Succcedded(); + } + public OperationResult Create(CreateFineViewModel command) { OperationResult op = new(); @@ -41,11 +78,35 @@ public class FineApplication : IFineApplication if (!_workshopRepository.Exists(x => x.id == command.WorkshopId)) return op.Failed("خطای سیستمی"); - if (!_employeeRepository.Exists(x => command.EmployeeIds.Any(a=>a==x.id))) + if (!_employeeRepository.Exists(x => command.EmployeeIds.Any(a => a == x.id))) return op.Failed("خطای سیستمی"); - #endregion - DateTime date = command.FineDate.ToGeorgianDateTime(); + if (!command.FineDate.TryToGeorgianDateTime(out var fineDate)) + { + return op.Failed("تاریخ وارد شده نامعتبر است"); + } + if (fineDate > DateTime.Now) + { + return op.Failed("تاریخ پرداخت جریمه می بایست تاریخ امروز یا قبل تر باشد"); + + } + if (command.Amount.Length > 15) + { + return op.Failed("مبلغ وارد شده معتبر نیست"); + } + var month = Convert.ToInt32(command.FineDate.Substring(5, 2)); + var year = Convert.ToInt32(command.FineDate.Substring(0, 4)); + + + + if (_customizeCheckoutRepository.Exists(x=>x.WorkshopId ==command.WorkshopId && command.EmployeeIds.Contains(x.EmployeeId) && x.YearInt==year && x.MonthInt == month)) + { + return op.Failed("شما نمیتوانید برای پرسنلی در تاریخی که برای فیش حقوقی صادر شده است جریمه ای دهید"); + + } + + #endregion + DateTime date = command.FineDate.ToGeorgianDateTime(); foreach (var employeeId in command.EmployeeIds) { @@ -64,11 +125,43 @@ public class FineApplication : IFineApplication var entity = _fineRepository.Get(command.Id); if (entity == null) return op.Failed("چنین جریمه ای یافت نشد"); - DateTime date = command.FineDate.ToGeorgianDateTime(); - foreach (var employeeId in command.EmployeeIds) + if (command.EmployeeId <= 0) { - entity.Edit(employeeId, command.WorkshopId, command.Title, command.Amount.MoneyToDouble(), date); + return op.Failed("خطای سیستمی!"); } + if (!command.FineDate.TryToGeorgianDateTime(out var fineDate)) + { + return op.Failed("تاریخ وارد شده نامعتبر است"); + } + if (fineDate > DateTime.Now) + { + return op.Failed("تاریخ پرداخت جریمه می بایست تاریخ امروز یا قبل تر باشد"); + + } + if (command.Amount.Length > 15) + { + return op.Failed("مبلغ وارد شده معتبر نیست"); + } + var month = Convert.ToInt32(command.FineDate.Substring(5, 2)); + var year = Convert.ToInt32(command.FineDate.Substring(0, 4)); + + + + if (_customizeCheckoutRepository.Exists(x => x.WorkshopId == command.WorkshopId && command.EmployeeId == x.EmployeeId && x.YearInt == year && x.MonthInt == month)) + { + return op.Failed("شما نمیتوانید برای پرسنلی در تاریخی که برای فیش حقوقی صادر شده است جریمه ای دهید"); + + } + + if (!_employeeRepository.Exists(x=>x.id == command.EmployeeId)) + { + return op.Failed("شخص وارد شده معتبر نمیباشد"); + } + DateTime date = command.FineDate.ToGeorgianDateTime(); + + + entity.Edit(command.EmployeeId, command.WorkshopId, command.Title, command.Amount.MoneyToDouble(), date); + _fineRepository.SaveChanges(); return op.Succcedded(entity.id); diff --git a/CompanyManagment.Application/FineSubjectApplication.cs b/CompanyManagment.Application/FineSubjectApplication.cs new file mode 100644 index 00000000..123a7b63 --- /dev/null +++ b/CompanyManagment.Application/FineSubjectApplication.cs @@ -0,0 +1,62 @@ +using System.Collections.Generic; +using _0_Framework_b.Application; +using Company.Domain.FineSubjectAgg; +using CompanyManagment.App.Contracts.FineSubject; + +namespace CompanyManagment.Application; + +public class FineSubjectApplication:IFineSubjectApplication +{ + private readonly IFineSubjectRepository _fineSubjectRepository; + + public FineSubjectApplication(IFineSubjectRepository fineSubjectRepository) + { + _fineSubjectRepository= fineSubjectRepository; + } + + + + public OperationResult Create(CreateFineSubjectViewModel command) + { + OperationResult op = new OperationResult(); + + if (string.IsNullOrWhiteSpace(command.Subject)) + return op.Failed("نام جریمه نمیتواند خالی باشد"); + + var entity = new FineSubject(command.Subject, command.Amount, command.WorkshopId); + + _fineSubjectRepository.Create(entity); + _fineSubjectRepository.SaveChanges(); + + return op.Succcedded(); + } + + public OperationResult Delete(long id) + { + OperationResult op = new OperationResult(); + var entity = _fineSubjectRepository.Get(id); + if (entity == null) + return op.Failed("این آیتم وجود ندارد"); + _fineSubjectRepository.Remove(entity); + _fineSubjectRepository.SaveChanges(); + + return op.Succcedded(); + + } + + public OperationResult Edit(EditFineSubjectViewModel command) + { + OperationResult op = new OperationResult(); + var entity = _fineSubjectRepository.Get(command.Id); + if (entity == null) + return op.Failed("این آیتم وجود ندارد"); + entity.Edit(command.Subject,command.Amount); + _fineSubjectRepository.SaveChanges(); + return op.Succcedded(); + } + + public List GetAll(long workshopId) + { + return _fineSubjectRepository.GetAll(workshopId); + } +} \ No newline at end of file diff --git a/CompanyManagment.Application/LoanApplication.cs b/CompanyManagment.Application/LoanApplication.cs index d664ccf5..4578ba9a 100644 --- a/CompanyManagment.Application/LoanApplication.cs +++ b/CompanyManagment.Application/LoanApplication.cs @@ -2,22 +2,27 @@ using System.Collections.Generic; using System.Globalization; using System.Linq; -using _0_Framework_b.Application; +using System.Reflection.Metadata.Ecma335; +using _0_Framework.Application; +using Company.Domain.CheckoutAgg; +using Company.Domain.CustomizeCheckoutAgg; using Company.Domain.LoanAgg; using Company.Domain.LoanAgg.Entities; using CompanyManagment.App.Contracts.Loan; +using Hangfire.States; using Microsoft.AspNetCore.Mvc.Infrastructure; -using Tools = _0_Framework.Application.Tools; namespace CompanyManagment.Application; public class LoanApplication : ILoanApplication { private readonly ILoanRepository _loanRepository; + private readonly ICustomizeCheckoutRepository _customizeCheckoutRepository; - public LoanApplication(ILoanRepository loanRepository) + public LoanApplication(ILoanRepository loanRepository, ICustomizeCheckoutRepository customizeCheckoutRepository) { _loanRepository = loanRepository; + _customizeCheckoutRepository = customizeCheckoutRepository; } public List GetSearchList(LoanSearchViewModel searchModel) @@ -33,30 +38,53 @@ public class LoanApplication : ILoanApplication public OperationResult Create(CreateLoanViewModel command) { var op = new OperationResult(); - var startDate = command.StartDateTime.ToGeorgianDateTime(); + var startInstallmentDate = command.StartInstallmentPayment.ToGeorgianDateTime(); + var loanGrantDate = command.LoanGrantDate.ToGeorgianDateTime(); var now = DateTime.Now; - var amountD = Tools.MoneyToDouble(command.Amount); + if (command.Amount.Length > 15) + { + return op.Failed("مبلغ وارد شده معتبر نیست"); + } + var amountD = command.Amount.MoneyToDouble(); var installment = - CalculateLoanInstallment(command.Amount, command.Count, command.StartDateTime, command.GetRounded); - #region Validation + CalculateLoanInstallment(command.Amount, command.Count, command.StartInstallmentPayment, command.GetRounded); + var lastInstallment = installment.MaxBy(x => x.DateGr).DateGr; + #region Validation - if (startDate.Date < now.Date) + if (startInstallmentDate.Date < now.Date) { return op.Failed("تاریخ شروع وام نمیتواند در گذشته باشد"); } - if (amountD < 1000000) - return op.Failed("حداقل مبلغ وام 1.000.000 ریال میباشد"); - #endregion + if (loanGrantDate>now) + { + return op.Failed("تاریخ پرداخت وام می بایست تاریخ امروز یا قبل تر باشد"); + } + if (!command.LoanGrantDate.TryToGeorgianDateTime(out var grantDate)) + { + return op.Failed("تاریخ وارد شده نامعتبر است"); + } + if (amountD < 1000000) + return op.Failed("حداقل مبلغ وام 1.000.000 ریال میباشد"); + + if (_customizeCheckoutRepository.Exists(x => + command.EmployeeIds.Contains(x.EmployeeId) && x.WorkshopId == command.WorkshopId && + (x.ContractStart > startInstallmentDate && x.ContractStart < lastInstallment))) + { + return op.Failed("شما نمیتوانید برای پرسنلی در تاریخی که برای فیش حقوقی صادر شده است وام دهید"); + } + + #endregion + foreach (var employeeId in command.EmployeeIds) { - var entity = new Loan(employeeId, command.WorkshopId, startDate, command.Count.ToString(), - Tools.MoneyToDouble(command.Amount), - Tools.MoneyToDouble(installment.First().Amount), + var entity = new Loan(employeeId, command.WorkshopId, startInstallmentDate, command.Count.ToString(), + command.Amount.MoneyToDouble(), + installment.First().Amount.MoneyToDouble(), installment.Select(x => - new LoanInstallment(Tools.MoneyToDouble(x.Amount), x.Month, x.Year)).ToList() - , command.GetRounded); + new LoanInstallment(x.Amount.MoneyToDouble(), x.Month, x.Year, x.DateGr)).ToList() + , command.GetRounded, grantDate); _loanRepository.Create(entity); } @@ -65,21 +93,22 @@ public class LoanApplication : ILoanApplication return op.Succcedded(); } - public OperationResult Edit(EditLoanViewModel command) - { - var op = new OperationResult(); - var entity = _loanRepository.Get(command.Id); - entity.Edit(); - _loanRepository.SaveChanges(); - return op.Succcedded(); - } - public List CalculateLoanInstallment(string amount, int installmentCount, string loanStartDate,bool getRounded) - { - PersianCalendar pc = new PersianCalendar(); - double amountD = Tools.MoneyToDouble(amount); - DateTime loanStartDateGe = loanStartDate.ToGeorgianDateTime(); + public List CalculateLoanInstallment(string amount, int installmentCount, string loanStartDate, bool getRounded) + { + int day = Convert.ToInt32(loanStartDate.Substring(8, 2)); + int month = Convert.ToInt32(loanStartDate.Substring(5, 2)); + int year = Convert.ToInt32(loanStartDate.Substring(0, 4)); + + var installments = new List(); + + + bool endOfMonth = day == 31; + + double amountD = amount.MoneyToDouble(); + var dividedAmount = amountD / installmentCount; + double moneyPerMonth = 0; if (getRounded) @@ -89,36 +118,133 @@ public class LoanApplication : ILoanApplication double lastLoan = amountD - (moneyPerMonth * (installmentCount - 1)); - var installments = new List(); - int month = pc.GetMonth(loanStartDateGe) ; - int year = pc.GetYear(loanStartDateGe); - for (int i = 1; i < installmentCount; i++) + if (endOfMonth) { - var installment = new LoanInstallmentViewModel() + for (int i = 1; i < installmentCount; i++) { - Month = month.ToString("00"), - Amount = moneyPerMonth.ToMoney(), - Year = year.ToString("00") + var installment = new LoanInstallmentViewModel() + { + DateFa = loanStartDate, + Amount = moneyPerMonth.ToMoney(), + DateGr = loanStartDate.ToGeorgianDateTime(), + Month = loanStartDate.Substring(5, 2), + Year = loanStartDate.Substring(0, 4), + Day = loanStartDate.Substring(8, 2) + }; + + installments.Add(installment); + + if (month == 12) + { + year++; + month = 1; + } + else + { + month++; + } + + loanStartDate = $"{year:0000}/{month:00}/01".FindeEndOfMonth(); + + } + var lastInstallment = new LoanInstallmentViewModel() + { + DateFa = loanStartDate, + Amount = lastLoan.ToMoney(), + DateGr = loanStartDate.ToGeorgianDateTime(), + Month = loanStartDate.Substring(5, 2), + Year = loanStartDate.Substring(0, 4), + Day = loanStartDate.Substring(8, 2) }; - installments.Add(installment); - loanStartDateGe = loanStartDateGe.AddMonths(1); - month = pc.GetMonth(loanStartDateGe); - year = pc.GetYear(loanStartDateGe); + installments.Add(lastInstallment); + return installments; } - loanStartDateGe = loanStartDateGe.AddMonths(1); - month = pc.GetMonth(loanStartDateGe); - year = pc.GetYear(loanStartDateGe); - var lastInstallment = new LoanInstallmentViewModel() + else { - Month = month.ToString("00"), - Amount = moneyPerMonth.ToMoney(), - Year = year.ToString("00") - }; - installments.Add(lastInstallment); - return installments; + for (int i = 1; i < installmentCount; i++) + { + var installment = new LoanInstallmentViewModel() + { + DateFa = loanStartDate, + Amount = moneyPerMonth.ToMoney(), + DateGr = loanStartDate.ToGeorgianDateTime(), + Month = loanStartDate.Substring(5, 2), + Year = loanStartDate.Substring(0, 4), + Day = loanStartDate.Substring(8, 2) + }; + installments.Add(installment); + var endDay = 0; + + if (month == 12) + { + year++; + month = 1; + } + else + { + month++; + } + if (day == 30) + { + if (month == 12) + { + var lastYearDay = Convert.ToInt32($"{year:0000}/{month:00}/1".FindeEndOfMonth().Substring(8, 2)); + endDay = lastYearDay == 30 ? lastYearDay : 29; + } + + } + + loanStartDate = endDay == 0 ? $"{year:0000}/{month:00}/{day:00}" : $"{year:0000}/{month:00}/{endDay:00}"; + + } + var lastInstallment = new LoanInstallmentViewModel() + { + DateFa = loanStartDate, + Amount = lastLoan.ToMoney(), + DateGr = loanStartDate.ToGeorgianDateTime(), + Month = loanStartDate.Substring(5, 2), + Year = loanStartDate.Substring(0, 4), + Day = loanStartDate.Substring(8, 2) + + }; + installments.Add(lastInstallment); + return installments; + } } + + public OperationResult Remove(long id) + { + OperationResult op = new OperationResult(); + var entity = _loanRepository.Get(id); + if (entity == null) + return op.Failed("این آیتم وجود ندارد"); + + var lastInstallment = entity.LoanInstallments.MaxBy(x => x.InstallmentDate).InstallmentDate; + + if (_customizeCheckoutRepository.Exists(x => + entity.EmployeeId == x.EmployeeId && x.WorkshopId == entity.WorkshopId && + (x.ContractStart > entity.StartInstallmentPayment && x.ContractStart < lastInstallment))) + { + return op.Failed("این پرسنل در این تاریخ دارای فیش حقوقی است"); + } + + + _loanRepository.Remove(entity); + _loanRepository.SaveChanges(); + return op.Succcedded(); + } + + public OperationResult RemoveRange(IEnumerable ids) + { + OperationResult op = new OperationResult(); + var loans = _loanRepository.GetBy(ids); + + _loanRepository.RemoveRange(loans); + _loanRepository.SaveChanges(); + return op.Succcedded(); + } } \ No newline at end of file diff --git a/CompanyManagment.Application/RewardApplication.cs b/CompanyManagment.Application/RewardApplication.cs index d682b122..c6cae763 100644 --- a/CompanyManagment.Application/RewardApplication.cs +++ b/CompanyManagment.Application/RewardApplication.cs @@ -1,8 +1,13 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; +using System.Linq; using _0_Framework.Application; +using Company.Domain.CheckoutAgg; +using Company.Domain.CustomizeCheckoutAgg; using Company.Domain.RewardAgg; using CompanyManagment.App.Contracts.Reward; using Microsoft.AspNetCore.Components.Forms; +using static Microsoft.EntityFrameworkCore.DbLoggerCategory.Database; namespace CompanyManagment.Application; @@ -10,14 +15,16 @@ public class RewardApplication : IRewardApplication { private readonly IRewardRepository _rewardRepository; private readonly IAuthHelper _authHelper; + private readonly ICustomizeCheckoutRepository _customizeCheckoutRepository; - public RewardApplication(IRewardRepository rewardRepository, IAuthHelper authHelper) + public RewardApplication(IRewardRepository rewardRepository, IAuthHelper authHelper, ICustomizeCheckoutRepository customizeCheckoutRepository) { _rewardRepository = rewardRepository; _authHelper = authHelper; + _customizeCheckoutRepository = customizeCheckoutRepository; } - public List GetSearchList(RewardSearchViewModel searchModel) + public List GetSearchList(RewardSearchModel searchModel) { return _rewardRepository.GetSearchList(searchModel); } @@ -27,12 +34,73 @@ public class RewardApplication : IRewardApplication return _rewardRepository.GetDetails(id); } - public OperationResult Create(CreateRewardViewModel command) + public OperationResult Remove(long id) + { + OperationResult op = new OperationResult(); + var entity =_rewardRepository.Get(id); + if (entity == null) + return op.Failed("این آیتم وجود ندارد"); + + var month = Convert.ToInt32(entity.GrantDate.ToFarsi().Substring(5, 2)); + var year= Convert.ToInt32(entity.GrantDate.ToFarsi().Substring(0, 4)); + + if (_customizeCheckoutRepository.Exists(x => x.WorkshopId == entity.WorkshopId && entity.EmployeeId==x.EmployeeId && x.YearInt == year && x.MonthInt == month)) + { + return op.Failed("این پرسنل در این تاریخ دارای فیش حقوقی است"); + } + _rewardRepository.Remove(entity); + _rewardRepository.SaveChanges(); + return op.Succcedded(); + } + + public OperationResult RemoveRange(IEnumerable ids) + { + OperationResult op = new OperationResult(); + var rewards = _rewardRepository.GetBy(ids); + _rewardRepository.RemoveRange(rewards); + _rewardRepository.SaveChanges(); + return op.Succcedded(); + + } + + public OperationResult Create(CreateRewardViewModel command) { var op = new OperationResult(); - foreach (var employeeId in command.EmployeeIds) + + #region Validation + + if (!command.GrantDate.TryToGeorgianDateTime(out var grantDate)) + { + return op.Failed("تاریخ وارد شده نامعتبر است"); + } + + if (grantDate > DateTime.Now) { - var entity = new Reward(employeeId, command.WorkshopId, command.Amount, command.Description, command.RewardedByAccountId); + return op.Failed("تاریخ پرداخت پاداش می بایست تاریخ امروز یا قبل تر باشد"); + + } + + if (command.Amount.Length>15) + { + return op.Failed("مبلغ وارد شده معتبر نیست"); + } + + var month = Convert.ToInt32(command.GrantDate.Substring(5, 2)); + var year = Convert.ToInt32(command.GrantDate.Substring(0, 4)); + + if (_customizeCheckoutRepository.Exists(x => x.WorkshopId == command.WorkshopId && command.EmployeeIds.Contains(x.EmployeeId) && x.YearInt == year && x.MonthInt == month)) + { + return op.Failed("شما نمیتوانید برای پرسنلی در تاریخی که برای فیش حقوقی صادر شده است پاداشی دهید"); + } + + + #endregion + + foreach (var employeeId in command.EmployeeIds) + { + var entity = new Reward(employeeId, command.WorkshopId, command.Amount.MoneyToDouble(), command.Description, + command.RewardedByAccountId, grantDate); + _rewardRepository.Create(entity); } @@ -43,11 +111,37 @@ public class RewardApplication : IRewardApplication public OperationResult Edit(EditRewardViewModel command) { var op = new OperationResult(); + + if (!command.GrantDate.TryToGeorgianDateTime(out var grantDate)) + { + return op.Failed("تاریخ وارد شده نامعتبر است"); + } + + if (grantDate > DateTime.Now) + { + return op.Failed("تاریخ پرداخت پاداش می بایست تاریخ امروز یا قبل تر باشد"); + + } + if (command.Amount.Length > 15) + { + return op.Failed("مبلغ وارد شده معتبر نیست"); + } + var entity = _rewardRepository.Get(command.Id); if (entity == null) return op.Failed("چنین آیتمی وجود ندارد"); - entity.Edit(command.Amount,command.Description,command.RewardedByAccountId); + + var month = Convert.ToInt32(command.GrantDate.Substring(5, 2)); + var year = Convert.ToInt32(command.GrantDate.Substring(0, 4)); + + if (_customizeCheckoutRepository.Exists(x => x.WorkshopId == command.WorkshopId && command.EmployeeId==x.EmployeeId && x.YearInt == year && x.MonthInt == month)) + { + return op.Failed("شما نمیتوانید برای پرسنلی در تاریخی که برای فیش حقوقی صادر شده است پاداشی دهید"); + } + + entity.Edit(command.Amount.MoneyToDouble(),command.Description,command.RewardedByAccountId, grantDate); _rewardRepository.SaveChanges(); return op.Succcedded(entity.id); } + } \ No newline at end of file diff --git a/CompanyManagment.Application/RollCallApplication.cs b/CompanyManagment.Application/RollCallApplication.cs index 7a528157..9fa13d8d 100644 --- a/CompanyManagment.Application/RollCallApplication.cs +++ b/CompanyManagment.Application/RollCallApplication.cs @@ -234,6 +234,9 @@ public class RollCallApplication : IRollCallApplication { rollCallWithDateTime.Start = rollCallWithDateTime.Start.AddDays(1); } + if (rollCallWithDateTime.Start == previousEnd) + return operation.Failed("ساعت ورود نمی تواند با ساعت خروج حضور غیاب دیگری در آن روز برابر باشد"); + } while (rollCallWithDateTime.Start >= rollCallWithDateTime.End) { @@ -271,12 +274,75 @@ public class RollCallApplication : IRollCallApplication _rollCallRepository.SaveChanges(); return operation.Succcedded(); } + public List GetWorkshopEmployeeRollCallsForDate(long workshopId, long employeeId, string dateFa) { DateTime date = Tools.ToGeorgianDateTime(dateFa); if (date == Tools.GetUndefinedDateTime()) return new(); - return _rollCallRepository.GetWorkshopEmployeeRollCallsForDate(workshopId, employeeId, date); + var res = _rollCallRepository.GetWorkshopEmployeeRollCallsForDate(workshopId, employeeId, date); + return res; + } + + public IEnumerable GetNotSlicedRollCallsByWorkshopId(long workshopId, DateTime durationStart, DateTime durationEnd) + { + return _rollCallRepository.GetNotSlicedRollCallsByWorkshopId(workshopId, durationStart, durationEnd); + } + + public List GetWorkshopAbsentHistory(long workshopId, DateTime startSearch, DateTime endSearch) + { + return _rollCallRepository.GetWorkshopAbsentHistory(workshopId, startSearch, endSearch); + } + + public OperationResult SetModifyTypeToNone(long rollCallId) + { + var operation = new OperationResult(); + + var rollCall = _rollCallRepository.Get(rollCallId); + + if (rollCall == null) + return operation.Failed("چنین آیتمی یافت نشد"); + + rollCall.SetModifyType(RollCallModifyType.None); + + _rollCallRepository.SaveChanges(); + + return operation.Succcedded(); + } + + public OperationResult SetModifyTypeToEditByEmployer(long rollCallId) + { + var operation = new OperationResult(); + + var rollCall = _rollCallRepository.Get(rollCallId); + + if (rollCall == null) + return operation.Failed("چنین آیتمی یافت نشد"); + + rollCall.SetModifyType(RollCallModifyType.EditByEmployer); + + _rollCallRepository.SaveChanges(); + + return operation.Succcedded(); + } + + + + public List GetRollCallWorkFlowsCutByBgService(long workshopId, DateTime start, DateTime end) + { + return _rollCallRepository.GetRollCallWorkFlowsCutByBgService(workshopId, start, end); + + } + + public int GetCountCutRollCallByBgService(long accId, long workshopId) + { + return _rollCallRepository.GetCountCutRollCallByBgService(accId, workshopId); + } + + + public RollCallViewModel GetDetails(long rollCallId) + { + return _rollCallRepository.GetDetails(rollCallId); } #endregion public long Flag(long employeeId, long workshopId) diff --git a/CompanyManagment.Application/RollCallEmployeeStatusApplication.cs b/CompanyManagment.Application/RollCallEmployeeStatusApplication.cs index 8285370a..073923ce 100644 --- a/CompanyManagment.Application/RollCallEmployeeStatusApplication.cs +++ b/CompanyManagment.Application/RollCallEmployeeStatusApplication.cs @@ -79,6 +79,12 @@ namespace CompanyManagment.Application x.StartDate.Date <= contractStart.Date && x.EndDate.Date >= contractEnd.Date); } + + public List GetActiveByWorkshopIdInDate(long workshopId, DateTime startDateGr, DateTime endDateGr) + { + return _employeeRollCallStatusRepository.GetActiveByWorkshopIdInDate(workshopId, startDateGr, endDateGr); + } + public OperationResult Deactivate(long id) { OperationResult op = new(); diff --git a/CompanyManagment.Application/SalaryAidApplication.cs b/CompanyManagment.Application/SalaryAidApplication.cs index ea8cd0c2..2ac121d0 100644 --- a/CompanyManagment.Application/SalaryAidApplication.cs +++ b/CompanyManagment.Application/SalaryAidApplication.cs @@ -1,41 +1,70 @@ using System.Collections.Generic; -using _0_Framework_b.Application; +using System.Linq; using Company.Domain.SalaryAidAgg; using CompanyManagment.App.Contracts.SalaryAid; -using Tools = _0_Framework.Application.Tools; +using _0_Framework.Application; +using Company.Domain.CheckoutAgg; +using CompanyManagment.App.Contracts.Checkout; +using System; +using Company.Domain.CustomizeCheckoutAgg; namespace CompanyManagment.Application; -public class SalaryAidApplication:ISalaryAidApplication +public class SalaryAidApplication : ISalaryAidApplication { private readonly ISalaryAidRepository _salaryAidRepository; + private readonly ICustomizeCheckoutRepository _customizeCheckoutRepository; - public SalaryAidApplication(ISalaryAidRepository salaryAidRepository) + public SalaryAidApplication(ISalaryAidRepository salaryAidRepository, ICustomizeCheckoutRepository customizeCheckoutRepository) { _salaryAidRepository = salaryAidRepository; + _customizeCheckoutRepository = customizeCheckoutRepository; } - public List GetSearchList(SalaryAidSearchViewModel searchViewModel) + public List GetSearchList(SalaryAidSearchViewModel searchViewModel) { - return _salaryAidRepository.GetSearchList(searchViewModel); - } + return _salaryAidRepository.GetSearchList(searchViewModel); + } public EditSalaryAidViewModel GetDetails(long id) { - return _salaryAidRepository.GetDetails(id); - } + return _salaryAidRepository.GetDetails(id); + } public OperationResult Create(CreateSalaryAidViewModel command) { var op = new OperationResult(); - var dateTime = command.SalaryDateTime.ToGeorgianDateTime(); + if (!command.SalaryDateTime.TryToGeorgianDateTime(out var startDate)) + { + return op.Failed("تاریخ وارد شده نامعتبر است"); + } + + if (startDate > DateTime.Now) + { + return op.Failed("تاریخ پرداخت مساعده می بایست تاریخ امروز یا قبل تر باشد"); + + } + if (command.Amount.Length > 15) + { + return op.Failed("مبلغ وارد شده معتبر نیست"); + } + + var month = Convert.ToInt32(command.SalaryDateTime.Substring(5, 2)); + var year = Convert.ToInt32(command.SalaryDateTime.Substring(0, 4)); + + + if (_customizeCheckoutRepository.Exists(x => x.WorkshopId == command.WorkshopId && command.EmployeeIds.Contains(x.EmployeeId) && x.YearInt == year && x.MonthInt == month)) + { + return op.Failed("شما نمیتوانید برای پرسنلی در تاریخی که برای فیش حقوقی صادر شده است مساعده ای دهید"); + } + foreach (var employeeId in command.EmployeeIds) { - var entity = new SalaryAid(employeeId, command.WorkshopId, Tools.MoneyToDouble(command.Amount), dateTime); - _salaryAidRepository.Create(entity); + var entity = new SalaryAid(employeeId, command.WorkshopId, command.Amount.MoneyToDouble(), startDate); + _salaryAidRepository.Create(entity); - } + } _salaryAidRepository.SaveChanges(); return op.Succcedded(); } @@ -43,10 +72,61 @@ public class SalaryAidApplication:ISalaryAidApplication public OperationResult Edit(EditSalaryAidViewModel command) { var op = new OperationResult(); + + if (!command.SalaryDateTime.TryToGeorgianDateTime(out var startDate)) + { + return op.Failed("تاریخ وارد شده نامعتبر است"); + } + + if (startDate > DateTime.Now) + { + return op.Failed("تاریخ پرداخت مساعده می بایست تاریخ امروز یا قبل تر باشد"); + + } + if (command.Amount.Length > 15) + { + return op.Failed("مبلغ وارد شده معتبر نیست"); + } var entity = _salaryAidRepository.Get(command.Id); if (entity == null) return op.Failed("چنین مساعده ای وجود ندارد"); - entity.Edit(Tools.MoneyToDouble(command.Amount)); + + var month = Convert.ToInt32(command.SalaryDateTime.Substring(5, 2)); + var year = Convert.ToInt32(command.SalaryDateTime.Substring(0, 4)); + + if (_customizeCheckoutRepository.Exists(x => x.WorkshopId == entity.WorkshopId && entity.EmployeeId == x.EmployeeId && x.YearInt == year && x.MonthInt == month)) + return op.Failed("شما نمیتوانید برای پرسنلی در تاریخی که برای فیش حقوقی صادر شده است مساعده ای دهید"); + + + entity.Edit(Tools.MoneyToDouble(command.Amount),startDate); + _salaryAidRepository.SaveChanges(); + return op.Succcedded(); + } + + public OperationResult Remove(long id) + { + OperationResult op = new OperationResult(); + var entity = _salaryAidRepository.Get(id); + if (entity == null) + return op.Failed("این آیتم وجود ندارد"); + + var month = Convert.ToInt32(entity.SalaryAidDateTime.ToFarsi().Substring(5, 2)); + var year = Convert.ToInt32(entity.SalaryAidDateTime.ToFarsi().Substring(0, 4)); + + if (_customizeCheckoutRepository.Exists(x => x.WorkshopId == entity.WorkshopId && entity.EmployeeId == x.EmployeeId && x.YearInt == year && x.MonthInt == month)) + return op.Failed("این پرسنل در این تاریخ دارای فیش حقوقی است"); + + + _salaryAidRepository.Remove(entity); + _salaryAidRepository.SaveChanges(); + return op.Succcedded(); + } + + public OperationResult RemoveRange(IEnumerable ids) + { + OperationResult op = new OperationResult(); + var salaries = _salaryAidRepository.GetBy(ids); + _salaryAidRepository.RemoveRange(salaries); _salaryAidRepository.SaveChanges(); return op.Succcedded(); } diff --git a/CompanyManagment.EFCore/CompanyContext.cs b/CompanyManagment.EFCore/CompanyContext.cs index 5d35fe20..0c55bbc9 100644 --- a/CompanyManagment.EFCore/CompanyContext.cs +++ b/CompanyManagment.EFCore/CompanyContext.cs @@ -37,6 +37,7 @@ using Company.Domain.FileTitle; using Company.Domain.FinancialStatmentAgg; using Company.Domain.FinancialTransactionAgg; using Company.Domain.FineAgg; +using Company.Domain.FineSubjectAgg; using Company.Domain.GroupPlanAgg; using Company.Domain.GroupPlanJobItemAgg; using Company.Domain.HolidayAgg; @@ -96,6 +97,7 @@ using Company.Domain.WorkshopAgg; using Company.Domain.WorkshopEmployerAgg; using Company.Domain.WorkshopPlanAgg; using Company.Domain.WorkshopPlanEmployeeAgg; +using Company.Domain.WorkshopSubAccountAgg; using Company.Domain.YearlySalaryAgg; using Company.Domain.YearlySalaryItemsAgg; using Company.Domain.YearlysSalaryTitleAgg; @@ -150,17 +152,25 @@ public class CompanyContext : DbContext public DbSet CustomizeWorkshopEmployeeSettings { get; set; } public DbSet Fines { get; set; } + public DbSet FinesSubject { get; set; } + public DbSet Loans { get; set; } - public DbSet SalaryAids { get; set; } + public DbSet SalaryAids { get; set; } - public DbSet Rewards { get; set; } + public DbSet Rewards { get; set; } public DbSet AndroidApkVersions { get; set; } #endregion + #region Pooya + + public DbSet WorkshopSubAccounts { get; set; } + + #endregion + public DbSet CustomizeCheckouts { get; set; } public DbSet TaxLeftWorkItems { get; set; } diff --git a/CompanyManagment.EFCore/Mapping/AndroidApkVersionMapping.cs b/CompanyManagment.EFCore/Mapping/AndroidApkVersionMapping.cs index 7dc1d9d6..8ed88fd7 100644 --- a/CompanyManagment.EFCore/Mapping/AndroidApkVersionMapping.cs +++ b/CompanyManagment.EFCore/Mapping/AndroidApkVersionMapping.cs @@ -1,4 +1,4 @@ -using _0_Framework.Domain.CustomizeCheckoutValueObjects; + using Company.Domain.AndroidApkVersionAgg; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; diff --git a/CompanyManagment.EFCore/Mapping/CustomizeCheckoutMapping.cs b/CompanyManagment.EFCore/Mapping/CustomizeCheckoutMapping.cs index 5a98d539..9068dd52 100644 --- a/CompanyManagment.EFCore/Mapping/CustomizeCheckoutMapping.cs +++ b/CompanyManagment.EFCore/Mapping/CustomizeCheckoutMapping.cs @@ -14,11 +14,9 @@ public class CustomizeCheckoutMapping : IEntityTypeConfiguration x.EmployeeId); builder.Property(x => x.WorkshopId); - builder.Property(x => x.EmployerId); builder.Property(x => x.ContractId).IsRequired(false); #endregion - builder.Property(x => x.IsActiveString).HasConversion().HasMaxLength(5); builder.Property(x => x.ContractNo).HasMaxLength(20); builder.Property(x => x.YearInt); builder.Property(x => x.MonthInt); @@ -55,9 +53,9 @@ public class CustomizeCheckoutMapping : IEntityTypeConfiguration x.CustomizeCheckouts) .HasForeignKey(x => x.WorkshopId); - builder.HasOne(x => x.Employee) - .WithMany(x => x.CustomizeCheckouts) - .HasForeignKey(x => x.EmployeeId); + //builder.HasOne(x => x.Employee) + // .WithMany(x => x.CustomizeCheckouts) + // .HasForeignKey(x => x.EmployeeId); #endregion } diff --git a/CompanyManagment.EFCore/Mapping/CustomizeWorkshopEmployeeSettingsMapping.cs b/CompanyManagment.EFCore/Mapping/CustomizeWorkshopEmployeeSettingsMapping.cs index fc730e9e..d55aa642 100644 --- a/CompanyManagment.EFCore/Mapping/CustomizeWorkshopEmployeeSettingsMapping.cs +++ b/CompanyManagment.EFCore/Mapping/CustomizeWorkshopEmployeeSettingsMapping.cs @@ -1,6 +1,6 @@ using System; using System.Security.Cryptography.X509Certificates; -using _0_Framework.Domain.CustomizeCheckoutValueObjects; +using _0_Framework.Domain.CustomizeCheckoutShared.Enums; using Company.Domain.CustomizeWorkshopEmployeeSettingsAgg.Entities; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; @@ -16,13 +16,29 @@ public class CustomizeWorkshopEmployeeSettingsMapping : IEntityTypeConfiguration builder.HasOne(x => x.CustomizeWorkshopGroupSettings).WithMany(x => x.CustomizeWorkshopEmployeeSettingsCollection) .HasForeignKey(x => x.CustomizeWorkshopGroupSettingId); + builder.Property(x => x.FridayWork).HasConversion( v => v.ToString("d"), v => (FridayWork)Enum.Parse(typeof(FridayWork), v)).HasMaxLength(1); - builder.HasKey(x => x.id); + + builder.Property(x => x.WorkshopShiftStatus).HasConversion( + v => v.ToString("d"), + v => (WorkshopShiftStatus)Enum.Parse(typeof(WorkshopShiftStatus), v)).HasMaxLength(1); + builder.Property(x => x.HolidayWork).HasConversion( v => v.ToString("d"), v => (HolidayWork)Enum.Parse(typeof(HolidayWork), v)).HasMaxLength(1); + builder.OwnsOne(x => x.IrregularShift, irregularShift => + { + irregularShift.Property(x => x.WorkshopIrregularShifts).HasConversion( + v => v.ToString("d"), + v => (WorkshopIrregularShifts)Enum.Parse(typeof(WorkshopIrregularShifts), v)).HasMaxLength(1); + irregularShift.Property(x => x.StartTime).IsRequired(); + irregularShift.Property(x=>x.EndTime).IsRequired(); + }); + + + builder.OwnsOne(x => x.BaseYearsPay, baseYearsPay => { baseYearsPay.Property(a => a.BaseYearsPayType).HasConversion( @@ -191,8 +207,17 @@ public class CustomizeWorkshopEmployeeSettingsMapping : IEntityTypeConfiguration v => (ShiftType)Enum.Parse(typeof(ShiftType), v)).HasMaxLength(1) .HasColumnName("ShiftPay_ShiftType"); }); + builder.OwnsOne(x => x.BreakTime, breakTime => + { + breakTime.Property(x => x.BreakTimeType).HasConversion(v => v.ToString("d") + , v => (BreakTimeType)Enum.Parse(typeof(BreakTimeType), v)).HasMaxLength(1).IsRequired(); - builder.OwnsMany(x => x.CustomizeWorkshopEmployeeSettingsShifts, shift => + breakTime.Property(x => x.BreakTimeValue).IsRequired(); + + breakTime.Property(x => x.HasBreakTimeValue).IsRequired(); + }); + + builder.OwnsMany(x => x.CustomizeWorkshopEmployeeSettingsShifts, shift => { shift.ToTable("CustomizeWorkshopEmployeeSettingsShifts"); shift.HasKey(x => x.id); diff --git a/CompanyManagment.EFCore/Mapping/CustomizeWorkshopGroupSettingsMapping.cs b/CompanyManagment.EFCore/Mapping/CustomizeWorkshopGroupSettingsMapping.cs index 75ca9bd2..d16c54e3 100644 --- a/CompanyManagment.EFCore/Mapping/CustomizeWorkshopGroupSettingsMapping.cs +++ b/CompanyManagment.EFCore/Mapping/CustomizeWorkshopGroupSettingsMapping.cs @@ -1,4 +1,4 @@ -using _0_Framework.Domain.CustomizeCheckoutValueObjects; +using _0_Framework.Domain.CustomizeCheckoutShared.Enums; using Company.Domain.CustomizeWorkshopGroupSettingsAgg.Entities; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; @@ -15,12 +15,28 @@ public class CustomizeWorkshopGroupSettingsMapping : IEntityTypeConfiguration x.FridayWork).HasConversion( v => v.ToString("d"), v => (FridayWork)Enum.Parse(typeof(FridayWork), v)).HasMaxLength(1); + + builder.Property(x => x.WorkshopShiftStatus).HasConversion( + v => v.ToString("d"), + v => (WorkshopShiftStatus)Enum.Parse(typeof(WorkshopShiftStatus), v)).HasMaxLength(1); + + + builder.HasKey(x => x.id); builder.Property(x => x.HolidayWork).HasConversion( v => v.ToString("d"), v => (HolidayWork)Enum.Parse(typeof(HolidayWork), v)).HasMaxLength(1); builder.Property(x => x.GroupName).HasMaxLength(120); + builder.OwnsOne(x => x.IrregularShift, irregularShift => + { + irregularShift.Property(x => x.WorkshopIrregularShifts).HasConversion( + v => v.ToString("d"), + v => (WorkshopIrregularShifts)Enum.Parse(typeof(WorkshopIrregularShifts), v)).HasMaxLength(1); + irregularShift.Property(x => x.StartTime); + irregularShift.Property(x => x.EndTime); + }); + builder.OwnsOne(x => x.BaseYearsPay, baseYearsPay => { baseYearsPay.Property(a => a.BaseYearsPayType).HasConversion( @@ -189,8 +205,17 @@ public class CustomizeWorkshopGroupSettingsMapping : IEntityTypeConfiguration (ShiftType)Enum.Parse(typeof(ShiftType), v)).HasMaxLength(1) .HasColumnName("ShiftPay_ShiftType"); }); + builder.OwnsOne(x => x.BreakTime, breakTime => + { + breakTime.Property(x => x.BreakTimeType).HasConversion(v => v.ToString("d") + , v => (BreakTimeType)Enum.Parse(typeof(BreakTimeType), v)).HasMaxLength(1).IsRequired(); - builder.OwnsMany(x => x.CustomizeWorkshopGroupSettingsShifts, shift => + breakTime.Property(x => x.BreakTimeValue).IsRequired(); + + breakTime.Property(x => x.HasBreakTimeValue).IsRequired(); + }); + + builder.OwnsMany(x => x.CustomizeWorkshopGroupSettingsShifts, shift => { shift.ToTable("CustomizeWorkshopGroupSettingsShifts"); diff --git a/CompanyManagment.EFCore/Mapping/CustomizeWorkshopSettingsMapping.cs b/CompanyManagment.EFCore/Mapping/CustomizeWorkshopSettingsMapping.cs index fa21c07e..10e83286 100644 --- a/CompanyManagment.EFCore/Mapping/CustomizeWorkshopSettingsMapping.cs +++ b/CompanyManagment.EFCore/Mapping/CustomizeWorkshopSettingsMapping.cs @@ -1,4 +1,4 @@ -using _0_Framework.Domain.CustomizeCheckoutValueObjects; +using _0_Framework.Domain.CustomizeCheckoutShared.Enums; using Company.Domain.CustomizeWorkshopSettingsAgg.Entities; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; @@ -16,6 +16,10 @@ public class CustomizeWorkshopSettingsMapping:IEntityTypeConfiguration v.ToString("d"), v => (FridayWork)Enum.Parse(typeof(FridayWork), v)).HasMaxLength(1); + builder.Property(x => x.WorkshopShiftStatus).HasConversion( + v => v.ToString("d"), + v => (WorkshopShiftStatus)Enum.Parse(typeof(WorkshopShiftStatus), v)).HasMaxLength(1); + builder.Property(x => x.BonusesPaysInEndOfMonth).HasConversion( v => v.ToString("d"), v => (BonusesPaysInEndOfYear)Enum.Parse(typeof(BonusesPaysInEndOfYear), v)).HasMaxLength(1); @@ -203,6 +207,8 @@ public class CustomizeWorkshopSettingsMapping:IEntityTypeConfiguration x.BreakTime); + builder.OwnsMany(x => x.CustomizeWorkshopSettingsShifts, shift => { diff --git a/CompanyManagment.EFCore/Mapping/FineMapping.cs b/CompanyManagment.EFCore/Mapping/FineMapping.cs index ece079b8..d2f3df60 100644 --- a/CompanyManagment.EFCore/Mapping/FineMapping.cs +++ b/CompanyManagment.EFCore/Mapping/FineMapping.cs @@ -1,5 +1,4 @@ -using _0_Framework.Domain.CustomizeCheckoutValueObjects; -using Company.Domain.FineAgg; +using Company.Domain.FineAgg; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; using System; diff --git a/CompanyManagment.EFCore/Mapping/FineSubjectMapping.cs b/CompanyManagment.EFCore/Mapping/FineSubjectMapping.cs new file mode 100644 index 00000000..091ea57f --- /dev/null +++ b/CompanyManagment.EFCore/Mapping/FineSubjectMapping.cs @@ -0,0 +1,17 @@ +using Company.Domain.FineSubjectAgg; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; + +namespace CompanyManagment.EFCore.Mapping; + +public class FineSubjectMapping:IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("FineSubjects"); + builder.HasKey(x => x.id); + builder.Property(x => x.Amount).HasMaxLength(25); + builder.Property(x => x.Title).HasMaxLength(255); + + } +} \ No newline at end of file diff --git a/CompanyManagment.EFCore/Mapping/LoanMapping.cs b/CompanyManagment.EFCore/Mapping/LoanMapping.cs index a31104a9..d8d4d6c6 100644 --- a/CompanyManagment.EFCore/Mapping/LoanMapping.cs +++ b/CompanyManagment.EFCore/Mapping/LoanMapping.cs @@ -1,6 +1,5 @@ using System; using _0_Framework.Application; -using _0_Framework.Domain.CustomizeCheckoutValueObjects; using Company.Domain.LoanAgg.Entities; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; diff --git a/CompanyManagment.EFCore/Mapping/RewardMapping.cs b/CompanyManagment.EFCore/Mapping/RewardMapping.cs index 6ac09c94..b13a414c 100644 --- a/CompanyManagment.EFCore/Mapping/RewardMapping.cs +++ b/CompanyManagment.EFCore/Mapping/RewardMapping.cs @@ -1,10 +1,8 @@ -using _0_Framework.Domain.CustomizeCheckoutValueObjects; -using Company.Domain.RewardAgg; +using Company.Domain.RewardAgg; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; using System; using _0_Framework.Application; -using _0_Framework.Domain; namespace CompanyManagment.EFCore.Mapping; diff --git a/CompanyManagment.EFCore/Mapping/WorkshopSubAccountMapping.cs b/CompanyManagment.EFCore/Mapping/WorkshopSubAccountMapping.cs new file mode 100644 index 00000000..75c21172 --- /dev/null +++ b/CompanyManagment.EFCore/Mapping/WorkshopSubAccountMapping.cs @@ -0,0 +1,21 @@ + +using Company.Domain.WorkshopSubAccountAgg; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; + +namespace CompanyManagment.EFCore.Mapping +{ + public class WorkshopSubAccountMapping : IEntityTypeConfiguration + { + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("WorkshopSubAccounts"); + + builder.HasKey(x => new { x.SubAccountId, x.WorkshopId }); + builder.Property(x => x.IsActive).HasMaxLength(5); + + + builder.HasOne(x => x.Workshop).WithMany(x => x.WorkshopSubAccounts).HasForeignKey(x => x.WorkshopId); + } + } +} diff --git a/CompanyManagment.EFCore/Migrations/20241201165110_WorkshopSetings_SubAccount_FinRewardLoneSalery.Designer.cs b/CompanyManagment.EFCore/Migrations/20241201165110_WorkshopSetings_SubAccount_FinRewardLoneSalery.Designer.cs new file mode 100644 index 00000000..e471dd35 --- /dev/null +++ b/CompanyManagment.EFCore/Migrations/20241201165110_WorkshopSetings_SubAccount_FinRewardLoneSalery.Designer.cs @@ -0,0 +1,7796 @@ +// +using System; +using CompanyManagment.EFCore; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace CompanyManagment.EFCore.Migrations +{ + [DbContext(typeof(CompanyContext))] + [Migration("20241201165110_WorkshopSetings_SubAccount_FinRewardLoneSalery")] + partial class WorkshopSetings_SubAccount_FinRewardLoneSalery + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.10") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("Company.Domain.AndroidApkVersionAgg.AndroidApkVersion", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("IsActive") + .IsRequired() + .HasMaxLength(1) + .HasColumnType("nvarchar(1)"); + + b.Property("Path") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("Title") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("VersionCode") + .HasMaxLength(20) + .HasColumnType("nvarchar(20)"); + + b.Property("VersionName") + .HasMaxLength(35) + .HasColumnType("nvarchar(35)"); + + b.HasKey("id"); + + b.ToTable("AndroidApkVersions", (string)null); + }); + + modelBuilder.Entity("Company.Domain.BillAgg.EntityBill", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("Appointed") + .HasColumnType("nvarchar(max)"); + + b.Property("Contact") + .HasColumnType("nvarchar(max)"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("IsActiveString") + .HasColumnType("nvarchar(max)"); + + b.Property("ProcessingStage") + .HasColumnType("nvarchar(max)"); + + b.Property("SubjectBill") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.HasKey("id"); + + b.ToTable("TextManager_Bill", (string)null); + }); + + modelBuilder.Entity("Company.Domain.Board.Board", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("BoardChairman") + .HasColumnType("nvarchar(max)"); + + b.Property("BoardType_Id") + .HasColumnType("int"); + + b.Property("Branch") + .HasColumnType("nvarchar(max)"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("DisputeResolutionPetitionDate") + .HasColumnType("datetime2"); + + b.Property("ExpertReport") + .HasColumnType("nvarchar(max)"); + + b.Property("File_Id") + .HasColumnType("bigint"); + + b.HasKey("id"); + + b.HasIndex("BoardType_Id"); + + b.HasIndex("File_Id"); + + b.ToTable("Boards", (string)null); + }); + + modelBuilder.Entity("Company.Domain.BoardType.BoardType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Title") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("BoardTypes", (string)null); + }); + + modelBuilder.Entity("Company.Domain.ChapterAgg.EntityChapter", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("Chapter") + .IsRequired() + .HasMaxLength(60) + .HasColumnType("nvarchar(60)"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("IsActiveString") + .HasColumnType("nvarchar(max)"); + + b.Property("Subtitle_Id") + .HasColumnType("bigint"); + + b.HasKey("id"); + + b.HasIndex("Subtitle_Id"); + + b.ToTable("TextManager_Chapter", (string)null); + }); + + modelBuilder.Entity("Company.Domain.CheckoutAgg.Checkout", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("AbsenceDeduction") + .HasColumnType("float"); + + b.Property("AbsencePeriod") + .HasColumnType("float"); + + b.Property("ArchiveCode") + .HasMaxLength(15) + .HasColumnType("nvarchar(15)"); + + b.Property("AverageHoursPerDay") + .HasColumnType("float"); + + b.Property("BaseYearsPay") + .HasColumnType("float"); + + b.Property("BonusesPay") + .HasColumnType("float"); + + b.Property("ConsumableItems") + .HasColumnType("float"); + + b.Property("ContractEnd") + .HasColumnType("datetime2"); + + b.Property("ContractId") + .HasColumnType("bigint"); + + b.Property("ContractNo") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ContractStart") + .HasColumnType("datetime2"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("CreditLeaves") + .HasColumnType("float"); + + b.Property("DateOfBirth") + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.Property("EmployeeFullName") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("EmployeeId") + .HasColumnType("bigint"); + + b.Property("FamilyAllowance") + .HasColumnType("float"); + + b.Property("FathersName") + .HasMaxLength(20) + .HasColumnType("nvarchar(20)"); + + b.Property("FridayPay") + .HasColumnType("float"); + + b.Property("HasRollCall") + .HasColumnType("bit"); + + b.Property("HousingAllowance") + .HasColumnType("float"); + + b.Property("InstallmentDeduction") + .HasColumnType("float"); + + b.Property("InsuranceDeduction") + .HasColumnType("float"); + + b.Property("IsActiveString") + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.Property("LeaveCheckout") + .HasColumnType("bit"); + + b.Property("LeavePay") + .HasColumnType("float"); + + b.Property("MarriedAllowance") + .HasColumnType("float"); + + b.Property("MissionPay") + .HasColumnType("float"); + + b.Property("Month") + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.Property("MonthlySalary") + .HasColumnType("float"); + + b.Property("NationalCode") + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.Property("NightworkPay") + .HasColumnType("float"); + + b.Property("OvertimePay") + .HasColumnType("float"); + + b.Property("PersonnelCode") + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.Property("RewardPay") + .HasColumnType("float"); + + b.Property("SalaryAidDeduction") + .HasColumnType("float"); + + b.Property("ShiftPay") + .HasColumnType("float"); + + b.Property("Signature") + .HasMaxLength(20) + .HasColumnType("nvarchar(20)"); + + b.Property("SumOfWorkingDays") + .HasMaxLength(6) + .HasColumnType("nvarchar(6)"); + + b.Property("TaxDeducation") + .HasColumnType("float"); + + b.Property("TotalClaims") + .HasMaxLength(25) + .HasColumnType("nvarchar(25)"); + + b.Property("TotalDeductions") + .HasMaxLength(25) + .HasColumnType("nvarchar(25)"); + + b.Property("TotalPayment") + .HasColumnType("float"); + + b.Property("WorkingHoursId") + .HasColumnType("bigint"); + + b.Property("WorkshopId") + .HasColumnType("bigint"); + + b.Property("WorkshopName") + .HasMaxLength(70) + .HasColumnType("nvarchar(70)"); + + b.Property("Year") + .HasMaxLength(4) + .HasColumnType("nvarchar(4)"); + + b.Property("YearsPay") + .HasColumnType("float"); + + b.HasKey("id"); + + b.HasIndex("WorkshopId"); + + b.ToTable("Checkouts", (string)null); + }); + + modelBuilder.Entity("Company.Domain.ClassifiedSalaryAgg.ClassifiedSalary", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("EndDate") + .HasColumnType("datetime2"); + + b.Property("Group1") + .HasColumnType("float"); + + b.Property("Group10") + .HasColumnType("float"); + + b.Property("Group11") + .HasColumnType("float"); + + b.Property("Group12") + .HasColumnType("float"); + + b.Property("Group13") + .HasColumnType("float"); + + b.Property("Group14") + .HasColumnType("float"); + + b.Property("Group15") + .HasColumnType("float"); + + b.Property("Group16") + .HasColumnType("float"); + + b.Property("Group17") + .HasColumnType("float"); + + b.Property("Group18") + .HasColumnType("float"); + + b.Property("Group19") + .HasColumnType("float"); + + b.Property("Group2") + .HasColumnType("float"); + + b.Property("Group20") + .HasColumnType("float"); + + b.Property("Group3") + .HasColumnType("float"); + + b.Property("Group4") + .HasColumnType("float"); + + b.Property("Group5") + .HasColumnType("float"); + + b.Property("Group6") + .HasColumnType("float"); + + b.Property("Group7") + .HasColumnType("float"); + + b.Property("Group8") + .HasColumnType("float"); + + b.Property("Group9") + .HasColumnType("float"); + + b.Property("StartDate") + .HasColumnType("datetime2"); + + b.Property("Year") + .HasColumnType("int"); + + b.HasKey("id"); + + b.ToTable("ClassifiedSalaries", (string)null); + }); + + modelBuilder.Entity("Company.Domain.ClientEmployeeWorkshopAgg.ClientEmployeeWorkshop", b => + { + b.Property("WorkshopId") + .HasColumnType("bigint"); + + b.Property("EmployeeId") + .HasColumnType("bigint"); + + b.HasKey("WorkshopId", "EmployeeId"); + + b.HasIndex("EmployeeId"); + + b.ToTable("ClientWorkshopEmployee", (string)null); + }); + + modelBuilder.Entity("Company.Domain.Contact2Agg.EntityContact", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("IsActiveString") + .HasColumnType("nvarchar(max)"); + + b.Property("NameContact") + .HasColumnType("nvarchar(max)"); + + b.Property("Signature") + .HasColumnType("nvarchar(max)"); + + b.HasKey("id"); + + b.ToTable("TextManager_Contact", (string)null); + }); + + modelBuilder.Entity("Company.Domain.ContarctingPartyAgg.PersonalContractingParty", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("Address") + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("AgentPhone") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ArchiveCode") + .HasColumnType("int"); + + b.Property("BlockTimes") + .HasColumnType("int"); + + b.Property("City") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("FName") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("IdNumber") + .HasMaxLength(20) + .HasColumnType("nvarchar(20)"); + + b.Property("IsActiveString") + .HasMaxLength(5) + .HasColumnType("nvarchar(5)"); + + b.Property("IsBlock") + .HasMaxLength(5) + .HasColumnType("nvarchar(5)"); + + b.Property("IsLegal") + .IsRequired() + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.Property("LName") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("NationalId") + .IsRequired() + .HasMaxLength(15) + .HasColumnType("nvarchar(15)"); + + b.Property("Nationalcode") + .IsRequired() + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.Property("Phone") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("RegisterId") + .IsRequired() + .HasMaxLength(15) + .HasColumnType("nvarchar(15)"); + + b.Property("RepresentativeFullName") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("RepresentativeId") + .HasColumnType("bigint"); + + b.Property("State") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("SureName") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Zone") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.HasKey("id"); + + b.HasIndex("RepresentativeId"); + + b.ToTable("PersonalContractingParties", (string)null); + }); + + modelBuilder.Entity("Company.Domain.ContractAgg.Contract", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("AgreementSalary") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ArchiveCode") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("ConsumableItems") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ContarctStart") + .HasColumnType("datetime2"); + + b.Property("ContractEnd") + .HasColumnType("datetime2"); + + b.Property("ContractNo") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("ContractPeriod") + .HasMaxLength(2) + .HasColumnType("nvarchar(2)"); + + b.Property("ContractType") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("nvarchar(20)"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("DayliWage") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("EmployeeId") + .HasColumnType("bigint"); + + b.Property("EmployerId") + .HasColumnType("bigint"); + + b.Property("FamilyAllowance") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("GetWorkDate") + .HasColumnType("datetime2"); + + b.Property("HousingAllowance") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("IsActiveString") + .IsRequired() + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.Property("JobType") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("JobTypeId") + .HasColumnType("bigint"); + + b.Property("MandatoryHoursid") + .HasColumnType("bigint"); + + b.Property("PersonnelCode") + .HasColumnType("bigint"); + + b.Property("SetContractDate") + .HasColumnType("datetime2"); + + b.Property("Signature") + .HasMaxLength(1) + .HasColumnType("nvarchar(1)"); + + b.Property("WorkingHoursWeekly") + .IsRequired() + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.Property("WorkshopAddress1") + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("WorkshopAddress2") + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("WorkshopIds") + .HasColumnType("bigint"); + + b.Property("YearlySalaryId") + .HasColumnType("bigint"); + + b.HasKey("id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("EmployerId"); + + b.HasIndex("JobTypeId"); + + b.HasIndex("MandatoryHoursid"); + + b.HasIndex("WorkshopIds"); + + b.HasIndex("YearlySalaryId"); + + b.ToTable("Contracts", (string)null); + }); + + modelBuilder.Entity("Company.Domain.ContractingPartyAccountAgg.ContractingPartyAccount", b => + { + b.Property("PersonalContractingPartyId") + .HasColumnType("bigint"); + + b.Property("AccountId") + .HasColumnType("bigint"); + + b.HasKey("PersonalContractingPartyId", "AccountId"); + + b.ToTable("ContractingPartyAccount", (string)null); + }); + + modelBuilder.Entity("Company.Domain.CrossJobAgg.CrossJob", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("CrossJobGuildId") + .HasColumnType("bigint"); + + b.Property("EquivalentRialOver") + .HasColumnType("bigint"); + + b.Property("EquivalentRialUnder") + .HasColumnType("bigint"); + + b.Property("SalaryRatioOver") + .HasColumnType("float"); + + b.Property("SalaryRatioUnder") + .HasColumnType("float"); + + b.HasKey("id"); + + b.HasIndex("CrossJobGuildId"); + + b.ToTable("CrossJobs", (string)null); + }); + + modelBuilder.Entity("Company.Domain.CrossJobGuildAgg.CrossJobGuild", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("EconomicCode") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("Year") + .HasMaxLength(4) + .HasColumnType("int"); + + b.HasKey("id"); + + b.ToTable("CrossJobGuilds", (string)null); + }); + + modelBuilder.Entity("Company.Domain.CrossJobItemsAgg.CrossJobItems", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("CrossJobId") + .HasColumnType("bigint"); + + b.Property("JobId") + .HasColumnType("bigint"); + + b.HasKey("id"); + + b.HasIndex("CrossJobId"); + + b.HasIndex("JobId"); + + b.ToTable("CrossJobItems", (string)null); + }); + + modelBuilder.Entity("Company.Domain.CustomizeCheckoutAgg.CustomizeCheckout", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("BaseYearsPay") + .HasColumnType("float"); + + b.Property("BonusesPay") + .HasColumnType("float"); + + b.Property("ContractEnd") + .HasColumnType("datetime2"); + + b.Property("ContractId") + .HasColumnType("bigint"); + + b.Property("ContractNo") + .HasMaxLength(20) + .HasColumnType("nvarchar(20)"); + + b.Property("ContractStart") + .HasColumnType("datetime2"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("EarlyExitDeduction") + .HasColumnType("float"); + + b.Property("EmployeeId") + .HasColumnType("bigint"); + + b.Property("FamilyAllowance") + .HasColumnType("float"); + + b.Property("FineAbsenceDeduction") + .HasColumnType("float"); + + b.Property("FineDeduction") + .HasColumnType("float"); + + b.Property("FridayPay") + .HasColumnType("float"); + + b.Property("InstallmentDeduction") + .HasColumnType("float"); + + b.Property("InsuranceDeduction") + .HasColumnType("float"); + + b.Property("LateToWorkDeduction") + .HasColumnType("float"); + + b.Property("LeavePay") + .HasColumnType("float"); + + b.Property("MarriedAllowance") + .HasColumnType("float"); + + b.Property("MonthInt") + .HasColumnType("int"); + + b.Property("MonthlySalary") + .HasColumnType("float"); + + b.Property("NightWorkPay") + .HasColumnType("float"); + + b.Property("OverTimePay") + .HasColumnType("float"); + + b.Property("RewardPay") + .HasColumnType("float"); + + b.Property("SalaryAidDeduction") + .HasColumnType("float"); + + b.Property("ShiftPay") + .HasColumnType("float"); + + b.Property("SumOfWorkingDays") + .HasColumnType("nvarchar(max)"); + + b.Property("TaxDeduction") + .HasColumnType("float"); + + b.Property("TotalClaims") + .HasColumnType("nvarchar(max)"); + + b.Property("TotalDeductions") + .HasColumnType("nvarchar(max)"); + + b.Property("TotalPayment") + .HasColumnType("float"); + + b.Property("WorkshopId") + .HasColumnType("bigint"); + + b.Property("YearInt") + .HasColumnType("int"); + + b.HasKey("id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("WorkshopId"); + + b.ToTable("CustomizeCheckouts", (string)null); + }); + + modelBuilder.Entity("Company.Domain.CustomizeWorkshopEmployeeSettingsAgg.Entities.CustomizeWorkshopEmployeeSettings", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("CustomizeWorkshopGroupSettingId") + .HasColumnType("bigint"); + + b.Property("EmployeeId") + .HasColumnType("bigint"); + + b.Property("FridayWork") + .IsRequired() + .HasMaxLength(1) + .HasColumnType("nvarchar(1)"); + + b.Property("HolidayWork") + .IsRequired() + .HasMaxLength(1) + .HasColumnType("nvarchar(1)"); + + b.Property("IsSettingChanged") + .HasColumnType("bit"); + + b.Property("IsShiftChanged") + .HasColumnType("bit"); + + b.Property("Salary") + .HasColumnType("float"); + + b.Property("WorkshopId") + .HasColumnType("bigint"); + + b.Property("WorkshopShiftStatus") + .IsRequired() + .HasMaxLength(1) + .HasColumnType("nvarchar(1)"); + + b.HasKey("id"); + + b.HasIndex("CustomizeWorkshopGroupSettingId"); + + b.ToTable("CustomizeWorkshopEmployeeSettings", (string)null); + }); + + modelBuilder.Entity("Company.Domain.CustomizeWorkshopGroupSettingsAgg.Entities.CustomizeWorkshopGroupSettings", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("CustomizeWorkshopSettingId") + .HasColumnType("bigint"); + + b.Property("FridayWork") + .IsRequired() + .HasMaxLength(1) + .HasColumnType("nvarchar(1)"); + + b.Property("GroupName") + .HasMaxLength(120) + .HasColumnType("nvarchar(120)"); + + b.Property("HolidayWork") + .IsRequired() + .HasMaxLength(1) + .HasColumnType("nvarchar(1)"); + + b.Property("IsSettingChange") + .HasColumnType("bit"); + + b.Property("IsShiftChange") + .HasColumnType("bit"); + + b.Property("MainGroup") + .HasColumnType("bit"); + + b.Property("Salary") + .HasColumnType("float"); + + b.Property("WorkshopShiftStatus") + .IsRequired() + .HasMaxLength(1) + .HasColumnType("nvarchar(1)"); + + b.HasKey("id"); + + b.HasIndex("CustomizeWorkshopSettingId"); + + b.ToTable("CustomizeWorkshopGroupSettings", (string)null); + }); + + modelBuilder.Entity("Company.Domain.CustomizeWorkshopSettingsAgg.Entities.CustomizeWorkshopSettings", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("BaseYearsPayInEndOfYear") + .IsRequired() + .HasMaxLength(1) + .HasColumnType("nvarchar(1)"); + + b.Property("BonusesPaysInEndOfMonth") + .IsRequired() + .HasMaxLength(1) + .HasColumnType("nvarchar(1)"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("Currency") + .HasColumnType("int"); + + b.Property("EndTimeOffSet") + .HasColumnType("time"); + + b.Property("FridayWork") + .IsRequired() + .HasMaxLength(1) + .HasColumnType("nvarchar(1)"); + + b.Property("HolidayWork") + .IsRequired() + .HasMaxLength(1) + .HasColumnType("nvarchar(1)"); + + b.Property("LeavePermittedDays") + .HasColumnType("int"); + + b.Property("MaxMonthDays") + .HasColumnType("int"); + + b.Property("OverTimeThresholdMinute") + .HasColumnType("int"); + + b.Property("WorkshopId") + .HasColumnType("bigint"); + + b.Property("WorkshopShiftStatus") + .IsRequired() + .HasMaxLength(1) + .HasColumnType("nvarchar(1)"); + + b.HasKey("id"); + + b.HasIndex("WorkshopId") + .IsUnique(); + + b.ToTable("CustomizeWorkshopSettings", (string)null); + }); + + modelBuilder.Entity("Company.Domain.DateSalaryAgg.DateSalary", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("EndDateFa") + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.Property("EndDateGr") + .HasColumnType("datetime2"); + + b.Property("StartDateFa") + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.Property("StartDateGr") + .HasColumnType("datetime2"); + + b.Property("Year") + .HasMaxLength(4) + .HasColumnType("nvarchar(4)"); + + b.HasKey("id"); + + b.ToTable("DateSalaries", (string)null); + }); + + modelBuilder.Entity("Company.Domain.DateSalaryItemAgg.DateSalaryItem", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("DateSalaryId") + .HasColumnType("bigint"); + + b.Property("Percent") + .HasColumnType("float"); + + b.Property("PercentageId") + .HasColumnType("bigint"); + + b.Property("Salary") + .HasColumnType("float"); + + b.HasKey("id"); + + b.HasIndex("DateSalaryId"); + + b.HasIndex("PercentageId"); + + b.ToTable("DateSalaryItems", (string)null); + }); + + modelBuilder.Entity("Company.Domain.EmployeeAccountAgg.EmployeeAccount", b => + { + b.Property("EmployeeId") + .HasColumnType("bigint"); + + b.Property("AccountId") + .HasColumnType("bigint"); + + b.HasKey("EmployeeId", "AccountId"); + + b.ToTable("EmployeeAccounts", (string)null); + }); + + modelBuilder.Entity("Company.Domain.EmployeeAgg.Employee", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("Address") + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("BankBranch") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("BankCardNumber") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("City") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("DateOfBirth") + .HasColumnType("datetime2"); + + b.Property("DateOfIssue") + .HasColumnType("datetime2"); + + b.Property("EservicePassword") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("EserviceUserName") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("FName") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("FatherName") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("FieldOfStudy") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("Gender") + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.Property("IdNumber") + .HasMaxLength(20) + .HasColumnType("nvarchar(20)"); + + b.Property("InsuranceCode") + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.Property("InsuranceHistoryByMonth") + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.Property("InsuranceHistoryByYear") + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.Property("IsActive") + .HasColumnType("bit"); + + b.Property("IsActiveString") + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.Property("LName") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("LevelOfEducation") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("MaritalStatus") + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.Property("MclsPassword") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("MclsUserName") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("MilitaryService") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("NationalCode") + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.Property("Nationality") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("NumberOfChildren") + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.Property("OfficePhone") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Phone") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("PlaceOfIssue") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("SanaPassword") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("SanaUserName") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("State") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("TaxOfficeUserName") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("TaxOfficepassword") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("id"); + + b.ToTable("Employees", (string)null); + }); + + modelBuilder.Entity("Company.Domain.EmployeeChildrenAgg.EmployeeChildren", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("DateOfBirth") + .HasColumnType("datetime2"); + + b.Property("EmployeeId") + .HasColumnType("bigint"); + + b.Property("FName") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("ParentNationalCode") + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.HasKey("id"); + + b.HasIndex("EmployeeId"); + + b.ToTable("EmployeeChildren", (string)null); + }); + + modelBuilder.Entity("Company.Domain.EmployeeComputeOptionsAgg.EmployeeComputeOptions", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("BonusesOptions") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ComputeOptions") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("EmployeeId") + .HasColumnType("bigint"); + + b.Property("WorkshopId") + .HasColumnType("bigint"); + + b.Property("YearsOptions") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.HasKey("id"); + + b.ToTable("EmployeeComputeOptions", (string)null); + }); + + modelBuilder.Entity("Company.Domain.EmployeeInsurancListDataAgg.EmployeeInsurancListData", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("BenefitsIncludedContinuous") + .HasColumnType("float"); + + b.Property("BenefitsIncludedNonContinuous") + .HasColumnType("float"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("DailyWage") + .HasColumnType("float"); + + b.Property("EmployeeId") + .HasColumnType("bigint"); + + b.Property("IncludeStatus") + .HasColumnType("bit"); + + b.Property("InsuranceListId") + .HasColumnType("bigint"); + + b.Property("InsuranceShare") + .HasColumnType("float"); + + b.Property("JobId") + .HasColumnType("bigint"); + + b.Property("LeftWorkDate") + .HasColumnType("datetime2(7)"); + + b.Property("MonthlyBenefits") + .HasColumnType("float"); + + b.Property("MonthlyBenefitsIncluded") + .HasColumnType("float"); + + b.Property("MonthlySalary") + .HasColumnType("float"); + + b.Property("StartWorkDate") + .HasColumnType("datetime2"); + + b.Property("WorkingDays") + .HasColumnType("int"); + + b.HasKey("id"); + + b.ToTable("EmployeeInsurancListData", (string)null); + }); + + modelBuilder.Entity("Company.Domain.EmployeeInsuranceRecordAgg.EmployeeInsuranceRecord", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("DateOfEnd") + .HasColumnType("datetime2"); + + b.Property("DateOfStart") + .HasColumnType("datetime2"); + + b.Property("EmployeeId") + .HasColumnType("bigint"); + + b.Property("WorkShopId") + .HasColumnType("bigint"); + + b.HasKey("id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("WorkShopId"); + + b.ToTable("EmployeeInsuranceRecord", (string)null); + }); + + modelBuilder.Entity("Company.Domain.EmployerAccountAgg.EmployerAccount", b => + { + b.Property("EmployerId") + .HasColumnType("bigint"); + + b.Property("AccountId") + .HasColumnType("bigint"); + + b.HasKey("EmployerId", "AccountId"); + + b.ToTable("EmployerAccounts", (string)null); + }); + + modelBuilder.Entity("Company.Domain.Evidence.Evidence", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("BoardType_Id") + .HasColumnType("int"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("File_Id") + .HasColumnType("bigint"); + + b.HasKey("id"); + + b.HasIndex("BoardType_Id"); + + b.HasIndex("File_Id"); + + b.ToTable("Evidences", (string)null); + }); + + modelBuilder.Entity("Company.Domain.EvidenceDetail.EvidenceDetail", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("Day") + .HasColumnType("nvarchar(max)"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("Evidence_Id") + .HasColumnType("bigint"); + + b.Property("FromDate") + .HasColumnType("datetime2"); + + b.Property("Title") + .HasColumnType("nvarchar(max)"); + + b.Property("ToDate") + .HasColumnType("datetime2"); + + b.HasKey("id"); + + b.HasIndex("Evidence_Id"); + + b.ToTable("EvidenceDetails", (string)null); + }); + + modelBuilder.Entity("Company.Domain.File1.File1", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("ArchiveNo") + .HasColumnType("bigint"); + + b.Property("Client") + .HasColumnType("int"); + + b.Property("ClientVisitDate") + .HasColumnType("datetime2"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("FileClass") + .HasColumnType("nvarchar(max)"); + + b.Property("HasMandate") + .HasColumnType("int"); + + b.Property("ProceederReference") + .HasColumnType("nvarchar(max)"); + + b.Property("Reqester") + .HasColumnType("bigint"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("Summoned") + .HasColumnType("bigint"); + + b.HasKey("id"); + + b.ToTable("Files", (string)null); + }); + + modelBuilder.Entity("Company.Domain.FileAlert.FileAlert", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("AdditionalDeadline") + .HasColumnType("int"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("FileState_Id") + .HasColumnType("bigint"); + + b.Property("File_Id") + .HasColumnType("bigint"); + + b.HasKey("id"); + + b.HasIndex("FileState_Id"); + + b.HasIndex("File_Id"); + + b.ToTable("File_Alerts", (string)null); + }); + + modelBuilder.Entity("Company.Domain.FileAndFileEmployerAgg.FileAndFileEmployer", b => + { + b.Property("FileId") + .HasColumnType("bigint"); + + b.Property("FileEmployerId") + .HasColumnType("bigint"); + + b.HasKey("FileId", "FileEmployerId"); + + b.HasIndex("FileEmployerId"); + + b.ToTable("FileAndFileEmployers", (string)null); + }); + + modelBuilder.Entity("Company.Domain.FileEmployeeAgg.FileEmployee", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("DateOfBirth") + .HasColumnType("datetime2"); + + b.Property("EservicePassword") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("EserviceUserName") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("FName") + .HasMaxLength(25) + .HasColumnType("nvarchar(25)"); + + b.Property("FatherName") + .HasMaxLength(25) + .HasColumnType("nvarchar(25)"); + + b.Property("FieldOfStudy") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Gender") + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.Property("IdNumber") + .HasMaxLength(15) + .HasColumnType("nvarchar(15)"); + + b.Property("InsuranceCode") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("IsActive") + .HasMaxLength(5) + .HasColumnType("nvarchar(5)"); + + b.Property("LName") + .HasMaxLength(25) + .HasColumnType("nvarchar(25)"); + + b.Property("LevelOfEducation") + .HasMaxLength(15) + .HasColumnType("nvarchar(15)"); + + b.Property("MaritalStatus") + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.Property("MclsPassword") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("MclsUserName") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("NationalCode") + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.Property("OfficePhone") + .HasMaxLength(30) + .HasColumnType("nvarchar(30)"); + + b.Property("Phone") + .HasMaxLength(30) + .HasColumnType("nvarchar(30)"); + + b.Property("RepresentativeFullName") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("RepresentativeId") + .HasColumnType("bigint"); + + b.Property("SanaPassword") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("SanaUserName") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("TaxOfficeUserName") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("TaxOfficepassword") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("id"); + + b.HasIndex("RepresentativeId"); + + b.ToTable("FileEmployee", (string)null); + }); + + modelBuilder.Entity("Company.Domain.FileEmployerAgg.FileEmployer", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("DateOfBirth") + .HasColumnType("datetime2"); + + b.Property("EservicePassword") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("EserviceUserName") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("FName") + .HasMaxLength(25) + .HasColumnType("nvarchar(25)"); + + b.Property("FieldOfStudy") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("FullName") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Gender") + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.Property("IdNumber") + .HasMaxLength(15) + .HasColumnType("nvarchar(15)"); + + b.Property("InsuranceWorkshopCode") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("IsActive") + .HasMaxLength(5) + .HasColumnType("nvarchar(5)"); + + b.Property("IsLegal") + .HasMaxLength(5) + .HasColumnType("nvarchar(5)"); + + b.Property("LName") + .HasMaxLength(25) + .HasColumnType("nvarchar(25)"); + + b.Property("LegalName") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("LevelOfEducation") + .HasMaxLength(15) + .HasColumnType("nvarchar(15)"); + + b.Property("MaritalStatus") + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.Property("MclsPassword") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("MclsUserName") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("NationalCode") + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.Property("NationalId") + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.Property("OfficePhone") + .HasMaxLength(30) + .HasColumnType("nvarchar(30)"); + + b.Property("Phone") + .HasMaxLength(30) + .HasColumnType("nvarchar(30)"); + + b.Property("RegisterId") + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.Property("RepresentativeFullName") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("RepresentativeId") + .HasColumnType("bigint"); + + b.Property("SanaPassword") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("SanaUserName") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("TaxOfficeUserName") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("TaxOfficepassword") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("id"); + + b.HasIndex("RepresentativeId"); + + b.ToTable("FileEmployer", (string)null); + }); + + modelBuilder.Entity("Company.Domain.FileState.FileState", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("FileTiming_Id") + .HasColumnType("bigint"); + + b.Property("State") + .HasColumnType("int"); + + b.Property("Title") + .HasColumnType("nvarchar(max)"); + + b.HasKey("id"); + + b.HasIndex("FileTiming_Id"); + + b.ToTable("File_States", (string)null); + }); + + modelBuilder.Entity("Company.Domain.FileTiming.FileTiming", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("Deadline") + .HasColumnType("int"); + + b.Property("Tips") + .HasColumnType("nvarchar(max)"); + + b.Property("Title") + .HasColumnType("nvarchar(max)"); + + b.HasKey("id"); + + b.ToTable("File_Timings", (string)null); + }); + + modelBuilder.Entity("Company.Domain.FileTitle.FileTitle", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("Title") + .HasColumnType("nvarchar(max)"); + + b.Property("Type") + .HasColumnType("nvarchar(max)"); + + b.HasKey("id"); + + b.ToTable("File_Titles", (string)null); + }); + + modelBuilder.Entity("Company.Domain.FinancialStatmentAgg.FinancialStatment", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("ContractingPartyId") + .HasColumnType("bigint"); + + b.Property("ContractingPartyName") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.HasKey("id"); + + b.ToTable("FinancialStatments", (string)null); + }); + + modelBuilder.Entity("Company.Domain.FinancialTransactionAgg.FinancialTransaction", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("Balance") + .HasColumnType("float"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("Creditor") + .HasColumnType("float"); + + b.Property("Deptor") + .HasColumnType("float"); + + b.Property("Description") + .HasMaxLength(600) + .HasColumnType("nvarchar(600)"); + + b.Property("DescriptionOption") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("FinancialStatementId") + .HasColumnType("bigint"); + + b.Property("MessageText") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("SentSms") + .HasColumnType("bit"); + + b.Property("SentSmsDateFa") + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.Property("TdateFa") + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.Property("TdateGr") + .HasColumnType("datetime2"); + + b.Property("TypeOfTransaction") + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.HasKey("id"); + + b.HasIndex("FinancialStatementId"); + + b.ToTable("FinancialTransactions", (string)null); + }); + + modelBuilder.Entity("Company.Domain.FineAgg.Fine", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("Amount") + .HasColumnType("float"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("EmployeeId") + .HasColumnType("bigint"); + + b.Property("FineDate") + .HasColumnType("datetime2"); + + b.Property("IsActive") + .IsRequired() + .HasMaxLength(1) + .HasColumnType("nvarchar(1)"); + + b.Property("Title") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("WorkshopId") + .HasColumnType("bigint"); + + b.HasKey("id"); + + b.ToTable("Fines", (string)null); + }); + + modelBuilder.Entity("Company.Domain.FineSubjectAgg.FineSubject", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("Amount") + .HasMaxLength(25) + .HasColumnType("nvarchar(25)"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("Title") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("WorkshopId") + .HasColumnType("bigint"); + + b.HasKey("id"); + + b.ToTable("FineSubjects", (string)null); + }); + + modelBuilder.Entity("Company.Domain.GroupPlanAgg.GroupPlan", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("AnnualSalary") + .HasColumnType("float"); + + b.Property("BaseSalary") + .HasColumnType("float"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("GroupNo") + .HasMaxLength(2) + .HasColumnType("nvarchar(2)"); + + b.Property("JobSalary") + .HasColumnType("float"); + + b.Property("WorkshopId") + .HasColumnType("bigint"); + + b.Property("WorkshopPlanId") + .HasColumnType("bigint"); + + b.HasKey("id"); + + b.HasIndex("WorkshopPlanId"); + + b.ToTable("GroupPlans", (string)null); + }); + + modelBuilder.Entity("Company.Domain.GroupPlanJobItemAgg.GroupPlanJobItem", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("GroupNo") + .HasMaxLength(2) + .HasColumnType("nvarchar(2)"); + + b.Property("GroupPlanId") + .HasColumnType("bigint"); + + b.Property("JobId") + .HasColumnType("bigint"); + + b.Property("JobName") + .HasMaxLength(150) + .HasColumnType("nvarchar(150)"); + + b.Property("WorkshopId") + .HasColumnType("bigint"); + + b.Property("WorkshopPlanId") + .HasColumnType("bigint"); + + b.HasKey("id"); + + b.HasIndex("GroupPlanId"); + + b.ToTable("GroupPlanJobItems", (string)null); + }); + + modelBuilder.Entity("Company.Domain.HolidayAgg.Holiday", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("Year") + .HasMaxLength(4) + .HasColumnType("nvarchar(4)"); + + b.HasKey("id"); + + b.ToTable("Holidays", (string)null); + }); + + modelBuilder.Entity("Company.Domain.HolidayItemAgg.HolidayItem", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("HolidayId") + .HasColumnType("bigint"); + + b.Property("HolidayYear") + .HasMaxLength(4) + .HasColumnType("nvarchar(4)"); + + b.Property("Holidaydate") + .HasColumnType("datetime2"); + + b.HasKey("id"); + + b.HasIndex("HolidayId"); + + b.ToTable("Holidayitems", (string)null); + }); + + modelBuilder.Entity("Company.Domain.InstitutionContractAgg.InstitutionContract", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("Address") + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); + + b.Property("City") + .HasMaxLength(30) + .HasColumnType("nvarchar(30)"); + + b.Property("ContractAmount") + .HasColumnType("float"); + + b.Property("ContractDateFa") + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.Property("ContractDateGr") + .HasColumnType("datetime2"); + + b.Property("ContractEndFa") + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.Property("ContractEndGr") + .HasColumnType("datetime2"); + + b.Property("ContractNo") + .HasMaxLength(40) + .HasColumnType("nvarchar(40)"); + + b.Property("ContractStartFa") + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.Property("ContractStartGr") + .HasColumnType("datetime2"); + + b.Property("ContractingPartyId") + .HasColumnType("bigint"); + + b.Property("ContractingPartyName") + .HasMaxLength(80) + .HasColumnType("nvarchar(80)"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("DailyCompenseation") + .HasColumnType("float"); + + b.Property("Description") + .HasMaxLength(10000) + .HasColumnType("nvarchar(max)"); + + b.Property("EmployeeManualCount") + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.Property("ExtensionNo") + .HasColumnType("int"); + + b.Property("HasValueAddedTax") + .HasColumnType("nvarchar(max)"); + + b.Property("IsActiveString") + .HasMaxLength(5) + .HasColumnType("nvarchar(5)"); + + b.Property("Obligation") + .HasColumnType("float"); + + b.Property("OfficialCompany") + .HasMaxLength(12) + .HasColumnType("nvarchar(12)"); + + b.Property("RepresentativeId") + .HasColumnType("bigint"); + + b.Property("RepresentativeName") + .HasMaxLength(80) + .HasColumnType("nvarchar(80)"); + + b.Property("Signature") + .HasMaxLength(1) + .HasColumnType("nvarchar(1)"); + + b.Property("State") + .HasMaxLength(20) + .HasColumnType("nvarchar(20)"); + + b.Property("TotalAmount") + .HasColumnType("float"); + + b.Property("TypeOfContract") + .HasMaxLength(30) + .HasColumnType("nvarchar(30)"); + + b.Property("ValueAddedTax") + .HasColumnType("float"); + + b.Property("WorkshopManualCount") + .HasMaxLength(5) + .HasColumnType("nvarchar(5)"); + + b.HasKey("id"); + + b.ToTable("InstitutionContracts", (string)null); + }); + + modelBuilder.Entity("Company.Domain.InstitutionContractContactInfoAgg.InstitutionContractContactInfo", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("FnameLname") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("InstitutionContractId") + .HasColumnType("bigint"); + + b.Property("PhoneNumber") + .HasMaxLength(20) + .HasColumnType("nvarchar(20)"); + + b.Property("PhoneType") + .HasMaxLength(20) + .HasColumnType("nvarchar(20)"); + + b.Property("Position") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("SendSms") + .HasColumnType("bit"); + + b.HasKey("id"); + + b.HasIndex("InstitutionContractId"); + + b.ToTable("InstitutinContractContactInfo", (string)null); + }); + + modelBuilder.Entity("Company.Domain.InstitutionPlanAgg.InstitutionPlan", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("BaseContractAmont") + .HasColumnType("float"); + + b.Property("CountPerson") + .HasColumnType("int"); + + b.Property("FinalContractAmont") + .HasColumnType("float"); + + b.Property("IncreasePercentage") + .HasColumnType("float"); + + b.HasKey("id"); + + b.ToTable("InstitutionPlan", (string)null); + }); + + modelBuilder.Entity("Company.Domain.InsurancJobAgg.InsuranceJob", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("EconomicCode") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("InsuranceJobTitle") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Year") + .HasMaxLength(4) + .HasColumnType("nvarchar(4)"); + + b.Property("YearlySalaryId") + .HasColumnType("bigint"); + + b.HasKey("id"); + + b.ToTable("InsuranceJobs", (string)null); + }); + + modelBuilder.Entity("Company.Domain.InsurancWorkshopInfoAgg.InsuranceWorkshopInfo", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("Address") + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("AgreementNumber") + .HasMaxLength(5) + .HasColumnType("nvarchar(5)"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("EmployerName") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("InsuranceCode") + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.Property("ListNumber") + .HasMaxLength(30) + .HasColumnType("nvarchar(30)"); + + b.Property("WorkshopId") + .HasColumnType("bigint"); + + b.Property("WorkshopName") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("id"); + + b.HasIndex("WorkshopId") + .IsUnique(); + + b.ToTable("InsuranceWorkshopInformation", (string)null); + }); + + modelBuilder.Entity("Company.Domain.InsuranceAgg.Insurance", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("Address") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("EmployerStr") + .HasColumnType("nvarchar(max)"); + + b.Property("ListNumber") + .HasColumnType("nvarchar(max)"); + + b.Property("Month") + .HasMaxLength(2) + .HasColumnType("int"); + + b.Property("WorkShopId") + .HasColumnType("bigint"); + + b.Property("WorkShopStr") + .HasColumnType("nvarchar(max)"); + + b.Property("Year") + .HasMaxLength(4) + .HasColumnType("int"); + + b.HasKey("id"); + + b.HasIndex("WorkShopId"); + + b.ToTable("Insurances", (string)null); + }); + + modelBuilder.Entity("Company.Domain.InsuranceEmployeeInfoAgg.InsuranceEmployeeInfo", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("DateOfBirth") + .HasColumnType("datetime2"); + + b.Property("DateOfIssue") + .HasColumnType("datetime2"); + + b.Property("EmployeeId") + .HasColumnType("bigint"); + + b.Property("FName") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("FatherName") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Gender") + .HasMaxLength(5) + .HasColumnType("nvarchar(5)"); + + b.Property("IdNumber") + .HasMaxLength(15) + .HasColumnType("nvarchar(15)"); + + b.Property("InsuranceCode") + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.Property("LName") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("NationalCode") + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.Property("PlaceOfIssue") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("id"); + + b.HasIndex("EmployeeId") + .IsUnique(); + + b.ToTable("InsuranceEmployeeInformation", (string)null); + }); + + modelBuilder.Entity("Company.Domain.InsuranceJobAndJobsAgg.InsuranceJobAndJobs", b => + { + b.Property("JobId") + .HasColumnType("bigint"); + + b.Property("InsuranceJobItemId") + .HasColumnType("bigint"); + + b.HasKey("JobId", "InsuranceJobItemId"); + + b.HasIndex("InsuranceJobItemId"); + + b.ToTable("InsuranceJobAndJobs", (string)null); + }); + + modelBuilder.Entity("Company.Domain.InsuranceJobItemAgg.InsuranceJobItem", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("InsuranceJobId") + .HasColumnType("bigint"); + + b.Property("PercentageLessThan") + .HasColumnType("float"); + + b.Property("PercentageMoreThan") + .HasColumnType("float"); + + b.Property("SalaeyLessThan") + .HasColumnType("float"); + + b.Property("SalaryMoreThan") + .HasColumnType("float"); + + b.HasKey("id"); + + b.HasIndex("InsuranceJobId"); + + b.ToTable("InsuranceJobItems", (string)null); + }); + + modelBuilder.Entity("Company.Domain.InsuranceListAgg.InsuranceList", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("ConfirmSentlist") + .HasColumnType("bit"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("DifficultJobsInsuranc") + .HasColumnType("float"); + + b.Property("EmployerShare") + .HasColumnType("float"); + + b.Property("EndDate") + .HasColumnType("datetime2"); + + b.Property("Included") + .HasColumnType("float"); + + b.Property("IncludedAndNotIncluded") + .HasColumnType("float"); + + b.Property("InsuredShare") + .HasColumnType("float"); + + b.Property("Month") + .HasMaxLength(2) + .HasColumnType("nvarchar(2)"); + + b.Property("StartDate") + .HasColumnType("datetime2"); + + b.Property("SumOfBenefitsIncluded") + .HasColumnType("float"); + + b.Property("SumOfDailyWage") + .HasColumnType("float"); + + b.Property("SumOfEmployees") + .HasColumnType("int"); + + b.Property("SumOfSalaries") + .HasColumnType("float"); + + b.Property("SumOfWorkingDays") + .HasColumnType("int"); + + b.Property("UnEmploymentInsurance") + .HasColumnType("float"); + + b.Property("WorkshopId") + .HasColumnType("bigint"); + + b.Property("Year") + .HasMaxLength(4) + .HasColumnType("nvarchar(4)"); + + b.HasKey("id"); + + b.ToTable("InsuranceLists", (string)null); + }); + + modelBuilder.Entity("Company.Domain.InsuranceWorkshopAgg.InsuranceListWorkshop", b => + { + b.Property("InsurancListId") + .HasColumnType("bigint"); + + b.Property("WorkshopId") + .HasColumnType("bigint"); + + b.HasKey("InsurancListId", "WorkshopId"); + + b.HasIndex("WorkshopId"); + + b.ToTable("InsuranceListWorkshops", (string)null); + }); + + modelBuilder.Entity("Company.Domain.InsuranceYearlySalaryAgg.InsuranceYearlySalary", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("EndDate") + .HasColumnType("datetime2"); + + b.Property("Group1") + .HasColumnType("float"); + + b.Property("Group10") + .HasColumnType("float"); + + b.Property("Group11") + .HasColumnType("float"); + + b.Property("Group12") + .HasColumnType("float"); + + b.Property("Group13") + .HasColumnType("float"); + + b.Property("Group14") + .HasColumnType("float"); + + b.Property("Group15") + .HasColumnType("float"); + + b.Property("Group16") + .HasColumnType("float"); + + b.Property("Group17") + .HasColumnType("float"); + + b.Property("Group18") + .HasColumnType("float"); + + b.Property("Group19") + .HasColumnType("float"); + + b.Property("Group2") + .HasColumnType("float"); + + b.Property("Group20") + .HasColumnType("float"); + + b.Property("Group21") + .HasColumnType("float"); + + b.Property("Group22") + .HasColumnType("float"); + + b.Property("Group23") + .HasColumnType("float"); + + b.Property("Group24") + .HasColumnType("float"); + + b.Property("Group25") + .HasColumnType("float"); + + b.Property("Group26") + .HasColumnType("float"); + + b.Property("Group27") + .HasColumnType("float"); + + b.Property("Group28") + .HasColumnType("float"); + + b.Property("Group29") + .HasColumnType("float"); + + b.Property("Group3") + .HasColumnType("float"); + + b.Property("Group30") + .HasColumnType("float"); + + b.Property("Group4") + .HasColumnType("float"); + + b.Property("Group5") + .HasColumnType("float"); + + b.Property("Group6") + .HasColumnType("float"); + + b.Property("Group7") + .HasColumnType("float"); + + b.Property("Group8") + .HasColumnType("float"); + + b.Property("Group9") + .HasColumnType("float"); + + b.Property("StartDate") + .HasColumnType("datetime2"); + + b.Property("Year") + .HasColumnType("int"); + + b.HasKey("id"); + + b.ToTable("InsuranceYearlySalaries", (string)null); + }); + + modelBuilder.Entity("Company.Domain.JobAgg.Job", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("JobCode") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("JobName") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.HasKey("id"); + + b.ToTable("Jobs", (string)null); + }); + + modelBuilder.Entity("Company.Domain.LeaveAgg.Leave", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("Decription") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("EmployeeFullName") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("EmployeeId") + .HasColumnType("bigint"); + + b.Property("EndLeave") + .HasColumnType("datetime2"); + + b.Property("IsAccepted") + .HasColumnType("bit"); + + b.Property("LeaveHourses") + .HasMaxLength(5) + .HasColumnType("nvarchar(5)"); + + b.Property("LeaveType") + .HasMaxLength(25) + .HasColumnType("nvarchar(25)"); + + b.Property("Month") + .HasColumnType("int"); + + b.Property("PaidLeaveType") + .HasMaxLength(25) + .HasColumnType("nvarchar(25)"); + + b.Property("StartLeave") + .HasColumnType("datetime2"); + + b.Property("WorkshopId") + .HasColumnType("bigint"); + + b.Property("WorkshopName") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("Year") + .HasColumnType("int"); + + b.HasKey("id"); + + b.ToTable("Leave", (string)null); + }); + + modelBuilder.Entity("Company.Domain.LeftWorkAgg.LeftWork", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("AddBonusesPay") + .HasColumnType("bit"); + + b.Property("AddLeavePay") + .HasColumnType("bit"); + + b.Property("AddYearsPay") + .HasColumnType("bit"); + + b.Property("BonusesOptions") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ComputeOptions") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("EmployeeFullName") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("EmployeeId") + .HasColumnType("bigint"); + + b.Property("IncludeStatus") + .HasColumnType("bit"); + + b.Property("JobId") + .HasColumnType("bigint"); + + b.Property("LeftWorkDate") + .HasColumnType("datetime2"); + + b.Property("StartWorkDate") + .HasColumnType("datetime2"); + + b.Property("WorkshopId") + .HasColumnType("bigint"); + + b.Property("WorkshopName") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.HasKey("id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("WorkshopId"); + + b.ToTable("LeftWork", (string)null); + }); + + modelBuilder.Entity("Company.Domain.LeftWorkInsuranceAgg.LeftWorkInsurance", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("EmployeeFullName") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("EmployeeId") + .HasColumnType("bigint"); + + b.Property("IncludeStatus") + .HasColumnType("bit"); + + b.Property("JobId") + .HasColumnType("bigint"); + + b.Property("LeftWorkDate") + .HasColumnType("datetime2(7)"); + + b.Property("StartWorkDate") + .HasColumnType("datetime2"); + + b.Property("WorkshopId") + .HasColumnType("bigint"); + + b.Property("WorkshopName") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.HasKey("id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("WorkshopId"); + + b.ToTable("LeftWorkInsurances", (string)null); + }); + + modelBuilder.Entity("Company.Domain.LoanAgg.Entities.Loan", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("Amount") + .HasColumnType("float"); + + b.Property("AmountPerMonth") + .HasColumnType("float"); + + b.Property("Count") + .HasMaxLength(3) + .HasColumnType("nvarchar(3)"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("EmployeeId") + .HasColumnType("bigint"); + + b.Property("GetRounded") + .HasColumnType("bit"); + + b.Property("LoanGrantDate") + .HasColumnType("datetime2"); + + b.Property("StartInstallmentPayment") + .HasColumnType("datetime2"); + + b.Property("WorkshopId") + .HasColumnType("bigint"); + + b.HasKey("id"); + + b.ToTable("Loan", (string)null); + }); + + modelBuilder.Entity("Company.Domain.MandatoryHoursAgg.MandatoryHours", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("Aban") + .HasColumnType("float"); + + b.Property("AbanFridays") + .HasColumnType("int"); + + b.Property("AbanHolidays") + .HasColumnType("int"); + + b.Property("AbanMonadatoryDays") + .HasColumnType("int"); + + b.Property("Azar") + .HasColumnType("float"); + + b.Property("AzarFridays") + .HasColumnType("int"); + + b.Property("AzarHolidays") + .HasColumnType("int"); + + b.Property("AzarMonadatoryDays") + .HasColumnType("int"); + + b.Property("Bahman") + .HasColumnType("float"); + + b.Property("BahmanFridays") + .HasColumnType("int"); + + b.Property("BahmanHolidays") + .HasColumnType("int"); + + b.Property("BahmanMonadatoryDays") + .HasColumnType("int"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("Dey") + .HasColumnType("float"); + + b.Property("DeyFridays") + .HasColumnType("int"); + + b.Property("DeyHolidays") + .HasColumnType("int"); + + b.Property("DeyMonadatoryDays") + .HasColumnType("int"); + + b.Property("Esfand") + .HasColumnType("float"); + + b.Property("EsfandFridays") + .HasColumnType("int"); + + b.Property("EsfandHolidays") + .HasColumnType("int"); + + b.Property("EsfandMonadatoryDays") + .HasColumnType("int"); + + b.Property("Farvardin") + .HasColumnType("float"); + + b.Property("FarvardinFridays") + .HasColumnType("int"); + + b.Property("FarvardinHolidays") + .HasColumnType("int"); + + b.Property("FarvardinMonadatoryDays") + .HasColumnType("int"); + + b.Property("Khordad") + .HasColumnType("float"); + + b.Property("KhordadFridays") + .HasColumnType("int"); + + b.Property("KhordadHolidays") + .HasColumnType("int"); + + b.Property("KhordadMonadatoryDays") + .HasColumnType("int"); + + b.Property("Mehr") + .HasColumnType("float"); + + b.Property("MehrFridays") + .HasColumnType("int"); + + b.Property("MehrHolidays") + .HasColumnType("int"); + + b.Property("MehrMonadatoryDays") + .HasColumnType("int"); + + b.Property("Mordad") + .HasColumnType("float"); + + b.Property("MordadFridays") + .HasColumnType("int"); + + b.Property("MordadHolidays") + .HasColumnType("int"); + + b.Property("MordadMonadatoryDays") + .HasColumnType("int"); + + b.Property("Ordibehesht") + .HasColumnType("float"); + + b.Property("OrdibeheshtFridays") + .HasColumnType("int"); + + b.Property("OrdibeheshtHolidays") + .HasColumnType("int"); + + b.Property("OrdibeheshtMonadatoryDays") + .HasColumnType("int"); + + b.Property("Shahrivar") + .HasColumnType("float"); + + b.Property("ShahrivarFridays") + .HasColumnType("int"); + + b.Property("ShahrivarHolidays") + .HasColumnType("int"); + + b.Property("ShahrivarMonadatoryDays") + .HasColumnType("int"); + + b.Property("Tir") + .HasColumnType("float"); + + b.Property("TirFridays") + .HasColumnType("int"); + + b.Property("TirHolidays") + .HasColumnType("int"); + + b.Property("TirMonadatoryDays") + .HasColumnType("int"); + + b.Property("Year") + .HasMaxLength(4) + .HasColumnType("int"); + + b.HasKey("id"); + + b.ToTable("MandatoryHours", (string)null); + }); + + modelBuilder.Entity("Company.Domain.MasterPenaltyTitle.MasterPenaltyTitle", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("Day") + .HasColumnType("nvarchar(max)"); + + b.Property("FromDate") + .HasColumnType("datetime2"); + + b.Property("MasterPetition_Id") + .HasColumnType("bigint"); + + b.Property("PaidAmount") + .HasColumnType("nvarchar(max)"); + + b.Property("RemainingAmount") + .HasColumnType("nvarchar(max)"); + + b.Property("Title") + .HasColumnType("nvarchar(max)"); + + b.Property("ToDate") + .HasColumnType("datetime2"); + + b.HasKey("id"); + + b.HasIndex("MasterPetition_Id"); + + b.ToTable("Master_PenaltyTitles", (string)null); + }); + + modelBuilder.Entity("Company.Domain.MasterPetition.MasterPetition", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("BoardType_Id") + .HasColumnType("int"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("File_Id") + .HasColumnType("bigint"); + + b.Property("MasterName") + .HasColumnType("nvarchar(max)"); + + b.Property("WorkHistoryDescreption") + .HasColumnType("nvarchar(max)"); + + b.HasKey("id"); + + b.HasIndex("BoardType_Id"); + + b.HasIndex("File_Id"); + + b.ToTable("Master_Petitions", (string)null); + }); + + modelBuilder.Entity("Company.Domain.MasterWorkHistory.MasterWorkHistory", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("FromDate") + .HasColumnType("datetime2"); + + b.Property("MasterPetition_Id") + .HasColumnType("bigint"); + + b.Property("ToDate") + .HasColumnType("datetime2"); + + b.Property("WorkingHoursPerDay") + .HasColumnType("int"); + + b.Property("WorkingHoursPerWeek") + .HasColumnType("int"); + + b.HasKey("id"); + + b.HasIndex("MasterPetition_Id"); + + b.ToTable("Master_WorkHistories", (string)null); + }); + + modelBuilder.Entity("Company.Domain.ModuleAgg.EntityModule", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("IsActiveString") + .HasColumnType("nvarchar(max)"); + + b.Property("NameSubModule") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("id"); + + b.ToTable("TextManager_Module", (string)null); + }); + + modelBuilder.Entity("Company.Domain.ModuleTextManagerAgg.EntityModuleTextManager", b => + { + b.Property("TextManagerId") + .HasColumnType("bigint"); + + b.Property("ModuleId") + .HasColumnType("bigint"); + + b.HasKey("TextManagerId", "ModuleId"); + + b.HasIndex("ModuleId"); + + b.ToTable("TextManager_ModuleTextManager", (string)null); + }); + + modelBuilder.Entity("Company.Domain.OriginalTitleAgg.EntityOriginalTitle", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("IsActiveString") + .HasColumnType("nvarchar(max)"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(60) + .HasColumnType("nvarchar(60)"); + + b.HasKey("id"); + + b.ToTable("TextManager_OriginalTitle", (string)null); + }); + + modelBuilder.Entity("Company.Domain.PaymentToEmployeeAgg.PaymentToEmployee", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("EmployeeId") + .HasColumnType("bigint"); + + b.Property("Month") + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.Property("WorkshopId") + .HasColumnType("bigint"); + + b.Property("Year") + .HasMaxLength(4) + .HasColumnType("nvarchar(4)"); + + b.HasKey("id"); + + b.ToTable("PaymentToEmployees", (string)null); + }); + + modelBuilder.Entity("Company.Domain.PaymentToEmployeeItemAgg.PaymentToEmployeeItem", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("BankCheckNumber") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("CashDescription") + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("DestinationBankAccountNumber") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("DestinationBankName") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("EmployeeId") + .HasColumnType("bigint"); + + b.Property("PayDate") + .HasColumnType("datetime2"); + + b.Property("Payment") + .HasColumnType("float"); + + b.Property("PaymentMetod") + .HasMaxLength(25) + .HasColumnType("nvarchar(25)"); + + b.Property("PaymentTitle") + .HasMaxLength(150) + .HasColumnType("nvarchar(150)"); + + b.Property("PaymentToEmployeeId") + .HasColumnType("bigint"); + + b.Property("SourceBankAccountNumber") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("SourceBankName") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("TypeDestinationBankNumber") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("TypeSourceBankNumber") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("WorkshopId") + .HasColumnType("bigint"); + + b.HasKey("id"); + + b.HasIndex("PaymentToEmployeeId"); + + b.ToTable("PaymentToEmployeeItems", (string)null); + }); + + modelBuilder.Entity("Company.Domain.PenaltyTitle.PenaltyTitle", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("Day") + .HasColumnType("nvarchar(max)"); + + b.Property("FromDate") + .HasColumnType("datetime2(7)"); + + b.Property("PaidAmount") + .HasColumnType("nvarchar(max)"); + + b.Property("Petition_Id") + .HasColumnType("bigint"); + + b.Property("RemainingAmount") + .HasColumnType("nvarchar(max)"); + + b.Property("Title") + .HasColumnType("nvarchar(max)"); + + b.Property("ToDate") + .HasColumnType("datetime2(7)"); + + b.HasKey("id"); + + b.HasIndex("Petition_Id"); + + b.ToTable("PenaltyTitles", (string)null); + }); + + modelBuilder.Entity("Company.Domain.PercentageAgg.Percentage", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("Percent") + .HasColumnType("float"); + + b.HasKey("id"); + + b.ToTable("Percentages", (string)null); + }); + + modelBuilder.Entity("Company.Domain.PersonnelCodeAgg.PersonnelCodeDomain", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("EmployeeId") + .HasColumnType("bigint"); + + b.Property("PersonnelCode") + .HasColumnType("bigint"); + + b.Property("WorkshopId") + .HasColumnType("bigint"); + + b.HasKey("id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("WorkshopId"); + + b.ToTable("PersonnelCodes", (string)null); + }); + + modelBuilder.Entity("Company.Domain.Petition.Petition", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("BoardType_Id") + .HasColumnType("int"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("File_Id") + .HasColumnType("bigint"); + + b.Property("NotificationPetitionDate") + .HasColumnType("datetime2"); + + b.Property("PetitionIssuanceDate") + .HasColumnType("datetime2"); + + b.Property("PetitionNo") + .HasColumnType("nvarchar(max)"); + + b.Property("TotalPenalty") + .HasColumnType("nvarchar(max)"); + + b.Property("TotalPenaltyTitles") + .HasColumnType("nvarchar(max)"); + + b.Property("WorkHistoryDescreption") + .HasColumnType("nvarchar(max)"); + + b.HasKey("id"); + + b.HasIndex("BoardType_Id"); + + b.HasIndex("File_Id"); + + b.ToTable("Petitions", (string)null); + }); + + modelBuilder.Entity("Company.Domain.ProceedingSession.ProceedingSession", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("Board_Id") + .HasColumnType("bigint"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("Date") + .HasColumnType("datetime2"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("Time") + .HasColumnType("nvarchar(max)"); + + b.HasKey("id"); + + b.HasIndex("Board_Id"); + + b.ToTable("ProceedingSessions", (string)null); + }); + + modelBuilder.Entity("Company.Domain.RepresentativeAgg.Representative", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("Address") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("AgentPhone") + .HasMaxLength(20) + .HasColumnType("nvarchar(20)"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("FName") + .HasMaxLength(20) + .HasColumnType("nvarchar(20)"); + + b.Property("FullName") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("IdNumber") + .HasMaxLength(20) + .HasColumnType("nvarchar(20)"); + + b.Property("IsActive") + .HasMaxLength(5) + .HasColumnType("nvarchar(5)"); + + b.Property("IsLegal") + .HasMaxLength(5) + .HasColumnType("nvarchar(5)"); + + b.Property("LName") + .HasMaxLength(20) + .HasColumnType("nvarchar(20)"); + + b.Property("LegalName") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("NationalId") + .HasMaxLength(20) + .HasColumnType("nvarchar(20)"); + + b.Property("Nationalcode") + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.Property("Phone") + .HasMaxLength(20) + .HasColumnType("nvarchar(20)"); + + b.Property("RegisterId") + .HasMaxLength(20) + .HasColumnType("nvarchar(20)"); + + b.HasKey("id"); + + b.ToTable("Representative", (string)null); + }); + + modelBuilder.Entity("Company.Domain.RewardAgg.Reward", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("Amount") + .HasColumnType("float"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasColumnType("ntext"); + + b.Property("EmployeeId") + .HasColumnType("bigint"); + + b.Property("GrantDate") + .HasColumnType("datetime2"); + + b.Property("IsActive") + .IsRequired() + .HasMaxLength(1) + .HasColumnType("nvarchar(1)"); + + b.Property("RewardedByAccountId") + .HasColumnType("bigint"); + + b.Property("WorkshopId") + .HasColumnType("bigint"); + + b.HasKey("id"); + + b.ToTable("Rewards", (string)null); + }); + + modelBuilder.Entity("Company.Domain.RollCallAgg.RollCall", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("EmployeeFullName") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("EmployeeId") + .HasColumnType("bigint"); + + b.Property("EndDate") + .HasColumnType("datetime2"); + + b.Property("Month") + .HasColumnType("int"); + + b.Property("RollCallModifyType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("StartDate") + .HasColumnType("datetime2"); + + b.Property("WorkshopId") + .HasColumnType("bigint"); + + b.Property("Year") + .HasColumnType("int"); + + b.HasKey("id"); + + b.ToTable("RollCall", (string)null); + }); + + modelBuilder.Entity("Company.Domain.RollCallEmployeeAgg.RollCallEmployee", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("EmployeeFullName") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("EmployeeId") + .HasColumnType("bigint"); + + b.Property("FName") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("HasChangedName") + .HasColumnType("bit"); + + b.Property("HasUploadedImage") + .HasMaxLength(5) + .HasColumnType("nvarchar(5)"); + + b.Property("IsActiveString") + .HasMaxLength(5) + .HasColumnType("nvarchar(5)"); + + b.Property("LName") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("WorkshopId") + .HasColumnType("bigint"); + + b.HasKey("id"); + + b.ToTable("RollCallEmployees", (string)null); + }); + + modelBuilder.Entity("Company.Domain.RollCallEmployeeStatusAgg.RollCallEmployeeStatus", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("EndDate") + .HasColumnType("datetime2"); + + b.Property("RollCallEmployeeId") + .HasColumnType("bigint"); + + b.Property("StartDate") + .HasColumnType("datetime2"); + + b.HasKey("id"); + + b.HasIndex("RollCallEmployeeId"); + + b.ToTable("RollCallEmployeesStatus"); + }); + + modelBuilder.Entity("Company.Domain.RollCallPlanAgg.RollCallPlan", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("BaseAmont") + .HasColumnType("float"); + + b.Property("FinalAmont") + .HasColumnType("float"); + + b.Property("IncreasePercentage") + .HasColumnType("float"); + + b.Property("MaxPersonValid") + .HasColumnType("int"); + + b.HasKey("id"); + + b.ToTable("RollCallPlans", (string)null); + }); + + modelBuilder.Entity("Company.Domain.RollCallServiceAgg.RollCallService", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("AccountId") + .HasColumnType("bigint"); + + b.Property("Amount") + .HasColumnType("float"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("Duration") + .HasMaxLength(2) + .HasColumnType("nvarchar(2)"); + + b.Property("EndService") + .HasColumnType("datetime2"); + + b.Property("IsActiveString") + .HasMaxLength(5) + .HasColumnType("nvarchar(5)"); + + b.Property("MaxPersonValid") + .HasColumnType("int"); + + b.Property("ServiceType") + .HasMaxLength(20) + .HasColumnType("nvarchar(20)"); + + b.Property("StartService") + .HasColumnType("datetime2"); + + b.Property("WorkshopId") + .HasColumnType("bigint"); + + b.HasKey("id"); + + b.HasIndex("AccountId"); + + b.ToTable("RollCallServices", (string)null); + }); + + modelBuilder.Entity("Company.Domain.SalaryAidAgg.SalaryAid", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("Amount") + .HasColumnType("float"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("EmployeeId") + .HasColumnType("bigint"); + + b.Property("SalaryAidDateTime") + .HasColumnType("datetime2"); + + b.Property("WorkshopId") + .HasColumnType("bigint"); + + b.HasKey("id"); + + b.ToTable("SalaryAids", (string)null); + }); + + modelBuilder.Entity("Company.Domain.SmsResultAgg.SmsResult", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("ContractingPartyName") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ContractingPatyId") + .HasColumnType("bigint"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("InstitutionContractId") + .HasColumnType("bigint"); + + b.Property("MessageId") + .HasColumnType("int"); + + b.Property("Mobile") + .HasMaxLength(12) + .HasColumnType("nvarchar(12)"); + + b.Property("Status") + .HasMaxLength(30) + .HasColumnType("nvarchar(30)"); + + b.Property("TypeOfSms") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.HasKey("id"); + + b.ToTable("SmsResults", (string)null); + }); + + modelBuilder.Entity("Company.Domain.SubtitleAgg.EntitySubtitle", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("EntitySubtitleid") + .HasColumnType("bigint"); + + b.Property("IsActiveString") + .HasColumnType("nvarchar(max)"); + + b.Property("OriginalTitle_Id") + .HasColumnType("bigint"); + + b.Property("Subtitle") + .IsRequired() + .HasMaxLength(60) + .HasColumnType("nvarchar(60)"); + + b.HasKey("id"); + + b.HasIndex("EntitySubtitleid"); + + b.HasIndex("OriginalTitle_Id"); + + b.ToTable("TextManager_Subtitle", (string)null); + }); + + modelBuilder.Entity("Company.Domain.TaxJobCategoryAgg.TaxJobCategory", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("JobCategoryCode") + .HasMaxLength(5) + .HasColumnType("nvarchar(5)"); + + b.Property("JobCategoryName") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("id"); + + b.ToTable("TaxJobCategory", (string)null); + }); + + modelBuilder.Entity("Company.Domain.TaxLeftWorkCategoryAgg.TaxLeftWorkCategory", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("BudgetLawExceptions") + .HasMaxLength(3) + .HasColumnType("nvarchar(3)"); + + b.Property("Country") + .HasMaxLength(3) + .HasColumnType("nvarchar(3)"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("CurrencyType") + .HasMaxLength(3) + .HasColumnType("nvarchar(3)"); + + b.Property("EmployeeId") + .HasColumnType("bigint"); + + b.Property("EmployeeName") + .HasMaxLength(150) + .HasColumnType("nvarchar(150)"); + + b.Property("EmploymentLocationStatus") + .HasMaxLength(3) + .HasColumnType("nvarchar(3)"); + + b.Property("ExchangeRate") + .HasMaxLength(3) + .HasColumnType("nvarchar(3)"); + + b.Property("InsuranceBranch") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("InsuranceName") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("JobCategoryCode") + .HasMaxLength(3) + .HasColumnType("nvarchar(3)"); + + b.Property("JobCategoryId") + .HasColumnType("bigint"); + + b.Property("JobTitle") + .HasMaxLength(150) + .HasColumnType("nvarchar(150)"); + + b.Property("PaymentType") + .HasMaxLength(3) + .HasColumnType("nvarchar(3)"); + + b.Property("RetirementDate") + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.Property("TaxExempt") + .HasMaxLength(3) + .HasColumnType("nvarchar(3)"); + + b.Property("TypeOfEmployment") + .HasMaxLength(3) + .HasColumnType("nvarchar(3)"); + + b.Property("TypeOfInsurance") + .HasMaxLength(3) + .HasColumnType("nvarchar(3)"); + + b.Property("WorkshopId") + .HasColumnType("bigint"); + + b.Property("WorkshopName") + .HasMaxLength(150) + .HasColumnType("nvarchar(150)"); + + b.HasKey("id"); + + b.HasIndex("WorkshopId"); + + b.ToTable("TaxLeftWorkCategory", (string)null); + }); + + modelBuilder.Entity("Company.Domain.TaxLeftWorkItemAgg.TaxLeftWorkItem", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("LeftWork") + .HasColumnType("datetime2"); + + b.Property("StartWork") + .HasColumnType("datetime2"); + + b.Property("TaxLeftWorkCategoryId") + .HasColumnType("bigint"); + + b.HasKey("id"); + + b.HasIndex("TaxLeftWorkCategoryId"); + + b.ToTable("TaxLeftWorkItem", (string)null); + }); + + modelBuilder.Entity("Company.Domain.TextManagerAgg.EntityTextManager", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("Chapter_Id") + .HasColumnType("bigint"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("DateTextManager") + .HasColumnType("nvarchar(max)"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("IsActiveString") + .HasColumnType("nvarchar(max)"); + + b.Property("NoteNumber") + .HasColumnType("nvarchar(max)"); + + b.Property("NumberTextManager") + .HasColumnType("nvarchar(max)"); + + b.Property("OriginalTitle_Id") + .HasColumnType("bigint"); + + b.Property("Paragraph") + .HasColumnType("nvarchar(max)"); + + b.Property("SubjectTextManager") + .HasColumnType("nvarchar(max)"); + + b.Property("Subtitle_Id") + .HasColumnType("bigint"); + + b.HasKey("id"); + + b.ToTable("TextManager_TextManager", (string)null); + }); + + modelBuilder.Entity("Company.Domain.WorkHistory.WorkHistory", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("FromDate") + .HasColumnType("datetime2"); + + b.Property("Petition_Id") + .HasColumnType("bigint"); + + b.Property("ToDate") + .HasColumnType("datetime2"); + + b.Property("WorkingHoursPerDay") + .HasColumnType("int"); + + b.Property("WorkingHoursPerWeek") + .HasColumnType("int"); + + b.HasKey("id"); + + b.HasIndex("Petition_Id"); + + b.ToTable("WorkHistories", (string)null); + }); + + modelBuilder.Entity("Company.Domain.WorkingHoursAgg.WorkingHours", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("ContractId") + .HasColumnType("bigint"); + + b.Property("ContractNo") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("NumberOfFriday") + .HasMaxLength(15) + .HasColumnType("nvarchar(15)"); + + b.Property("NumberOfWorkingDays") + .HasMaxLength(15) + .HasColumnType("nvarchar(15)"); + + b.Property("OverNightWorkH") + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.Property("OverNightWorkM") + .HasMaxLength(2) + .HasColumnType("nvarchar(2)"); + + b.Property("OverTimeWorkH") + .HasMaxLength(15) + .HasColumnType("nvarchar(15)"); + + b.Property("OverTimeWorkM") + .HasMaxLength(2) + .HasColumnType("nvarchar(2)"); + + b.Property("ShiftWork") + .HasMaxLength(2) + .HasColumnType("nvarchar(2)"); + + b.Property("TotalHoursesH") + .HasMaxLength(15) + .HasColumnType("nvarchar(15)"); + + b.Property("TotalHoursesM") + .HasMaxLength(2) + .HasColumnType("nvarchar(2)"); + + b.Property("WeeklyWorkingTime") + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.HasKey("id"); + + b.HasIndex("ContractId"); + + b.ToTable("WorkingHours", (string)null); + }); + + modelBuilder.Entity("Company.Domain.WorkingHoursItemsAgg.WorkingHoursItems", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("ComplexEnd") + .HasMaxLength(5) + .HasColumnType("nvarchar(5)"); + + b.Property("ComplexStart") + .HasMaxLength(5) + .HasColumnType("nvarchar(5)"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("DayOfWork") + .HasMaxLength(1) + .HasColumnType("nvarchar(1)"); + + b.Property("End1") + .HasMaxLength(5) + .HasColumnType("nvarchar(5)"); + + b.Property("End2") + .HasMaxLength(5) + .HasColumnType("nvarchar(5)"); + + b.Property("End3") + .HasMaxLength(5) + .HasColumnType("nvarchar(5)"); + + b.Property("RestTime") + .HasMaxLength(5) + .HasColumnType("nvarchar(5)"); + + b.Property("Start1") + .HasMaxLength(5) + .HasColumnType("nvarchar(5)"); + + b.Property("Start2") + .HasMaxLength(5) + .HasColumnType("nvarchar(5)"); + + b.Property("Start3") + .HasMaxLength(5) + .HasColumnType("nvarchar(5)"); + + b.Property("WeekNumber") + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.Property("WorkingHoursId") + .HasColumnType("bigint"); + + b.HasKey("id"); + + b.HasIndex("WorkingHoursId"); + + b.ToTable("WorkingHoursItems", (string)null); + }); + + modelBuilder.Entity("Company.Domain.WorkingHoursTempAgg.WorkingHoursTemp", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("EmployeeId") + .HasColumnType("bigint"); + + b.Property("ShiftWork") + .HasMaxLength(2) + .HasColumnType("nvarchar(2)"); + + b.Property("WorkShopAddress2") + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("WorkshopId") + .HasColumnType("bigint"); + + b.HasKey("id"); + + b.ToTable("WorkingHoursTemp", (string)null); + }); + + modelBuilder.Entity("Company.Domain.WorkingHoursTempItemAgg.WorkingHoursTempItem", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("ComplexEnd") + .HasMaxLength(5) + .HasColumnType("nvarchar(5)"); + + b.Property("ComplexStart") + .HasMaxLength(5) + .HasColumnType("nvarchar(5)"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("DayOfWork") + .HasMaxLength(1) + .HasColumnType("nvarchar(1)"); + + b.Property("End1") + .HasMaxLength(5) + .HasColumnType("nvarchar(5)"); + + b.Property("End2") + .HasMaxLength(5) + .HasColumnType("nvarchar(5)"); + + b.Property("RestTime") + .HasMaxLength(5) + .HasColumnType("nvarchar(5)"); + + b.Property("Start1") + .HasMaxLength(5) + .HasColumnType("nvarchar(5)"); + + b.Property("Start2") + .HasMaxLength(5) + .HasColumnType("nvarchar(5)"); + + b.Property("WeekNumber") + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.Property("WorkingHoursTempId") + .HasColumnType("bigint"); + + b.HasKey("id"); + + b.HasIndex("WorkingHoursTempId"); + + b.ToTable("WorkingHoursTempItem", (string)null); + }); + + modelBuilder.Entity("Company.Domain.WorkshopAccountAgg.WorkshopAccount", b => + { + b.Property("WorkshopId") + .HasColumnType("bigint"); + + b.Property("AccountId") + .HasColumnType("bigint"); + + b.Property("ContractAndCheckout") + .HasMaxLength(5) + .HasColumnType("nvarchar(5)"); + + b.Property("Insurance") + .HasMaxLength(5) + .HasColumnType("nvarchar(5)"); + + b.Property("IsActiveSting") + .HasMaxLength(5) + .HasColumnType("nvarchar(5)"); + + b.Property("Tax") + .HasMaxLength(5) + .HasColumnType("nvarchar(5)"); + + b.HasKey("WorkshopId", "AccountId"); + + b.ToTable("WorkshopeAccounts", (string)null); + }); + + modelBuilder.Entity("Company.Domain.WorkshopAgg.Workshop", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("AddBonusesPay") + .HasColumnType("bit"); + + b.Property("AddLeavePay") + .HasColumnType("bit"); + + b.Property("AddYearsPay") + .HasColumnType("bit"); + + b.Property("Address") + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("AgentName") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("AgentPhone") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("AgreementNumber") + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.Property("ArchiveCode") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("BonusesOptions") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("City") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("ComputeOptions") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ContractTerm") + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("FixedSalary") + .HasColumnType("bit"); + + b.Property("HasRollCallFreeVip") + .HasMaxLength(5) + .HasColumnType("nvarchar(5)"); + + b.Property("InsuranceCode") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("InsuranceJobId") + .HasColumnType("bigint"); + + b.Property("IsActive") + .HasColumnType("bit"); + + b.Property("IsActiveString") + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.Property("IsClassified") + .HasColumnType("bit"); + + b.Property("IsOldContract") + .HasColumnType("bit"); + + b.Property("Population") + .HasMaxLength(25) + .HasColumnType("nvarchar(25)"); + + b.Property("State") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("TotalPaymentHide") + .HasColumnType("bit"); + + b.Property("TypeOfContract") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("TypeOfInsuranceSend") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("TypeOfOwnership") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("WorkshopFullName") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("WorkshopHolidayWorking") + .HasColumnType("bit"); + + b.Property("WorkshopName") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("WorkshopSureName") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("YearsOptions") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ZoneName") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.HasKey("id"); + + b.ToTable("Workshops", (string)null); + }); + + modelBuilder.Entity("Company.Domain.WorkshopEmployerAgg.WorkshopEmployer", b => + { + b.Property("WorkshopId") + .HasColumnType("bigint"); + + b.Property("EmployerId") + .HasColumnType("bigint"); + + b.HasKey("WorkshopId", "EmployerId"); + + b.HasIndex("EmployerId"); + + b.ToTable("WorkshopeEmployers", (string)null); + }); + + modelBuilder.Entity("Company.Domain.WorkshopPlanAgg.WorkshopPlan", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("Designer") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("DesignerPhone") + .HasMaxLength(20) + .HasColumnType("nvarchar(20)"); + + b.Property("ExecutionDateFa") + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.Property("ExecutionDateGr") + .HasColumnType("datetime2"); + + b.Property("IncludingDateFa") + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.Property("IncludingDateGr") + .HasColumnType("datetime2"); + + b.Property("WorkshopId") + .HasColumnType("bigint"); + + b.HasKey("id"); + + b.ToTable("WorkshopPlan", (string)null); + }); + + modelBuilder.Entity("Company.Domain.WorkshopPlanEmployeeAgg.WorkshopPlanEmployee", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("EmployeeFullName") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("EmployeeId") + .HasColumnType("bigint"); + + b.Property("WorkshopId") + .HasColumnType("bigint"); + + b.Property("WorkshopPlanId") + .HasColumnType("bigint"); + + b.HasKey("id"); + + b.HasIndex("WorkshopPlanId"); + + b.ToTable("WorkshopPlanEmployees", (string)null); + }); + + modelBuilder.Entity("Company.Domain.WorkshopSubAccountAgg.WorkshopSubAccount", b => + { + b.Property("SubAccountId") + .HasColumnType("bigint"); + + b.Property("WorkshopId") + .HasColumnType("bigint"); + + b.Property("IsActive") + .HasMaxLength(5) + .HasColumnType("int"); + + b.HasKey("SubAccountId", "WorkshopId"); + + b.HasIndex("WorkshopId"); + + b.ToTable("WorkshopSubAccounts", (string)null); + }); + + modelBuilder.Entity("Company.Domain.YearlySalaryAgg.YearlySalary", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("ConnectionId") + .HasColumnType("int"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("EndDate") + .HasColumnType("datetime2"); + + b.Property("StartDate") + .HasColumnType("datetime2"); + + b.Property("Year") + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.HasKey("id"); + + b.ToTable("YearlySalariess", (string)null); + }); + + modelBuilder.Entity("Company.Domain.YearlySalaryItemsAgg.YearlySalaryItem", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("ItemName") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("ItemValue") + .HasColumnType("float"); + + b.Property("ParentConnectionId") + .HasColumnType("int"); + + b.Property("ValueType") + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.Property("YearlySalaryId") + .HasColumnType("bigint"); + + b.HasKey("id"); + + b.HasIndex("YearlySalaryId"); + + b.ToTable("YearlyItems", (string)null); + }); + + modelBuilder.Entity("Company.Domain.YearlysSalaryTitleAgg.YearlySalaryTitle", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("Title1") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("Title10") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("Title2") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("Title3") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("Title4") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("Title5") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("Title6") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("Title7") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("Title8") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("Title9") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.HasKey("id"); + + b.ToTable("YearlySalaryTitles", (string)null); + }); + + modelBuilder.Entity("Company.Domain.ZoneAgg.Zone", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("CityId") + .HasColumnType("int"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("ZoneName") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.HasKey("id"); + + b.ToTable("Zones", (string)null); + }); + + modelBuilder.Entity("Company.Domain.empolyerAgg.Employer", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("Address") + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("AgentPhone") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ContractingPartyId") + .HasColumnType("bigint"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("DateOfBirth") + .HasColumnType("datetime2"); + + b.Property("DateOfIssue") + .HasColumnType("datetime2"); + + b.Property("EmployerLName") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("EmployerNo") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("EservicePassword") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("EserviceUserName") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("FName") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("FatherName") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("FullName") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("Gender") + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.Property("IdNumber") + .HasMaxLength(20) + .HasColumnType("nvarchar(20)"); + + b.Property("IsActive") + .HasColumnType("bit"); + + b.Property("IsLegal") + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.Property("LName") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("MclsPassword") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("MclsUserName") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("NationalId") + .HasMaxLength(15) + .HasColumnType("nvarchar(15)"); + + b.Property("Nationalcode") + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.Property("Nationality") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Phone") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("PlaceOfIssue") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("RegisterId") + .HasMaxLength(15) + .HasColumnType("nvarchar(15)"); + + b.Property("SanaPassword") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("SanaUserName") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("TaxOfficeUserName") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("TaxOfficepassword") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("id"); + + b.HasIndex("ContractingPartyId"); + + b.ToTable("Employers", (string)null); + }); + + modelBuilder.Entity("EmployerWorkshop", b => + { + b.Property("EmployersListid") + .HasColumnType("bigint"); + + b.Property("WorkshopsListid") + .HasColumnType("bigint"); + + b.HasKey("EmployersListid", "WorkshopsListid"); + + b.HasIndex("WorkshopsListid"); + + b.ToTable("EmployerWorkshop"); + }); + + modelBuilder.Entity("Company.Domain.Board.Board", b => + { + b.HasOne("Company.Domain.BoardType.BoardType", "BoardType") + .WithMany("BoardsList") + .HasForeignKey("BoardType_Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Company.Domain.File1.File1", "File1") + .WithMany("BoardsList") + .HasForeignKey("File_Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("BoardType"); + + b.Navigation("File1"); + }); + + modelBuilder.Entity("Company.Domain.ChapterAgg.EntityChapter", b => + { + b.HasOne("Company.Domain.SubtitleAgg.EntitySubtitle", "EntitySubtitle") + .WithMany("Chapters") + .HasForeignKey("Subtitle_Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("EntitySubtitle"); + }); + + modelBuilder.Entity("Company.Domain.CheckoutAgg.Checkout", b => + { + b.HasOne("Company.Domain.WorkshopAgg.Workshop", "Workshop") + .WithMany("Checkouts") + .HasForeignKey("WorkshopId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Workshop"); + }); + + modelBuilder.Entity("Company.Domain.ClientEmployeeWorkshopAgg.ClientEmployeeWorkshop", b => + { + b.HasOne("Company.Domain.EmployeeAgg.Employee", "Employee") + .WithMany("ClientEmployeeWorkshopList") + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Company.Domain.WorkshopAgg.Workshop", "Workshop") + .WithMany("ClientEmployeeWorkshopList") + .HasForeignKey("WorkshopId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Workshop"); + }); + + modelBuilder.Entity("Company.Domain.ContarctingPartyAgg.PersonalContractingParty", b => + { + b.HasOne("Company.Domain.RepresentativeAgg.Representative", "Representative") + .WithMany("ContractingParties") + .HasForeignKey("RepresentativeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Representative"); + }); + + modelBuilder.Entity("Company.Domain.ContractAgg.Contract", b => + { + b.HasOne("Company.Domain.EmployeeAgg.Employee", "Employee") + .WithMany("Contracts") + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Company.Domain.empolyerAgg.Employer", "Employer") + .WithMany("Contracts") + .HasForeignKey("EmployerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Company.Domain.JobAgg.Job", "Job") + .WithMany("ContractsList") + .HasForeignKey("JobTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Company.Domain.MandatoryHoursAgg.MandatoryHours", null) + .WithMany("Contracts") + .HasForeignKey("MandatoryHoursid"); + + b.HasOne("Company.Domain.WorkshopAgg.Workshop", "Workshop") + .WithMany("Contracts2") + .HasForeignKey("WorkshopIds") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Company.Domain.YearlySalaryAgg.YearlySalary", "YearlySalary") + .WithMany("Contracts") + .HasForeignKey("YearlySalaryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Employer"); + + b.Navigation("Job"); + + b.Navigation("Workshop"); + + b.Navigation("YearlySalary"); + }); + + modelBuilder.Entity("Company.Domain.ContractingPartyAccountAgg.ContractingPartyAccount", b => + { + b.HasOne("Company.Domain.ContarctingPartyAgg.PersonalContractingParty", "PersonalContractingParty") + .WithMany() + .HasForeignKey("PersonalContractingPartyId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("PersonalContractingParty"); + }); + + modelBuilder.Entity("Company.Domain.CrossJobAgg.CrossJob", b => + { + b.HasOne("Company.Domain.CrossJobGuildAgg.CrossJobGuild", "CrossJobGuild") + .WithMany("CrossJobList") + .HasForeignKey("CrossJobGuildId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CrossJobGuild"); + }); + + modelBuilder.Entity("Company.Domain.CrossJobItemsAgg.CrossJobItems", b => + { + b.HasOne("Company.Domain.CrossJobAgg.CrossJob", "CrossJob") + .WithMany("CrossJobItemsList") + .HasForeignKey("CrossJobId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Company.Domain.JobAgg.Job", "Job") + .WithMany("CrossJobItemsList") + .HasForeignKey("JobId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CrossJob"); + + b.Navigation("Job"); + }); + + modelBuilder.Entity("Company.Domain.CustomizeCheckoutAgg.CustomizeCheckout", b => + { + b.HasOne("Company.Domain.EmployeeAgg.Employee", "Employee") + .WithMany("CustomizeCheckouts") + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Company.Domain.WorkshopAgg.Workshop", "Workshop") + .WithMany("CustomizeCheckouts") + .HasForeignKey("WorkshopId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Workshop"); + }); + + modelBuilder.Entity("Company.Domain.CustomizeWorkshopEmployeeSettingsAgg.Entities.CustomizeWorkshopEmployeeSettings", b => + { + b.HasOne("Company.Domain.CustomizeWorkshopGroupSettingsAgg.Entities.CustomizeWorkshopGroupSettings", "CustomizeWorkshopGroupSettings") + .WithMany("CustomizeWorkshopEmployeeSettingsCollection") + .HasForeignKey("CustomizeWorkshopGroupSettingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.OwnsMany("Company.Domain.CustomizeWorkshopEmployeeSettingsAgg.Entities.CustomizeWorkshopEmployeeSettingsShift", "CustomizeWorkshopEmployeeSettingsShifts", b1 => + { + b1.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b1.Property("id")); + + b1.Property("CreationDate") + .HasColumnType("datetime2"); + + b1.Property("CustomizeWorkshopEmployeeSettingsId") + .HasColumnType("bigint"); + + b1.Property("EndTime") + .HasColumnType("time"); + + b1.Property("Placement") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("nvarchar(20)"); + + b1.Property("PreviousShiftThreshold") + .HasColumnType("time"); + + b1.Property("StartTime") + .HasColumnType("time"); + + b1.HasKey("id"); + + b1.HasIndex("CustomizeWorkshopEmployeeSettingsId"); + + b1.ToTable("CustomizeWorkshopEmployeeSettingsShifts", (string)null); + + b1.WithOwner("CustomizeWorkshopEmployeeSettings") + .HasForeignKey("CustomizeWorkshopEmployeeSettingsId"); + + b1.Navigation("CustomizeWorkshopEmployeeSettings"); + }); + + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.BaseYearsPay", "BaseYearsPay", b1 => + { + b1.Property("CustomizeWorkshopEmployeeSettingsid") + .HasColumnType("bigint"); + + b1.Property("BaseYearsPayType") + .IsRequired() + .HasMaxLength(1) + .HasColumnType("nvarchar(1)") + .HasColumnName("BaseYearsPay_BaseYearsPayType"); + + b1.Property("PaymentType") + .IsRequired() + .HasMaxLength(1) + .HasColumnType("nvarchar(1)") + .HasColumnName("BaseYearsPay_PaymentType"); + + b1.Property("Value") + .HasColumnType("float") + .HasColumnName("BaseYearsPay_Value"); + + b1.HasKey("CustomizeWorkshopEmployeeSettingsid"); + + b1.ToTable("CustomizeWorkshopEmployeeSettings"); + + b1.WithOwner() + .HasForeignKey("CustomizeWorkshopEmployeeSettingsid"); + }); + + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.BonusesPay", "BonusesPay", b1 => + { + b1.Property("CustomizeWorkshopEmployeeSettingsid") + .HasColumnType("bigint"); + + b1.Property("BonusesPayType") + .IsRequired() + .HasMaxLength(1) + .HasColumnType("nvarchar(1)") + .HasColumnName("BonusesPay_BonusesPayType"); + + b1.Property("PaymentType") + .IsRequired() + .HasMaxLength(1) + .HasColumnType("nvarchar(1)") + .HasColumnName("BonusesPay_PaymentType"); + + b1.Property("Value") + .HasColumnType("float") + .HasColumnName("BonusesPay_Value"); + + b1.HasKey("CustomizeWorkshopEmployeeSettingsid"); + + b1.ToTable("CustomizeWorkshopEmployeeSettings"); + + b1.WithOwner() + .HasForeignKey("CustomizeWorkshopEmployeeSettingsid"); + }); + + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.BreakTime", "BreakTime", b1 => + { + b1.Property("CustomizeWorkshopEmployeeSettingsid") + .HasColumnType("bigint"); + + b1.Property("BreakTimeType") + .IsRequired() + .HasMaxLength(1) + .HasColumnType("nvarchar(1)"); + + b1.Property("BreakTimeValue") + .HasColumnType("time"); + + b1.Property("HasBreakTimeValue") + .HasColumnType("bit"); + + b1.HasKey("CustomizeWorkshopEmployeeSettingsid"); + + b1.ToTable("CustomizeWorkshopEmployeeSettings"); + + b1.WithOwner() + .HasForeignKey("CustomizeWorkshopEmployeeSettingsid"); + }); + + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.EarlyExit", "EarlyExit", b1 => + { + b1.Property("CustomizeWorkshopEmployeeSettingsid") + .HasColumnType("bigint"); + + b1.Property("EarlyExitType") + .IsRequired() + .HasMaxLength(1) + .HasColumnType("nvarchar(1)") + .HasColumnName("EarlyExit_EarlyExitType"); + + b1.Property("Value") + .HasColumnType("float") + .HasColumnName("EarlyExitTimeFines_Value"); + + b1.HasKey("CustomizeWorkshopEmployeeSettingsid"); + + b1.ToTable("CustomizeWorkshopEmployeeSettings"); + + b1.WithOwner() + .HasForeignKey("CustomizeWorkshopEmployeeSettingsid"); + + b1.OwnsMany("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.EarlyExitTimeFine", "EarlyExitTimeFines", b2 => + { + b2.Property("CustomizeWorkshopEmployeeSettingsId") + .HasColumnType("bigint"); + + b2.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b2.Property("Id")); + + b2.Property("FineMoney") + .HasColumnType("float") + .HasColumnName("EarlyExitTimeFines_FineMoney"); + + b2.Property("Minute") + .HasMaxLength(4) + .HasColumnType("nvarchar(4)") + .HasColumnName("EarlyExitTimeFines_Minute"); + + b2.HasKey("CustomizeWorkshopEmployeeSettingsId", "Id"); + + b2.ToTable("CustomizeWorkshopEmployeeSettings_EarlyExitTimeFines"); + + b2.WithOwner() + .HasForeignKey("CustomizeWorkshopEmployeeSettingsId"); + }); + + b1.Navigation("EarlyExitTimeFines"); + }); + + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.FamilyAllowance", "FamilyAllowance", b1 => + { + b1.Property("CustomizeWorkshopEmployeeSettingsid") + .HasColumnType("bigint"); + + b1.Property("FamilyAllowanceType") + .IsRequired() + .HasMaxLength(1) + .HasColumnType("nvarchar(1)") + .HasColumnName("FamilyAllowance_FamilyAllowanceType"); + + b1.Property("Value") + .HasColumnType("float") + .HasColumnName("FamilyAllowance_Value"); + + b1.HasKey("CustomizeWorkshopEmployeeSettingsid"); + + b1.ToTable("CustomizeWorkshopEmployeeSettings"); + + b1.WithOwner() + .HasForeignKey("CustomizeWorkshopEmployeeSettingsid"); + }); + + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.FineAbsenceDeduction", "FineAbsenceDeduction", b1 => + { + b1.Property("CustomizeWorkshopEmployeeSettingsid") + .HasColumnType("bigint"); + + b1.Property("FineAbsenceDeductionType") + .IsRequired() + .HasMaxLength(1) + .HasColumnType("nvarchar(1)") + .HasColumnName("FineAbsenceDeduction_FineAbsenceDeductionType"); + + b1.Property("Value") + .HasColumnType("float") + .HasColumnName("FineAbsenceDeduction_Value"); + + b1.HasKey("CustomizeWorkshopEmployeeSettingsid"); + + b1.ToTable("CustomizeWorkshopEmployeeSettings"); + + b1.WithOwner() + .HasForeignKey("CustomizeWorkshopEmployeeSettingsid"); + + b1.OwnsMany("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.FineAbsenceDayOfWeek", "FineAbsenceDayOfWeekCollection", b2 => + { + b2.Property("CustomizeWorkshopEmployeeSettingsId") + .HasColumnType("bigint"); + + b2.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b2.Property("Id")); + + b2.Property("DayOfWeek") + .IsRequired() + .HasMaxLength(1) + .HasColumnType("nvarchar(1)") + .HasColumnName("FineAbsenceDayOfWeekCollection_DayOfWeek"); + + b2.HasKey("CustomizeWorkshopEmployeeSettingsId", "Id"); + + b2.ToTable("CustomizeWorkshopEmployeeSettings_FineAbsenceDayOfWeekCollection"); + + b2.WithOwner() + .HasForeignKey("CustomizeWorkshopEmployeeSettingsId"); + }); + + b1.Navigation("FineAbsenceDayOfWeekCollection"); + }); + + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.FridayPay", "FridayPay", b1 => + { + b1.Property("CustomizeWorkshopEmployeeSettingsid") + .HasColumnType("bigint"); + + b1.Property("FridayPayType") + .IsRequired() + .HasMaxLength(1) + .HasColumnType("nvarchar(1)"); + + b1.Property("Value") + .HasColumnType("float") + .HasColumnName("FridayPay_Value"); + + b1.HasKey("CustomizeWorkshopEmployeeSettingsid"); + + b1.ToTable("CustomizeWorkshopEmployeeSettings"); + + b1.WithOwner() + .HasForeignKey("CustomizeWorkshopEmployeeSettingsid"); + }); + + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.InsuranceDeduction", "InsuranceDeduction", b1 => + { + b1.Property("CustomizeWorkshopEmployeeSettingsid") + .HasColumnType("bigint"); + + b1.Property("InsuranceDeductionType") + .IsRequired() + .HasMaxLength(1) + .HasColumnType("nvarchar(1)") + .HasColumnName("InsuranceDeduction_InsuranceDeductionType"); + + b1.Property("Value") + .HasColumnType("float") + .HasColumnName("InsuranceDeduction_Value"); + + b1.HasKey("CustomizeWorkshopEmployeeSettingsid"); + + b1.ToTable("CustomizeWorkshopEmployeeSettings"); + + b1.WithOwner() + .HasForeignKey("CustomizeWorkshopEmployeeSettingsid"); + }); + + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.IrregularShift", "IrregularShift", b1 => + { + b1.Property("CustomizeWorkshopEmployeeSettingsid") + .HasColumnType("bigint"); + + b1.Property("EndTime") + .HasColumnType("time"); + + b1.Property("StartTime") + .HasColumnType("time"); + + b1.Property("WorkshopIrregularShifts") + .IsRequired() + .HasMaxLength(1) + .HasColumnType("nvarchar(1)"); + + b1.HasKey("CustomizeWorkshopEmployeeSettingsid"); + + b1.ToTable("CustomizeWorkshopEmployeeSettings"); + + b1.WithOwner() + .HasForeignKey("CustomizeWorkshopEmployeeSettingsid"); + }); + + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.LateToWork", "LateToWork", b1 => + { + b1.Property("CustomizeWorkshopEmployeeSettingsid") + .HasColumnType("bigint"); + + b1.Property("LateToWorkType") + .IsRequired() + .HasMaxLength(1) + .HasColumnType("nvarchar(1)") + .HasColumnName("LateToWork_LateToWorkType"); + + b1.Property("Value") + .HasColumnType("float") + .HasColumnName("LateToWork_Value"); + + b1.HasKey("CustomizeWorkshopEmployeeSettingsid"); + + b1.ToTable("CustomizeWorkshopEmployeeSettings"); + + b1.WithOwner() + .HasForeignKey("CustomizeWorkshopEmployeeSettingsid"); + + b1.OwnsMany("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.LateToWorkTimeFine", "LateToWorkTimeFines", b2 => + { + b2.Property("CustomizeWorkshopEmployeeSettingsId") + .HasColumnType("bigint"); + + b2.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b2.Property("Id")); + + b2.Property("FineMoney") + .HasColumnType("float") + .HasColumnName("LateToWorkTimeFines_FineMoney"); + + b2.Property("Minute") + .HasMaxLength(4) + .HasColumnType("nvarchar(4)") + .HasColumnName("LateToWorkTimeFines_Minute"); + + b2.HasKey("CustomizeWorkshopEmployeeSettingsId", "Id"); + + b2.ToTable("CustomizeWorkshopEmployeeSettings_LateToWorkTimeFines"); + + b2.WithOwner() + .HasForeignKey("CustomizeWorkshopEmployeeSettingsId"); + }); + + b1.Navigation("LateToWorkTimeFines"); + }); + + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.LeavePay", "LeavePay", b1 => + { + b1.Property("CustomizeWorkshopEmployeeSettingsid") + .HasColumnType("bigint"); + + b1.Property("LeavePayType") + .IsRequired() + .HasMaxLength(1) + .HasColumnType("nvarchar(1)") + .HasColumnName("LeavePay_LeavePayType"); + + b1.Property("Value") + .HasColumnType("float") + .HasColumnName("LeavePay_Value"); + + b1.HasKey("CustomizeWorkshopEmployeeSettingsid"); + + b1.ToTable("CustomizeWorkshopEmployeeSettings"); + + b1.WithOwner() + .HasForeignKey("CustomizeWorkshopEmployeeSettingsid"); + }); + + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.MarriedAllowance", "MarriedAllowance", b1 => + { + b1.Property("CustomizeWorkshopEmployeeSettingsid") + .HasColumnType("bigint"); + + b1.Property("MarriedAllowanceType") + .IsRequired() + .HasMaxLength(1) + .HasColumnType("nvarchar(1)") + .HasColumnName("MarriedAllowance_MarriedAllowanceType"); + + b1.Property("Value") + .HasColumnType("float") + .HasColumnName("MarriedAllowance_Value"); + + b1.HasKey("CustomizeWorkshopEmployeeSettingsid"); + + b1.ToTable("CustomizeWorkshopEmployeeSettings"); + + b1.WithOwner() + .HasForeignKey("CustomizeWorkshopEmployeeSettingsid"); + }); + + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.NightWorkPay", "NightWorkPay", b1 => + { + b1.Property("CustomizeWorkshopEmployeeSettingsid") + .HasColumnType("bigint"); + + b1.Property("NightWorkingType") + .IsRequired() + .HasMaxLength(1) + .HasColumnType("nvarchar(1)") + .HasColumnName("NightWorkPay_NightWorkingType"); + + b1.Property("Value") + .HasColumnType("float") + .HasColumnName("NightWorkPay_Value"); + + b1.HasKey("CustomizeWorkshopEmployeeSettingsid"); + + b1.ToTable("CustomizeWorkshopEmployeeSettings"); + + b1.WithOwner() + .HasForeignKey("CustomizeWorkshopEmployeeSettingsid"); + }); + + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.OverTimePay", "OverTimePay", b1 => + { + b1.Property("CustomizeWorkshopEmployeeSettingsid") + .HasColumnType("bigint"); + + b1.Property("OverTimePayType") + .IsRequired() + .HasMaxLength(1) + .HasColumnType("nvarchar(1)") + .HasColumnName("OverTimePay_OverTimePayType"); + + b1.Property("Value") + .HasColumnType("float") + .HasColumnName("OverTimePay_Value"); + + b1.HasKey("CustomizeWorkshopEmployeeSettingsid"); + + b1.ToTable("CustomizeWorkshopEmployeeSettings"); + + b1.WithOwner() + .HasForeignKey("CustomizeWorkshopEmployeeSettingsid"); + }); + + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.ShiftPay", "ShiftPay", b1 => + { + b1.Property("CustomizeWorkshopEmployeeSettingsid") + .HasColumnType("bigint"); + + b1.Property("ShiftPayType") + .IsRequired() + .HasMaxLength(1) + .HasColumnType("nvarchar(1)") + .HasColumnName("ShiftPay_ShiftPayType"); + + b1.Property("ShiftType") + .IsRequired() + .HasMaxLength(1) + .HasColumnType("nvarchar(1)") + .HasColumnName("ShiftPay_ShiftType"); + + b1.Property("Value") + .HasColumnType("float") + .HasColumnName("ShiftPay_Value"); + + b1.HasKey("CustomizeWorkshopEmployeeSettingsid"); + + b1.ToTable("CustomizeWorkshopEmployeeSettings"); + + b1.WithOwner() + .HasForeignKey("CustomizeWorkshopEmployeeSettingsid"); + }); + + b.Navigation("BaseYearsPay"); + + b.Navigation("BonusesPay"); + + b.Navigation("BreakTime"); + + b.Navigation("CustomizeWorkshopEmployeeSettingsShifts"); + + b.Navigation("CustomizeWorkshopGroupSettings"); + + b.Navigation("EarlyExit"); + + b.Navigation("FamilyAllowance"); + + b.Navigation("FineAbsenceDeduction"); + + b.Navigation("FridayPay"); + + b.Navigation("InsuranceDeduction"); + + b.Navigation("IrregularShift"); + + b.Navigation("LateToWork"); + + b.Navigation("LeavePay"); + + b.Navigation("MarriedAllowance"); + + b.Navigation("NightWorkPay"); + + b.Navigation("OverTimePay"); + + b.Navigation("ShiftPay"); + }); + + modelBuilder.Entity("Company.Domain.CustomizeWorkshopGroupSettingsAgg.Entities.CustomizeWorkshopGroupSettings", b => + { + b.HasOne("Company.Domain.CustomizeWorkshopSettingsAgg.Entities.CustomizeWorkshopSettings", "CustomizeWorkshopSettings") + .WithMany("CustomizeWorkshopGroupSettingsCollection") + .HasForeignKey("CustomizeWorkshopSettingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.OwnsMany("Company.Domain.CustomizeWorkshopGroupSettingsAgg.Entities.CustomizeWorkshopGroupSettingsShift", "CustomizeWorkshopGroupSettingsShifts", b1 => + { + b1.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b1.Property("id")); + + b1.Property("CreationDate") + .HasColumnType("datetime2"); + + b1.Property("CustomizeWorkshopGroupSettingsId") + .HasColumnType("bigint"); + + b1.Property("EndTime") + .HasColumnType("time"); + + b1.Property("Placement") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("nvarchar(20)"); + + b1.Property("StartTime") + .HasColumnType("time"); + + b1.HasKey("id"); + + b1.HasIndex("CustomizeWorkshopGroupSettingsId"); + + b1.ToTable("CustomizeWorkshopGroupSettingsShifts", (string)null); + + b1.WithOwner("CustomizeWorkshopGroupSettings") + .HasForeignKey("CustomizeWorkshopGroupSettingsId"); + + b1.Navigation("CustomizeWorkshopGroupSettings"); + }); + + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.BaseYearsPay", "BaseYearsPay", b1 => + { + b1.Property("CustomizeWorkshopGroupSettingsid") + .HasColumnType("bigint"); + + b1.Property("BaseYearsPayType") + .IsRequired() + .HasMaxLength(1) + .HasColumnType("nvarchar(1)") + .HasColumnName("BaseYearsPay_BaseYearsPayType"); + + b1.Property("PaymentType") + .IsRequired() + .HasMaxLength(1) + .HasColumnType("nvarchar(1)") + .HasColumnName("BaseYearsPay_PaymentType"); + + b1.Property("Value") + .HasColumnType("float") + .HasColumnName("BaseYearsPay_Value"); + + b1.HasKey("CustomizeWorkshopGroupSettingsid"); + + b1.ToTable("CustomizeWorkshopGroupSettings"); + + b1.WithOwner() + .HasForeignKey("CustomizeWorkshopGroupSettingsid"); + }); + + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.BonusesPay", "BonusesPay", b1 => + { + b1.Property("CustomizeWorkshopGroupSettingsid") + .HasColumnType("bigint"); + + b1.Property("BonusesPayType") + .IsRequired() + .HasMaxLength(1) + .HasColumnType("nvarchar(1)") + .HasColumnName("BonusesPay_BonusesPayType"); + + b1.Property("PaymentType") + .IsRequired() + .HasMaxLength(1) + .HasColumnType("nvarchar(1)") + .HasColumnName("BonusesPay_PaymentType"); + + b1.Property("Value") + .HasColumnType("float") + .HasColumnName("BonusesPay_Value"); + + b1.HasKey("CustomizeWorkshopGroupSettingsid"); + + b1.ToTable("CustomizeWorkshopGroupSettings"); + + b1.WithOwner() + .HasForeignKey("CustomizeWorkshopGroupSettingsid"); + }); + + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.BreakTime", "BreakTime", b1 => + { + b1.Property("CustomizeWorkshopGroupSettingsid") + .HasColumnType("bigint"); + + b1.Property("BreakTimeType") + .IsRequired() + .HasMaxLength(1) + .HasColumnType("nvarchar(1)"); + + b1.Property("BreakTimeValue") + .HasColumnType("time"); + + b1.Property("HasBreakTimeValue") + .HasColumnType("bit"); + + b1.HasKey("CustomizeWorkshopGroupSettingsid"); + + b1.ToTable("CustomizeWorkshopGroupSettings"); + + b1.WithOwner() + .HasForeignKey("CustomizeWorkshopGroupSettingsid"); + }); + + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.EarlyExit", "EarlyExit", b1 => + { + b1.Property("CustomizeWorkshopGroupSettingsid") + .HasColumnType("bigint"); + + b1.Property("EarlyExitType") + .IsRequired() + .HasMaxLength(1) + .HasColumnType("nvarchar(1)") + .HasColumnName("EarlyExit_EarlyExitType"); + + b1.Property("Value") + .HasColumnType("float") + .HasColumnName("EarlyExitTimeFines_Value"); + + b1.HasKey("CustomizeWorkshopGroupSettingsid"); + + b1.ToTable("CustomizeWorkshopGroupSettings"); + + b1.WithOwner() + .HasForeignKey("CustomizeWorkshopGroupSettingsid"); + + b1.OwnsMany("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.EarlyExitTimeFine", "EarlyExitTimeFines", b2 => + { + b2.Property("CustomizeWorkshopGroupSettingsId") + .HasColumnType("bigint"); + + b2.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b2.Property("Id")); + + b2.Property("FineMoney") + .HasColumnType("float") + .HasColumnName("EarlyExitTimeFines_FineMoney"); + + b2.Property("Minute") + .HasMaxLength(4) + .HasColumnType("nvarchar(4)") + .HasColumnName("EarlyExitTimeFines_Minute"); + + b2.HasKey("CustomizeWorkshopGroupSettingsId", "Id"); + + b2.ToTable("CustomizeWorkshopGroupSettings_EarlyExitTimeFines"); + + b2.WithOwner() + .HasForeignKey("CustomizeWorkshopGroupSettingsId"); + }); + + b1.Navigation("EarlyExitTimeFines"); + }); + + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.FamilyAllowance", "FamilyAllowance", b1 => + { + b1.Property("CustomizeWorkshopGroupSettingsid") + .HasColumnType("bigint"); + + b1.Property("FamilyAllowanceType") + .IsRequired() + .HasMaxLength(1) + .HasColumnType("nvarchar(1)") + .HasColumnName("FamilyAllowance_FamilyAllowanceType"); + + b1.Property("Value") + .HasColumnType("float") + .HasColumnName("FamilyAllowance_Value"); + + b1.HasKey("CustomizeWorkshopGroupSettingsid"); + + b1.ToTable("CustomizeWorkshopGroupSettings"); + + b1.WithOwner() + .HasForeignKey("CustomizeWorkshopGroupSettingsid"); + }); + + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.FineAbsenceDeduction", "FineAbsenceDeduction", b1 => + { + b1.Property("CustomizeWorkshopGroupSettingsid") + .HasColumnType("bigint"); + + b1.Property("FineAbsenceDeductionType") + .IsRequired() + .HasMaxLength(1) + .HasColumnType("nvarchar(1)") + .HasColumnName("FineAbsenceDeduction_FineAbsenceDeductionType"); + + b1.Property("Value") + .HasColumnType("float") + .HasColumnName("FineAbsenceDeduction_Value"); + + b1.HasKey("CustomizeWorkshopGroupSettingsid"); + + b1.ToTable("CustomizeWorkshopGroupSettings"); + + b1.WithOwner() + .HasForeignKey("CustomizeWorkshopGroupSettingsid"); + + b1.OwnsMany("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.FineAbsenceDayOfWeek", "FineAbsenceDayOfWeekCollection", b2 => + { + b2.Property("CustomizeWorkshopGroupSettingsId") + .HasColumnType("bigint"); + + b2.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b2.Property("Id")); + + b2.Property("DayOfWeek") + .IsRequired() + .HasMaxLength(1) + .HasColumnType("nvarchar(1)") + .HasColumnName("FineAbsenceDayOfWeekCollection_DayOfWeek"); + + b2.HasKey("CustomizeWorkshopGroupSettingsId", "Id"); + + b2.ToTable("CustomizeWorkshopGroupSettings_FineAbsenceDayOfWeekCollection"); + + b2.WithOwner() + .HasForeignKey("CustomizeWorkshopGroupSettingsId"); + }); + + b1.Navigation("FineAbsenceDayOfWeekCollection"); + }); + + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.FridayPay", "FridayPay", b1 => + { + b1.Property("CustomizeWorkshopGroupSettingsid") + .HasColumnType("bigint"); + + b1.Property("FridayPayType") + .IsRequired() + .HasMaxLength(1) + .HasColumnType("nvarchar(1)"); + + b1.Property("Value") + .HasColumnType("float") + .HasColumnName("FridayPay_Value"); + + b1.HasKey("CustomizeWorkshopGroupSettingsid"); + + b1.ToTable("CustomizeWorkshopGroupSettings"); + + b1.WithOwner() + .HasForeignKey("CustomizeWorkshopGroupSettingsid"); + }); + + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.InsuranceDeduction", "InsuranceDeduction", b1 => + { + b1.Property("CustomizeWorkshopGroupSettingsid") + .HasColumnType("bigint"); + + b1.Property("InsuranceDeductionType") + .IsRequired() + .HasMaxLength(1) + .HasColumnType("nvarchar(1)") + .HasColumnName("InsuranceDeduction_InsuranceDeductionType"); + + b1.Property("Value") + .HasColumnType("float") + .HasColumnName("InsuranceDeduction_Value"); + + b1.HasKey("CustomizeWorkshopGroupSettingsid"); + + b1.ToTable("CustomizeWorkshopGroupSettings"); + + b1.WithOwner() + .HasForeignKey("CustomizeWorkshopGroupSettingsid"); + }); + + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.IrregularShift", "IrregularShift", b1 => + { + b1.Property("CustomizeWorkshopGroupSettingsid") + .HasColumnType("bigint"); + + b1.Property("EndTime") + .HasColumnType("time"); + + b1.Property("StartTime") + .HasColumnType("time"); + + b1.Property("WorkshopIrregularShifts") + .IsRequired() + .HasMaxLength(1) + .HasColumnType("nvarchar(1)"); + + b1.HasKey("CustomizeWorkshopGroupSettingsid"); + + b1.ToTable("CustomizeWorkshopGroupSettings"); + + b1.WithOwner() + .HasForeignKey("CustomizeWorkshopGroupSettingsid"); + }); + + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.LateToWork", "LateToWork", b1 => + { + b1.Property("CustomizeWorkshopGroupSettingsid") + .HasColumnType("bigint"); + + b1.Property("LateToWorkType") + .IsRequired() + .HasMaxLength(1) + .HasColumnType("nvarchar(1)") + .HasColumnName("LateToWork_LateToWorkType"); + + b1.Property("Value") + .HasColumnType("float") + .HasColumnName("LateToWork_Value"); + + b1.HasKey("CustomizeWorkshopGroupSettingsid"); + + b1.ToTable("CustomizeWorkshopGroupSettings"); + + b1.WithOwner() + .HasForeignKey("CustomizeWorkshopGroupSettingsid"); + + b1.OwnsMany("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.LateToWorkTimeFine", "LateToWorkTimeFines", b2 => + { + b2.Property("CustomizeWorkshopGroupSettingsId") + .HasColumnType("bigint"); + + b2.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b2.Property("Id")); + + b2.Property("FineMoney") + .HasColumnType("float") + .HasColumnName("LateToWorkTimeFines_FineMoney"); + + b2.Property("Minute") + .HasMaxLength(4) + .HasColumnType("nvarchar(4)") + .HasColumnName("LateToWorkTimeFines_Minute"); + + b2.HasKey("CustomizeWorkshopGroupSettingsId", "Id"); + + b2.ToTable("CustomizeWorkshopGroupSettings_LateToWorkTimeFines"); + + b2.WithOwner() + .HasForeignKey("CustomizeWorkshopGroupSettingsId"); + }); + + b1.Navigation("LateToWorkTimeFines"); + }); + + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.LeavePay", "LeavePay", b1 => + { + b1.Property("CustomizeWorkshopGroupSettingsid") + .HasColumnType("bigint"); + + b1.Property("LeavePayType") + .IsRequired() + .HasMaxLength(1) + .HasColumnType("nvarchar(1)") + .HasColumnName("LeavePay_LeavePayType"); + + b1.Property("Value") + .HasColumnType("float") + .HasColumnName("LeavePay_Value"); + + b1.HasKey("CustomizeWorkshopGroupSettingsid"); + + b1.ToTable("CustomizeWorkshopGroupSettings"); + + b1.WithOwner() + .HasForeignKey("CustomizeWorkshopGroupSettingsid"); + }); + + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.MarriedAllowance", "MarriedAllowance", b1 => + { + b1.Property("CustomizeWorkshopGroupSettingsid") + .HasColumnType("bigint"); + + b1.Property("MarriedAllowanceType") + .IsRequired() + .HasMaxLength(1) + .HasColumnType("nvarchar(1)") + .HasColumnName("MarriedAllowance_MarriedAllowanceType"); + + b1.Property("Value") + .HasColumnType("float") + .HasColumnName("MarriedAllowance_Value"); + + b1.HasKey("CustomizeWorkshopGroupSettingsid"); + + b1.ToTable("CustomizeWorkshopGroupSettings"); + + b1.WithOwner() + .HasForeignKey("CustomizeWorkshopGroupSettingsid"); + }); + + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.NightWorkPay", "NightWorkPay", b1 => + { + b1.Property("CustomizeWorkshopGroupSettingsid") + .HasColumnType("bigint"); + + b1.Property("NightWorkingType") + .IsRequired() + .HasMaxLength(1) + .HasColumnType("nvarchar(1)") + .HasColumnName("NightWorkPay_NightWorkingType"); + + b1.Property("Value") + .HasColumnType("float") + .HasColumnName("NightWorkPay_Value"); + + b1.HasKey("CustomizeWorkshopGroupSettingsid"); + + b1.ToTable("CustomizeWorkshopGroupSettings"); + + b1.WithOwner() + .HasForeignKey("CustomizeWorkshopGroupSettingsid"); + }); + + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.OverTimePay", "OverTimePay", b1 => + { + b1.Property("CustomizeWorkshopGroupSettingsid") + .HasColumnType("bigint"); + + b1.Property("OverTimePayType") + .IsRequired() + .HasMaxLength(1) + .HasColumnType("nvarchar(1)") + .HasColumnName("OverTimePay_OverTimePayType"); + + b1.Property("Value") + .HasColumnType("float") + .HasColumnName("OverTimePay_Value"); + + b1.HasKey("CustomizeWorkshopGroupSettingsid"); + + b1.ToTable("CustomizeWorkshopGroupSettings"); + + b1.WithOwner() + .HasForeignKey("CustomizeWorkshopGroupSettingsid"); + }); + + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.ShiftPay", "ShiftPay", b1 => + { + b1.Property("CustomizeWorkshopGroupSettingsid") + .HasColumnType("bigint"); + + b1.Property("ShiftPayType") + .IsRequired() + .HasMaxLength(1) + .HasColumnType("nvarchar(1)") + .HasColumnName("ShiftPay_ShiftPayType"); + + b1.Property("ShiftType") + .IsRequired() + .HasMaxLength(1) + .HasColumnType("nvarchar(1)") + .HasColumnName("ShiftPay_ShiftType"); + + b1.Property("Value") + .HasColumnType("float") + .HasColumnName("ShiftPay_Value"); + + b1.HasKey("CustomizeWorkshopGroupSettingsid"); + + b1.ToTable("CustomizeWorkshopGroupSettings"); + + b1.WithOwner() + .HasForeignKey("CustomizeWorkshopGroupSettingsid"); + }); + + b.Navigation("BaseYearsPay"); + + b.Navigation("BonusesPay"); + + b.Navigation("BreakTime"); + + b.Navigation("CustomizeWorkshopGroupSettingsShifts"); + + b.Navigation("CustomizeWorkshopSettings"); + + b.Navigation("EarlyExit"); + + b.Navigation("FamilyAllowance"); + + b.Navigation("FineAbsenceDeduction"); + + b.Navigation("FridayPay"); + + b.Navigation("InsuranceDeduction"); + + b.Navigation("IrregularShift"); + + b.Navigation("LateToWork"); + + b.Navigation("LeavePay"); + + b.Navigation("MarriedAllowance"); + + b.Navigation("NightWorkPay"); + + b.Navigation("OverTimePay"); + + b.Navigation("ShiftPay"); + }); + + modelBuilder.Entity("Company.Domain.CustomizeWorkshopSettingsAgg.Entities.CustomizeWorkshopSettings", b => + { + b.HasOne("Company.Domain.WorkshopAgg.Workshop", "Workshop") + .WithOne("CustomizeWorkshopSettings") + .HasForeignKey("Company.Domain.CustomizeWorkshopSettingsAgg.Entities.CustomizeWorkshopSettings", "WorkshopId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.OwnsMany("Company.Domain.CustomizeWorkshopSettingsAgg.Entities.CustomizeWorkshopSettingsShift", "CustomizeWorkshopSettingsShifts", b1 => + { + b1.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b1.Property("id")); + + b1.Property("CreationDate") + .HasColumnType("datetime2"); + + b1.Property("CustomizeWorkshopSettingsId") + .HasColumnType("bigint"); + + b1.Property("EndTime") + .HasColumnType("time"); + + b1.Property("Placement") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("nvarchar(20)"); + + b1.Property("StartTime") + .HasColumnType("time"); + + b1.HasKey("id"); + + b1.HasIndex("CustomizeWorkshopSettingsId"); + + b1.ToTable("CustomizeWorkshopSettingsShifts", (string)null); + + b1.WithOwner("CustomizeWorkshopSettings") + .HasForeignKey("CustomizeWorkshopSettingsId"); + + b1.Navigation("CustomizeWorkshopSettings"); + }); + + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.BaseYearsPay", "BaseYearsPay", b1 => + { + b1.Property("CustomizeWorkshopSettingsid") + .HasColumnType("bigint"); + + b1.Property("BaseYearsPayType") + .IsRequired() + .HasMaxLength(1) + .HasColumnType("nvarchar(1)") + .HasColumnName("BaseYearsPay_BaseYearsPayType"); + + b1.Property("PaymentType") + .IsRequired() + .HasMaxLength(1) + .HasColumnType("nvarchar(1)") + .HasColumnName("BaseYearsPay_PaymentType"); + + b1.Property("Value") + .HasColumnType("float") + .HasColumnName("BaseYearsPay_Value"); + + b1.HasKey("CustomizeWorkshopSettingsid"); + + b1.ToTable("CustomizeWorkshopSettings"); + + b1.WithOwner() + .HasForeignKey("CustomizeWorkshopSettingsid"); + }); + + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.BonusesPay", "BonusesPay", b1 => + { + b1.Property("CustomizeWorkshopSettingsid") + .HasColumnType("bigint"); + + b1.Property("BonusesPayType") + .IsRequired() + .HasMaxLength(1) + .HasColumnType("nvarchar(1)") + .HasColumnName("BonusesPay_BonusesPayType"); + + b1.Property("PaymentType") + .IsRequired() + .HasMaxLength(1) + .HasColumnType("nvarchar(1)") + .HasColumnName("BonusesPay_PaymentType"); + + b1.Property("Value") + .HasColumnType("float") + .HasColumnName("BonusesPay_Value"); + + b1.HasKey("CustomizeWorkshopSettingsid"); + + b1.ToTable("CustomizeWorkshopSettings"); + + b1.WithOwner() + .HasForeignKey("CustomizeWorkshopSettingsid"); + }); + + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.EarlyExit", "EarlyExit", b1 => + { + b1.Property("CustomizeWorkshopSettingsid") + .HasColumnType("bigint"); + + b1.Property("EarlyExitType") + .IsRequired() + .HasMaxLength(1) + .HasColumnType("nvarchar(1)") + .HasColumnName("EarlyExit_EarlyExitType"); + + b1.Property("Value") + .HasColumnType("float") + .HasColumnName("EarlyExitTimeFines_Value"); + + b1.HasKey("CustomizeWorkshopSettingsid"); + + b1.ToTable("CustomizeWorkshopSettings"); + + b1.WithOwner() + .HasForeignKey("CustomizeWorkshopSettingsid"); + + b1.OwnsMany("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.EarlyExitTimeFine", "EarlyExitTimeFines", b2 => + { + b2.Property("CustomizeWorkshopSettingsId") + .HasColumnType("bigint"); + + b2.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b2.Property("Id")); + + b2.Property("FineMoney") + .HasColumnType("float") + .HasColumnName("EarlyExitTimeFines_FineMoney"); + + b2.Property("Minute") + .HasMaxLength(4) + .HasColumnType("nvarchar(4)") + .HasColumnName("EarlyExitTimeFines_Minute"); + + b2.HasKey("CustomizeWorkshopSettingsId", "Id"); + + b2.ToTable("CustomizeWorkshopSettings_EarlyExitTimeFines"); + + b2.WithOwner() + .HasForeignKey("CustomizeWorkshopSettingsId"); + }); + + b1.Navigation("EarlyExitTimeFines"); + }); + + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.FamilyAllowance", "FamilyAllowance", b1 => + { + b1.Property("CustomizeWorkshopSettingsid") + .HasColumnType("bigint"); + + b1.Property("FamilyAllowanceType") + .IsRequired() + .HasMaxLength(1) + .HasColumnType("nvarchar(1)") + .HasColumnName("FamilyAllowance_FamilyAllowanceType"); + + b1.Property("Value") + .HasColumnType("float") + .HasColumnName("FamilyAllowance_Value"); + + b1.HasKey("CustomizeWorkshopSettingsid"); + + b1.ToTable("CustomizeWorkshopSettings"); + + b1.WithOwner() + .HasForeignKey("CustomizeWorkshopSettingsid"); + }); + + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.FineAbsenceDeduction", "FineAbsenceDeduction", b1 => + { + b1.Property("CustomizeWorkshopSettingsid") + .HasColumnType("bigint"); + + b1.Property("FineAbsenceDeductionType") + .IsRequired() + .HasMaxLength(1) + .HasColumnType("nvarchar(1)") + .HasColumnName("FineAbsenceDeduction_FineAbsenceDeductionType"); + + b1.Property("Value") + .HasColumnType("float") + .HasColumnName("FineAbsenceDeduction_Value"); + + b1.HasKey("CustomizeWorkshopSettingsid"); + + b1.ToTable("CustomizeWorkshopSettings"); + + b1.WithOwner() + .HasForeignKey("CustomizeWorkshopSettingsid"); + + b1.OwnsMany("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.FineAbsenceDayOfWeek", "FineAbsenceDayOfWeekCollection", b2 => + { + b2.Property("CustomizeWorkshopSettingsId") + .HasColumnType("bigint"); + + b2.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b2.Property("Id")); + + b2.Property("DayOfWeek") + .IsRequired() + .HasMaxLength(1) + .HasColumnType("nvarchar(1)") + .HasColumnName("FineAbsenceDayOfWeekCollection_DayOfWeek"); + + b2.HasKey("CustomizeWorkshopSettingsId", "Id"); + + b2.ToTable("CustomizeWorkshopSettings_FineAbsenceDayOfWeekCollection"); + + b2.WithOwner() + .HasForeignKey("CustomizeWorkshopSettingsId"); + }); + + b1.Navigation("FineAbsenceDayOfWeekCollection"); + }); + + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.FridayPay", "FridayPay", b1 => + { + b1.Property("CustomizeWorkshopSettingsid") + .HasColumnType("bigint"); + + b1.Property("FridayPayType") + .IsRequired() + .HasMaxLength(1) + .HasColumnType("nvarchar(1)"); + + b1.Property("Value") + .HasColumnType("float") + .HasColumnName("FridayPay_Value"); + + b1.HasKey("CustomizeWorkshopSettingsid"); + + b1.ToTable("CustomizeWorkshopSettings"); + + b1.WithOwner() + .HasForeignKey("CustomizeWorkshopSettingsid"); + }); + + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.InsuranceDeduction", "InsuranceDeduction", b1 => + { + b1.Property("CustomizeWorkshopSettingsid") + .HasColumnType("bigint"); + + b1.Property("InsuranceDeductionType") + .IsRequired() + .HasMaxLength(1) + .HasColumnType("nvarchar(1)") + .HasColumnName("InsuranceDeduction_InsuranceDeductionType"); + + b1.Property("Value") + .HasColumnType("float") + .HasColumnName("InsuranceDeduction_Value"); + + b1.HasKey("CustomizeWorkshopSettingsid"); + + b1.ToTable("CustomizeWorkshopSettings"); + + b1.WithOwner() + .HasForeignKey("CustomizeWorkshopSettingsid"); + }); + + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.LateToWork", "LateToWork", b1 => + { + b1.Property("CustomizeWorkshopSettingsid") + .HasColumnType("bigint"); + + b1.Property("LateToWorkType") + .IsRequired() + .HasMaxLength(1) + .HasColumnType("nvarchar(1)") + .HasColumnName("LateToWork_LateToWorkType"); + + b1.Property("Value") + .HasColumnType("float") + .HasColumnName("LateToWork_Value"); + + b1.HasKey("CustomizeWorkshopSettingsid"); + + b1.ToTable("CustomizeWorkshopSettings"); + + b1.WithOwner() + .HasForeignKey("CustomizeWorkshopSettingsid"); + + b1.OwnsMany("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.LateToWorkTimeFine", "LateToWorkTimeFines", b2 => + { + b2.Property("CustomizeWorkshopSettingsId") + .HasColumnType("bigint"); + + b2.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b2.Property("Id")); + + b2.Property("FineMoney") + .HasColumnType("float") + .HasColumnName("LateToWorkTimeFines_FineMoney"); + + b2.Property("Minute") + .HasMaxLength(4) + .HasColumnType("nvarchar(4)") + .HasColumnName("LateToWorkTimeFines_Minute"); + + b2.HasKey("CustomizeWorkshopSettingsId", "Id"); + + b2.ToTable("CustomizeWorkshopSettings_LateToWorkTimeFines"); + + b2.WithOwner() + .HasForeignKey("CustomizeWorkshopSettingsId"); + }); + + b1.Navigation("LateToWorkTimeFines"); + }); + + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.LeavePay", "LeavePay", b1 => + { + b1.Property("CustomizeWorkshopSettingsid") + .HasColumnType("bigint"); + + b1.Property("LeavePayType") + .IsRequired() + .HasMaxLength(1) + .HasColumnType("nvarchar(1)") + .HasColumnName("LeavePay_LeavePayType"); + + b1.Property("Value") + .HasColumnType("float") + .HasColumnName("LeavePay_Value"); + + b1.HasKey("CustomizeWorkshopSettingsid"); + + b1.ToTable("CustomizeWorkshopSettings"); + + b1.WithOwner() + .HasForeignKey("CustomizeWorkshopSettingsid"); + }); + + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.MarriedAllowance", "MarriedAllowance", b1 => + { + b1.Property("CustomizeWorkshopSettingsid") + .HasColumnType("bigint"); + + b1.Property("MarriedAllowanceType") + .IsRequired() + .HasMaxLength(1) + .HasColumnType("nvarchar(1)") + .HasColumnName("MarriedAllowance_MarriedAllowanceType"); + + b1.Property("Value") + .HasColumnType("float") + .HasColumnName("MarriedAllowance_Value"); + + b1.HasKey("CustomizeWorkshopSettingsid"); + + b1.ToTable("CustomizeWorkshopSettings"); + + b1.WithOwner() + .HasForeignKey("CustomizeWorkshopSettingsid"); + }); + + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.NightWorkPay", "NightWorkPay", b1 => + { + b1.Property("CustomizeWorkshopSettingsid") + .HasColumnType("bigint"); + + b1.Property("NightWorkingType") + .IsRequired() + .HasMaxLength(1) + .HasColumnType("nvarchar(1)") + .HasColumnName("NightWorkPay_NightWorkingType"); + + b1.Property("Value") + .HasColumnType("float") + .HasColumnName("NightWorkPay_Value"); + + b1.HasKey("CustomizeWorkshopSettingsid"); + + b1.ToTable("CustomizeWorkshopSettings"); + + b1.WithOwner() + .HasForeignKey("CustomizeWorkshopSettingsid"); + }); + + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.OverTimePay", "OverTimePay", b1 => + { + b1.Property("CustomizeWorkshopSettingsid") + .HasColumnType("bigint"); + + b1.Property("OverTimePayType") + .IsRequired() + .HasMaxLength(1) + .HasColumnType("nvarchar(1)") + .HasColumnName("OverTimePay_OverTimePayType"); + + b1.Property("Value") + .HasColumnType("float") + .HasColumnName("OverTimePay_Value"); + + b1.HasKey("CustomizeWorkshopSettingsid"); + + b1.ToTable("CustomizeWorkshopSettings"); + + b1.WithOwner() + .HasForeignKey("CustomizeWorkshopSettingsid"); + }); + + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.ShiftPay", "ShiftPay", b1 => + { + b1.Property("CustomizeWorkshopSettingsid") + .HasColumnType("bigint"); + + b1.Property("ShiftPayType") + .IsRequired() + .HasMaxLength(1) + .HasColumnType("nvarchar(1)") + .HasColumnName("ShiftPay_ShiftPayType"); + + b1.Property("ShiftType") + .IsRequired() + .HasMaxLength(1) + .HasColumnType("nvarchar(1)") + .HasColumnName("ShiftPay_ShiftType"); + + b1.Property("Value") + .HasColumnType("float") + .HasColumnName("ShiftPay_Value"); + + b1.HasKey("CustomizeWorkshopSettingsid"); + + b1.ToTable("CustomizeWorkshopSettings"); + + b1.WithOwner() + .HasForeignKey("CustomizeWorkshopSettingsid"); + }); + + b.Navigation("BaseYearsPay"); + + b.Navigation("BonusesPay"); + + b.Navigation("CustomizeWorkshopSettingsShifts"); + + b.Navigation("EarlyExit"); + + b.Navigation("FamilyAllowance"); + + b.Navigation("FineAbsenceDeduction"); + + b.Navigation("FridayPay"); + + b.Navigation("InsuranceDeduction"); + + b.Navigation("LateToWork"); + + b.Navigation("LeavePay"); + + b.Navigation("MarriedAllowance"); + + b.Navigation("NightWorkPay"); + + b.Navigation("OverTimePay"); + + b.Navigation("ShiftPay"); + + b.Navigation("Workshop"); + }); + + modelBuilder.Entity("Company.Domain.DateSalaryItemAgg.DateSalaryItem", b => + { + b.HasOne("Company.Domain.DateSalaryAgg.DateSalary", "DateSalary") + .WithMany("DateSalaryItemList") + .HasForeignKey("DateSalaryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Company.Domain.PercentageAgg.Percentage", "Percentage") + .WithMany("DateSalaryItemList") + .HasForeignKey("PercentageId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DateSalary"); + + b.Navigation("Percentage"); + }); + + modelBuilder.Entity("Company.Domain.EmployeeAccountAgg.EmployeeAccount", b => + { + b.HasOne("Company.Domain.EmployeeAgg.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("Company.Domain.EmployeeChildrenAgg.EmployeeChildren", b => + { + b.HasOne("Company.Domain.EmployeeAgg.Employee", "Employee") + .WithMany("EmployeeChildrenList") + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("Company.Domain.EmployeeInsuranceRecordAgg.EmployeeInsuranceRecord", b => + { + b.HasOne("Company.Domain.EmployeeAgg.Employee", "Employee") + .WithMany("EmployeeInsuranceRecords") + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Company.Domain.WorkshopAgg.Workshop", "Workshop") + .WithMany("EmployeeInsuranceRecords") + .HasForeignKey("WorkShopId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Workshop"); + }); + + modelBuilder.Entity("Company.Domain.EmployerAccountAgg.EmployerAccount", b => + { + b.HasOne("Company.Domain.empolyerAgg.Employer", "Employer") + .WithMany() + .HasForeignKey("EmployerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employer"); + }); + + modelBuilder.Entity("Company.Domain.Evidence.Evidence", b => + { + b.HasOne("Company.Domain.BoardType.BoardType", "BoardType") + .WithMany("EvidencesList") + .HasForeignKey("BoardType_Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Company.Domain.File1.File1", "File1") + .WithMany("EvidencesList") + .HasForeignKey("File_Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("BoardType"); + + b.Navigation("File1"); + }); + + modelBuilder.Entity("Company.Domain.EvidenceDetail.EvidenceDetail", b => + { + b.HasOne("Company.Domain.Evidence.Evidence", "Evidence") + .WithMany("EvidenceDetailsList") + .HasForeignKey("Evidence_Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Evidence"); + }); + + modelBuilder.Entity("Company.Domain.FileAlert.FileAlert", b => + { + b.HasOne("Company.Domain.FileState.FileState", "FileState") + .WithMany("FileAlertsList") + .HasForeignKey("FileState_Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Company.Domain.File1.File1", "File") + .WithMany("FileAlertsList") + .HasForeignKey("File_Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("File"); + + b.Navigation("FileState"); + }); + + modelBuilder.Entity("Company.Domain.FileAndFileEmployerAgg.FileAndFileEmployer", b => + { + b.HasOne("Company.Domain.FileEmployerAgg.FileEmployer", "FileEmployer") + .WithMany("FileAndFileEmployers") + .HasForeignKey("FileEmployerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Company.Domain.File1.File1", "File1") + .WithMany("FileAndFileEmployers") + .HasForeignKey("FileId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("File1"); + + b.Navigation("FileEmployer"); + }); + + modelBuilder.Entity("Company.Domain.FileEmployeeAgg.FileEmployee", b => + { + b.HasOne("Company.Domain.RepresentativeAgg.Representative", "Representative") + .WithMany("FileEmployeeList") + .HasForeignKey("RepresentativeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Representative"); + }); + + modelBuilder.Entity("Company.Domain.FileEmployerAgg.FileEmployer", b => + { + b.HasOne("Company.Domain.RepresentativeAgg.Representative", "Representative") + .WithMany("FileEmployerList") + .HasForeignKey("RepresentativeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Representative"); + }); + + modelBuilder.Entity("Company.Domain.FileState.FileState", b => + { + b.HasOne("Company.Domain.FileTiming.FileTiming", "FileTiming") + .WithMany("FileStates") + .HasForeignKey("FileTiming_Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("FileTiming"); + }); + + modelBuilder.Entity("Company.Domain.FinancialTransactionAgg.FinancialTransaction", b => + { + b.HasOne("Company.Domain.FinancialStatmentAgg.FinancialStatment", "FinancialStatment") + .WithMany("FinancialTransactionList") + .HasForeignKey("FinancialStatementId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("FinancialStatment"); + }); + + modelBuilder.Entity("Company.Domain.GroupPlanAgg.GroupPlan", b => + { + b.HasOne("Company.Domain.WorkshopPlanAgg.WorkshopPlan", "WorkshopPlan") + .WithMany("GroupPlans") + .HasForeignKey("WorkshopPlanId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("WorkshopPlan"); + }); + + modelBuilder.Entity("Company.Domain.GroupPlanJobItemAgg.GroupPlanJobItem", b => + { + b.HasOne("Company.Domain.GroupPlanAgg.GroupPlan", "GroupPlan") + .WithMany("GroupPlanJobItems") + .HasForeignKey("GroupPlanId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("GroupPlan"); + }); + + modelBuilder.Entity("Company.Domain.HolidayItemAgg.HolidayItem", b => + { + b.HasOne("Company.Domain.HolidayAgg.Holiday", "Holidayss") + .WithMany("HolidayItems") + .HasForeignKey("HolidayId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Holidayss"); + }); + + modelBuilder.Entity("Company.Domain.InstitutionContractContactInfoAgg.InstitutionContractContactInfo", b => + { + b.HasOne("Company.Domain.InstitutionContractAgg.InstitutionContract", "InstitutionContracts") + .WithMany("ContactInfoList") + .HasForeignKey("InstitutionContractId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("InstitutionContracts"); + }); + + modelBuilder.Entity("Company.Domain.InsurancWorkshopInfoAgg.InsuranceWorkshopInfo", b => + { + b.HasOne("Company.Domain.WorkshopAgg.Workshop", "Workshop") + .WithOne("InsuranceWorkshopInfo") + .HasForeignKey("Company.Domain.InsurancWorkshopInfoAgg.InsuranceWorkshopInfo", "WorkshopId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Workshop"); + }); + + modelBuilder.Entity("Company.Domain.InsuranceAgg.Insurance", b => + { + b.HasOne("Company.Domain.WorkshopAgg.Workshop", "Workshop") + .WithMany("Insurances") + .HasForeignKey("WorkShopId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Workshop"); + }); + + modelBuilder.Entity("Company.Domain.InsuranceEmployeeInfoAgg.InsuranceEmployeeInfo", b => + { + b.HasOne("Company.Domain.EmployeeAgg.Employee", "Employee") + .WithOne("InsuranceEmployeeInfo") + .HasForeignKey("Company.Domain.InsuranceEmployeeInfoAgg.InsuranceEmployeeInfo", "EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("Company.Domain.InsuranceJobAndJobsAgg.InsuranceJobAndJobs", b => + { + b.HasOne("Company.Domain.InsuranceJobItemAgg.InsuranceJobItem", "InsuranceJobItem") + .WithMany("InsuranceJobAndJobs") + .HasForeignKey("InsuranceJobItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Company.Domain.JobAgg.Job", "Jobs") + .WithMany("InsuranceJobAndJobs") + .HasForeignKey("JobId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("InsuranceJobItem"); + + b.Navigation("Jobs"); + }); + + modelBuilder.Entity("Company.Domain.InsuranceJobItemAgg.InsuranceJobItem", b => + { + b.HasOne("Company.Domain.InsurancJobAgg.InsuranceJob", "InsuranceJob") + .WithMany("InsuranceJobItemList") + .HasForeignKey("InsuranceJobId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("InsuranceJob"); + }); + + modelBuilder.Entity("Company.Domain.InsuranceWorkshopAgg.InsuranceListWorkshop", b => + { + b.HasOne("Company.Domain.InsuranceListAgg.InsuranceList", "InsuranceList") + .WithMany("InsuranceListWorkshops") + .HasForeignKey("InsurancListId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Company.Domain.WorkshopAgg.Workshop", "Workshop") + .WithMany("InsuranceListWorkshops") + .HasForeignKey("WorkshopId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("InsuranceList"); + + b.Navigation("Workshop"); + }); + + modelBuilder.Entity("Company.Domain.LeftWorkAgg.LeftWork", b => + { + b.HasOne("Company.Domain.EmployeeAgg.Employee", "Employee") + .WithMany("LeftWorks") + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Company.Domain.WorkshopAgg.Workshop", "Workshop") + .WithMany("LeftWorks") + .HasForeignKey("WorkshopId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Workshop"); + }); + + modelBuilder.Entity("Company.Domain.LeftWorkInsuranceAgg.LeftWorkInsurance", b => + { + b.HasOne("Company.Domain.EmployeeAgg.Employee", "Employee") + .WithMany("LeftWorkInsurances") + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Company.Domain.WorkshopAgg.Workshop", "Workshop") + .WithMany("LeftWorkInsurances") + .HasForeignKey("WorkshopId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Workshop"); + }); + + modelBuilder.Entity("Company.Domain.LoanAgg.Entities.Loan", b => + { + b.OwnsMany("Company.Domain.LoanAgg.Entities.LoanInstallment", "LoanInstallments", b1 => + { + b1.Property("LoanId") + .HasColumnType("bigint"); + + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b1.Property("Id")); + + b1.Property("AmountForMonth") + .HasColumnType("float"); + + b1.Property("InstallmentDate") + .HasColumnType("datetime2"); + + b1.Property("IsActive") + .IsRequired() + .HasMaxLength(1) + .HasColumnType("nvarchar(1)"); + + b1.Property("Month") + .HasMaxLength(2) + .HasColumnType("nvarchar(2)"); + + b1.Property("Year") + .HasMaxLength(4) + .HasColumnType("nvarchar(4)"); + + b1.HasKey("LoanId", "Id"); + + b1.ToTable("LoanInstallment"); + + b1.WithOwner() + .HasForeignKey("LoanId"); + }); + + b.Navigation("LoanInstallments"); + }); + + modelBuilder.Entity("Company.Domain.MasterPenaltyTitle.MasterPenaltyTitle", b => + { + b.HasOne("Company.Domain.MasterPetition.MasterPetition", "MasterPetition") + .WithMany("MasterPenaltyTitlesList") + .HasForeignKey("MasterPetition_Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("MasterPetition"); + }); + + modelBuilder.Entity("Company.Domain.MasterPetition.MasterPetition", b => + { + b.HasOne("Company.Domain.BoardType.BoardType", "BoardType") + .WithMany("MasterPetitionsList") + .HasForeignKey("BoardType_Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Company.Domain.File1.File1", "File1") + .WithMany("MasterPetitionsList") + .HasForeignKey("File_Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("BoardType"); + + b.Navigation("File1"); + }); + + modelBuilder.Entity("Company.Domain.MasterWorkHistory.MasterWorkHistory", b => + { + b.HasOne("Company.Domain.MasterPetition.MasterPetition", "MasterPetition") + .WithMany("MasterWorkHistoriesList") + .HasForeignKey("MasterPetition_Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("MasterPetition"); + }); + + modelBuilder.Entity("Company.Domain.ModuleTextManagerAgg.EntityModuleTextManager", b => + { + b.HasOne("Company.Domain.ModuleAgg.EntityModule", "Module") + .WithMany("EntityModuleTextManagers") + .HasForeignKey("ModuleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Company.Domain.TextManagerAgg.EntityTextManager", "TextManager") + .WithMany("EntityModuleTextManagers") + .HasForeignKey("TextManagerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Module"); + + b.Navigation("TextManager"); + }); + + modelBuilder.Entity("Company.Domain.PaymentToEmployeeItemAgg.PaymentToEmployeeItem", b => + { + b.HasOne("Company.Domain.PaymentToEmployeeAgg.PaymentToEmployee", "PaymentToEmployee") + .WithMany("PaymentToEmployeeItemList") + .HasForeignKey("PaymentToEmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("PaymentToEmployee"); + }); + + modelBuilder.Entity("Company.Domain.PenaltyTitle.PenaltyTitle", b => + { + b.HasOne("Company.Domain.Petition.Petition", "Petition") + .WithMany("PenaltyTitlesList") + .HasForeignKey("Petition_Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Petition"); + }); + + modelBuilder.Entity("Company.Domain.PersonnelCodeAgg.PersonnelCodeDomain", b => + { + b.HasOne("Company.Domain.EmployeeAgg.Employee", "Employee") + .WithMany("PersonnelCodeList") + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Company.Domain.WorkshopAgg.Workshop", "Workshop") + .WithMany("PersonnelCodeList") + .HasForeignKey("WorkshopId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Workshop"); + }); + + modelBuilder.Entity("Company.Domain.Petition.Petition", b => + { + b.HasOne("Company.Domain.BoardType.BoardType", "BoardType") + .WithMany("PetitionsList") + .HasForeignKey("BoardType_Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Company.Domain.File1.File1", "File1") + .WithMany("PetitionsList") + .HasForeignKey("File_Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("BoardType"); + + b.Navigation("File1"); + }); + + modelBuilder.Entity("Company.Domain.ProceedingSession.ProceedingSession", b => + { + b.HasOne("Company.Domain.Board.Board", "Board") + .WithMany("ProceedingSessionsList") + .HasForeignKey("Board_Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Board"); + }); + + modelBuilder.Entity("Company.Domain.RollCallEmployeeStatusAgg.RollCallEmployeeStatus", b => + { + b.HasOne("Company.Domain.RollCallEmployeeAgg.RollCallEmployee", "RollCallEmployee") + .WithMany("EmployeesStatus") + .HasForeignKey("RollCallEmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("RollCallEmployee"); + }); + + modelBuilder.Entity("Company.Domain.RollCallServiceAgg.RollCallService", b => + { + b.HasOne("Company.Domain.WorkshopAgg.Workshop", "Workshop") + .WithMany("RollCallServicesList") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Workshop"); + }); + + modelBuilder.Entity("Company.Domain.SubtitleAgg.EntitySubtitle", b => + { + b.HasOne("Company.Domain.SubtitleAgg.EntitySubtitle", null) + .WithMany("Subtitles") + .HasForeignKey("EntitySubtitleid"); + + b.HasOne("Company.Domain.OriginalTitleAgg.EntityOriginalTitle", "EntityOriginalTitle") + .WithMany("Subtitles") + .HasForeignKey("OriginalTitle_Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("EntityOriginalTitle"); + }); + + modelBuilder.Entity("Company.Domain.TaxLeftWorkCategoryAgg.TaxLeftWorkCategory", b => + { + b.HasOne("Company.Domain.WorkshopAgg.Workshop", "Workshop") + .WithMany("TaxLeftWorkCategoryList") + .HasForeignKey("WorkshopId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Workshop"); + }); + + modelBuilder.Entity("Company.Domain.TaxLeftWorkItemAgg.TaxLeftWorkItem", b => + { + b.HasOne("Company.Domain.TaxLeftWorkCategoryAgg.TaxLeftWorkCategory", "TaxLeftWorkCategory") + .WithMany("TaxLeftWorkItemList") + .HasForeignKey("TaxLeftWorkCategoryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("TaxLeftWorkCategory"); + }); + + modelBuilder.Entity("Company.Domain.WorkHistory.WorkHistory", b => + { + b.HasOne("Company.Domain.Petition.Petition", "Petition") + .WithMany("WorkHistoriesList") + .HasForeignKey("Petition_Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Petition"); + }); + + modelBuilder.Entity("Company.Domain.WorkingHoursAgg.WorkingHours", b => + { + b.HasOne("Company.Domain.ContractAgg.Contract", "Contracts") + .WithMany("WorkingHoursList") + .HasForeignKey("ContractId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contracts"); + }); + + modelBuilder.Entity("Company.Domain.WorkingHoursItemsAgg.WorkingHoursItems", b => + { + b.HasOne("Company.Domain.WorkingHoursAgg.WorkingHours", "WorkingHourses") + .WithMany("WorkingHoursItemsList") + .HasForeignKey("WorkingHoursId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("WorkingHourses"); + }); + + modelBuilder.Entity("Company.Domain.WorkingHoursTempItemAgg.WorkingHoursTempItem", b => + { + b.HasOne("Company.Domain.WorkingHoursTempAgg.WorkingHoursTemp", "WorkingHoursTemp") + .WithMany("WorkingHoursTempItemList") + .HasForeignKey("WorkingHoursTempId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("WorkingHoursTemp"); + }); + + modelBuilder.Entity("Company.Domain.WorkshopAccountAgg.WorkshopAccount", b => + { + b.HasOne("Company.Domain.WorkshopAgg.Workshop", "Workshop") + .WithMany() + .HasForeignKey("WorkshopId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Workshop"); + }); + + modelBuilder.Entity("Company.Domain.WorkshopEmployerAgg.WorkshopEmployer", b => + { + b.HasOne("Company.Domain.empolyerAgg.Employer", "Employer") + .WithMany("WorkshopEmployers") + .HasForeignKey("EmployerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Company.Domain.WorkshopAgg.Workshop", "Workshop") + .WithMany("WorkshopEmployers") + .HasForeignKey("WorkshopId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employer"); + + b.Navigation("Workshop"); + }); + + modelBuilder.Entity("Company.Domain.WorkshopPlanEmployeeAgg.WorkshopPlanEmployee", b => + { + b.HasOne("Company.Domain.WorkshopPlanAgg.WorkshopPlan", "WorkshopPlan") + .WithMany("WorkshopPlanEmployees") + .HasForeignKey("WorkshopPlanId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("WorkshopPlan"); + }); + + modelBuilder.Entity("Company.Domain.WorkshopSubAccountAgg.WorkshopSubAccount", b => + { + b.HasOne("Company.Domain.WorkshopAgg.Workshop", "Workshop") + .WithMany("WorkshopSubAccounts") + .HasForeignKey("WorkshopId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Workshop"); + }); + + modelBuilder.Entity("Company.Domain.YearlySalaryItemsAgg.YearlySalaryItem", b => + { + b.HasOne("Company.Domain.YearlySalaryAgg.YearlySalary", "YearlySalary") + .WithMany("YearlySalaryItemsList") + .HasForeignKey("YearlySalaryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("YearlySalary"); + }); + + modelBuilder.Entity("Company.Domain.empolyerAgg.Employer", b => + { + b.HasOne("Company.Domain.ContarctingPartyAgg.PersonalContractingParty", "ContractingParty") + .WithMany("Employers") + .HasForeignKey("ContractingPartyId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ContractingParty"); + }); + + modelBuilder.Entity("EmployerWorkshop", b => + { + b.HasOne("Company.Domain.empolyerAgg.Employer", null) + .WithMany() + .HasForeignKey("EmployersListid") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Company.Domain.WorkshopAgg.Workshop", null) + .WithMany() + .HasForeignKey("WorkshopsListid") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Company.Domain.Board.Board", b => + { + b.Navigation("ProceedingSessionsList"); + }); + + modelBuilder.Entity("Company.Domain.BoardType.BoardType", b => + { + b.Navigation("BoardsList"); + + b.Navigation("EvidencesList"); + + b.Navigation("MasterPetitionsList"); + + b.Navigation("PetitionsList"); + }); + + modelBuilder.Entity("Company.Domain.ContarctingPartyAgg.PersonalContractingParty", b => + { + b.Navigation("Employers"); + }); + + modelBuilder.Entity("Company.Domain.ContractAgg.Contract", b => + { + b.Navigation("WorkingHoursList"); + }); + + modelBuilder.Entity("Company.Domain.CrossJobAgg.CrossJob", b => + { + b.Navigation("CrossJobItemsList"); + }); + + modelBuilder.Entity("Company.Domain.CrossJobGuildAgg.CrossJobGuild", b => + { + b.Navigation("CrossJobList"); + }); + + modelBuilder.Entity("Company.Domain.CustomizeWorkshopGroupSettingsAgg.Entities.CustomizeWorkshopGroupSettings", b => + { + b.Navigation("CustomizeWorkshopEmployeeSettingsCollection"); + }); + + modelBuilder.Entity("Company.Domain.CustomizeWorkshopSettingsAgg.Entities.CustomizeWorkshopSettings", b => + { + b.Navigation("CustomizeWorkshopGroupSettingsCollection"); + }); + + modelBuilder.Entity("Company.Domain.DateSalaryAgg.DateSalary", b => + { + b.Navigation("DateSalaryItemList"); + }); + + modelBuilder.Entity("Company.Domain.EmployeeAgg.Employee", b => + { + b.Navigation("ClientEmployeeWorkshopList"); + + b.Navigation("Contracts"); + + b.Navigation("CustomizeCheckouts"); + + b.Navigation("EmployeeChildrenList"); + + b.Navigation("EmployeeInsuranceRecords"); + + b.Navigation("InsuranceEmployeeInfo"); + + b.Navigation("LeftWorkInsurances"); + + b.Navigation("LeftWorks"); + + b.Navigation("PersonnelCodeList"); + }); + + modelBuilder.Entity("Company.Domain.Evidence.Evidence", b => + { + b.Navigation("EvidenceDetailsList"); + }); + + modelBuilder.Entity("Company.Domain.File1.File1", b => + { + b.Navigation("BoardsList"); + + b.Navigation("EvidencesList"); + + b.Navigation("FileAlertsList"); + + b.Navigation("FileAndFileEmployers"); + + b.Navigation("MasterPetitionsList"); + + b.Navigation("PetitionsList"); + }); + + modelBuilder.Entity("Company.Domain.FileEmployerAgg.FileEmployer", b => + { + b.Navigation("FileAndFileEmployers"); + }); + + modelBuilder.Entity("Company.Domain.FileState.FileState", b => + { + b.Navigation("FileAlertsList"); + }); + + modelBuilder.Entity("Company.Domain.FileTiming.FileTiming", b => + { + b.Navigation("FileStates"); + }); + + modelBuilder.Entity("Company.Domain.FinancialStatmentAgg.FinancialStatment", b => + { + b.Navigation("FinancialTransactionList"); + }); + + modelBuilder.Entity("Company.Domain.GroupPlanAgg.GroupPlan", b => + { + b.Navigation("GroupPlanJobItems"); + }); + + modelBuilder.Entity("Company.Domain.HolidayAgg.Holiday", b => + { + b.Navigation("HolidayItems"); + }); + + modelBuilder.Entity("Company.Domain.InstitutionContractAgg.InstitutionContract", b => + { + b.Navigation("ContactInfoList"); + }); + + modelBuilder.Entity("Company.Domain.InsurancJobAgg.InsuranceJob", b => + { + b.Navigation("InsuranceJobItemList"); + }); + + modelBuilder.Entity("Company.Domain.InsuranceJobItemAgg.InsuranceJobItem", b => + { + b.Navigation("InsuranceJobAndJobs"); + }); + + modelBuilder.Entity("Company.Domain.InsuranceListAgg.InsuranceList", b => + { + b.Navigation("InsuranceListWorkshops"); + }); + + modelBuilder.Entity("Company.Domain.JobAgg.Job", b => + { + b.Navigation("ContractsList"); + + b.Navigation("CrossJobItemsList"); + + b.Navigation("InsuranceJobAndJobs"); + }); + + modelBuilder.Entity("Company.Domain.MandatoryHoursAgg.MandatoryHours", b => + { + b.Navigation("Contracts"); + }); + + modelBuilder.Entity("Company.Domain.MasterPetition.MasterPetition", b => + { + b.Navigation("MasterPenaltyTitlesList"); + + b.Navigation("MasterWorkHistoriesList"); + }); + + modelBuilder.Entity("Company.Domain.ModuleAgg.EntityModule", b => + { + b.Navigation("EntityModuleTextManagers"); + }); + + modelBuilder.Entity("Company.Domain.OriginalTitleAgg.EntityOriginalTitle", b => + { + b.Navigation("Subtitles"); + }); + + modelBuilder.Entity("Company.Domain.PaymentToEmployeeAgg.PaymentToEmployee", b => + { + b.Navigation("PaymentToEmployeeItemList"); + }); + + modelBuilder.Entity("Company.Domain.PercentageAgg.Percentage", b => + { + b.Navigation("DateSalaryItemList"); + }); + + modelBuilder.Entity("Company.Domain.Petition.Petition", b => + { + b.Navigation("PenaltyTitlesList"); + + b.Navigation("WorkHistoriesList"); + }); + + modelBuilder.Entity("Company.Domain.RepresentativeAgg.Representative", b => + { + b.Navigation("ContractingParties"); + + b.Navigation("FileEmployeeList"); + + b.Navigation("FileEmployerList"); + }); + + modelBuilder.Entity("Company.Domain.RollCallEmployeeAgg.RollCallEmployee", b => + { + b.Navigation("EmployeesStatus"); + }); + + modelBuilder.Entity("Company.Domain.SubtitleAgg.EntitySubtitle", b => + { + b.Navigation("Chapters"); + + b.Navigation("Subtitles"); + }); + + modelBuilder.Entity("Company.Domain.TaxLeftWorkCategoryAgg.TaxLeftWorkCategory", b => + { + b.Navigation("TaxLeftWorkItemList"); + }); + + modelBuilder.Entity("Company.Domain.TextManagerAgg.EntityTextManager", b => + { + b.Navigation("EntityModuleTextManagers"); + }); + + modelBuilder.Entity("Company.Domain.WorkingHoursAgg.WorkingHours", b => + { + b.Navigation("WorkingHoursItemsList"); + }); + + modelBuilder.Entity("Company.Domain.WorkingHoursTempAgg.WorkingHoursTemp", b => + { + b.Navigation("WorkingHoursTempItemList"); + }); + + modelBuilder.Entity("Company.Domain.WorkshopAgg.Workshop", b => + { + b.Navigation("Checkouts"); + + b.Navigation("ClientEmployeeWorkshopList"); + + b.Navigation("Contracts2"); + + b.Navigation("CustomizeCheckouts"); + + b.Navigation("CustomizeWorkshopSettings"); + + b.Navigation("EmployeeInsuranceRecords"); + + b.Navigation("InsuranceListWorkshops"); + + b.Navigation("InsuranceWorkshopInfo"); + + b.Navigation("Insurances"); + + b.Navigation("LeftWorkInsurances"); + + b.Navigation("LeftWorks"); + + b.Navigation("PersonnelCodeList"); + + b.Navigation("RollCallServicesList"); + + b.Navigation("TaxLeftWorkCategoryList"); + + b.Navigation("WorkshopEmployers"); + + b.Navigation("WorkshopSubAccounts"); + }); + + modelBuilder.Entity("Company.Domain.WorkshopPlanAgg.WorkshopPlan", b => + { + b.Navigation("GroupPlans"); + + b.Navigation("WorkshopPlanEmployees"); + }); + + modelBuilder.Entity("Company.Domain.YearlySalaryAgg.YearlySalary", b => + { + b.Navigation("Contracts"); + + b.Navigation("YearlySalaryItemsList"); + }); + + modelBuilder.Entity("Company.Domain.empolyerAgg.Employer", b => + { + b.Navigation("Contracts"); + + b.Navigation("WorkshopEmployers"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/CompanyManagment.EFCore/Migrations/20241201165110_WorkshopSetings_SubAccount_FinRewardLoneSalery.cs b/CompanyManagment.EFCore/Migrations/20241201165110_WorkshopSetings_SubAccount_FinRewardLoneSalery.cs new file mode 100644 index 00000000..e9111deb --- /dev/null +++ b/CompanyManagment.EFCore/Migrations/20241201165110_WorkshopSetings_SubAccount_FinRewardLoneSalery.cs @@ -0,0 +1,356 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace CompanyManagment.EFCore.Migrations +{ + /// + public partial class WorkshopSetings_SubAccount_FinRewardLoneSalery : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "EmployerId", + table: "CustomizeCheckouts"); + + migrationBuilder.DropColumn( + name: "IsActiveString", + table: "CustomizeCheckouts"); + + migrationBuilder.RenameColumn( + name: "StartDateTime", + table: "Loan", + newName: "StartInstallmentPayment"); + + migrationBuilder.RenameColumn( + name: "IsChanged", + table: "CustomizeWorkshopEmployeeSettings", + newName: "IsShiftChanged"); + + migrationBuilder.AddColumn( + name: "GrantDate", + table: "Rewards", + type: "datetime2", + nullable: false, + defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + + migrationBuilder.AddColumn( + name: "InstallmentDate", + table: "LoanInstallment", + type: "datetime2", + nullable: false, + defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + + migrationBuilder.AddColumn( + name: "LoanGrantDate", + table: "Loan", + type: "datetime2", + nullable: false, + defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + + migrationBuilder.AddColumn( + name: "WorkshopShiftStatus", + table: "CustomizeWorkshopSettings", + type: "nvarchar(1)", + maxLength: 1, + nullable: false, + defaultValue: ""); + + migrationBuilder.AddColumn( + name: "BreakTime_BreakTimeType", + table: "CustomizeWorkshopGroupSettings", + type: "nvarchar(1)", + maxLength: 1, + nullable: true); + + migrationBuilder.AddColumn( + name: "BreakTime_BreakTimeValue", + table: "CustomizeWorkshopGroupSettings", + type: "time", + nullable: true); + + migrationBuilder.AddColumn( + name: "BreakTime_HasBreakTimeValue", + table: "CustomizeWorkshopGroupSettings", + type: "bit", + nullable: true); + + migrationBuilder.AddColumn( + name: "IrregularShift_EndTime", + table: "CustomizeWorkshopGroupSettings", + type: "time", + nullable: true); + + migrationBuilder.AddColumn( + name: "IrregularShift_StartTime", + table: "CustomizeWorkshopGroupSettings", + type: "time", + nullable: true); + + migrationBuilder.AddColumn( + name: "IrregularShift_WorkshopIrregularShifts", + table: "CustomizeWorkshopGroupSettings", + type: "nvarchar(1)", + maxLength: 1, + nullable: true); + + migrationBuilder.AddColumn( + name: "IsSettingChange", + table: "CustomizeWorkshopGroupSettings", + type: "bit", + nullable: false, + defaultValue: false); + + migrationBuilder.AddColumn( + name: "IsShiftChange", + table: "CustomizeWorkshopGroupSettings", + type: "bit", + nullable: false, + defaultValue: false); + + migrationBuilder.AddColumn( + name: "MainGroup", + table: "CustomizeWorkshopGroupSettings", + type: "bit", + nullable: false, + defaultValue: false); + + migrationBuilder.AddColumn( + name: "WorkshopShiftStatus", + table: "CustomizeWorkshopGroupSettings", + type: "nvarchar(1)", + maxLength: 1, + nullable: false, + defaultValue: ""); + + migrationBuilder.AddColumn( + name: "PreviousShiftThreshold", + table: "CustomizeWorkshopEmployeeSettingsShifts", + type: "time", + nullable: false, + defaultValue: new TimeOnly(0, 0, 0)); + + migrationBuilder.AddColumn( + name: "BreakTime_BreakTimeType", + table: "CustomizeWorkshopEmployeeSettings", + type: "nvarchar(1)", + maxLength: 1, + nullable: true); + + migrationBuilder.AddColumn( + name: "BreakTime_BreakTimeValue", + table: "CustomizeWorkshopEmployeeSettings", + type: "time", + nullable: true); + + migrationBuilder.AddColumn( + name: "BreakTime_HasBreakTimeValue", + table: "CustomizeWorkshopEmployeeSettings", + type: "bit", + nullable: true); + + migrationBuilder.AddColumn( + name: "IrregularShift_EndTime", + table: "CustomizeWorkshopEmployeeSettings", + type: "time", + nullable: true); + + migrationBuilder.AddColumn( + name: "IrregularShift_StartTime", + table: "CustomizeWorkshopEmployeeSettings", + type: "time", + nullable: true); + + migrationBuilder.AddColumn( + name: "IrregularShift_WorkshopIrregularShifts", + table: "CustomizeWorkshopEmployeeSettings", + type: "nvarchar(1)", + maxLength: 1, + nullable: true); + + migrationBuilder.AddColumn( + name: "IsSettingChanged", + table: "CustomizeWorkshopEmployeeSettings", + type: "bit", + nullable: false, + defaultValue: false); + + migrationBuilder.AddColumn( + name: "WorkshopShiftStatus", + table: "CustomizeWorkshopEmployeeSettings", + type: "nvarchar(1)", + maxLength: 1, + nullable: false, + defaultValue: ""); + + migrationBuilder.CreateTable( + name: "FineSubjects", + columns: table => new + { + id = table.Column(type: "bigint", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Title = table.Column(type: "nvarchar(255)", maxLength: 255, nullable: true), + Amount = table.Column(type: "nvarchar(25)", maxLength: 25, nullable: true), + WorkshopId = table.Column(type: "bigint", nullable: false), + CreationDate = table.Column(type: "datetime2", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_FineSubjects", x => x.id); + }); + + migrationBuilder.CreateTable( + name: "WorkshopSubAccounts", + columns: table => new + { + WorkshopId = table.Column(type: "bigint", nullable: false), + SubAccountId = table.Column(type: "bigint", nullable: false), + IsActive = table.Column(type: "int", maxLength: 5, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_WorkshopSubAccounts", x => new { x.SubAccountId, x.WorkshopId }); + table.ForeignKey( + name: "FK_WorkshopSubAccounts_Workshops_WorkshopId", + column: x => x.WorkshopId, + principalTable: "Workshops", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_WorkshopSubAccounts_WorkshopId", + table: "WorkshopSubAccounts", + column: "WorkshopId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "FineSubjects"); + + migrationBuilder.DropTable( + name: "WorkshopSubAccounts"); + + migrationBuilder.DropColumn( + name: "GrantDate", + table: "Rewards"); + + migrationBuilder.DropColumn( + name: "InstallmentDate", + table: "LoanInstallment"); + + migrationBuilder.DropColumn( + name: "LoanGrantDate", + table: "Loan"); + + migrationBuilder.DropColumn( + name: "WorkshopShiftStatus", + table: "CustomizeWorkshopSettings"); + + migrationBuilder.DropColumn( + name: "BreakTime_BreakTimeType", + table: "CustomizeWorkshopGroupSettings"); + + migrationBuilder.DropColumn( + name: "BreakTime_BreakTimeValue", + table: "CustomizeWorkshopGroupSettings"); + + migrationBuilder.DropColumn( + name: "BreakTime_HasBreakTimeValue", + table: "CustomizeWorkshopGroupSettings"); + + migrationBuilder.DropColumn( + name: "IrregularShift_EndTime", + table: "CustomizeWorkshopGroupSettings"); + + migrationBuilder.DropColumn( + name: "IrregularShift_StartTime", + table: "CustomizeWorkshopGroupSettings"); + + migrationBuilder.DropColumn( + name: "IrregularShift_WorkshopIrregularShifts", + table: "CustomizeWorkshopGroupSettings"); + + migrationBuilder.DropColumn( + name: "IsSettingChange", + table: "CustomizeWorkshopGroupSettings"); + + migrationBuilder.DropColumn( + name: "IsShiftChange", + table: "CustomizeWorkshopGroupSettings"); + + migrationBuilder.DropColumn( + name: "MainGroup", + table: "CustomizeWorkshopGroupSettings"); + + migrationBuilder.DropColumn( + name: "WorkshopShiftStatus", + table: "CustomizeWorkshopGroupSettings"); + + migrationBuilder.DropColumn( + name: "PreviousShiftThreshold", + table: "CustomizeWorkshopEmployeeSettingsShifts"); + + migrationBuilder.DropColumn( + name: "BreakTime_BreakTimeType", + table: "CustomizeWorkshopEmployeeSettings"); + + migrationBuilder.DropColumn( + name: "BreakTime_BreakTimeValue", + table: "CustomizeWorkshopEmployeeSettings"); + + migrationBuilder.DropColumn( + name: "BreakTime_HasBreakTimeValue", + table: "CustomizeWorkshopEmployeeSettings"); + + migrationBuilder.DropColumn( + name: "IrregularShift_EndTime", + table: "CustomizeWorkshopEmployeeSettings"); + + migrationBuilder.DropColumn( + name: "IrregularShift_StartTime", + table: "CustomizeWorkshopEmployeeSettings"); + + migrationBuilder.DropColumn( + name: "IrregularShift_WorkshopIrregularShifts", + table: "CustomizeWorkshopEmployeeSettings"); + + migrationBuilder.DropColumn( + name: "IsSettingChanged", + table: "CustomizeWorkshopEmployeeSettings"); + + migrationBuilder.DropColumn( + name: "WorkshopShiftStatus", + table: "CustomizeWorkshopEmployeeSettings"); + + migrationBuilder.RenameColumn( + name: "StartInstallmentPayment", + table: "Loan", + newName: "StartDateTime"); + + migrationBuilder.RenameColumn( + name: "IsShiftChanged", + table: "CustomizeWorkshopEmployeeSettings", + newName: "IsChanged"); + + migrationBuilder.AddColumn( + name: "EmployerId", + table: "CustomizeCheckouts", + type: "bigint", + nullable: false, + defaultValue: 0L); + + migrationBuilder.AddColumn( + name: "IsActiveString", + table: "CustomizeCheckouts", + type: "nvarchar(5)", + maxLength: 5, + nullable: false, + defaultValue: ""); + } + } +} diff --git a/CompanyManagment.EFCore/Migrations/CompanyContextModelSnapshot.cs b/CompanyManagment.EFCore/Migrations/CompanyContextModelSnapshot.cs index 1a3bcc52..fe1e7faf 100644 --- a/CompanyManagment.EFCore/Migrations/CompanyContextModelSnapshot.cs +++ b/CompanyManagment.EFCore/Migrations/CompanyContextModelSnapshot.cs @@ -17,7 +17,7 @@ namespace CompanyManagment.EFCore.Migrations { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "8.0.4") + .HasAnnotation("ProductVersion", "8.0.10") .HasAnnotation("Relational:MaxIdentifierLength", 128); SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); @@ -846,9 +846,6 @@ namespace CompanyManagment.EFCore.Migrations b.Property("EmployeeId") .HasColumnType("bigint"); - b.Property("EmployerId") - .HasColumnType("bigint"); - b.Property("FamilyAllowance") .HasColumnType("float"); @@ -867,11 +864,6 @@ namespace CompanyManagment.EFCore.Migrations b.Property("InsuranceDeduction") .HasColumnType("float"); - b.Property("IsActiveString") - .IsRequired() - .HasMaxLength(5) - .HasColumnType("nvarchar(5)"); - b.Property("LateToWorkDeduction") .HasColumnType("float"); @@ -959,7 +951,10 @@ namespace CompanyManagment.EFCore.Migrations .HasMaxLength(1) .HasColumnType("nvarchar(1)"); - b.Property("IsChanged") + b.Property("IsSettingChanged") + .HasColumnType("bit"); + + b.Property("IsShiftChanged") .HasColumnType("bit"); b.Property("Salary") @@ -968,6 +963,11 @@ namespace CompanyManagment.EFCore.Migrations b.Property("WorkshopId") .HasColumnType("bigint"); + b.Property("WorkshopShiftStatus") + .IsRequired() + .HasMaxLength(1) + .HasColumnType("nvarchar(1)"); + b.HasKey("id"); b.HasIndex("CustomizeWorkshopGroupSettingId"); @@ -1003,9 +1003,23 @@ namespace CompanyManagment.EFCore.Migrations .HasMaxLength(1) .HasColumnType("nvarchar(1)"); + b.Property("IsSettingChange") + .HasColumnType("bit"); + + b.Property("IsShiftChange") + .HasColumnType("bit"); + + b.Property("MainGroup") + .HasColumnType("bit"); + b.Property("Salary") .HasColumnType("float"); + b.Property("WorkshopShiftStatus") + .IsRequired() + .HasMaxLength(1) + .HasColumnType("nvarchar(1)"); + b.HasKey("id"); b.HasIndex("CustomizeWorkshopSettingId"); @@ -1062,6 +1076,11 @@ namespace CompanyManagment.EFCore.Migrations b.Property("WorkshopId") .HasColumnType("bigint"); + b.Property("WorkshopShiftStatus") + .IsRequired() + .HasMaxLength(1) + .HasColumnType("nvarchar(1)"); + b.HasKey("id"); b.HasIndex("WorkshopId") @@ -2062,6 +2081,33 @@ namespace CompanyManagment.EFCore.Migrations b.ToTable("Fines", (string)null); }); + modelBuilder.Entity("Company.Domain.FineSubjectAgg.FineSubject", b => + { + b.Property("id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("id")); + + b.Property("Amount") + .HasMaxLength(25) + .HasColumnType("nvarchar(25)"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("Title") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("WorkshopId") + .HasColumnType("bigint"); + + b.HasKey("id"); + + b.ToTable("FineSubjects", (string)null); + }); + modelBuilder.Entity("Company.Domain.GroupPlanAgg.GroupPlan", b => { b.Property("id") @@ -3013,7 +3059,10 @@ namespace CompanyManagment.EFCore.Migrations b.Property("GetRounded") .HasColumnType("bit"); - b.Property("StartDateTime") + b.Property("LoanGrantDate") + .HasColumnType("datetime2"); + + b.Property("StartInstallmentPayment") .HasColumnType("datetime2"); b.Property("WorkshopId") @@ -3715,6 +3764,9 @@ namespace CompanyManagment.EFCore.Migrations b.Property("EmployeeId") .HasColumnType("bigint"); + b.Property("GrantDate") + .HasColumnType("datetime2"); + b.Property("IsActive") .IsRequired() .HasMaxLength(1) @@ -4705,6 +4757,25 @@ namespace CompanyManagment.EFCore.Migrations b.ToTable("WorkshopPlanEmployees", (string)null); }); + modelBuilder.Entity("Company.Domain.WorkshopSubAccountAgg.WorkshopSubAccount", b => + { + b.Property("SubAccountId") + .HasColumnType("bigint"); + + b.Property("WorkshopId") + .HasColumnType("bigint"); + + b.Property("IsActive") + .HasMaxLength(5) + .HasColumnType("int"); + + b.HasKey("SubAccountId", "WorkshopId"); + + b.HasIndex("WorkshopId"); + + b.ToTable("WorkshopSubAccounts", (string)null); + }); + modelBuilder.Entity("Company.Domain.YearlySalaryAgg.YearlySalary", b => { b.Property("id") @@ -5203,6 +5274,9 @@ namespace CompanyManagment.EFCore.Migrations .HasMaxLength(20) .HasColumnType("nvarchar(20)"); + b1.Property("PreviousShiftThreshold") + .HasColumnType("time"); + b1.Property("StartTime") .HasColumnType("time"); @@ -5218,7 +5292,7 @@ namespace CompanyManagment.EFCore.Migrations b1.Navigation("CustomizeWorkshopEmployeeSettings"); }); - b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutValueObjects.BaseYearsPay", "BaseYearsPay", b1 => + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.BaseYearsPay", "BaseYearsPay", b1 => { b1.Property("CustomizeWorkshopEmployeeSettingsid") .HasColumnType("bigint"); @@ -5247,7 +5321,7 @@ namespace CompanyManagment.EFCore.Migrations .HasForeignKey("CustomizeWorkshopEmployeeSettingsid"); }); - b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutValueObjects.BonusesPay", "BonusesPay", b1 => + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.BonusesPay", "BonusesPay", b1 => { b1.Property("CustomizeWorkshopEmployeeSettingsid") .HasColumnType("bigint"); @@ -5276,7 +5350,31 @@ namespace CompanyManagment.EFCore.Migrations .HasForeignKey("CustomizeWorkshopEmployeeSettingsid"); }); - b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutValueObjects.EarlyExit", "EarlyExit", b1 => + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.BreakTime", "BreakTime", b1 => + { + b1.Property("CustomizeWorkshopEmployeeSettingsid") + .HasColumnType("bigint"); + + b1.Property("BreakTimeType") + .IsRequired() + .HasMaxLength(1) + .HasColumnType("nvarchar(1)"); + + b1.Property("BreakTimeValue") + .HasColumnType("time"); + + b1.Property("HasBreakTimeValue") + .HasColumnType("bit"); + + b1.HasKey("CustomizeWorkshopEmployeeSettingsid"); + + b1.ToTable("CustomizeWorkshopEmployeeSettings"); + + b1.WithOwner() + .HasForeignKey("CustomizeWorkshopEmployeeSettingsid"); + }); + + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.EarlyExit", "EarlyExit", b1 => { b1.Property("CustomizeWorkshopEmployeeSettingsid") .HasColumnType("bigint"); @@ -5298,7 +5396,7 @@ namespace CompanyManagment.EFCore.Migrations b1.WithOwner() .HasForeignKey("CustomizeWorkshopEmployeeSettingsid"); - b1.OwnsMany("_0_Framework.Domain.CustomizeCheckoutValueObjects.EarlyExitTimeFine", "EarlyExitTimeFines", b2 => + b1.OwnsMany("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.EarlyExitTimeFine", "EarlyExitTimeFines", b2 => { b2.Property("CustomizeWorkshopEmployeeSettingsId") .HasColumnType("bigint"); @@ -5329,7 +5427,7 @@ namespace CompanyManagment.EFCore.Migrations b1.Navigation("EarlyExitTimeFines"); }); - b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutValueObjects.FamilyAllowance", "FamilyAllowance", b1 => + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.FamilyAllowance", "FamilyAllowance", b1 => { b1.Property("CustomizeWorkshopEmployeeSettingsid") .HasColumnType("bigint"); @@ -5352,7 +5450,7 @@ namespace CompanyManagment.EFCore.Migrations .HasForeignKey("CustomizeWorkshopEmployeeSettingsid"); }); - b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutValueObjects.FineAbsenceDeduction", "FineAbsenceDeduction", b1 => + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.FineAbsenceDeduction", "FineAbsenceDeduction", b1 => { b1.Property("CustomizeWorkshopEmployeeSettingsid") .HasColumnType("bigint"); @@ -5374,7 +5472,7 @@ namespace CompanyManagment.EFCore.Migrations b1.WithOwner() .HasForeignKey("CustomizeWorkshopEmployeeSettingsid"); - b1.OwnsMany("_0_Framework.Domain.CustomizeCheckoutValueObjects.FineAbsenceDayOfWeek", "FineAbsenceDayOfWeekCollection", b2 => + b1.OwnsMany("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.FineAbsenceDayOfWeek", "FineAbsenceDayOfWeekCollection", b2 => { b2.Property("CustomizeWorkshopEmployeeSettingsId") .HasColumnType("bigint"); @@ -5402,7 +5500,7 @@ namespace CompanyManagment.EFCore.Migrations b1.Navigation("FineAbsenceDayOfWeekCollection"); }); - b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutValueObjects.FridayPay", "FridayPay", b1 => + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.FridayPay", "FridayPay", b1 => { b1.Property("CustomizeWorkshopEmployeeSettingsid") .HasColumnType("bigint"); @@ -5424,7 +5522,7 @@ namespace CompanyManagment.EFCore.Migrations .HasForeignKey("CustomizeWorkshopEmployeeSettingsid"); }); - b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutValueObjects.InsuranceDeduction", "InsuranceDeduction", b1 => + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.InsuranceDeduction", "InsuranceDeduction", b1 => { b1.Property("CustomizeWorkshopEmployeeSettingsid") .HasColumnType("bigint"); @@ -5447,7 +5545,31 @@ namespace CompanyManagment.EFCore.Migrations .HasForeignKey("CustomizeWorkshopEmployeeSettingsid"); }); - b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutValueObjects.LateToWork", "LateToWork", b1 => + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.IrregularShift", "IrregularShift", b1 => + { + b1.Property("CustomizeWorkshopEmployeeSettingsid") + .HasColumnType("bigint"); + + b1.Property("EndTime") + .HasColumnType("time"); + + b1.Property("StartTime") + .HasColumnType("time"); + + b1.Property("WorkshopIrregularShifts") + .IsRequired() + .HasMaxLength(1) + .HasColumnType("nvarchar(1)"); + + b1.HasKey("CustomizeWorkshopEmployeeSettingsid"); + + b1.ToTable("CustomizeWorkshopEmployeeSettings"); + + b1.WithOwner() + .HasForeignKey("CustomizeWorkshopEmployeeSettingsid"); + }); + + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.LateToWork", "LateToWork", b1 => { b1.Property("CustomizeWorkshopEmployeeSettingsid") .HasColumnType("bigint"); @@ -5469,7 +5591,7 @@ namespace CompanyManagment.EFCore.Migrations b1.WithOwner() .HasForeignKey("CustomizeWorkshopEmployeeSettingsid"); - b1.OwnsMany("_0_Framework.Domain.CustomizeCheckoutValueObjects.LateToWorkTimeFine", "LateToWorkTimeFines", b2 => + b1.OwnsMany("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.LateToWorkTimeFine", "LateToWorkTimeFines", b2 => { b2.Property("CustomizeWorkshopEmployeeSettingsId") .HasColumnType("bigint"); @@ -5500,7 +5622,7 @@ namespace CompanyManagment.EFCore.Migrations b1.Navigation("LateToWorkTimeFines"); }); - b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutValueObjects.LeavePay", "LeavePay", b1 => + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.LeavePay", "LeavePay", b1 => { b1.Property("CustomizeWorkshopEmployeeSettingsid") .HasColumnType("bigint"); @@ -5523,7 +5645,7 @@ namespace CompanyManagment.EFCore.Migrations .HasForeignKey("CustomizeWorkshopEmployeeSettingsid"); }); - b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutValueObjects.MarriedAllowance", "MarriedAllowance", b1 => + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.MarriedAllowance", "MarriedAllowance", b1 => { b1.Property("CustomizeWorkshopEmployeeSettingsid") .HasColumnType("bigint"); @@ -5546,7 +5668,7 @@ namespace CompanyManagment.EFCore.Migrations .HasForeignKey("CustomizeWorkshopEmployeeSettingsid"); }); - b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutValueObjects.NightWorkPay", "NightWorkPay", b1 => + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.NightWorkPay", "NightWorkPay", b1 => { b1.Property("CustomizeWorkshopEmployeeSettingsid") .HasColumnType("bigint"); @@ -5569,7 +5691,7 @@ namespace CompanyManagment.EFCore.Migrations .HasForeignKey("CustomizeWorkshopEmployeeSettingsid"); }); - b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutValueObjects.OverTimePay", "OverTimePay", b1 => + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.OverTimePay", "OverTimePay", b1 => { b1.Property("CustomizeWorkshopEmployeeSettingsid") .HasColumnType("bigint"); @@ -5592,7 +5714,7 @@ namespace CompanyManagment.EFCore.Migrations .HasForeignKey("CustomizeWorkshopEmployeeSettingsid"); }); - b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutValueObjects.ShiftPay", "ShiftPay", b1 => + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.ShiftPay", "ShiftPay", b1 => { b1.Property("CustomizeWorkshopEmployeeSettingsid") .HasColumnType("bigint"); @@ -5625,6 +5747,8 @@ namespace CompanyManagment.EFCore.Migrations b.Navigation("BonusesPay"); + b.Navigation("BreakTime"); + b.Navigation("CustomizeWorkshopEmployeeSettingsShifts"); b.Navigation("CustomizeWorkshopGroupSettings"); @@ -5639,6 +5763,8 @@ namespace CompanyManagment.EFCore.Migrations b.Navigation("InsuranceDeduction"); + b.Navigation("IrregularShift"); + b.Navigation("LateToWork"); b.Navigation("LeavePay"); @@ -5697,7 +5823,7 @@ namespace CompanyManagment.EFCore.Migrations b1.Navigation("CustomizeWorkshopGroupSettings"); }); - b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutValueObjects.BaseYearsPay", "BaseYearsPay", b1 => + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.BaseYearsPay", "BaseYearsPay", b1 => { b1.Property("CustomizeWorkshopGroupSettingsid") .HasColumnType("bigint"); @@ -5726,7 +5852,7 @@ namespace CompanyManagment.EFCore.Migrations .HasForeignKey("CustomizeWorkshopGroupSettingsid"); }); - b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutValueObjects.BonusesPay", "BonusesPay", b1 => + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.BonusesPay", "BonusesPay", b1 => { b1.Property("CustomizeWorkshopGroupSettingsid") .HasColumnType("bigint"); @@ -5755,7 +5881,31 @@ namespace CompanyManagment.EFCore.Migrations .HasForeignKey("CustomizeWorkshopGroupSettingsid"); }); - b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutValueObjects.EarlyExit", "EarlyExit", b1 => + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.BreakTime", "BreakTime", b1 => + { + b1.Property("CustomizeWorkshopGroupSettingsid") + .HasColumnType("bigint"); + + b1.Property("BreakTimeType") + .IsRequired() + .HasMaxLength(1) + .HasColumnType("nvarchar(1)"); + + b1.Property("BreakTimeValue") + .HasColumnType("time"); + + b1.Property("HasBreakTimeValue") + .HasColumnType("bit"); + + b1.HasKey("CustomizeWorkshopGroupSettingsid"); + + b1.ToTable("CustomizeWorkshopGroupSettings"); + + b1.WithOwner() + .HasForeignKey("CustomizeWorkshopGroupSettingsid"); + }); + + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.EarlyExit", "EarlyExit", b1 => { b1.Property("CustomizeWorkshopGroupSettingsid") .HasColumnType("bigint"); @@ -5777,7 +5927,7 @@ namespace CompanyManagment.EFCore.Migrations b1.WithOwner() .HasForeignKey("CustomizeWorkshopGroupSettingsid"); - b1.OwnsMany("_0_Framework.Domain.CustomizeCheckoutValueObjects.EarlyExitTimeFine", "EarlyExitTimeFines", b2 => + b1.OwnsMany("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.EarlyExitTimeFine", "EarlyExitTimeFines", b2 => { b2.Property("CustomizeWorkshopGroupSettingsId") .HasColumnType("bigint"); @@ -5808,7 +5958,7 @@ namespace CompanyManagment.EFCore.Migrations b1.Navigation("EarlyExitTimeFines"); }); - b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutValueObjects.FamilyAllowance", "FamilyAllowance", b1 => + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.FamilyAllowance", "FamilyAllowance", b1 => { b1.Property("CustomizeWorkshopGroupSettingsid") .HasColumnType("bigint"); @@ -5831,7 +5981,7 @@ namespace CompanyManagment.EFCore.Migrations .HasForeignKey("CustomizeWorkshopGroupSettingsid"); }); - b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutValueObjects.FineAbsenceDeduction", "FineAbsenceDeduction", b1 => + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.FineAbsenceDeduction", "FineAbsenceDeduction", b1 => { b1.Property("CustomizeWorkshopGroupSettingsid") .HasColumnType("bigint"); @@ -5853,7 +6003,7 @@ namespace CompanyManagment.EFCore.Migrations b1.WithOwner() .HasForeignKey("CustomizeWorkshopGroupSettingsid"); - b1.OwnsMany("_0_Framework.Domain.CustomizeCheckoutValueObjects.FineAbsenceDayOfWeek", "FineAbsenceDayOfWeekCollection", b2 => + b1.OwnsMany("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.FineAbsenceDayOfWeek", "FineAbsenceDayOfWeekCollection", b2 => { b2.Property("CustomizeWorkshopGroupSettingsId") .HasColumnType("bigint"); @@ -5881,7 +6031,7 @@ namespace CompanyManagment.EFCore.Migrations b1.Navigation("FineAbsenceDayOfWeekCollection"); }); - b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutValueObjects.FridayPay", "FridayPay", b1 => + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.FridayPay", "FridayPay", b1 => { b1.Property("CustomizeWorkshopGroupSettingsid") .HasColumnType("bigint"); @@ -5903,7 +6053,7 @@ namespace CompanyManagment.EFCore.Migrations .HasForeignKey("CustomizeWorkshopGroupSettingsid"); }); - b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutValueObjects.InsuranceDeduction", "InsuranceDeduction", b1 => + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.InsuranceDeduction", "InsuranceDeduction", b1 => { b1.Property("CustomizeWorkshopGroupSettingsid") .HasColumnType("bigint"); @@ -5926,7 +6076,31 @@ namespace CompanyManagment.EFCore.Migrations .HasForeignKey("CustomizeWorkshopGroupSettingsid"); }); - b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutValueObjects.LateToWork", "LateToWork", b1 => + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.IrregularShift", "IrregularShift", b1 => + { + b1.Property("CustomizeWorkshopGroupSettingsid") + .HasColumnType("bigint"); + + b1.Property("EndTime") + .HasColumnType("time"); + + b1.Property("StartTime") + .HasColumnType("time"); + + b1.Property("WorkshopIrregularShifts") + .IsRequired() + .HasMaxLength(1) + .HasColumnType("nvarchar(1)"); + + b1.HasKey("CustomizeWorkshopGroupSettingsid"); + + b1.ToTable("CustomizeWorkshopGroupSettings"); + + b1.WithOwner() + .HasForeignKey("CustomizeWorkshopGroupSettingsid"); + }); + + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.LateToWork", "LateToWork", b1 => { b1.Property("CustomizeWorkshopGroupSettingsid") .HasColumnType("bigint"); @@ -5948,7 +6122,7 @@ namespace CompanyManagment.EFCore.Migrations b1.WithOwner() .HasForeignKey("CustomizeWorkshopGroupSettingsid"); - b1.OwnsMany("_0_Framework.Domain.CustomizeCheckoutValueObjects.LateToWorkTimeFine", "LateToWorkTimeFines", b2 => + b1.OwnsMany("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.LateToWorkTimeFine", "LateToWorkTimeFines", b2 => { b2.Property("CustomizeWorkshopGroupSettingsId") .HasColumnType("bigint"); @@ -5979,7 +6153,7 @@ namespace CompanyManagment.EFCore.Migrations b1.Navigation("LateToWorkTimeFines"); }); - b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutValueObjects.LeavePay", "LeavePay", b1 => + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.LeavePay", "LeavePay", b1 => { b1.Property("CustomizeWorkshopGroupSettingsid") .HasColumnType("bigint"); @@ -6002,7 +6176,7 @@ namespace CompanyManagment.EFCore.Migrations .HasForeignKey("CustomizeWorkshopGroupSettingsid"); }); - b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutValueObjects.MarriedAllowance", "MarriedAllowance", b1 => + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.MarriedAllowance", "MarriedAllowance", b1 => { b1.Property("CustomizeWorkshopGroupSettingsid") .HasColumnType("bigint"); @@ -6025,7 +6199,7 @@ namespace CompanyManagment.EFCore.Migrations .HasForeignKey("CustomizeWorkshopGroupSettingsid"); }); - b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutValueObjects.NightWorkPay", "NightWorkPay", b1 => + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.NightWorkPay", "NightWorkPay", b1 => { b1.Property("CustomizeWorkshopGroupSettingsid") .HasColumnType("bigint"); @@ -6048,7 +6222,7 @@ namespace CompanyManagment.EFCore.Migrations .HasForeignKey("CustomizeWorkshopGroupSettingsid"); }); - b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutValueObjects.OverTimePay", "OverTimePay", b1 => + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.OverTimePay", "OverTimePay", b1 => { b1.Property("CustomizeWorkshopGroupSettingsid") .HasColumnType("bigint"); @@ -6071,7 +6245,7 @@ namespace CompanyManagment.EFCore.Migrations .HasForeignKey("CustomizeWorkshopGroupSettingsid"); }); - b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutValueObjects.ShiftPay", "ShiftPay", b1 => + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.ShiftPay", "ShiftPay", b1 => { b1.Property("CustomizeWorkshopGroupSettingsid") .HasColumnType("bigint"); @@ -6104,6 +6278,8 @@ namespace CompanyManagment.EFCore.Migrations b.Navigation("BonusesPay"); + b.Navigation("BreakTime"); + b.Navigation("CustomizeWorkshopGroupSettingsShifts"); b.Navigation("CustomizeWorkshopSettings"); @@ -6118,6 +6294,8 @@ namespace CompanyManagment.EFCore.Migrations b.Navigation("InsuranceDeduction"); + b.Navigation("IrregularShift"); + b.Navigation("LateToWork"); b.Navigation("LeavePay"); @@ -6176,7 +6354,7 @@ namespace CompanyManagment.EFCore.Migrations b1.Navigation("CustomizeWorkshopSettings"); }); - b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutValueObjects.BaseYearsPay", "BaseYearsPay", b1 => + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.BaseYearsPay", "BaseYearsPay", b1 => { b1.Property("CustomizeWorkshopSettingsid") .HasColumnType("bigint"); @@ -6205,7 +6383,7 @@ namespace CompanyManagment.EFCore.Migrations .HasForeignKey("CustomizeWorkshopSettingsid"); }); - b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutValueObjects.BonusesPay", "BonusesPay", b1 => + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.BonusesPay", "BonusesPay", b1 => { b1.Property("CustomizeWorkshopSettingsid") .HasColumnType("bigint"); @@ -6234,7 +6412,7 @@ namespace CompanyManagment.EFCore.Migrations .HasForeignKey("CustomizeWorkshopSettingsid"); }); - b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutValueObjects.EarlyExit", "EarlyExit", b1 => + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.EarlyExit", "EarlyExit", b1 => { b1.Property("CustomizeWorkshopSettingsid") .HasColumnType("bigint"); @@ -6256,7 +6434,7 @@ namespace CompanyManagment.EFCore.Migrations b1.WithOwner() .HasForeignKey("CustomizeWorkshopSettingsid"); - b1.OwnsMany("_0_Framework.Domain.CustomizeCheckoutValueObjects.EarlyExitTimeFine", "EarlyExitTimeFines", b2 => + b1.OwnsMany("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.EarlyExitTimeFine", "EarlyExitTimeFines", b2 => { b2.Property("CustomizeWorkshopSettingsId") .HasColumnType("bigint"); @@ -6287,7 +6465,7 @@ namespace CompanyManagment.EFCore.Migrations b1.Navigation("EarlyExitTimeFines"); }); - b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutValueObjects.FamilyAllowance", "FamilyAllowance", b1 => + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.FamilyAllowance", "FamilyAllowance", b1 => { b1.Property("CustomizeWorkshopSettingsid") .HasColumnType("bigint"); @@ -6310,7 +6488,7 @@ namespace CompanyManagment.EFCore.Migrations .HasForeignKey("CustomizeWorkshopSettingsid"); }); - b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutValueObjects.FineAbsenceDeduction", "FineAbsenceDeduction", b1 => + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.FineAbsenceDeduction", "FineAbsenceDeduction", b1 => { b1.Property("CustomizeWorkshopSettingsid") .HasColumnType("bigint"); @@ -6332,7 +6510,7 @@ namespace CompanyManagment.EFCore.Migrations b1.WithOwner() .HasForeignKey("CustomizeWorkshopSettingsid"); - b1.OwnsMany("_0_Framework.Domain.CustomizeCheckoutValueObjects.FineAbsenceDayOfWeek", "FineAbsenceDayOfWeekCollection", b2 => + b1.OwnsMany("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.FineAbsenceDayOfWeek", "FineAbsenceDayOfWeekCollection", b2 => { b2.Property("CustomizeWorkshopSettingsId") .HasColumnType("bigint"); @@ -6360,7 +6538,7 @@ namespace CompanyManagment.EFCore.Migrations b1.Navigation("FineAbsenceDayOfWeekCollection"); }); - b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutValueObjects.FridayPay", "FridayPay", b1 => + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.FridayPay", "FridayPay", b1 => { b1.Property("CustomizeWorkshopSettingsid") .HasColumnType("bigint"); @@ -6382,7 +6560,7 @@ namespace CompanyManagment.EFCore.Migrations .HasForeignKey("CustomizeWorkshopSettingsid"); }); - b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutValueObjects.InsuranceDeduction", "InsuranceDeduction", b1 => + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.InsuranceDeduction", "InsuranceDeduction", b1 => { b1.Property("CustomizeWorkshopSettingsid") .HasColumnType("bigint"); @@ -6405,7 +6583,7 @@ namespace CompanyManagment.EFCore.Migrations .HasForeignKey("CustomizeWorkshopSettingsid"); }); - b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutValueObjects.LateToWork", "LateToWork", b1 => + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.LateToWork", "LateToWork", b1 => { b1.Property("CustomizeWorkshopSettingsid") .HasColumnType("bigint"); @@ -6427,7 +6605,7 @@ namespace CompanyManagment.EFCore.Migrations b1.WithOwner() .HasForeignKey("CustomizeWorkshopSettingsid"); - b1.OwnsMany("_0_Framework.Domain.CustomizeCheckoutValueObjects.LateToWorkTimeFine", "LateToWorkTimeFines", b2 => + b1.OwnsMany("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.LateToWorkTimeFine", "LateToWorkTimeFines", b2 => { b2.Property("CustomizeWorkshopSettingsId") .HasColumnType("bigint"); @@ -6458,7 +6636,7 @@ namespace CompanyManagment.EFCore.Migrations b1.Navigation("LateToWorkTimeFines"); }); - b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutValueObjects.LeavePay", "LeavePay", b1 => + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.LeavePay", "LeavePay", b1 => { b1.Property("CustomizeWorkshopSettingsid") .HasColumnType("bigint"); @@ -6481,7 +6659,7 @@ namespace CompanyManagment.EFCore.Migrations .HasForeignKey("CustomizeWorkshopSettingsid"); }); - b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutValueObjects.MarriedAllowance", "MarriedAllowance", b1 => + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.MarriedAllowance", "MarriedAllowance", b1 => { b1.Property("CustomizeWorkshopSettingsid") .HasColumnType("bigint"); @@ -6504,7 +6682,7 @@ namespace CompanyManagment.EFCore.Migrations .HasForeignKey("CustomizeWorkshopSettingsid"); }); - b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutValueObjects.NightWorkPay", "NightWorkPay", b1 => + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.NightWorkPay", "NightWorkPay", b1 => { b1.Property("CustomizeWorkshopSettingsid") .HasColumnType("bigint"); @@ -6527,7 +6705,7 @@ namespace CompanyManagment.EFCore.Migrations .HasForeignKey("CustomizeWorkshopSettingsid"); }); - b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutValueObjects.OverTimePay", "OverTimePay", b1 => + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.OverTimePay", "OverTimePay", b1 => { b1.Property("CustomizeWorkshopSettingsid") .HasColumnType("bigint"); @@ -6550,7 +6728,7 @@ namespace CompanyManagment.EFCore.Migrations .HasForeignKey("CustomizeWorkshopSettingsid"); }); - b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutValueObjects.ShiftPay", "ShiftPay", b1 => + b.OwnsOne("_0_Framework.Domain.CustomizeCheckoutShared.ValueObjects.ShiftPay", "ShiftPay", b1 => { b1.Property("CustomizeWorkshopSettingsid") .HasColumnType("bigint"); @@ -6973,6 +7151,9 @@ namespace CompanyManagment.EFCore.Migrations b1.Property("AmountForMonth") .HasColumnType("float"); + b1.Property("InstallmentDate") + .HasColumnType("datetime2"); + b1.Property("IsActive") .IsRequired() .HasMaxLength(1) @@ -7272,6 +7453,17 @@ namespace CompanyManagment.EFCore.Migrations b.Navigation("WorkshopPlan"); }); + modelBuilder.Entity("Company.Domain.WorkshopSubAccountAgg.WorkshopSubAccount", b => + { + b.HasOne("Company.Domain.WorkshopAgg.Workshop", "Workshop") + .WithMany("WorkshopSubAccounts") + .HasForeignKey("WorkshopId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Workshop"); + }); + modelBuilder.Entity("Company.Domain.YearlySalaryItemsAgg.YearlySalaryItem", b => { b.HasOne("Company.Domain.YearlySalaryAgg.YearlySalary", "YearlySalary") @@ -7571,6 +7763,8 @@ namespace CompanyManagment.EFCore.Migrations b.Navigation("TaxLeftWorkCategoryList"); b.Navigation("WorkshopEmployers"); + + b.Navigation("WorkshopSubAccounts"); }); modelBuilder.Entity("Company.Domain.WorkshopPlanAgg.WorkshopPlan", b => diff --git a/CompanyManagment.EFCore/Repository/CheckoutRepository.cs b/CompanyManagment.EFCore/Repository/CheckoutRepository.cs index 778607e2..500903c3 100644 --- a/CompanyManagment.EFCore/Repository/CheckoutRepository.cs +++ b/CompanyManagment.EFCore/Repository/CheckoutRepository.cs @@ -1477,4 +1477,39 @@ public class CheckoutRepository : RepositoryBase, ICheckoutRepos } #endregion + + #region Pooya + public List<(long EmployeeId, DateTime CheckoutStart, DateTime CheckoutEnd)> GetLastCheckoutsByWorkshopId(long workshopId, DateTime start, DateTime end) + { + var leftWorkEmployees = _context.LeftWorkList.Where(x => x.WorkshopId == workshopId && x.LeftWorkDate.AddDays(-1).Date >= start.Date && + x.StartWorkDate.Date <= end).Select(x => x.EmployeeId).ToList(); + + //var leftWorkInsuranceEmployees = _context.LeftWorkInsuranceList.Where(x => x.WorkshopId == workshopId && + // (x.LeftWorkDate == null || x.LeftWorkDate.Value.Date.AddDays(-1) >= start.Date) && + // x.StartWorkDate.Date <= end).Select(x => x.EmployeeId).ToList(); + + //var workingEmployees = leftWorkEmployees.Concat(leftWorkInsuranceEmployees).Distinct(); + + return _context.CheckoutSet.Where(x => x.ContractEnd.Date <= end && x.ContractEnd.Date >= start && x.WorkshopId == workshopId && leftWorkEmployees.Contains(x.EmployeeId)).GroupBy(x => x.EmployeeId).Select(x => new + { + EmployeeId = x.Key, + CheckoutEnd = x.Max(y => y.ContractEnd), + CheckoutStart = x.Max(y => y.ContractStart), + }).AsEnumerable().Select(x => (x.EmployeeId, x.CheckoutStart, x.CheckoutEnd)).ToList(); + } + + public List<(long EmployeeId, DateTime CheckoutStart, DateTime CheckoutEnd)> GetLastCheckoutsByWorkshopIdForWorkFlow(long workshopId, DateTime start, DateTime end) + { + + + + return _context.CheckoutSet.Where(x => x.ContractEnd.Date >= start && x.ContractStart.Date <= end && x.WorkshopId == workshopId).Select(x => new + { + EmployeeId = x.EmployeeId, + CheckoutEnd = x.ContractEnd, + CheckoutStart = x.ContractStart + }).AsEnumerable().Select(x => (x.EmployeeId, x.CheckoutStart, x.CheckoutEnd)).ToList(); + } + + #endregion } \ No newline at end of file diff --git a/CompanyManagment.EFCore/Repository/CustomizeCheckoutRepository.cs b/CompanyManagment.EFCore/Repository/CustomizeCheckoutRepository.cs new file mode 100644 index 00000000..8f70a6e1 --- /dev/null +++ b/CompanyManagment.EFCore/Repository/CustomizeCheckoutRepository.cs @@ -0,0 +1,155 @@ + +using _0_Framework.Application; +using _0_Framework.InfraStructure; +using Company.Domain.CustomizeCheckoutAgg; +using CompanyManagment.App.Contracts.CustomizeCheckout; +using Microsoft.EntityFrameworkCore; +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; + +namespace CompanyManagment.EFCore.Repository +{ + public class CustomizeCheckoutRepository : RepositoryBase, ICustomizeCheckoutRepository + { + private readonly CompanyContext _companyContext; + public CustomizeCheckoutRepository(CompanyContext context) : base(context) + { + _companyContext = context; + } + + public IEnumerable Search(SearchCustomizeCheckout searchModel) + { + + + + + + + + var query = _companyContext.CustomizeCheckouts.Include(x => x.Employee).ThenInclude(x => x.PersonnelCodeList) + .AsSplitQuery().Where(x => x.WorkshopId == searchModel.WorkshopId); + #region parameters initialize + + //start of search is the first day of the current month by default and end of search is today + var startSearchDate = DateTime.Now.FindFirstDayOfMonth().ToGeorgianDateTime().Date; + var endSearchDate = DateTime.Today; + + var pc = new PersianCalendar(); + var currentYear = pc.GetYear(DateTime.Now); + var currentMonth = pc.GetMonth(DateTime.Now); + + if (!string.IsNullOrWhiteSpace(searchModel.SearchStartFa) && !string.IsNullOrWhiteSpace(searchModel.SearchEndFa) && + searchModel.Year == 0 && searchModel.Month == 0) + { + var queryStartDate = searchModel.SearchStartFa.ToGeorgianDateTime().Date; + var queryEndDate = searchModel.SearchEndFa.ToGeorgianDateTime().Date; + + if (queryEndDate > queryStartDate && queryEndDate <= DateTime.Today) + { + startSearchDate = queryStartDate; + endSearchDate = queryEndDate; + } + query = query.Where(x => x.ContractEnd.Date >= startSearchDate && x.ContractStart.Date <= endSearchDate); + } + + + if (searchModel.Year > 0 && searchModel.Month > 0 && searchModel.Month < 12) + { + var queryStartDate = $"{searchModel.Year:0000}/{searchModel.Month:00}/01".ToGeorgianDateTime(); + queryStartDate.FindFirstDayOfNextMonth(out var queryEndDate); + queryEndDate = queryEndDate.AddDays(-1); + + + + + if (queryEndDate <= DateTime.Today) + { + startSearchDate = queryStartDate; + endSearchDate = queryEndDate; + } + + else if (searchModel.Year == currentYear && searchModel.Month == currentMonth) + { + queryEndDate = DateTime.Today; + + startSearchDate = queryStartDate; + endSearchDate = queryEndDate; + } + } + + + //Month Index operations + startSearchDate.AddMonthsFa(-1 * (searchModel.MonthIndex), out startSearchDate); + startSearchDate.FindFirstDayOfNextMonth(out endSearchDate); + endSearchDate = endSearchDate.AddDays(-1); + + + #endregion + + query = query.Where(x => x.ContractEnd.Date <= endSearchDate && x.ContractEnd.Date >= startSearchDate); + + if (searchModel.EmployeeId > 0) + query = query.Where(x => x.EmployeeId == searchModel.EmployeeId); + + + switch (searchModel.OrderBy) + { + case CustomizeCheckoutOrderByEnum.ContractStartDesc: + query = query.OrderByDescending(x => x.ContractStart.Date); + break; + case CustomizeCheckoutOrderByEnum.ContractStart: + query = query.OrderBy(x => x.ContractStart.Date); + break; + case CustomizeCheckoutOrderByEnum.ContractNoDesc: + query = query.OrderByDescending(x => x.ContractNo); + break; + case CustomizeCheckoutOrderByEnum.ContractNo: + query = query.OrderBy(x => x.ContractNo); + break; + default: + query = query.OrderByDescending(x => x.ContractStart.Date); + break; + + } + + + return query.Select(x => new CustomizeCheckoutMandatoryViewModel() + { + ContractEndFa = x.ContractEnd.ToFarsi(), + ContractStartFa = x.ContractStart.ToFarsi(), + ContractNo = x.ContractNo, + EmployeeName = x.Employee.FName + " " + x.Employee.LName, + PersonnelCode = x.Employee.PersonnelCodeList.FirstOrDefault(y => y.WorkshopId == searchModel.WorkshopId).PersonnelCode, + Month = pc.GetMonth(startSearchDate), + Year = pc.GetYear(endSearchDate), + BaseYearsPay = x.BaseYearsPay, + BonusesPay = x.BonusesPay, + EarlyExitDeduction = x.EarlyExitDeduction, + FamilyAllowance = x.FamilyAllowance, + FineAbsenceDeduction = x.FineAbsenceDeduction, + FineDeduction = x.FineDeduction, + FridayPay = x.FridayPay, + InstallmentDeduction = x.InstallmentDeduction, + InsuranceDeduction = x.InsuranceDeduction, + LateToWorkDeduction = x.LateToWorkDeduction, + LeavePay = x.LeavePay, + MarriedAllowance = x.MarriedAllowance, + MonthlySalary = x.MonthlySalary, + NightWorkPay = x.NightWorkPay, + OverTimePay = x.OverTimePay, + RewardPay = x.RewardPay, + SalaryAidDeduction = x.SalaryAidDeduction, + ShiftPay = x.ShiftPay, + SumOfWorkingDays = x.SumOfWorkingDays, + TaxDeduction = x.TaxDeduction, + TotalClaims = x.TotalClaims, + TotalDeductions = x.TotalDeductions, + TotalPayment = x.TotalPayment + }).ToList(); + + + } + } +} diff --git a/CompanyManagment.EFCore/Repository/CustomizeWorkshopEmployeeSettingsRepository.cs b/CompanyManagment.EFCore/Repository/CustomizeWorkshopEmployeeSettingsRepository.cs index f90279ad..0b7a60c1 100644 --- a/CompanyManagment.EFCore/Repository/CustomizeWorkshopEmployeeSettingsRepository.cs +++ b/CompanyManagment.EFCore/Repository/CustomizeWorkshopEmployeeSettingsRepository.cs @@ -1,11 +1,13 @@ -using System.Linq; -using _0_Framework.Application; +using _0_Framework.Application; +using _0_Framework.Domain.CustomizeCheckoutShared.Enums; using _0_Framework.InfraStructure; using Company.Domain.CustomizeWorkshopEmployeeSettingsAgg; using Company.Domain.CustomizeWorkshopEmployeeSettingsAgg.Entities; using CompanyManagment.App.Contracts.CustomizeWorkshopSettings; using CompanyManagment.App.Contracts.CustomizeWorkshopSettings.ValueObjectsViewModel; using Microsoft.EntityFrameworkCore; +using System.Collections.Generic; +using System.Linq; namespace CompanyManagment.EFCore.Repository; @@ -27,7 +29,8 @@ public class CustomizeWorkshopEmployeeSettingsRepository(CompanyContext companyC { LateToWorkTimeFinesVewModels = entity.LateToWork.LateToWorkTimeFines.Select(x => new LateToWorkTimeFineVewModel() { FineMoney = x.FineMoney, Minute = x.Minute }).ToList(), - Value = entity.LateToWork.Value, LateToWorkType = entity.LateToWork.LateToWorkType + Value = entity.LateToWork.Value, + LateToWorkType = entity.LateToWork.LateToWorkType }, HolidayWork = entity.HolidayWork, FineAbsenceDeduction = new() @@ -41,16 +44,19 @@ public class CustomizeWorkshopEmployeeSettingsRepository(CompanyContext companyC { EarlyExitTimeFinesViewModels = entity.EarlyExit.EarlyExitTimeFines.Select(x => new EarlyExitTimeFineViewModel() { FineMoney = x.FineMoney, Minute = x.Minute }).ToList(), - Value = entity.EarlyExit.Value, EarlyExitType = entity.EarlyExit.EarlyExitType + Value = entity.EarlyExit.Value, + EarlyExitType = entity.EarlyExit.EarlyExitType }, BonusesPay = new() { - Value = entity.BonusesPay.Value, BonusesPayType = entity.BonusesPay.BonusesPayType, + Value = entity.BonusesPay.Value, + BonusesPayType = entity.BonusesPay.BonusesPayType, PaymentType = entity.BonusesPay.PaymentType }, ShiftPay = new() { - Value = entity.ShiftPay.Value, ShiftPayType = entity.ShiftPay.ShiftPayType, + Value = entity.ShiftPay.Value, + ShiftPayType = entity.ShiftPay.ShiftPayType, ShiftType = entity.ShiftPay.ShiftType }, InsuranceDeduction = new() @@ -60,13 +66,13 @@ public class CustomizeWorkshopEmployeeSettingsRepository(CompanyContext companyC }, OverTimePay = new() { - OverTimePayType = entity.OverTimePay.OverTimePayType, - Value = entity.OverTimePay.Value + OverTimePayType = entity.OverTimePay.OverTimePayType, + Value = entity.OverTimePay.Value }, BaseYearsPay = new() { BaseYearsPayType = entity.BaseYearsPay.BaseYearsPayType, - Value = entity.BaseYearsPay.Value + Value = entity.BaseYearsPay.Value }, NightWorkPay = new() { NightWorkingType = entity.NightWorkPay.NightWorkingType, Value = entity.NightWorkPay.Value }, LeavePay = new() { Value = entity.LeavePay.Value, LeavePayType = entity.LeavePay.LeavePayType }, @@ -88,6 +94,8 @@ public class CustomizeWorkshopEmployeeSettingsRepository(CompanyContext companyC WorkshopId = entity.WorkshopId, EmployeeFullName = _companyContext.Employees.Find(entity.EmployeeId)?.FullName, GroupId = entity.CustomizeWorkshopGroupSettingId, + IsSettingChanged = entity.IsSettingChanged, + IsShiftChanged = entity.IsShiftChanged }; @@ -95,7 +103,62 @@ public class CustomizeWorkshopEmployeeSettingsRepository(CompanyContext companyC public CustomizeWorkshopEmployeeSettings GetByEmployeeIdGroupSettingsId(long workshopId, long employeeId) { - return _companyContext.CustomizeWorkshopEmployeeSettings.Include(x=>x.CustomizeWorkshopGroupSettings).FirstOrDefault(x => - x.WorkshopId == workshopId && x.EmployeeId == employeeId); + return _companyContext.CustomizeWorkshopEmployeeSettings.Include(x => x.CustomizeWorkshopGroupSettings).FirstOrDefault(x => + x.WorkshopId == workshopId && x.EmployeeId == employeeId); + } + + public void Remove(long id) + { + var entity = Get(id); + if (entity == null) + return; + Remove(entity); + } + + public List GetBy(long groupId) + { + return _companyContext.CustomizeWorkshopEmployeeSettings + .Where(x => x.CustomizeWorkshopGroupSettingId == groupId).ToList(); + } + + public List GetEmployeeSettingsByWorkshopId(long workshopId) + { + var list = _companyContext.CustomizeWorkshopEmployeeSettings.AsNoTracking().Where(x => x.WorkshopId == workshopId) + .Select(x => new CustomizeWorkshopEmployeeSettingsViewModel + { + EmployeeId = x.EmployeeId, + Id = x.id, + IsSettingChanged = x.IsSettingChanged, + IsShiftChanged = x.IsShiftChanged, + Salary = x.Salary, + BreakTime = x.BreakTime, + }); + var names = _companyContext.Employees.Where(x => list.Any(y => y.EmployeeId == x.id)) + .Select(x => new { Id = x.id, Name = x.FName + " " + x.LName }); + + return list.Join(names, x => x.EmployeeId, y + => y.Id, (x, y) => new CustomizeWorkshopEmployeeSettingsViewModel + { + Id = x.Id, + EmployeeId = x.EmployeeId, + IsSettingChanged = x.IsSettingChanged, + IsShiftChanged = x.IsShiftChanged, + Salary = x.Salary, + EmployeeFullName = y.Name, + BreakTime = x.BreakTime, + }).ToList(); + + + } + + public List GetEmployeeSettingNotInMainGroup(long workshopId) + { + return _companyContext.CustomizeWorkshopEmployeeSettings.Where(x => x.WorkshopId == workshopId) + .Include(x => x.CustomizeWorkshopGroupSettings).Where(x=>!x.CustomizeWorkshopGroupSettings.MainGroup).Select(x => new CustomizeWorkshopEmployeeSettingsViewModel() + { + Id = x.id, + EmployeeId = x.EmployeeId + }).ToList(); + } } \ No newline at end of file diff --git a/CompanyManagment.EFCore/Repository/CustomizeWorkshopGroupSettingsRepository.cs b/CompanyManagment.EFCore/Repository/CustomizeWorkshopGroupSettingsRepository.cs index da12afe1..454effed 100644 --- a/CompanyManagment.EFCore/Repository/CustomizeWorkshopGroupSettingsRepository.cs +++ b/CompanyManagment.EFCore/Repository/CustomizeWorkshopGroupSettingsRepository.cs @@ -1,23 +1,28 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.IO; using System.Linq; using _0_Framework.Application; using _0_Framework.InfraStructure; using Company.Domain.CustomizeWorkshopGroupSettingsAgg; using Company.Domain.CustomizeWorkshopGroupSettingsAgg.Entities; +using Company.Domain.RollCallEmployeeAgg; using CompanyManagment.App.Contracts.CustomizeWorkshopSettings; using CompanyManagment.App.Contracts.CustomizeWorkshopSettings.ValueObjectsViewModel; using CompanyManagment.App.Contracts.Employee; +using CompanyManagment.App.Contracts.RollCallEmployee; +using Microsoft.AspNetCore.Razor.TagHelpers; using Microsoft.EntityFrameworkCore; namespace CompanyManagment.EFCore.Repository; -public class CustomizeWorkshopGroupSettingsRepository(CompanyContext companyContext) +public class CustomizeWorkshopGroupSettingsRepository(CompanyContext companyContext, IRollCallEmployeeRepository _rollCallEmployeeRepository) : RepositoryBase(companyContext), ICustomizeWorkshopGroupSettingsRepository { private readonly CompanyContext _companyContext = companyContext; + private readonly IRollCallEmployeeRepository _rollCallEmployeeRepository = _rollCallEmployeeRepository; public CustomizeWorkshopGroupSettings GetIncludeWorkshopSettings(long id) { @@ -25,32 +30,39 @@ public class CustomizeWorkshopGroupSettingsRepository(CompanyContext companyCont .FirstOrDefault(x => x.id == id); } - public List GetEmployeesWithoutGroup(long rollCallWorkshopSettingId) + public CustomizeWorkshopGroupSettings GetWorkshopMainGroup(long workshopId) { - var rollCallWorkshopSettings = _companyContext.CustomizeWorkshopSettings - .Include(x => x.CustomizeWorkshopGroupSettingsCollection).ThenInclude(x => x.CustomizeWorkshopEmployeeSettingsCollection) - .FirstOrDefault(x => x.id == rollCallWorkshopSettingId); + return _companyContext.CustomizeWorkshopGroupSettings + .Include(x=>x.CustomizeWorkshopSettings) + .Include(x=> x.CustomizeWorkshopEmployeeSettingsCollection) + .AsSplitQuery().FirstOrDefault(x => x.MainGroup && x.CustomizeWorkshopSettings.WorkshopId == workshopId); + } - if (rollCallWorkshopSettings == null) + public List GetEmployeesWithoutGroup(long customizeWorkshopSettingId) + { + var workshopSettings = _companyContext.CustomizeWorkshopSettings.Find(customizeWorkshopSettingId); + + if (workshopSettings == null) return new(); - var dateNow = DateTime.Now; + var existsEmployees = _companyContext.CustomizeWorkshopEmployeeSettings + .Include(x=>x.CustomizeWorkshopGroupSettings) + .Where(x => x.WorkshopId == workshopSettings.WorkshopId && !x.CustomizeWorkshopGroupSettings.MainGroup) + .Select(x=>x.EmployeeId).ToList(); + - var listOfEmployeeIdsHasGroup = rollCallWorkshopSettings.CustomizeWorkshopGroupSettingsCollection.SelectMany(x => - x.CustomizeWorkshopEmployeeSettingsCollection.Select(a => a.EmployeeId).Distinct()).ToList(); + var workshopId = workshopSettings.WorkshopId; + var rollCallEmployees = _rollCallEmployeeRepository.GetActivePersonnelByWorkshopId(workshopId); - 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() + var employees = rollCallEmployees + .Where(x=>!existsEmployees.Contains(x.EmployeeId)) + .Select(x => new EmployeeViewModel() + { + EmployeeFullName = x.EmployeeFullName, + Id = x.EmployeeId + }).ToList(); return employees; } @@ -61,12 +73,12 @@ public class CustomizeWorkshopGroupSettingsRepository(CompanyContext companyCont .FirstOrDefault(x => x.id == groupId); } - public List GetChangedEmployeeSettingsByGroupSettingsId(long groupSettingsId) + public List GetShiftChangedEmployeeSettingsByGroupSettingsId(long groupSettingsId) { var groupEmployeeSettingsList = _companyContext.CustomizeWorkshopGroupSettings .Include(x => x.CustomizeWorkshopEmployeeSettingsCollection) .FirstOrDefault(x => x.id == groupSettingsId)?.CustomizeWorkshopEmployeeSettingsCollection - .Where(x => x.IsChanged).ToList(); + .Where(x => x.IsShiftChanged).ToList(); if (groupEmployeeSettingsList == null) return new(); @@ -81,7 +93,40 @@ public class CustomizeWorkshopGroupSettingsRepository(CompanyContext companyCont { EmployeeId = x.EmployeeId, Id = x.id, - IsChanged = x.IsChanged, + IsShiftChanged = x.IsShiftChanged, + IsSettingChanged = x.IsSettingChanged, + Name = y.FullName, + RollCallWorkshopShifts = x.CustomizeWorkshopEmployeeSettingsShifts.Select(z => new CustomizeWorkshopShiftViewModel() + { + EndTime = z.EndTime.ToString("HH:mm"), + Placement = z.Placement, + StartTime = z.StartTime.ToString("HH:mm") + }).ToList() + }).ToList(); + } + + public List GetSettingChangedEmployeeSettingsByGroupSettingsId(long groupSettingsId) + { + var groupEmployeeSettingsList = _companyContext.CustomizeWorkshopGroupSettings + .Include(x => x.CustomizeWorkshopEmployeeSettingsCollection) + .FirstOrDefault(x => x.id == groupSettingsId)?.CustomizeWorkshopEmployeeSettingsCollection + .Where(x => x.IsSettingChanged).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, + IsSettingChanged = x.IsSettingChanged, + IsShiftChanged = x.IsShiftChanged, Name = y.FullName, RollCallWorkshopShifts = x.CustomizeWorkshopEmployeeSettingsShifts.Select(z => new CustomizeWorkshopShiftViewModel() { @@ -95,10 +140,8 @@ public class CustomizeWorkshopGroupSettingsRepository(CompanyContext companyCont public List GetEmployeeSettingsByGroupSettingsId(long groupSettingsId) { - var entity = _companyContext.CustomizeWorkshopGroupSettings.Select(x => new { x.CustomizeWorkshopEmployeeSettingsCollection, x.id }) - .FirstOrDefault(x => x.id == groupSettingsId); - - + var entity = _companyContext.CustomizeWorkshopGroupSettings.Include(x=>x.CustomizeWorkshopEmployeeSettingsCollection) + .FirstOrDefault(x => x.id == groupSettingsId); if (entity == null) return new(); @@ -118,13 +161,16 @@ public class CustomizeWorkshopGroupSettingsRepository(CompanyContext companyCont Id = x.id, Name = y.FullName, Salary = x.Salary, - IsChanged = x.IsChanged, + IsSettingChanged = x.IsSettingChanged, + IsShiftChanged = x.IsShiftChanged, RollCallWorkshopShifts = x.CustomizeWorkshopEmployeeSettingsShifts.Select(z => new CustomizeWorkshopShiftViewModel() { EndTime = z.EndTime.ToString("HH:mm"), StartTime = z.StartTime.ToString("HH:mm"), Placement = z.Placement - }).ToList() + }).ToList(), + IrregularShift = x.IrregularShift, + WorkshopShiftStatus = x.WorkshopShiftStatus }); return joinedList.ToList(); } @@ -196,6 +242,10 @@ public class CustomizeWorkshopGroupSettingsRepository(CompanyContext companyCont Salary = entity.Salary.ToMoney(), CustomizeWorkshopSettingId = entity.CustomizeWorkshopSettingId, Name = entity.GroupName, + WorkshopShiftStatus = entity.WorkshopShiftStatus, + BreakTime = entity.BreakTime, + IrregularShift = entity.IrregularShift, + IsShiftChanged = entity.IsShiftChange, ShiftViewModel = entity.CustomizeWorkshopGroupSettingsShifts.Select(x => new CustomizeWorkshopShiftViewModel() { EndTime = x.EndTime.ToString("HH:mm"), Placement = x.Placement, StartTime = x.StartTime.ToString("HH:mm") }).ToList(), @@ -205,6 +255,13 @@ public class CustomizeWorkshopGroupSettingsRepository(CompanyContext companyCont } + public List GetAllGroupsIncludeEmployeeSettingsByWorkshopSettingsId(long workshopSettingsId) + { + return _companyContext.CustomizeWorkshopGroupSettings + .Include(x => x.CustomizeWorkshopEmployeeSettingsCollection) + .Where(x => x.CustomizeWorkshopSettingId == workshopSettingsId).ToList(); + } + public void Remove(long groupId) { var entity = _companyContext.CustomizeWorkshopGroupSettings.Find(groupId); diff --git a/CompanyManagment.EFCore/Repository/CustomizeWorkshopSettingsRepository.cs b/CompanyManagment.EFCore/Repository/CustomizeWorkshopSettingsRepository.cs index 00a4cfb7..10f30938 100644 --- a/CompanyManagment.EFCore/Repository/CustomizeWorkshopSettingsRepository.cs +++ b/CompanyManagment.EFCore/Repository/CustomizeWorkshopSettingsRepository.cs @@ -1,6 +1,7 @@  using System; +using System.Collections.Generic; using System.IO; using System.Linq; using _0_Framework.Application; @@ -21,34 +22,39 @@ namespace CompanyManagment.EFCore.Repository private readonly IAuthHelper _authHelper = authHelper; private readonly IEmployeeRepository _employeeRepository = employeeRepository; - public CustomizeWorkshopSettingsViewModel GetWorkshopSettingsByWorkshopId(long workshopId) + public CustomizeWorkshopSettingsViewModel GetWorkshopSettingsByWorkshopId(long workshopId,AuthViewModel auth) { - var user = _authHelper.CurrentAccountInfo(); - var entity = _companyContext.CustomizeWorkshopSettings + var entity = _companyContext.CustomizeWorkshopSettings.Where(x => x.WorkshopId == workshopId) .Include(x => x.CustomizeWorkshopGroupSettingsCollection) - .ThenInclude(x => x.CustomizeWorkshopEmployeeSettingsCollection) - .FirstOrDefault(x => x.WorkshopId == workshopId); + .ThenInclude(x => x.CustomizeWorkshopEmployeeSettingsCollection).AsSplitQuery() + .FirstOrDefault(); if (entity == null) return new(); - return new CustomizeWorkshopSettingsViewModel() + var employeeIds = entity.CustomizeWorkshopGroupSettingsCollection + .SelectMany(x => x.CustomizeWorkshopEmployeeSettingsCollection) + .Select(y => y.EmployeeId) + .ToList(); + var employees = _employeeRepository.GetBy(employeeIds); + return new CustomizeWorkshopSettingsViewModel() { Id = entity.id, - Name = user.WorkshopList.FirstOrDefault(w => w.Id == entity.WorkshopId)?.Name, - GroupSettings = entity.CustomizeWorkshopGroupSettingsCollection.Select(x => + Name = auth.WorkshopList.FirstOrDefault(w => w.Id == entity.WorkshopId)?.Name, + GroupSettings = entity.CustomizeWorkshopGroupSettingsCollection.Where(x => !x.MainGroup).Select(x => new CustomizeWorkshopGroupSettingsViewModel() { Id = x.id, GroupName = x.GroupName, RollCallWorkshopEmployeesSettings = x.CustomizeWorkshopEmployeeSettingsCollection.Select(y => { - var employee = _employeeRepository.Get(y.EmployeeId); + var employee = employees.First(e => e.Id == y.EmployeeId); return new CustomizeWorkshopEmployeeSettingsViewModel() { Id = y.id, EmployeeId = y.EmployeeId, - IsChanged = y.IsChanged, - Name = $"{employee.FName} {employee.LName}", + IsSettingChanged = y.IsSettingChanged, + IsShiftChanged = y.IsShiftChanged, + Name = $"{employee}", RollCallWorkshopShifts = y.CustomizeWorkshopEmployeeSettingsShifts.Select(s => new CustomizeWorkshopShiftViewModel() { @@ -60,6 +66,8 @@ namespace CompanyManagment.EFCore.Repository }; }).ToList(), + WorkshopShiftStatus = x.WorkshopShiftStatus, + IrregularShift = x.IrregularShift, Salary = x.Salary, RollCallWorkshopShifts = x.CustomizeWorkshopGroupSettingsShifts.Select(s => new CustomizeWorkshopShiftViewModel() @@ -69,11 +77,66 @@ namespace CompanyManagment.EFCore.Repository StartTime = s.StartTime.ToString("HH:mm") }).ToList(), + MainGroup = x.MainGroup, + }).ToList(), + }; } + public CustomizeWorkshopSettingsViewModel GetWorkshopSettingsByWorkshopIdForAdmin(long workshopId) + { + + var entity = _companyContext.CustomizeWorkshopSettings.Where(x => x.WorkshopId == workshopId) + .Include(x => x.CustomizeWorkshopGroupSettingsCollection) + .ThenInclude(x => x.CustomizeWorkshopEmployeeSettingsCollection).AsSplitQuery() + .FirstOrDefault(); + if (entity == null) + return new(); - public CustomizeWorkshopEmployeeSettingsViewModel GetEmployeeSettingsByWorkshopIdGroupSettingsId(long workshopId, + return new CustomizeWorkshopSettingsViewModel() + { + Id = entity.id, + GroupSettings = entity.CustomizeWorkshopGroupSettingsCollection.Where(x => !x.MainGroup).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, + IsSettingChanged = y.IsSettingChanged, + IsShiftChanged = y.IsShiftChanged, + Name = $"{employee.FName} {employee.LName}", + RollCallWorkshopShifts = y.CustomizeWorkshopEmployeeSettingsShifts.Select(s => + new CustomizeWorkshopShiftViewModel() + { + EndTime = s.EndTime.ToString("HH:mm"), + Placement = s.Placement, + StartTime = s.StartTime.ToString("HH:mm") + }).ToList(), + Salary = y.Salary, + + }; + }).ToList(), + Salary = x.Salary, + RollCallWorkshopShifts = x.CustomizeWorkshopGroupSettingsShifts.Select(s => + new CustomizeWorkshopShiftViewModel() + { + EndTime = s.EndTime.ToString("HH:mm"), + Placement = s.Placement, + StartTime = s.StartTime.ToString("HH:mm") + + }).ToList(), + MainGroup = x.MainGroup + + }).ToList(), + }; + } + public CustomizeWorkshopEmployeeSettingsViewModel GetEmployeeSettingsByWorkshopIdGroupSettingsId(long workshopId, long employeeId) { throw new NotImplementedException(); @@ -82,7 +145,7 @@ namespace CompanyManagment.EFCore.Repository public EditCustomizeWorkshopSettings GetWorkshopSettingsDetails(long workshopId) { - var entity = _companyContext.CustomizeWorkshopSettings.FirstOrDefault(x => x.WorkshopId == workshopId); + var entity = _companyContext.CustomizeWorkshopSettings.AsSplitQuery().FirstOrDefault(x => x.WorkshopId == workshopId); if (entity == null) return new(); var viewModel = new EditCustomizeWorkshopSettings() @@ -166,28 +229,50 @@ namespace CompanyManagment.EFCore.Repository } - public EditCustomizeWorkshopSettings GetSimpleWorkshopSettings(long workshopId) - { - var entity = _companyContext.CustomizeWorkshopSettings.FirstOrDefault(x => x.WorkshopId == workshopId); - if (entity == null) - { - return new(); - } + public EditCustomizeWorkshopSettings GetSimpleWorkshopSettings(long workshopId) + { + var entity = _companyContext.CustomizeWorkshopSettings.FirstOrDefault(x => x.WorkshopId == workshopId); + if (entity == null) + { + return new(); + } - return new() - { - ShiftsList = entity.CustomizeWorkshopSettingsShifts.Select(x => new CustomizeWorkshopShiftViewModel() - { - EndTime = x.EndTime.ToString("HH:mm"), - StartTime = x.StartTime.ToString("HH:mm"), - Placement = x.Placement - }).ToList(), - Id = entity.id, - WorkshopId = entity.WorkshopId + return new() + { + ShiftsList = entity.CustomizeWorkshopSettingsShifts.Select(x => new CustomizeWorkshopShiftViewModel() + { + EndTime = x.EndTime.ToString("HH:mm"), + StartTime = x.StartTime.ToString("HH:mm"), + Placement = x.Placement + }).ToList(), + Id = entity.id, + WorkshopId = entity.WorkshopId, + WorkshopShiftStatus = entity.WorkshopShiftStatus - }; - } - public CustomizeWorkshopEmployeeSettingsViewModel GetEmployeeSettingsByWorkshopIdEmployeeId(long workshopId, long employeeId) + }; + } + + public List GetShiftChangesGroupAndEmployees(long customizeWorkshopSettingsId) + { + + + var result = from groupSetting in _companyContext.CustomizeWorkshopGroupSettings + where groupSetting.IsShiftChange // Filter parent tables where isChange is true + join employeeSettings in _companyContext.CustomizeWorkshopEmployeeSettings on groupSetting.id equals employeeSettings.CustomizeWorkshopGroupSettingId + where employeeSettings.IsShiftChanged// Filter child tables where isChange is true + join employee in _companyContext.Employees on employeeSettings.EmployeeId equals employee.id + group new { employee.FullName, groupSetting.GroupName } by groupSetting.id into grouped + select new ChangedGroupedViewModel + { + GroupName = grouped.First().GroupName, + EmployeeName = grouped.Select(e => e.FullName).ToList() + }; + + return result.ToList(); + + } + + public CustomizeWorkshopEmployeeSettingsViewModel GetEmployeeSettingsByWorkshopIdEmployeeId(long workshopId, long employeeId) { var employee = _companyContext.CustomizeWorkshopSettings .Include(x => x.CustomizeWorkshopGroupSettingsCollection) @@ -204,7 +289,8 @@ namespace CompanyManagment.EFCore.Repository { EmployeeId = employee.EmployeeId, Id = employee.id, - IsChanged = employee.IsChanged, + IsSettingChanged = employee.IsSettingChanged, + IsShiftChanged = employee.IsShiftChanged, Name = employeeName?.FullName, RollCallWorkshopShifts = employee.CustomizeWorkshopEmployeeSettingsShifts.Select(x => new CustomizeWorkshopShiftViewModel() diff --git a/CompanyManagment.EFCore/Repository/EmployeeRepository .cs b/CompanyManagment.EFCore/Repository/EmployeeRepository .cs index 81bbc71a..825cea9b 100644 --- a/CompanyManagment.EFCore/Repository/EmployeeRepository .cs +++ b/CompanyManagment.EFCore/Repository/EmployeeRepository .cs @@ -725,5 +725,75 @@ public class EmployeeRepository : RepositoryBase, IEmployeeRepos return query.OrderByDescending(x => x.Id).Take(100).ToList(); } } + + + #endregion + + #region Mahan + public List GetBy(List employeeIds) + { + return _context.Employees.Where(x => employeeIds.Contains(x.id)).Select(x => new EmployeeViewModel() + { + Id = x.id, + EmployeeFullName = x.FullName + }).ToList(); + } + #endregion + + #region Pooya + + public List GetRangeByIds(IEnumerable newEmployeeIds) + { + return _context.Employees.Where(x => newEmployeeIds.Contains(x.id)).ToList(); + } + + + public List GetWorkingEmployeesByWorkshopId(long workshopId) + { + var dateNow = DateTime.Now.Date; + + + var workshopActiveLeftWorksQuery = _context.LeftWorkList.Where(x => x.WorkshopId == workshopId && + x.StartWorkDate <= dateNow && x.LeftWorkDate > dateNow); + + + var workshopActiveInsuranceLeftWorksQuery = _context.LeftWorkInsuranceList.Where(x => x.WorkshopId == workshopId && + x.StartWorkDate <= dateNow && (x.LeftWorkDate > dateNow || x.LeftWorkDate == null)); + + + var employeesQuery = _context.Employees.Where(x => workshopActiveLeftWorksQuery.Any(y => y.EmployeeId == x.id) || + workshopActiveInsuranceLeftWorksQuery.Any(y => y.EmployeeId == x.id)); + + + return employeesQuery.Select(x => new EmployeeViewModel() + { + Id = x.id, + EmployeeFullName = x.FullName + }).ToList(); + } + + public List<(long Id, string Name)> SimpleGetRangeByIds(IEnumerable newEmployeeIds) + { + return _context.Employees.Where(x => newEmployeeIds.Contains(x.id)).Select(x => new + { + Id = x.id, + x.FName, + x.LName + }).AsEnumerable().Select(x => (x.Id, x.FName + " " + x.LName)).ToList(); + } + + public List GetWorkingEmployeesByWorkshopIdsAndNationalCodeAndDate(List workshopIds, string nationalCode, DateTime date) + { + return _context.Employees.Where(x => x.NationalCode.Contains(nationalCode)).Include(x => x.LeftWorks).Include(x => x.LeftWorkInsurances) + .Where(x => (x.LeftWorks.Any(y => workshopIds.Contains(y.WorkshopId) && y.StartWorkDate <= date && y.LeftWorkDate >= date)) || + (x.LeftWorkInsurances.Any(y => workshopIds.Contains(y.WorkshopId) && y.StartWorkDate <= date && y.LeftWorkDate == null))) + .Select(x => new EmployeeViewModel() + { + NationalCode = x.NationalCode, + FName = x.FName, + LName = x.LName, + Phone = x.Phone + }).ToList(); + } #endregion } \ No newline at end of file diff --git a/CompanyManagment.EFCore/Repository/FineRepository.cs b/CompanyManagment.EFCore/Repository/FineRepository.cs index 522b15e4..1261b80e 100644 --- a/CompanyManagment.EFCore/Repository/FineRepository.cs +++ b/CompanyManagment.EFCore/Repository/FineRepository.cs @@ -7,48 +7,72 @@ using CompanyManagment.App.Contracts.Fine; namespace CompanyManagment.EFCore.Repository; -public class FineRepository:RepositoryBase, IFineRepository +public class FineRepository : RepositoryBase, IFineRepository { - private readonly CompanyContext _companyContext; + private readonly CompanyContext _companyContext; - public FineRepository(CompanyContext companyContext):base(companyContext) - { - _companyContext = companyContext; - } + public FineRepository(CompanyContext companyContext) : base(companyContext) + { + _companyContext = companyContext; + } - public List GetSearchList(FineSearchViewModel searchModel) - { + public List GetSearchList(FineSearchViewModel searchModel) + { var query = _companyContext.Fines.Where(x => x.WorkshopId == searchModel.WorkshopId); if (searchModel.EmployeeId != 0) query = query.Where(x => x.EmployeeId == searchModel.EmployeeId); - - return query.Select(x => new FineSearchViewModel() + var result = query.OrderByDescending(x => x.CreationDate).Skip(searchModel.PageIndex).Take(30).Select(x => new FineViewModel() { Id = x.id, WorkshopId = x.WorkshopId, EmployeeId = x.EmployeeId, - EmployeeFullName = _companyContext.Employees.FirstOrDefault(e => e.id == x.EmployeeId).FullName, - PersonnelCode = _companyContext.PersonnelCodeSet.FirstOrDefault(p => p.EmployeeId == x.EmployeeId).PersonnelCode.ToString(), Title = x.Title, Amount = x.Amount.ToMoney(), FineDate = x.FineDate.ToFarsi(), IsActive = x.IsActive, + CreationDate = x.CreationDate.ToFarsi() + }).AsEnumerable(); + var employees = _companyContext.Employees.Where(x => result.Any(a => a.EmployeeId == x.id)).ToList(); + var personnelCodes = _companyContext.PersonnelCodeSet + .Where(x => result.Any(a => a.EmployeeId == x.EmployeeId && x.WorkshopId == a.WorkshopId)).ToList(); + return result.Select(x => new FineViewModel() + { + Id = x.Id, + WorkshopId = x.WorkshopId, + EmployeeId = x.EmployeeId, + EmployeeFullName = employees.FirstOrDefault(a => a.id == x.EmployeeId)?.FullName, + PersonnelCode = personnelCodes.FirstOrDefault(a => x.WorkshopId == a.WorkshopId && a.EmployeeId == x.EmployeeId)?.PersonnelCode.ToString(), + Title = x.Title, + Amount = x.Amount, + FineDate = x.FineDate, + IsActive = x.IsActive, CreationDate = x.CreationDate - }).OrderByDescending(x => x.CreationDate).Skip(searchModel.PageIndex).Take(30).ToList(); + }).ToList(); } - public EditFineViewModel GetDetails(long id) - { - return _companyContext.Fines.Select(x => new EditFineViewModel() + public List GetBy(IEnumerable ids) + { + return _companyContext.Fines.Where(x => ids.Contains(x.id)).ToList(); + + } + + public EditFineViewModel GetDetails(long id) + { + var entity = _companyContext.Fines.FirstOrDefault(x => x.id == id); + if (entity == null) + return new(); + + return new EditFineViewModel() { - Id = x.id, - WorkshopId = x.WorkshopId, - EmployeeId = x.EmployeeId, - Title = x.Title, - Amount = x.Amount.ToMoney(), - IsActive = x.IsActive, - FineDate = x.FineDate.ToFarsi(), - }).FirstOrDefault(x => x.Id == id); + Id = entity.id, + WorkshopId = entity.WorkshopId, + EmployeeId = entity.EmployeeId, + EmployeeFullname = _companyContext.Employees.FirstOrDefault(x => x.id == entity.EmployeeId)?.FullName ?? "", + Title = entity.Title, + Amount = entity.Amount.ToMoney(), + IsActive = entity.IsActive, + FineDate = entity.FineDate.ToFarsi(), + }; } } \ No newline at end of file diff --git a/CompanyManagment.EFCore/Repository/FineSubjectRepository.cs b/CompanyManagment.EFCore/Repository/FineSubjectRepository.cs new file mode 100644 index 00000000..db2cd652 --- /dev/null +++ b/CompanyManagment.EFCore/Repository/FineSubjectRepository.cs @@ -0,0 +1,27 @@ +using System.Collections.Generic; +using System.Linq; +using _0_Framework.InfraStructure; +using Company.Domain.FineSubjectAgg; +using CompanyManagment.App.Contracts.FineSubject; + +namespace CompanyManagment.EFCore.Repository; + +public class FineSubjectRepository : RepositoryBase, IFineSubjectRepository +{ + private readonly CompanyContext _companyContext; + public FineSubjectRepository(CompanyContext companyContext) : base(companyContext) + { + _companyContext = companyContext; + } + + public List GetAll(long workshopId) + { + return _companyContext.FinesSubject.Where(x => x.WorkshopId == workshopId).Select(x => new FineSubjectViewModel() + { + Id = x.id, + Subject = x.Title, + Amount = x.Amount + + }).ToList(); + } +} \ No newline at end of file diff --git a/CompanyManagment.EFCore/Repository/LeftWorkRepository.cs b/CompanyManagment.EFCore/Repository/LeftWorkRepository.cs index c55bb1db..e00e714e 100644 --- a/CompanyManagment.EFCore/Repository/LeftWorkRepository.cs +++ b/CompanyManagment.EFCore/Repository/LeftWorkRepository.cs @@ -557,4 +557,15 @@ public class LeftWorkRepository : RepositoryBase, ILeftWorkRepos return op.Succcedded(); } + + public List GetByWorkshopIdInDates(long workshopId, DateTime startDateGr, DateTime endDateGr) + { + return _context.LeftWorkList.Where(x => x.WorkshopId == workshopId && x.LeftWorkDate.AddDays(-1) >= startDateGr && + x.StartWorkDate <= endDateGr).Select(x => new LeftWorkViewModel() + { + StartWorkDateGr = x.StartWorkDate.Date, + LeftWorkDateGr = x.LeftWorkDate.Date, + EmployeeId = x.EmployeeId + }).ToList(); + } } \ No newline at end of file diff --git a/CompanyManagment.EFCore/Repository/LoanRepository.cs b/CompanyManagment.EFCore/Repository/LoanRepository.cs index 4add1239..49396057 100644 --- a/CompanyManagment.EFCore/Repository/LoanRepository.cs +++ b/CompanyManagment.EFCore/Repository/LoanRepository.cs @@ -5,6 +5,7 @@ using CompanyManagment.App.Contracts.Loan; using System.Collections.Generic; using System.Linq; using _0_Framework.Application; +using Microsoft.EntityFrameworkCore; namespace CompanyManagment.EFCore.Repository; @@ -24,31 +25,44 @@ public class LoanRepository:RepositoryBase,ILoanRepository Id = x.id, WorkshopId = x.WorkshopId, EmployeeId = x.EmployeeId, - StartDateTime = x.StartDateMonth, + EmployeeFullName = _companyContext.Employees.FirstOrDefault(e => e.id == x.EmployeeId).FullName, + StartDateTime = x.StartDateMonth, Count = x.Count, Amount = x.Amount.ToMoney(), }).FirstOrDefault(x => x.Id == id); } - public List GetSearchList(LoanSearchViewModel searchViewModel) + public List GetBy(IEnumerable ids) + { + return _companyContext.Loans.Where(x => ids.Contains(x.id)).ToList(); + } + + public List GetSearchList(LoanSearchViewModel searchViewModel) { - var query = _companyContext.Loans.Where(x=> x.WorkshopId == searchViewModel.WorkshopId); + var query = _companyContext.Loans.Where(x => x.WorkshopId == searchViewModel.WorkshopId); if (searchViewModel.EmployeeId != 0) query = query.Where(x => x.EmployeeId == searchViewModel.EmployeeId); + + var employeeIds = query.Select(x => x.EmployeeId); + + var personnelCodes = _companyContext.PersonnelCodeSet.Where(x => x.WorkshopId == searchViewModel.WorkshopId && employeeIds.Contains(x.EmployeeId)); + + + var employees = _companyContext.Employees.Where(x => employeeIds.Contains(x.id)).AsSplitQuery(); return query.Select(x => new LoanSearchViewModel() { Id = x.id, WorkshopId = x.WorkshopId, EmployeeId = x.EmployeeId, - EmployeeFullName = _companyContext.Employees.FirstOrDefault(e => e.id == x.EmployeeId).FullName, - PersonnelCode = _companyContext.PersonnelCodeSet.FirstOrDefault(p => p.EmployeeId == x.EmployeeId).PersonnelCode.ToString(), - StartDateTime = x.StartDateMonth, + EmployeeFullName =employees.FirstOrDefault(e => e.id == x.EmployeeId).FullName, + PersonnelCode = personnelCodes.FirstOrDefault(e => e.EmployeeId == x.EmployeeId && e.WorkshopId == searchViewModel.WorkshopId).PersonnelCode.ToString(), + StartDateTime = x.StartInstallmentPayment.ToFarsi(), Count = x.Count, Amount = x.Amount.ToMoney(), AmountPerMonth = x.AmountPerMonth.ToMoney(), CreationDate = x.CreationDate - }).OrderByDescending(x => x.CreationDate).Skip(searchViewModel.PageIndex).Take(30).ToList(); + }).OrderByDescending(x => x.CreationDate).Skip(searchViewModel.PageIndex).AsSplitQuery().Take(30).ToList(); } } \ No newline at end of file diff --git a/CompanyManagment.EFCore/Repository/RewardRepository.cs b/CompanyManagment.EFCore/Repository/RewardRepository.cs index 62a5ca36..1b113ce9 100644 --- a/CompanyManagment.EFCore/Repository/RewardRepository.cs +++ b/CompanyManagment.EFCore/Repository/RewardRepository.cs @@ -7,46 +7,74 @@ using CompanyManagment.App.Contracts.Reward; namespace CompanyManagment.EFCore.Repository; -public class RewardRepository:RepositoryBase, IRewardRepository +public class RewardRepository : RepositoryBase, IRewardRepository { - private readonly CompanyContext _companyContext; - public RewardRepository( CompanyContext companyContext) : base(companyContext) - { - _companyContext = companyContext; - } + private readonly CompanyContext _companyContext; + public RewardRepository(CompanyContext companyContext) : base(companyContext) + { + _companyContext = companyContext; + } - public List GetSearchList(RewardSearchViewModel searchViewModel) - { - var query = _companyContext.Rewards.Where(x => x.WorkshopId == searchViewModel.WorkshopId); + public List GetSearchList(RewardSearchModel searchViewModel) + { + var query = _companyContext.Rewards.Where(x => x.WorkshopId == searchViewModel.WorkshopId && x.IsActive == IsActive.True); if (searchViewModel.EmployeeId != 0) query = query.Where(x => x.EmployeeId == searchViewModel.EmployeeId); - - return query.Select(x => new RewardSearchViewModel() + var enumQuery = query; + var result = enumQuery.OrderByDescending(x=>x.CreationDate).Select(x => new RewardViewModel() { Id = x.id, - WorkshopId = x.WorkshopId, EmployeeId = x.EmployeeId, - EmployeeFullName = _companyContext.Employees.FirstOrDefault(e => e.id == x.EmployeeId).FullName, - PersonnelCode = _companyContext.PersonnelCodeSet.FirstOrDefault(p => p.EmployeeId == x.EmployeeId).PersonnelCode.ToString(), Description = x.Description, Amount = x.Amount.ToMoney(), - RewardedByAccountId = x.RewardedByAccountId, - CreationDate = x.CreationDate - }).OrderByDescending(x => x.CreationDate).Skip(searchViewModel.PageIndex).Take(30).ToList(); + WorkshopId = x.WorkshopId, + CreationDate = x.CreationDate.ToFarsi(), + GrantDate = x.GrantDate.ToFarsi() + }).Skip(searchViewModel.PageIndex).Take(30); + + var employees = _companyContext.Employees.Where(x => result.Any(a => a.EmployeeId == x.id)); + var personnelCodes = _companyContext.PersonnelCodeSet + .Where(x => result.Any(a => a.EmployeeId == x.EmployeeId && x.WorkshopId == a.WorkshopId)); + return result.Select(x => new RewardViewModel() + { + Amount = x.Amount, + CreationDate = x.CreationDate, + Description = x.Description, + GrantDate = x.GrantDate, + EmployeeFullName = employees.FirstOrDefault(e => e.id == x.EmployeeId).FullName , + Id = x.Id, + PersonnelCode = personnelCodes + .FirstOrDefault(a => a.WorkshopId == x.WorkshopId && a.EmployeeId == x.EmployeeId).PersonnelCode + .ToString(), + WorkshopId = x.WorkshopId, + EmployeeId = x.EmployeeId + }).ToList(); } - public EditRewardViewModel GetDetails(long id) - { - return _companyContext.Rewards.Select(x => new EditRewardViewModel() + public EditRewardViewModel GetDetails(long id) + { + var entity = _companyContext.Rewards.FirstOrDefault(x => x.id == id); + if (entity == null) + return new(); + var res = new EditRewardViewModel() { - Id = x.id, - WorkshopId = x.WorkshopId, - EmployeeId = x.EmployeeId, - Amount = x.Amount, - Description = x.Description, - IsActive = x.IsActive, - RewardedByAccountId = x.RewardedByAccountId - }).FirstOrDefault(x => x.Id == id); + Id = entity.id, + WorkshopId = entity.WorkshopId, + EmployeeId = entity.EmployeeId, + Amount = entity.Amount.ToMoney(), + Description = entity.Description, + RewardedByAccountId = entity.RewardedByAccountId, + GrantDate = entity.GrantDate.ToFarsi() + }; + + res.EmployeeFullName = _companyContext.Employees.Find(entity.EmployeeId)?.FullName; + return res; + + } + + public List GetBy(IEnumerable ids) + { + return _companyContext.Rewards.Where(x => ids.Contains(x.id)).ToList(); } } \ No newline at end of file diff --git a/CompanyManagment.EFCore/Repository/RollCallEmployeeStatusRepository.cs b/CompanyManagment.EFCore/Repository/RollCallEmployeeStatusRepository.cs index 0a84fdd3..c005adcb 100644 --- a/CompanyManagment.EFCore/Repository/RollCallEmployeeStatusRepository.cs +++ b/CompanyManagment.EFCore/Repository/RollCallEmployeeStatusRepository.cs @@ -6,6 +6,7 @@ using System; using System.Collections.Generic; using System.Linq; using CompanyManagment.App.Contracts.RollCallEmployee; +using Microsoft.EntityFrameworkCore; namespace CompanyManagment.EFCore.Repository { @@ -65,6 +66,21 @@ namespace CompanyManagment.EFCore.Repository } + public List GetActiveByWorkshopIdInDate(long workshopId, DateTime startDateGr, DateTime endDateGr) + { + return _context.RollCallEmployeesStatus.Include(x => x.RollCallEmployee).Where(x => x.RollCallEmployee.WorkshopId == workshopId && + x.StartDate.Date <= endDateGr.Date && x.EndDate.Date >= startDateGr.Date).Select(x => new RollCallEmployeeStatusViewModel() + { + EndDateGr = x.EndDate, + EndDate = x.EndDate.ToFarsi(), + Id = x.id, + StartDateGr = x.StartDate, + StartDate = x.StartDate.ToFarsi(), + EmployeeId = x.RollCallEmployee.EmployeeId, + EmployeeName = x.RollCallEmployee.EmployeeFullName + }).ToList(); + } + #endregion } } diff --git a/CompanyManagment.EFCore/Repository/RollCallMandatoryRepository.cs b/CompanyManagment.EFCore/Repository/RollCallMandatoryRepository.cs index 85ea4d9d..b1d1db9f 100644 --- a/CompanyManagment.EFCore/Repository/RollCallMandatoryRepository.cs +++ b/CompanyManagment.EFCore/Repository/RollCallMandatoryRepository.cs @@ -16,10 +16,11 @@ using CompanyManagment.App.Contracts.WorkingHoursTemp; using System; using System.Collections.Generic; using System.Linq; -using _0_Framework.Domain.CustomizeCheckoutValueObjects; using CompanyManagment.App.Contracts.Fine; using System.Globalization; using System.IO; +using _0_Framework.Domain.CustomizeCheckoutShared.Enums; +using _0_Framework.Domain.CustomizeCheckoutShared.ValueObjects; using Microsoft.EntityFrameworkCore; using Company.Domain.EmployeeAgg; diff --git a/CompanyManagment.EFCore/Repository/RollCallRepository.cs b/CompanyManagment.EFCore/Repository/RollCallRepository.cs index 40bdd728..1cf325b5 100644 --- a/CompanyManagment.EFCore/Repository/RollCallRepository.cs +++ b/CompanyManagment.EFCore/Repository/RollCallRepository.cs @@ -40,235 +40,348 @@ public class RollCallRepository : RepositoryBase, IRollCallRepos #region Pooya + public List GetRollCallWorkFlowsCutByBgService(long workshopId, DateTime start, DateTime end) + { + var rollCalls = _context.RollCalls + .Where(x => x.RollCallModifyType == RollCallModifyType.CutByBgService && x.WorkshopId == workshopId && + x.StartDate.Value.Date >= start.Date && x.StartDate.Value.Date <= end.Date).ToList(); + var names = _context.RollCallEmployees.Where(x => x.WorkshopId == workshopId) + .Select(x => new { x.EmployeeId, x.WorkshopId, x.EmployeeFullName }).ToList(); + + + return rollCalls.GroupBy(x => x.StartDate!.Value.Date) + .Select(g => new RollCallsByDateViewModel() + { + DateGr = g.Key, + DateFa = g.Key.ToFarsi(), + ActiveEmployees = g.Select(x => new RollCallViewModel() + { + EmployeeId = x.EmployeeId, + EmployeeFullName = names.FirstOrDefault(y => y.EmployeeId == x.EmployeeId)?.EmployeeFullName ?? "", + WorkshopId = x.WorkshopId, + Id = x.id, + StartDate = x.StartDate, + EndDate = x.EndDate + }) + }) + .ToList(); + + } + + + public int GetCountCutRollCallByBgService(long accId, long workshopId) + { + return _context.RollCalls.Where(x => + x.WorkshopId == workshopId && x.RollCallModifyType == RollCallModifyType.CutByBgService) + .GroupBy(x => x.StartDate!.Value.Date) + .Count(); + } + + public IEnumerable GetNotSlicedRollCallsByWorkshopId(long workshopId, DateTime durationStart, DateTime durationEnd) + { + if (durationEnd.Date >= DateTime.Now.Date) + durationEnd = DateTime.Now.AddDays(-1).Date; + + var names = _context.RollCallEmployees.Where(x => x.WorkshopId == workshopId).ToList(); + + var rollCalls = _context.RollCalls.Where(x => x.WorkshopId == workshopId && + x.StartDate.Value.Date >= durationStart && x.StartDate.Value.Date <= durationEnd && x.EndDate.HasValue).ToList(); + if (rollCalls == null || !rollCalls.Any()) + return new List(); + return rollCalls.GroupBy(x => x.StartDate.Value.Date).SelectMany(x => + x.GroupBy(y => y.EmployeeId).Where(y => y.Count() == 1) + .SelectMany(y => y)).Select(x => new RollCallViewModel + { + Id = x.id, + StartDate = x.StartDate.Value, + EndDate = x.EndDate.Value, + EmployeeId = x.EmployeeId, + DateGr = x.StartDate.Value.Date, + EmployeeFullName = names.FirstOrDefault(y => y.EmployeeId == x.EmployeeId)?.EmployeeFullName ?? "" + }); + } //حضور غیاب فیش حقوقی public List GetEmployeeRollCallsForMonth(long employeeId, long workshopId, DateTime startMonthDay, DateTime endMonthDay) - { + { - var rollCalls = _context.RollCalls.Where(x => - x.EmployeeId == employeeId && x.WorkshopId == workshopId && x.StartDate != null && x.EndDate != null && - x.StartDate.Value.Date >= startMonthDay && x.StartDate.Value.Date <= endMonthDay).ToList(); + var rollCalls = _context.RollCalls.Where(x => + x.EmployeeId == employeeId && x.WorkshopId == workshopId && x.StartDate != null && x.EndDate != null && + x.StartDate.Value.Date >= startMonthDay && x.StartDate.Value.Date <= endMonthDay).ToList(); - var year = Convert.ToInt32(startMonthDay.ToFarsi().Substring(0, 4)); - var month = Convert.ToInt32(startMonthDay.ToFarsi().Substring(5, 2)); - var firstDayOfCurrentMonth = new DateTime(year, month, 1, new PersianCalendar()); + var year = Convert.ToInt32(startMonthDay.ToFarsi().Substring(0, 4)); + var month = Convert.ToInt32(startMonthDay.ToFarsi().Substring(5, 2)); + var firstDayOfCurrentMonth = new DateTime(year, month, 1, new PersianCalendar()); - if (month == 12) - { - year += 1; - month = 1; - } - else - month += 1; + if (month == 12) + { + year += 1; + month = 1; + } + else + month += 1; - var nextMonthDate = new DateTime(year, month, 1, new PersianCalendar()); + var nextMonthDate = new DateTime(year, month, 1, new PersianCalendar()); - var lastDayOfCurrentMonth = nextMonthDate.AddDays(-1); + var lastDayOfCurrentMonth = nextMonthDate.AddDays(-1); - int dateRange = (int)(lastDayOfCurrentMonth - firstDayOfCurrentMonth).TotalDays + 1; + int dateRange = (int)(lastDayOfCurrentMonth - firstDayOfCurrentMonth).TotalDays + 1; - //all the dates from start to end, to be compared with present days to get absent dates - var completeDaysList = Enumerable.Range(0, dateRange).Select(offset => startMonthDay.AddDays(offset).Date); + //all the dates from start to end, to be compared with present days to get absent dates + var completeDaysList = Enumerable.Range(0, dateRange).Select(offset => startMonthDay.AddDays(offset).Date); - var absentRecords = completeDaysList - .ExceptBy(rollCalls.Select(x => x.StartDate!.Value.Date), y => y.Date.Date) - .Select(x => new CheckoutDailyRollCallViewModel() - { - StartDate = null, - EndDate = null, - DateTimeGr = x.Date.Date, - DayOfWeek = x.Date.DayOfWeek.ToString(), - RollCallDateFa = x.Date.ToFarsi() - }); + var absentRecords = completeDaysList + .ExceptBy(rollCalls.Select(x => x.StartDate!.Value.Date), y => y.Date.Date) + .Select(x => new CheckoutDailyRollCallViewModel() + { + StartDate = null, + EndDate = null, + DateTimeGr = x.Date.Date, + DayOfWeek = x.Date.DayOfWeek.ToString(), + RollCallDateFa = x.Date.ToFarsi() + }); - var presentDays = rollCalls.GroupBy(x => x.StartDate!.Value.Date).Select(x => new CheckoutDailyRollCallViewModel() - { - StartDate = x.Min(y => y.StartDate)!.Value.ToString("HH:mm"), - EndDate = x.Max(y => y.EndDate)!.Value.ToString("HH:mm"), - TotalhourseSpan = new TimeSpan(x.Where(y => y.EndDate != null).Sum(y => (y.EndDate - y.StartDate)!.Value.Ticks)), - DayOfWeek = x.Key.DayOfWeek.DayOfWeeKToPersian(), - RollCallDateFa = x.Key.Date.ToFarsi(), - DateTimeGr = x.Key.Date, - IsSliced = x.Count() > 1 - }); + var presentDays = rollCalls.GroupBy(x => x.StartDate!.Value.Date).Select(x => new CheckoutDailyRollCallViewModel() + { + StartDate = x.Min(y => y.StartDate)!.Value.ToString("HH:mm"), + EndDate = x.Max(y => y.EndDate)!.Value.ToString("HH:mm"), + TotalhourseSpan = new TimeSpan(x.Where(y => y.EndDate != null).Sum(y => (y.EndDate - y.StartDate)!.Value.Ticks)), + DayOfWeek = x.Key.DayOfWeek.DayOfWeeKToPersian(), + RollCallDateFa = x.Key.Date.ToFarsi(), + DateTimeGr = x.Key.Date, + IsSliced = x.Count() > 1 + }); - presentDays = presentDays.Select(x => new CheckoutDailyRollCallViewModel - { - StartDate = x.StartDate, - EndDate = x.EndDate, - TotalWorkingHours = $"{(int)x.TotalhourseSpan.TotalHours}:{(x.TotalhourseSpan.Minutes):00}", - DayOfWeek = x.DayOfWeek, - RollCallDateFa = x.RollCallDateFa, - DateTimeGr = x.DateTimeGr, - IsSliced = x.IsSliced, + presentDays = presentDays.Select(x => new CheckoutDailyRollCallViewModel + { + StartDate = x.StartDate, + EndDate = x.EndDate, + TotalWorkingHours = $"{(int)x.TotalhourseSpan.TotalHours}:{(x.TotalhourseSpan.Minutes):00}", + DayOfWeek = x.DayOfWeek, + RollCallDateFa = x.RollCallDateFa, + DateTimeGr = x.DateTimeGr, + IsSliced = x.IsSliced, - }); + }); - return presentDays.Concat(absentRecords).OrderBy(x => x.DateTimeGr).ToList(); + return presentDays.Concat(absentRecords).OrderBy(x => x.DateTimeGr).ToList(); - } + } - //جستجوی سوابق حضور غیاب بر اساس کارمند - public EmployeeRollCallsByMonthViewModel GetEmployeeRollCallsHistory(long employeeId, long workshopId, - DateTime? startDateTime, DateTime? endDateTime, DateTime? exactDateTime, DateTime? dateIndex) - { + //جستجوی سوابق حضور غیاب بر اساس کارمند + public EmployeeRollCallsByMonthViewModel GetEmployeeRollCallsHistory(long employeeId, long workshopId, + DateTime? startDateTime, DateTime? endDateTime, DateTime? exactDateTime, DateTime? dateIndex) + { - //get RollCallEmployee and RollCallEmployeeStatus for that employee in that workshop - var employeeRollCallStatuses = _context.RollCallEmployees.Include(x => x.EmployeesStatus) - .FirstOrDefault(x => x.EmployeeId == employeeId && x.WorkshopId == workshopId); + //get RollCallEmployee and RollCallEmployeeStatus for that employee in that workshop + var employeeRollCallStatuses = _context.RollCallEmployees.Include(x => x.EmployeesStatus) + .FirstOrDefault(x => x.EmployeeId == employeeId && x.WorkshopId == workshopId); - //if none was found return empty - if (employeeRollCallStatuses == null || employeeRollCallStatuses.EmployeesStatus == null || !employeeRollCallStatuses.EmployeesStatus.Any()) - return null; + //if none was found return empty + if (employeeRollCallStatuses == null) + return new(); - //this list will have all the months which employee was active in - var activeMonths = new List(); + //this list will have all the months which employee was active in + var activeMonths = new List(); - //filling the list - foreach (var status in employeeRollCallStatuses.EmployeesStatus) - { - var persianEndDate = new PersianDateTime(status.EndDate.Date); - var persianStartDate = new PersianDateTime(status.StartDate.Date); + //filling the list + foreach (var status in employeeRollCallStatuses.EmployeesStatus) + { + var persianEndDate = new PersianDateTime(status.EndDate.Date); + var persianStartDate = new PersianDateTime(status.StartDate.Date); - var persianStartFirstDayOfMonth = new PersianDateTime(persianStartDate.Year, persianStartDate.Month, 1); + var persianStartFirstDayOfMonth = new PersianDateTime(persianStartDate.Year, persianStartDate.Month, 1); - for (PersianDateTime start = persianStartFirstDayOfMonth; start <= persianEndDate && start < PersianDateTime.Today.Date; start = start.AddMonths(1)) - { - activeMonths.Add(start); - } - } - //might have duplicated records, this is the reason for distinct - var activeMonthsList = activeMonths.OrderByDescending(x => x.Date).Distinct().ToList(); + for (PersianDateTime start = persianStartFirstDayOfMonth; start <= persianEndDate && start < PersianDateTime.Today.Date; start = start.AddMonths(1)) + { + activeMonths.Add(start); + } + } + //might have duplicated records, this is the reason for distinct + var activeMonthsList = activeMonths.OrderByDescending(x => x.Date).Distinct().ToList(); - PersianDateTime startSearch = new(); - PersianDateTime endSearch = new(); + PersianDateTime startSearch = new(); + PersianDateTime endSearch = new(); - //if search has these parameters below - if (startDateTime.HasValue && endDateTime.HasValue) - { - //change them to persian date time and save them - startSearch = new PersianDateTime(startDateTime.Value); - endSearch = new PersianDateTime(endDateTime.Value); + //if search has these parameters below + if (startDateTime.HasValue && endDateTime.HasValue) + { + //change them to persian date time and save them + startSearch = new PersianDateTime(startDateTime.Value); + endSearch = new PersianDateTime(endDateTime.Value); - //get the months that include these dates - activeMonthsList = activeMonthsList.Where(x => x.Year >= startSearch.Year && x.Month >= startSearch.Month && x.Year <= endSearch.Year && x.Month <= endSearch.Month).ToList(); - } - //if exact datetime is given - if (exactDateTime.HasValue) - { - //start and end will be the same date - startSearch = new PersianDateTime(exactDateTime.Value); - endSearch = startSearch; - //get the - activeMonthsList = activeMonthsList.Where(x => x.Year >= startSearch.Year && x.Month >= startSearch.Month && x.Year <= endSearch.Year && x.Month <= endSearch.Month).ToList(); - } + //get the months that include these dates + activeMonthsList = activeMonthsList.Where(x => x.Year >= startSearch.Year && x.Month >= startSearch.Month && x.Year <= endSearch.Year && x.Month <= endSearch.Month).ToList(); + } + //if exact datetime is given + if (exactDateTime.HasValue) + { + //start and end will be the same date + startSearch = new PersianDateTime(exactDateTime.Value); + endSearch = startSearch; + //get the + activeMonthsList = activeMonthsList.Where(x => x.Year >= startSearch.Year && x.Month >= startSearch.Month && x.Year <= endSearch.Year && x.Month <= endSearch.Month).ToList(); + } - if (dateIndex != null) - { - var persianDateIndex = new PersianDateTime(dateIndex.Value); - var dateIndexFirstOfMonth = persianDateIndex.AddDays(-(persianDateIndex.Day - 1)); - activeMonthsList = activeMonthsList.Where(x => dateIndexFirstOfMonth >= x).ToList(); - } + if (dateIndex != null) + { + var persianDateIndex = new PersianDateTime(dateIndex.Value); + var dateIndexFirstOfMonth = persianDateIndex.AddDays(-(persianDateIndex.Day - 1)); + activeMonthsList = activeMonthsList.Where(x => dateIndexFirstOfMonth >= x).ToList(); + } - if (!activeMonthsList.Any()) return new(); + if (!activeMonthsList.Any()) return new(); - //get the last month which user was active in - PersianDateTime selectedMonthPersian = activeMonthsList.First(); + //get the last month which user was active in + PersianDateTime selectedMonthPersian = activeMonthsList.First(); - DateTime selectedMonthFirstDay = selectedMonthPersian; - DateTime nextMonthFirstDay = selectedMonthPersian.AddMonths(1); + DateTime selectedMonthFirstDay = selectedMonthPersian; + DateTime nextMonthFirstDay = selectedMonthPersian.AddMonths(1); - var statusesOfMonth = employeeRollCallStatuses.EmployeesStatus.Where(x => x.EndDate >= selectedMonthFirstDay && - x.StartDate < nextMonthFirstDay); + var statusesOfMonth = employeeRollCallStatuses.EmployeesStatus.Where(x => x.EndDate >= selectedMonthFirstDay && + x.StartDate < nextMonthFirstDay); - var leavesQuery = - _context.LeaveList.Where(x => (x.LeaveType == "استعلاجی" || (x.LeaveType == "استحقاقی" && x.PaidLeaveType == "روزانه")) && - x.IsAccepted && - x.EndLeave >= selectedMonthFirstDay && x.StartLeave < nextMonthFirstDay && x.WorkshopId == workshopId && x.EmployeeId == employeeId); + var leavesQuery = + _context.LeaveList.Where(x => (x.LeaveType == "استعلاجی" || (x.LeaveType == "استحقاقی" && x.PaidLeaveType == "روزانه")) && + x.IsAccepted && + x.EndLeave >= selectedMonthFirstDay && x.StartLeave < nextMonthFirstDay && x.WorkshopId == workshopId); - var rollCalls = _context.RollCalls.Where(x => - !leavesQuery.Any(y => - y.StartLeave.Date <= x.StartDate.Value.Date && y.EndLeave.Date >= x.StartDate.Value.Date) && - x.EmployeeId == employeeId && x.WorkshopId == workshopId && x.StartDate != null && - x.StartDate >= selectedMonthFirstDay && x.StartDate < nextMonthFirstDay && x.RollCallModifyType != RollCallModifyType.Undefined); + var rollCalls = _context.RollCalls.Where(x => + !leavesQuery.Any(y => + y.StartLeave.Date <= x.StartDate.Value.Date && y.EndLeave.Date >= x.StartDate.Value.Date) && + x.EmployeeId == employeeId && x.WorkshopId == workshopId && x.StartDate != null && + x.StartDate >= selectedMonthFirstDay && x.StartDate < nextMonthFirstDay && x.RollCallModifyType != RollCallModifyType.Undefined); - var personnelCode = - _context.PersonnelCodeSet.FirstOrDefault(x => x.EmployeeId == employeeId && x.WorkshopId == workshopId)?.PersonnelCode; + var personnelCode = + _context.PersonnelCodeSet.FirstOrDefault(x => x.EmployeeId == employeeId && x.WorkshopId == workshopId)?.PersonnelCode; - var employeeName = _context.RollCallEmployees.Where(x => x.WorkshopId == workshopId).Select(x => new { x.EmployeeId, x.EmployeeFullName }) - .FirstOrDefault(x => x.EmployeeId == employeeId); + var employeeName = _context.RollCallEmployees.Where(x => x.WorkshopId == workshopId).Select(x => new { x.EmployeeId, x.EmployeeFullName }) + .FirstOrDefault(x => x.EmployeeId == employeeId); - var rollCallsList = rollCalls.ToList(); - var leavesList = leavesQuery.ToList(); + var rollCallsList = rollCalls.ToList(); + var leavesList = leavesQuery.ToList(); - int dateRange = (int)(nextMonthFirstDay - selectedMonthFirstDay).TotalDays; + int dateRange = (int)(nextMonthFirstDay - selectedMonthFirstDay).TotalDays; - var todayDate = DateTime.Now.Date; - //all the dates from start to end, to be compared with present days to get absent dates - var completeDaysList = Enumerable.Range(0, dateRange).Select(offset => selectedMonthFirstDay.AddDays(offset).Date).Where(x => x.Date < todayDate); + var todayDate = DateTime.Now.Date; + //all the dates from start to end, to be compared with present days to get absent dates + var completeDaysList = Enumerable.Range(0, dateRange).Select(offset => selectedMonthFirstDay.AddDays(offset).Date).Where(x => x.Date < todayDate); - //if user search range is within a month for example, we dont want 30/31/29 days for month, we want it to be the size of the search range - //user input = 2024/04/15~2024/04/21, output days count is 21-15+1=6 days from 15th to 21st - if (exactDateTime.HasValue || (startDateTime.HasValue && endDateTime.HasValue)) - completeDaysList = completeDaysList.Where(x => x.Date >= startSearch.Date && x.Date <= endSearch.Date); + //if user search range is within a month for example, we dont want 30/31/29 days for month, we want it to be the size of the search range + //user input = 2024/04/15~2024/04/21, output days count is 21-15+1=6 days from 15th to 21st + if (exactDateTime.HasValue || (startDateTime.HasValue && endDateTime.HasValue)) + completeDaysList = completeDaysList.Where(x => x.Date >= startSearch.Date && x.Date <= endSearch.Date); - var result = completeDaysList.Where(x => !rollCallsList.Any(y => y.StartDate.Value.Date == x.Date && y.EndDate == null) && - statusesOfMonth.Any(y => x >= y.StartDate.Date && x <= y.EndDate.Date)) - .Select(x => - { - var leave = leavesList.FirstOrDefault(y => y.EndLeave >= x.Date.Date && y.StartLeave <= x.Date.Date); - return new RollCallViewModel() - { - DateGr = x.Date.Date, - DateFa = x.Date.Date.ToFarsi(), - RollCallTimesList = rollCallsList.Where(y => x.Date.Date == y.StartDate!.Value.Date).Select(y => - new RollCallTimeViewModel() - { - StartDate = y.StartDate.Value.ToString("HH:mm"), - EndDate = y.EndDate!.Value.ToString("HH:mm") - }), - TotalWorkingHoursSpan = new TimeSpan(rollCallsList.Where(y => x.Date.Date == y.StartDate!.Value.Date) - .Sum(y => (y.EndDate!.Value - y.StartDate.Value).Ticks)), - Reason = leave?.LeaveType ?? "", - HasLeave = (leave?.PaidLeaveType == "روزانه" || leave?.LeaveType == "استعلاجی") ? true : false - }; - }); - result = result.Select(x => new RollCallViewModel() - { - EmployeeFullName = employeeName.EmployeeFullName, - EmployeeId = employeeId, - PersonnelCode = personnelCode.ToString(), - DateGr = x.DateGr, - DateFa = x.DateFa, - DayOfWeekFa = x.DateGr.DayOfWeek.DayOfWeeKToPersian(), - IsHoliday = _holidayItemApplication.IsHoliday(x.DateGr), - IsAbsent = !x.RollCallTimesList.Any(), - RollCallTimesList = x.RollCallTimesList, - TotalWorkingHours = $"{(int)x.TotalWorkingHoursSpan.TotalHours}:{x.TotalWorkingHoursSpan.Minutes.ToString("00")}", - }).ToList(); - return new EmployeeRollCallsByMonthViewModel() - { - PersianMonthName = selectedMonthPersian.ToString("MMMM"), - PersianYear = selectedMonthPersian.ToString("yyyy"), - DateGr = selectedMonthFirstDay, - RollCalls = result.OrderByDescending(x => x.DateGr), - DateIndex = activeMonthsList.Count > 1 ? activeMonthsList.Skip(1).First().ToString("yyyy/MM/dd") : null + var result = completeDaysList.Where(x => !rollCallsList.Any(y => y.StartDate.Value.Date == x.Date && y.EndDate == null) && + statusesOfMonth.Any(y => x >= y.StartDate.Date && x <= y.EndDate.Date)) + .Select(x => + { + var leave = leavesList.FirstOrDefault(y => y.EndLeave >= x.Date.Date && y.StartLeave <= x.Date.Date); + return new RollCallViewModel() + { + DateGr = x.Date.Date, + DateFa = x.Date.Date.ToFarsi(), + RollCallTimesList = rollCallsList.Where(y => x.Date.Date == y.StartDate!.Value.Date).Select(y => + new RollCallTimeViewModel() + { + StartDate = y.StartDate.Value.ToString("HH:mm"), + EndDate = y.EndDate!.Value.ToString("HH:mm") + }), + TotalWorkingHoursSpan = new TimeSpan(rollCallsList.Where(y => x.Date.Date == y.StartDate!.Value.Date) + .Sum(y => (y.EndDate!.Value - y.StartDate.Value).Ticks)), + Reason = leave?.LeaveType ?? "", + HasLeave = (leave?.PaidLeaveType == "روزانه" || leave?.LeaveType == "استعلاجی") ? true : false + }; + }); + result = result.Select(x => new RollCallViewModel() + { + EmployeeFullName = employeeName.EmployeeFullName, + EmployeeId = employeeId, + PersonnelCode = personnelCode.ToString(), + DateGr = x.DateGr, + DateFa = x.DateFa, + DayOfWeekFa = x.DateGr.DayOfWeek.DayOfWeeKToPersian(), + IsHoliday = _holidayItemApplication.IsHoliday(x.DateGr), + IsAbsent = !x.RollCallTimesList.Any(), + RollCallTimesList = x.RollCallTimesList, + TotalWorkingHours = $"{(int)x.TotalWorkingHoursSpan.TotalHours}:{x.TotalWorkingHoursSpan.Minutes.ToString("00")}", + }).ToList(); + return new EmployeeRollCallsByMonthViewModel() + { + PersianMonthName = selectedMonthPersian.ToString("MMMM"), + PersianYear = selectedMonthPersian.ToString("yyyy"), + DateGr = selectedMonthFirstDay, + RollCalls = result.OrderByDescending(x => x.DateGr), + DateIndex = activeMonthsList.Count > 1 ? activeMonthsList.Skip(1).First().ToString("yyyy/MM/dd") : null - }; - } + }; + } - public void AddRange(List rollCalls) + public void AddRange(List rollCalls) { _context.RollCalls.AddRange(rollCalls); } + //سوابق غیبت + public List GetWorkshopAbsentHistory(long workshopId, DateTime startSearch, DateTime endSearch) + { + if (endSearch.Date == DateTime.Now.Date) + endSearch = endSearch.AddDays(-1); + //get leaves for workshop that have been activated in dateIndex date + var leavesQuery = _context.LeaveList.Where(x => x.WorkshopId == workshopId && + x.IsAccepted && (x.LeaveType == "استعلاجی" || (x.LeaveType == "استحقاقی" && x.PaidLeaveType == "روزانه")) && + x.EndLeave.Date >= startSearch.Date && x.StartLeave.Date <= endSearch.Date); + //roll calls for current workshop where shift start is in dateIndex date (filters today's shifts) + var rollCallsQuery = _context.RollCalls + .Where(x => x.WorkshopId == workshopId && x.StartDate.HasValue && + x.StartDate.Value.Date >= startSearch.Date && x.StartDate.Value.Date <= endSearch.Date && x.RollCallModifyType != RollCallModifyType.Undefined && + x.RollCallModifyType != RollCallModifyType.CutByBgService); + + + //get active employees of workshop in dateIndex date + var activeEmployeesQuery = + _context.RollCallEmployees.Include(x => x.EmployeesStatus) + .Where(x => x.WorkshopId == workshopId && x.EmployeesStatus.Any(y => y.EndDate.Date >= startSearch && y.StartDate.Date <= endSearch)); + var rollCallsList = rollCallsQuery.ToList(); + var activatedEmployeesList = activeEmployeesQuery.ToList(); + var leavesList = leavesQuery.ToList(); + + + + int daysCount = (int)((endSearch.Date - startSearch.Date).TotalDays + 1); + List days = Enumerable.Range(0, daysCount).Select(x => startSearch.Date.AddDays(x)).ToList(); + List result = new(); + foreach (var day in days) + { + var item = new RollCallsByDateViewModel() + { + DateGr = day, + DateFa = day.ToFarsi(), + ActiveEmployees = activatedEmployeesList.Where(x => x.EmployeesStatus.Any(y => y.StartDate.Date <= day && y.EndDate.Date >= day) && + !leavesList.Any(y => y.EmployeeId == x.EmployeeId && y.StartLeave.Date <= day && y.EndLeave.Date >= day) && + !rollCallsList.Any(rc => rc.EmployeeId == x.EmployeeId && rc.StartDate.Value.Date == day.Date)) + .Select(x => new RollCallViewModel() + { + EmployeeId = x.EmployeeId, + EmployeeFullName = x.EmployeeFullName, + Id = x.id, + WorkshopId = x.WorkshopId + + }), + IsHoliday = _holidayItemApplication.IsHoliday(day), + IsFriday = day.DayOfWeek == DayOfWeek.Friday + }; + result.Add(item); + } + return result; + } //سوابق حضور غیاب کارگاه public RollCallsByDateViewModel GetWorkshopRollCallHistory(RollCallSearchModel searchModel) @@ -488,8 +601,8 @@ public class RollCallRepository : RepositoryBase, IRollCallRepos return new CurrentDayRollCall() { AbsentEmployees = absentsViewModel.ToList(), - PresentEmployees = presentEmployees.OrderByDescending(x=>x.RollCallTimesList.Any(y=>string.IsNullOrWhiteSpace(y.EndDate))) - .ThenByDescending(x=>x.RollCallTimesList.Max(y=>y.StartDate)).ToList() + PresentEmployees = presentEmployees.OrderByDescending(x => x.RollCallTimesList.Any(y => string.IsNullOrWhiteSpace(y.EndDate))) + .ThenByDescending(x => x.RollCallTimesList.Max(y => y.StartDate)).ToList() }; } @@ -533,6 +646,23 @@ public class RollCallRepository : RepositoryBase, IRollCallRepos }).ToList(); } + public RollCallViewModel GetDetails(long rollCallId) + { + var entity = _context.RollCalls.FirstOrDefault(x => x.id == rollCallId); + if (entity == null) + return null; + var name = _context.RollCallEmployees.FirstOrDefault(x => x.WorkshopId == entity.WorkshopId && x.EmployeeId == entity.EmployeeId).EmployeeFullName; + return new RollCallViewModel + { + WorkshopId = entity.WorkshopId, + EmployeeId = entity.EmployeeId, + StartDate = entity.StartDate.Value, + EndDate = entity.EndDate.Value, + EmployeeFullName = name, + Id = entity.id, + DateGr = entity.StartDate.Value.Date + }; + } #endregion public long Flag(long employeeId, long workshopId) diff --git a/CompanyManagment.EFCore/Repository/SalaryAidRepository.cs b/CompanyManagment.EFCore/Repository/SalaryAidRepository.cs index 784baedb..df342e4b 100644 --- a/CompanyManagment.EFCore/Repository/SalaryAidRepository.cs +++ b/CompanyManagment.EFCore/Repository/SalaryAidRepository.cs @@ -9,42 +9,63 @@ namespace CompanyManagment.EFCore.Repository; public class SalaryAidRepository:RepositoryBase,ISalaryAidRepository { - private readonly CompanyContext _context; + private readonly CompanyContext _companyContext; public SalaryAidRepository(CompanyContext context):base(context) { - _context = context; + _companyContext = context; } - public List GetSearchList(SalaryAidSearchViewModel searchViewModel) + public List GetSearchList(SalaryAidSearchViewModel searchViewModel) { - var query = _context.SalaryAids.Where(x => x.WorkshopId == searchViewModel.WorkshopId); + var query = _companyContext.SalaryAids.Where(x => x.WorkshopId == searchViewModel.WorkshopId); - if (searchViewModel.EmployeeId != 0) - query = query.Where(x => x.EmployeeId == searchViewModel.EmployeeId); + if (searchViewModel.EmployeeId != 0) + query = query.Where(x => x.EmployeeId == searchViewModel.EmployeeId); + var result = query.OrderByDescending(x => x.CreationDate).Skip(searchViewModel.PageIndex).Take(30).AsEnumerable(); - return query.Select(x => new SalaryAidSearchViewModel() - { - Id = x.id, - WorkshopId = x.WorkshopId, + var employees = _companyContext.Employees.Where(x => result.Any(a => a.EmployeeId == x.id)).ToList(); + + var personnelCodes = _companyContext.PersonnelCodeSet + .Where(x => result.Any(a => a.EmployeeId == x.EmployeeId && x.WorkshopId == a.WorkshopId)).ToList(); + + return result.Select(x => new SalaryAidViewModel() + { + Amount = x.Amount.ToMoney(), + CreationDate = x.CreationDate.ToFarsi(), + EmployeeFullName = employees.FirstOrDefault(e => e.id == x.EmployeeId)?.FullName, + Id = x.id, + PersonnelCode = personnelCodes + .FirstOrDefault(a => a.WorkshopId == x.WorkshopId && a.EmployeeId == x.EmployeeId)?.PersonnelCode + .ToString(), EmployeeId = x.EmployeeId, - EmployeeFullName = _context.Employees.FirstOrDefault(e => e.id == x.EmployeeId).FullName, - PersonnelCode = _context.PersonnelCodeSet.FirstOrDefault(p => p.EmployeeId == x.EmployeeId).PersonnelCode.ToString(), - Amount = x.Amount.ToMoney(), - SalaryDateTime = x.SalaryAidDateTime.ToFarsi(), - CreationDate = x.CreationDate - }).OrderByDescending(x => x.CreationDate).Skip(searchViewModel.PageIndex).Take(30).ToList(); + SalaryAidDateTimeFa = x.SalaryAidDateTime.ToFarsi(), + SalaryAidDateTimeGe = x.SalaryAidDateTime, + WorkshopId = x.WorkshopId + }).ToList(); + } public EditSalaryAidViewModel GetDetails(long id) { - return _context.SalaryAids.Select(x => new EditSalaryAidViewModel() - { - Id = x.id, - WorkshopId = x.WorkshopId, - EmployeeId = x.EmployeeId, - Amount = x.Amount.ToMoney(), - SalaryDateTime = x.SalaryAidDateTime.ToFarsi() - }).FirstOrDefault(x => x.Id == id); + var entity = _companyContext.SalaryAids.FirstOrDefault(x => x.id == id); + if (entity == null) + return new(); + var res = new EditSalaryAidViewModel() + { + Id = entity.id, + WorkshopId = entity.WorkshopId, + EmployeeId = entity.EmployeeId, + Amount = entity.Amount.ToMoney(), + SalaryDateTime = entity.SalaryAidDateTime.ToFarsi() + }; + + res.EmployeeFullName = _companyContext.Employees.Find(entity.EmployeeId)?.FullName; + return res; } + + public List GetBy(IEnumerable ids) + { + return _companyContext.SalaryAids.Where(x => ids.Contains(x.id)).ToList(); + } } \ No newline at end of file diff --git a/CompanyManagment.EFCore/Repository/WorkshopSubAccountRepository.cs b/CompanyManagment.EFCore/Repository/WorkshopSubAccountRepository.cs new file mode 100644 index 00000000..e8e34f8f --- /dev/null +++ b/CompanyManagment.EFCore/Repository/WorkshopSubAccountRepository.cs @@ -0,0 +1,38 @@ +using _0_Framework.InfraStructure; +using Company.Domain.WorkshopSubAccountAgg; +using CompanyManagment.App.Contracts.Workshop; +using Microsoft.EntityFrameworkCore; +using System.Collections.Generic; +using System.Linq; + +namespace CompanyManagment.EFCore.Repository +{ + public class WorkshopSubAccountRepository : RepositoryBase, IWorkshopSubAccountRepository + { + private readonly CompanyContext _companyContext; + public WorkshopSubAccountRepository(CompanyContext context, CompanyContext companyContext) : base(context) + { + _companyContext = companyContext; + } + + public List GetWorkshopsBySubAccountId(long subAccountId) + { + return _companyContext.WorkshopSubAccounts.Include(x => x.Workshop).Where(x => x.SubAccountId == subAccountId) + .Select(x => new WorkshopSubAccountViewModel() + { + SubAccountId = x.SubAccountId, + IsActive = x.IsActive.ToString(), + WorkshopId = x.WorkshopId, + WorkshopName = x.Workshop.WorkshopName, + }) + .ToList(); + } + + public List GetWorkshopsSubAccountEntityBySubAccountId(long subAccountId) + { + return _companyContext.WorkshopSubAccounts + .Where(x => x.SubAccountId == subAccountId).ToList(); + + } + } +} diff --git a/DadmehrGostar.sln b/DadmehrGostar.sln index ef0af7f2..6ac6c282 100644 --- a/DadmehrGostar.sln +++ b/DadmehrGostar.sln @@ -52,6 +52,26 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "backwork", "backwork", "{97 EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "backService", "backService\backService.csproj", "{5EE2EC2E-E1B5-457C-9A1F-642D2BDB4AE7}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "WorkFlow", "WorkFlow", "{FEA5EBD6-1377-4543-9F18-708758D4D5AE}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Application", "Application", "{D1803DC6-4FA6-4500-9C3C-5F7AC1AEE187}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WorkFlow.Application", "WorkFlow\Application\WorkFlow.Application\WorkFlow.Application.csproj", "{BA69B1F4-2D53-4FAC-A658-FD59EB552269}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WorkFlow.Application.Contracts", "WorkFlow\Application\WorkFlow.Application.Contracts\WorkFlow.Application.Contracts.csproj", "{BA6933AF-C104-4271-ADEA-999E1BFC5A6C}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Domain", "Domain", "{486CBA92-3B91-4761-A853-2A856B1D1159}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WorkFlow.Domain", "WorkFlow\Domain\WorkFlow.Domain\WorkFlow.Domain.csproj", "{AFE354B3-CCDF-4810-9FFF-6F10B49757B8}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Infrastructure", "Infrastructure", "{09517B4E-C699-4D57-8590-0B773228820A}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WorkFlow.Infrastructure.EfCore", "WorkFlow\Infrastructure\WorkFlow.Infrastructure.EfCore\WorkFlow.Infrastructure.EfCore.csproj", "{9643E1D4-A2FE-4CA1-A303-1A499CDB6D87}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WorkFlow.Infrastructure.ACL", "WorkFlow\Infrastructure\WorkFlow.Infrastructure.ACL\WorkFlow.Infrastructure.ACL.csproj", "{3CDCCA2F-79F1-43FD-B9C4-211279624148}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WorkFlow.Infrastructure.Config", "WorkFlow\Infrastructure\WorkFlow.Infrastructure.Config\WorkFlow.Infrastructure.Config.csproj", "{0E6A32F1-1BCB-45A1-BB1A-A5B8AFA8F551}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -114,6 +134,30 @@ Global {5EE2EC2E-E1B5-457C-9A1F-642D2BDB4AE7}.Debug|Any CPU.Build.0 = Debug|Any CPU {5EE2EC2E-E1B5-457C-9A1F-642D2BDB4AE7}.Release|Any CPU.ActiveCfg = Release|Any CPU {5EE2EC2E-E1B5-457C-9A1F-642D2BDB4AE7}.Release|Any CPU.Build.0 = Release|Any CPU + {BA69B1F4-2D53-4FAC-A658-FD59EB552269}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BA69B1F4-2D53-4FAC-A658-FD59EB552269}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BA69B1F4-2D53-4FAC-A658-FD59EB552269}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BA69B1F4-2D53-4FAC-A658-FD59EB552269}.Release|Any CPU.Build.0 = Release|Any CPU + {BA6933AF-C104-4271-ADEA-999E1BFC5A6C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BA6933AF-C104-4271-ADEA-999E1BFC5A6C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BA6933AF-C104-4271-ADEA-999E1BFC5A6C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BA6933AF-C104-4271-ADEA-999E1BFC5A6C}.Release|Any CPU.Build.0 = Release|Any CPU + {AFE354B3-CCDF-4810-9FFF-6F10B49757B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AFE354B3-CCDF-4810-9FFF-6F10B49757B8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AFE354B3-CCDF-4810-9FFF-6F10B49757B8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AFE354B3-CCDF-4810-9FFF-6F10B49757B8}.Release|Any CPU.Build.0 = Release|Any CPU + {9643E1D4-A2FE-4CA1-A303-1A499CDB6D87}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9643E1D4-A2FE-4CA1-A303-1A499CDB6D87}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9643E1D4-A2FE-4CA1-A303-1A499CDB6D87}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9643E1D4-A2FE-4CA1-A303-1A499CDB6D87}.Release|Any CPU.Build.0 = Release|Any CPU + {3CDCCA2F-79F1-43FD-B9C4-211279624148}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3CDCCA2F-79F1-43FD-B9C4-211279624148}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3CDCCA2F-79F1-43FD-B9C4-211279624148}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3CDCCA2F-79F1-43FD-B9C4-211279624148}.Release|Any CPU.Build.0 = Release|Any CPU + {0E6A32F1-1BCB-45A1-BB1A-A5B8AFA8F551}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0E6A32F1-1BCB-45A1-BB1A-A5B8AFA8F551}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0E6A32F1-1BCB-45A1-BB1A-A5B8AFA8F551}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0E6A32F1-1BCB-45A1-BB1A-A5B8AFA8F551}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -136,6 +180,15 @@ Global {1D38F80F-8400-43C2-88B3-D2A369AAF1F0} = {08818896-0B78-4A25-B216-12951D06DC0F} {55799DFE-885F-4B35-AFEE-0D0CE24E6ED9} = {3D998261-663C-486D-9979-81F95AED9F72} {5EE2EC2E-E1B5-457C-9A1F-642D2BDB4AE7} = {97A930E5-06B3-4D67-885A-8D9A773BFC1A} + {D1803DC6-4FA6-4500-9C3C-5F7AC1AEE187} = {FEA5EBD6-1377-4543-9F18-708758D4D5AE} + {BA69B1F4-2D53-4FAC-A658-FD59EB552269} = {D1803DC6-4FA6-4500-9C3C-5F7AC1AEE187} + {BA6933AF-C104-4271-ADEA-999E1BFC5A6C} = {D1803DC6-4FA6-4500-9C3C-5F7AC1AEE187} + {486CBA92-3B91-4761-A853-2A856B1D1159} = {FEA5EBD6-1377-4543-9F18-708758D4D5AE} + {AFE354B3-CCDF-4810-9FFF-6F10B49757B8} = {486CBA92-3B91-4761-A853-2A856B1D1159} + {09517B4E-C699-4D57-8590-0B773228820A} = {FEA5EBD6-1377-4543-9F18-708758D4D5AE} + {9643E1D4-A2FE-4CA1-A303-1A499CDB6D87} = {09517B4E-C699-4D57-8590-0B773228820A} + {3CDCCA2F-79F1-43FD-B9C4-211279624148} = {09517B4E-C699-4D57-8590-0B773228820A} + {0E6A32F1-1BCB-45A1-BB1A-A5B8AFA8F551} = {09517B4E-C699-4D57-8590-0B773228820A} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {E6CFB3A7-A7C8-4E82-8F06-F750408F0BA9} diff --git a/PersonalContractingParty.Config/PersonalBootstrapper.cs b/PersonalContractingParty.Config/PersonalBootstrapper.cs index 90fd12a0..15ecf6a9 100644 --- a/PersonalContractingParty.Config/PersonalBootstrapper.cs +++ b/PersonalContractingParty.Config/PersonalBootstrapper.cs @@ -180,6 +180,11 @@ using CompanyManagment.App.Contracts.Reward; using CompanyManagment.App.Contracts.SalaryAid; using Company.Domain.AndroidApkVersionAgg; using CompanyManagment.App.Contracts.AndroidApkVersion; +using Company.Domain.FineSubjectAgg; +using CompanyManagment.App.Contracts.FineSubject; +using Company.Domain.CustomizeCheckoutAgg; +using CompanyManagment.App.Contracts.CustomizeCheckout; +using Company.Domain.WorkshopSubAccountAgg; namespace PersonalContractingParty.Config; @@ -200,7 +205,7 @@ public class PersonalBootstrapper //------MAIN-PROJECT---------------- services.AddTransient(); services.AddTransient(); - + services.AddTransient(); services.AddTransient(); @@ -312,7 +317,7 @@ public class PersonalBootstrapper services.AddTransient(); services.AddTransient(); services.AddTransient(); - + services.AddTransient(); services.AddTransient(); @@ -375,20 +380,27 @@ public class PersonalBootstrapper services.AddTransient(); services.AddTransient(); + services.AddTransient(); + services.AddTransient(); services.AddTransient(); services.AddTransient(); - services.AddTransient(); + services.AddTransient(); services.AddTransient(); - services.AddTransient(); + services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); #endregion + #region Pooya + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + #endregion //=========End Of Main==================================== //---File Project------------------------------------ diff --git a/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/CheckoutTemporary.cshtml b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/CheckoutTemporary.cshtml new file mode 100644 index 00000000..8799f0b4 --- /dev/null +++ b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/CheckoutTemporary.cshtml @@ -0,0 +1,4 @@ +@page +@model ServiceHost.Areas.Client.Pages.Company.CustomizeCheckout.CheckoutTemporaryModel +@{ +} diff --git a/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/CheckoutTemporary.cshtml.cs b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/CheckoutTemporary.cshtml.cs new file mode 100644 index 00000000..bd47e4ad --- /dev/null +++ b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/CheckoutTemporary.cshtml.cs @@ -0,0 +1,12 @@ +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.RazorPages; + +namespace ServiceHost.Areas.Client.Pages.Company.CustomizeCheckout +{ + public class CheckoutTemporaryModel : PageModel + { + public void OnGet() + { + } + } +} diff --git a/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/CheckoutUnofficial.cshtml b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/CheckoutUnofficial.cshtml new file mode 100644 index 00000000..b9fee090 --- /dev/null +++ b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/CheckoutUnofficial.cshtml @@ -0,0 +1,517 @@ +@page +@model ServiceHost.Areas.Client.Pages.Company.CustomizeCheckout.CheckoutUnofficialModel + +@{ + string clientVersion = _0_Framework.Application.Version.StyleVersion; + ViewData["Title"] = " - " + "فیش حقوقی غیر رسمی"; + int index = 1; + int i = 0; +} + + +@section Styles { + + + + + + + + + + +} + + + + + + + + + + + + + +
+
+
+
+
+ +
+

اطلاعات فیش حقوقی دلخواه

+
@Model.WorkshopFullName
+
+
+ +
+
+
+ +
+ + +
+
+ +
+
+
+ + + + + + +
+
+ +
+ +
+
+ + @*
+ + +
*@ +
+
+ + لیست فیش حقوقی دلخواه + +
+
+
+ @* + *@ +
+
+ + +
+ + +
+
+ +
+
+ + @if (@Model.CustomizeCheckouts.Count > 0) + { +
+
+ + +
+ + +
+ + +
+
+
+ +
+
+

لیست فیش حقوقی دلخواه

+
+
+ + +
+
+
+ + +
+
+
+ + + + +
+
شماره پرسنلی
+
سال
+
ماه
+
شماره قرارداد
+
نام پرسنل
+
آغاز قرارداد
+
پایان قرارداد
+
امضاء پرسنل
+
عملیات
+
+ + + @foreach (var item in @Model.CustomizeCheckouts) + { +
+
+
+ ردیف +
+ +
+
+
شماره پرسنلی
+
@item.PersonnelCode
+
+
+
سال
+
@item.Year
+
+
+
ماه
+
@item.Month
+
+
+
شماره قرارداد
+
@item.ContractNo
+
+
+
نام پرسنل
+
@item.EmployeeName
+
+
+
آغاز قرارداد
+
@item.ContractStartFa
+
+
+
پایان قرارداد
+
@item.ContractEndFa
+
+
+
امضاء پرسنل
+
+ + + +
+
+
+
+ + + + +
+
+ + + + + +
+ +
+
+ + @(i) +
+ +
+ + @item.EmployeeName + +
+
+ + +
+ +
+ آغاز قرارداد + @item.ContractStartFa +
+
+ پایان قرارداد + @item.ContractEndFa +
+
+ +
+
+
+ + + + +
+ } +
+ } + else + { +
+
+
+
+ +
اطلاعاتی وجود ندارد.
+
+
+
+
+ } + +
+ + +
+
+
+ +
+ + + + + + + + +@section Script { + + + + + + +} diff --git a/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/CheckoutUnofficial.cshtml.cs b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/CheckoutUnofficial.cshtml.cs new file mode 100644 index 00000000..47163426 --- /dev/null +++ b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/CheckoutUnofficial.cshtml.cs @@ -0,0 +1,90 @@ +using System.Security.AccessControl; +using System.Security.Claims; +using _0_Framework.Application; +using CompanyManagment.App.Contracts.CustomizeCheckout; +using CompanyManagment.App.Contracts.Employee; +using CompanyManagment.App.Contracts.Workshop; +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.RazorPages; + +namespace ServiceHost.Areas.Client.Pages.Company.CustomizeCheckout +{ + public class CheckoutUnofficialModel : PageModel + { + private readonly ICustomizeCheckoutApplication _customizeCheckoutApplication; + private readonly IWorkshopApplication _workshopApplication; + private readonly IEmployeeApplication _employeeApplication; + private readonly IAuthHelper _authHelper; + private readonly IPasswordHasher _passwordHasher; + private readonly IHttpContextAccessor _httpContextAccessor; + + private readonly long _workshopId; + public string WorkshopFullName; + public SearchCustomizeCheckout SearchModel; + + public List CustomizeCheckouts { get; set; } + + public CheckoutUnofficialModel(ICustomizeCheckoutApplication customizeCheckoutApplication, IAuthHelper authHelper, IPasswordHasher passwordHasher, IHttpContextAccessor httpContextAccessor, IWorkshopApplication workshopApplication, IEmployeeApplication employeeApplication) + { + _customizeCheckoutApplication = customizeCheckoutApplication; + _authHelper = authHelper; + _passwordHasher = passwordHasher; + _httpContextAccessor = httpContextAccessor; + _workshopApplication = workshopApplication; + _employeeApplication = employeeApplication; + + var workshopHash = _httpContextAccessor.HttpContext?.User.FindFirstValue("WorkshopSlug"); + _workshopId = _passwordHasher.SlugDecrypt(workshopHash); + } + + public IActionResult OnGet(SearchCustomizeCheckout searchViewModel) + { + WorkshopFullName = _workshopApplication.GetWorkshopInfo(_workshopId).WorkshopFullName; + CustomizeCheckouts = _customizeCheckoutApplication.Search(new SearchCustomizeCheckout(_workshopId)).ToList(); + + SearchModel = new SearchCustomizeCheckout(_workshopId) + { + Year = searchViewModel.Year, + Month = searchViewModel.Month, + SearchStartFa = searchViewModel.SearchStartFa, + SearchEndFa = searchViewModel.SearchEndFa, + EmployeeId = searchViewModel.EmployeeId, + OrderBy = searchViewModel.OrderBy, + MonthIndex = searchViewModel.MonthIndex + }; + return Page(); + } + + public IActionResult OnGetEmployeeList() + { + var result = _employeeApplication.GetWorkingEmployeesByWorkshopId(_workshopId); + return new JsonResult(new + { + success = true, + data = result + }); + } + + + + public IActionResult OnGetCreate() + { + return Partial("ModalCheckoutUnofficialCreate"); + } + + public IActionResult OnGetEmployeesByYearAndMonth(int year, int month) + { + var result = _customizeCheckoutApplication.GetWorkshopEmployeesEligibleForCheckoutInDates(_workshopId, year, month); + return new JsonResult(new + { + success = true, + data = result + }); + } + + //public IActionResult OnPostCreate() + //{ + + //} + } +} diff --git a/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/Grouping.cshtml b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/Grouping.cshtml new file mode 100644 index 00000000..861db8ea --- /dev/null +++ b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/Grouping.cshtml @@ -0,0 +1,141 @@ +@page +@model ServiceHost.Areas.Client.Pages.Company.CustomizeCheckout.GroupingModel + +@{ + string clientVersion = _0_Framework.Application.Version.StyleVersion; + ViewData["Title"] = " - " + "تنظیمات گروه‌بندی و حقوق پرسنل"; + int index = 1; + int i = 0; +} + +@section Styles { + + + + + + +} + +
+ +
+
+
+
+ +
+

تنظیمات گروه‌بندی و حقوق پرسنل

+
@Model.WorkshopFullName
+
+
+ +
+
+
+ + +
+
+ +
+
+
+ +
+
ردیف
+
نام گروه
+
ساعت کاری
+
حقوق
+
عملیات
+
+ +
+
+
+
+
+
+
+ +
+
ردیف
+
نام پرسنل
+
ساعت کاری
+
حقوق
+
عملیات
+
+ +
+
+
+
+ +
+
+
+ + + +@section Script { + + + + +} \ No newline at end of file diff --git a/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/Grouping.cshtml.cs b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/Grouping.cshtml.cs new file mode 100644 index 00000000..c94c5dc6 --- /dev/null +++ b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/Grouping.cshtml.cs @@ -0,0 +1,139 @@ +using System.Security.Claims; +using _0_Framework.Application; +using CompanyManagment.App.Contracts.CustomizeWorkshopSettings; +using CompanyManagment.App.Contracts.Employee; +using CompanyManagment.App.Contracts.Workshop; +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.RazorPages; + +namespace ServiceHost.Areas.Client.Pages.Company.CustomizeCheckout +{ + public class GroupingModel : PageModel + { + private readonly IPasswordHasher _passwordHasher; + private readonly IWorkshopApplication _workshopApplication; + private readonly IEmployeeApplication _employeeApplication; + private readonly ICustomizeWorkshopSettingsApplication _customizeWorkshopSettingsApplication; + private readonly IHttpContextAccessor _contextAccessor; + private readonly IAuthHelper _authHelper; + + private readonly long _workshopId; + public string WorkshopFullName; + public CustomizeWorkshopSettingsViewModel RollCallWorkshopSettings; + + public GroupingModel(IPasswordHasher passwordHasher, IWorkshopApplication workshopApplication, IEmployeeApplication employeeApplication, ICustomizeWorkshopSettingsApplication customizeWorkshopSettingsApplication, IHttpContextAccessor contextAccessor, IAuthHelper authHelper) + { + _passwordHasher = passwordHasher; + _workshopApplication = workshopApplication; + _employeeApplication = employeeApplication; + _customizeWorkshopSettingsApplication = customizeWorkshopSettingsApplication; + _contextAccessor = contextAccessor; + _authHelper = authHelper; + + var workshopHash = _contextAccessor.HttpContext?.User.FindFirstValue("WorkshopSlug"); + _workshopId = _passwordHasher.SlugDecrypt(workshopHash); + + if (_workshopId < 1) + throw new InvalidDataException("اختلال در کارگاه"); + } + + public IActionResult OnGet() + { + //if (_workshopId != 11) + // return Redirect("/Client/Company/CustomizeCheckout"); + var account = _authHelper.CurrentAccountInfo(); + + var workshop = _workshopApplication.GetWorkshopInfo(_workshopId); + WorkshopFullName = workshop.WorkshopFullName; + + RollCallWorkshopSettings = _customizeWorkshopSettingsApplication.GetWorkshopSettingsByWorkshopId(_workshopId, account); + if (RollCallWorkshopSettings.Id == 0) + { + return Redirect("/Client/Company/CustomizeCheckout"); + } + + return Page(); + } + + public IActionResult OnGetWorkshopSettingsDataAjax() + { + var account = _authHelper.CurrentAccountInfo(); + var result = _customizeWorkshopSettingsApplication.GetWorkshopSettingsByWorkshopId(_workshopId, account); + return new JsonResult(new + { + isSuccedded = true, + data = result + }); + } + + public IActionResult OnGetEmployeesGroupAjax(long groupId) + { + var result = _customizeWorkshopSettingsApplication.GetEmployeeSettingsByGroupSettingsId(groupId); + return new JsonResult(new + { + success = true, + data = result + }); + } + + public IActionResult OnGetEmployeeIsChangeList(long groupId) + { + var result = _customizeWorkshopSettingsApplication.GetEmployeeSettingsByGroupSettingsId(groupId) + .Where(x => x.IsSettingChanged).ToList(); + return new JsonResult(new + { + success = true, + data = result + }); + } + + public IActionResult OnGetEmployeeGroupAjax(long rollCallWorkshopSettingId) + { + var result = _customizeWorkshopSettingsApplication.GetEmployeesWithoutGroup(rollCallWorkshopSettingId); + return new JsonResult(new + { + success = true, + data = result + }); + } + + public IActionResult OnGetGroupingSetting(long groupId) + { + var command = _customizeWorkshopSettingsApplication.GetCustomizeWorkshopGroupSettingsDetails(groupId); + command.EmployeeIds = _customizeWorkshopSettingsApplication.GetEmployeeSettingsByGroupSettingsId(command.Id).Select(x => x.EmployeeId).ToList(); + return Partial("ModalSettingGroup", command); + } + + public IActionResult OnPostGroupingSetting(EditCustomizeWorkshopGroupSettings command) + { + //command.EmployeeIds = _customizeWorkshopSettingsApplication.GetEmployeeSettingsByGroupSettingsId(command.Id).Select(x => x.EmployeeId).ToList(); + OperationResult result = _customizeWorkshopSettingsApplication.EditRollCallGroupSetting(command); + + return new JsonResult(new + { + isSuccess = result.IsSuccedded, + message = result.Message + }); + } + + public IActionResult OnGetGroupingEmployeeSetting(long customizeEmployeeId, List employeeId) + { + var command = _customizeWorkshopSettingsApplication.GetCustomizeEmployeeSettingsDetails(customizeEmployeeId); + command.EmployeeIds = employeeId; + + return Partial("ModalSettingGroupEmployee", command); + } + + public IActionResult OnPostGroupingEmployeeSetting(EditCustomizeEmployeeSettings command) + { + command.WorkshopId = _workshopId; + OperationResult result = _customizeWorkshopSettingsApplication.EditRollCallEmployeeSettings(command); + + return new JsonResult(new + { + isSuccess = result.IsSuccedded, + message = result.Message + }); + } + } +} \ No newline at end of file diff --git a/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/Index.cshtml b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/Index.cshtml new file mode 100644 index 00000000..a0118b87 --- /dev/null +++ b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/Index.cshtml @@ -0,0 +1,127 @@ +@page +@model ServiceHost.Areas.Client.Pages.Company.CustomizeCheckout.IndexModel + +@{ + ViewData["Title"] = " - " + "فیش حقوقی غیر رسمی"; + string clientVersion = _0_Framework.Application.Version.StyleVersion; +} + +@section Styles { + +} + + + + + + + + + +@section Script { + + + +} diff --git a/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/Index.cshtml.cs b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/Index.cshtml.cs new file mode 100644 index 00000000..01ba21cc --- /dev/null +++ b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/Index.cshtml.cs @@ -0,0 +1,74 @@ +using System.Security.Claims; +using _0_Framework.Application; +using CompanyManagment.App.Contracts.CustomizeWorkshopSettings; +using CompanyManagment.App.Contracts.Error; +using CompanyManagment.App.Contracts.Workshop; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.RazorPages; + +namespace ServiceHost.Areas.Client.Pages.Company.CustomizeCheckout +{ + [Authorize] + public class IndexModel : PageModel + { + private IPasswordHasher _passwordHasher; + private IWorkshopApplication _workshopApplication; + public string WorkshopFullName; + private readonly ICustomizeWorkshopSettingsApplication _customizeWorkshopSettingsApplication; + + public IndexModel(IPasswordHasher passwordHasher, IWorkshopApplication workshopApplication, ICustomizeWorkshopSettingsApplication customizeWorkshopSettingsApplication) + { + _passwordHasher = passwordHasher; + _workshopApplication = workshopApplication; + _customizeWorkshopSettingsApplication = customizeWorkshopSettingsApplication; + } + + public IActionResult OnGet() + { + var workshopHash = User.FindFirstValue("WorkshopSlug"); + var workshopId = _passwordHasher.SlugDecrypt(workshopHash); + + if (workshopId <= 0) + return BadRequest(); + + var workshopInfo = _workshopApplication.GetWorkshopInfo(workshopId); + WorkshopFullName = workshopInfo.WorkshopFullName; + + return Page(); + } + + public IActionResult OnGetModalSettingRollCall() + { + var workshopHash = User.FindFirstValue("WorkshopSlug"); + var workshopId = _passwordHasher.SlugDecrypt(workshopHash); + if (workshopId < 1) + return BadRequest(); + + var command = _customizeWorkshopSettingsApplication.GetWorkshopSettingsDetails(workshopId); + + if (command.Id == 0) + { + var resultError = new ErrorViewModel() + { + Message = "شما تنظیماتی مربوط به کارگاه را تنظیم نکرده اید." + }; + return Partial("../Error/_ErrorModal", resultError); + } + + return Partial("ModalSetting", command); + } + + public IActionResult OnPostSaveCustomWorkshopSettings(EditCustomizeWorkshopSettings command,bool isAllGroupChanged) + { + //TODO:VAFA!!!! + var result = _customizeWorkshopSettingsApplication.EditWorkshopSetting(command, isAllGroupChanged); + + return new JsonResult(new + { + isSuccess = result.IsSuccedded, + message = result.Message, + }); + } + } +} diff --git a/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/ModalCheckoutUnofficialCreate.cshtml b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/ModalCheckoutUnofficialCreate.cshtml new file mode 100644 index 00000000..513f66fe --- /dev/null +++ b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/ModalCheckoutUnofficialCreate.cshtml @@ -0,0 +1,146 @@ +@{ + string clientVersion = _0_Framework.Application.Version.StyleVersion; + + +} + +
+ + +
+ + + + + + + \ No newline at end of file diff --git a/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/ModalSetting.cshtml b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/ModalSetting.cshtml new file mode 100644 index 00000000..134c9c4b --- /dev/null +++ b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/ModalSetting.cshtml @@ -0,0 +1,209 @@ +@model CompanyManagment.App.Contracts.CustomizeWorkshopSettings.EditCustomizeWorkshopSettings +@{ + string clientVersion = _0_Framework.Application.Version.StyleVersion; + int index = 1; + int i = 0; + + +} + + + + + + \ No newline at end of file diff --git a/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/ModalSettingGroup.cshtml b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/ModalSettingGroup.cshtml new file mode 100644 index 00000000..4443137d --- /dev/null +++ b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/ModalSettingGroup.cshtml @@ -0,0 +1,249 @@ +@model CompanyManagment.App.Contracts.CustomizeWorkshopSettings.EditCustomizeWorkshopGroupSettings +@{ + string clientVersion = _0_Framework.Application.Version.StyleVersion; + int index = 1; + int i = 0; + int indexShift = 0; + + +} + + + + + + + + + + + + \ No newline at end of file diff --git a/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/ModalSettingGroupEmployee.cshtml b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/ModalSettingGroupEmployee.cshtml new file mode 100644 index 00000000..85b70004 --- /dev/null +++ b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/ModalSettingGroupEmployee.cshtml @@ -0,0 +1,240 @@ +@model CompanyManagment.App.Contracts.CustomizeWorkshopSettings.EditCustomizeEmployeeSettings +@{ + string clientVersion = _0_Framework.Application.Version.StyleVersion; + int index = 1; + int i = 0; + int indexShift = 0; + int indexEmployee = 0; + + +} + + + + + + \ No newline at end of file diff --git a/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/PrintOne.cshtml b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/PrintOne.cshtml new file mode 100644 index 00000000..5f282702 --- /dev/null +++ b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/PrintOne.cshtml @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalEmployeeSettingPartials/BonusesPayAndBaseYearPay.cshtml b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalEmployeeSettingPartials/BonusesPayAndBaseYearPay.cshtml new file mode 100644 index 00000000..865c8918 --- /dev/null +++ b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalEmployeeSettingPartials/BonusesPayAndBaseYearPay.cshtml @@ -0,0 +1,151 @@ +@using _0_Framework.Domain.CustomizeCheckoutShared.Enums +@model CompanyManagment.App.Contracts.CustomizeWorkshopSettings.EditCustomizeEmployeeSettings + +
+
+
+ + + + + + این تنظیمات در محاسبات فیش حقوق قانونی اداره کار تاثیری نخواهد داشت. +
+
+
+
عیدی
+
+ + +
+
+ + + +
+
+ + + + +
+
+ + +
+
+ + +
+
+ + + + +
+ + @* *@ + +
+
+
+ +
+ + +
+
+ + +
+
+
+
+ + +
+
+
+ +
+
سنوات
+ +
+ + +
+ +
+ + + +
+
+ + + + +
+ @*
+ + +
+
+ + +
*@ +
+ + + + +
+ +
+
+
+ +
+ + +
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalEmployeeSettingPartials/FineAbsenceDeduction.cshtml b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalEmployeeSettingPartials/FineAbsenceDeduction.cshtml new file mode 100644 index 00000000..98c79d59 --- /dev/null +++ b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalEmployeeSettingPartials/FineAbsenceDeduction.cshtml @@ -0,0 +1,207 @@ +@using _0_Framework.Domain.CustomizeCheckoutShared.Enums + +@model CompanyManagment.App.Contracts.CustomizeWorkshopSettings.EditCustomizeEmployeeSettings + +
+
+
+ + + + + + این تنظیمات در محاسبات فیش حقوق قانونی اداره کار تاثیری نخواهد داشت. +
+
+
+
جریمه غیبت
+ +
+ + +
+ +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ +
+ + + +
+
+ + + + + +
+
+ + + + +
+
+
+
+ +
+ + + + \ No newline at end of file diff --git a/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalEmployeeSettingPartials/FridayAndHoliday.cshtml b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalEmployeeSettingPartials/FridayAndHoliday.cshtml new file mode 100644 index 00000000..6df058d2 --- /dev/null +++ b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalEmployeeSettingPartials/FridayAndHoliday.cshtml @@ -0,0 +1,44 @@ +@using _0_Framework.Domain.CustomizeCheckoutShared.Enums + +@model CompanyManagment.App.Contracts.CustomizeWorkshopSettings.EditCustomizeEmployeeSettings + +
+
+
+ + + + + + این تنظیمات در محاسبات فیش حقوق قانونی اداره کار تاثیری نخواهد داشت. +
+
+
+
تعطیلات جمعه
+
+ + +
+
+ + +
+
+ +
+
+
+ +
+
تعطیلات رسمی
+
+ + +
+
+ + +
+ +
+
\ No newline at end of file diff --git a/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalEmployeeSettingPartials/FridayPayAndOvertimePay.cshtml b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalEmployeeSettingPartials/FridayPayAndOvertimePay.cshtml new file mode 100644 index 00000000..05340ce4 --- /dev/null +++ b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalEmployeeSettingPartials/FridayPayAndOvertimePay.cshtml @@ -0,0 +1,95 @@ +@using _0_Framework.Domain.CustomizeCheckoutShared.Enums + +@model CompanyManagment.App.Contracts.CustomizeWorkshopSettings.EditCustomizeEmployeeSettings + +
+
+
+ + + + + + این تنظیمات در محاسبات فیش حقوق قانونی اداره کار تاثیری نخواهد داشت. +
+
+ +
+
جمعه کاری
+ +
+ + +
+ +
+ + + +
+
+ + + +
+
+ + + + +
+
+
+ +
+ + + + +
+
+ + +
+
+
+ +
+
+ + + + + + مبنای محاسبه ساعات اضافه کاری ، ساعات کارکرد پرسنل بیش از ساعات تنظیمی در بخش گروهبندی میباشد. +
+
+ +
+
اضافه کاری
+
+ + +
(با انتخاب این گزینه اگر پرسنل بیش از ساعات تعیین شده اشتغال بکار داشته باشد مبلغی محاسبه نمیگردد)
+
+
+ + + +
+
+ + + +
+ +
+ + + + +
+
+
+
+
diff --git a/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalEmployeeSettingPartials/LateToWorkAndEarlyExit.cshtml b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalEmployeeSettingPartials/LateToWorkAndEarlyExit.cshtml new file mode 100644 index 00000000..6f47c9d2 --- /dev/null +++ b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalEmployeeSettingPartials/LateToWorkAndEarlyExit.cshtml @@ -0,0 +1,310 @@ +@using _0_Framework.Domain.CustomizeCheckoutShared.Enums +@model CompanyManagment.App.Contracts.CustomizeWorkshopSettings.EditCustomizeEmployeeSettings + +
+
+
+ + + + + + این تنظیمات در محاسبات فیش حقوق قانونی اداره کار تاثیری نخواهد داشت. +
+
+
+
تاخیر در ورود
+ +
+ + +
+ +
+ + + +
+
+ + + +
+
+ + + + +
+
+
+ +
+
+
+ +
+
در صورت تمایل به جرائم بیشتر از گزینه‌های زیر استفاده نمایید:
+
در صورت تاخیر پرسنل در ورود به مجموعه:
+
(توجه داشته باشید، مبلغ این جریمه مضاف بر مبالغ کسر شده بخش بالا محاسبه می‌گردد و در صورت تکمیل هر سه مرحله این بخش از جرائم، در صورتی که پرسنل از شروط دو سه مرحله عدول نماید. مجموع کل جرائم شامل محاسبه می‌گردد.)
+
+ + +
+ 0 } && + !String.IsNullOrWhiteSpace(Model.LateToWork.LateToWorkTimeFinesVewModels[0].Minute) && + Model.LateToWork.LateToWorkTimeFinesVewModels[0].FineMoney > 0 ? "checked" : "")/> + + @* *@ + + @* value="@(Model.FridayPay.FridayPayType == FridayPayType.MoneyPerFridayPerHour ? Model.FridayPay.Value : "")" @((Model.FridayPay.Value != 0 && Model.FridayPay.FridayPayType == FridayPayType.MoneyPerFridayPerHour) ? "" : "disabled") *@ + 0 } && !String.IsNullOrWhiteSpace(Model.LateToWork?.LateToWorkTimeFinesVewModels[0].Minute) ? "" : "disabled") : "disabled") /> + + 0 } && (Model.LateToWork?.LateToWorkTimeFinesVewModels[0].FineMoney > 0) ? "" : "disabled") : "disabled") /> + +
+ +
+ 1 } && + !String.IsNullOrWhiteSpace(Model.LateToWork.LateToWorkTimeFinesVewModels[1].Minute) && + Model.LateToWork.LateToWorkTimeFinesVewModels[1]?.FineMoney > 0 ? "checked" : "") + /> + + + 1 } && !String.IsNullOrWhiteSpace(Model.LateToWork?.LateToWorkTimeFinesVewModels[1].Minute) ? "" : "disabled") : "disabled") /> + + 1 } && Model.LateToWork?.LateToWorkTimeFinesVewModels[1].FineMoney > 0 ? "" : "disabled") : "disabled") /> + +
+ +
+ 2 } && + !String.IsNullOrWhiteSpace(Model.LateToWork.LateToWorkTimeFinesVewModels[2].Minute) && + Model.LateToWork.LateToWorkTimeFinesVewModels[2].FineMoney > 0 ? "checked" : "") + /> + + + 2 } && !String.IsNullOrWhiteSpace(Model.LateToWork?.LateToWorkTimeFinesVewModels[2].Minute) ? "" : "disabled") : "disabled") /> + + 2 } && Model.LateToWork?.LateToWorkTimeFinesVewModels[2].FineMoney > 0 ? "" : "disabled") : "disabled") /> + +
+
+ +
+
+
+ +
+
تعجیل در خروج
+
+ + +
+ +
+ + + +
+
+ + + + +
+
+ + + + +
+
+
+ +
+
+
+ +
+
در صورت تمایل به جرائم بیشتر از گزینه‌های زیر استفاده نمایید:
+
در صورت تاخیر پرسنل در ورود به مجموعه:
+
(توجه داشته باشید، مبلغ این جریمه مضاف بر مبالغ کسر شده بخش بالا محاسبه می‌گردد و در صورت تکمیل هر سه مرحله این بخش از جرائم، در صورتی که پرسنل از شروط دو سه مرحله عدول نماید. مجموع کل جرائم شامل محاسبه می‌گردد.)
+
+ +
+ 0 } && + !String.IsNullOrWhiteSpace(Model.EarlyExit.EarlyExitTimeFinesViewModels[0].Minute) && + Model.EarlyExit.EarlyExitTimeFinesViewModels[0].FineMoney > 0 ? "checked" : "") + /> + + 0 } && !String.IsNullOrWhiteSpace(Model.EarlyExit?.EarlyExitTimeFinesViewModels[0].Minute) ? "" : "disabled") : "disabled") /> + + 0 } && Model.EarlyExit?.EarlyExitTimeFinesViewModels[0].FineMoney > 0 ? "" : "disabled") : "disabled") /> + +
+ +
+ 1 } && + !String.IsNullOrWhiteSpace(Model.EarlyExit.EarlyExitTimeFinesViewModels[1].Minute) && + Model.EarlyExit.EarlyExitTimeFinesViewModels[1].FineMoney > 0 ? "checked" : "") + /> + + 1 } && !String.IsNullOrWhiteSpace(Model.EarlyExit?.EarlyExitTimeFinesViewModels[1].Minute) ? "" : "disabled") : "disabled") /> + + 1 } && Model.EarlyExit?.EarlyExitTimeFinesViewModels[1].FineMoney > 0 ? "" : "disabled") : "disabled") /> + +
+ +
+ 2 } && + !String.IsNullOrWhiteSpace(Model.EarlyExit.EarlyExitTimeFinesViewModels[2].Minute) && + Model.EarlyExit.EarlyExitTimeFinesViewModels[2].FineMoney > 0 ? "checked" : "") + /> + + 2 } && !String.IsNullOrWhiteSpace(Model.EarlyExit?.EarlyExitTimeFinesViewModels[2].Minute) ? "" : "disabled") : "disabled") /> + + 2 } && Model.EarlyExit?.EarlyExitTimeFinesViewModels[2].FineMoney > 0 ? "" : "disabled") : "disabled") /> + +
+
+ +
+ + \ No newline at end of file diff --git a/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalEmployeeSettingPartials/LeavePayAndInsuranceDeduction.cshtml b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalEmployeeSettingPartials/LeavePayAndInsuranceDeduction.cshtml new file mode 100644 index 00000000..70b3af7a --- /dev/null +++ b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalEmployeeSettingPartials/LeavePayAndInsuranceDeduction.cshtml @@ -0,0 +1,59 @@ +@using _0_Framework.Domain.CustomizeCheckoutShared.Enums +@using Microsoft.AspNetCore.Mvc.TagHelpers +@model CompanyManagment.App.Contracts.CustomizeWorkshopSettings.EditCustomizeEmployeeSettings + +
+
+
+ + + + + + این تنظیمات در محاسبات فیش حقوق قانونی اداره کار تاثیری نخواهد داشت. +
+
+
+
مزد مرخصی
+
+ + +
+
+ + + + +
+
+ +
+
+
+ +
+
حق بیمه
+
+ + +
+
+ + +
+
+ + + +
+
+ + + + +
+
+
\ No newline at end of file diff --git a/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalEmployeeSettingPartials/MarriedAllowanceAndFamilyAllowance.cshtml b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalEmployeeSettingPartials/MarriedAllowanceAndFamilyAllowance.cshtml new file mode 100644 index 00000000..ef80d46c --- /dev/null +++ b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalEmployeeSettingPartials/MarriedAllowanceAndFamilyAllowance.cshtml @@ -0,0 +1,62 @@ +@using _0_Framework.Domain.CustomizeCheckoutShared +@using _0_Framework.Domain.CustomizeCheckoutShared.Enums +@model CompanyManagment.App.Contracts.CustomizeWorkshopSettings.EditCustomizeEmployeeSettings + +
+
+
+ + + + + + این تنظیمات در محاسبات فیش حقوق قانونی اداره کار تاثیری نخواهد داشت. +
+
+
+
حق تاهل
+
+ + +
+
+ + + + +
+
+ + +
+
+
+ +
+
حق اولاد
+
+ + +
(جهت استفاده از این بخش میبایست در فرم اطلاعات پرسنل تعداد فرزندان و سال تولد آن ها را وارد نمائید)
+
+
+ + + +
+
+ + + +
+
+ + + + +
+
+
+
+
\ No newline at end of file diff --git a/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalEmployeeSettingPartials/NightWork.cshtml b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalEmployeeSettingPartials/NightWork.cshtml new file mode 100644 index 00000000..c2b8297a --- /dev/null +++ b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalEmployeeSettingPartials/NightWork.cshtml @@ -0,0 +1,45 @@ + + +@using _0_Framework.Domain.CustomizeCheckoutShared.Enums +@model CompanyManagment.App.Contracts.CustomizeWorkshopSettings.EditCustomizeEmployeeSettings + +
+
+
+ + + + + + این تنظیمات در محاسبات فیش حقوق قانونی اداره کار تاثیری نخواهد داشت. +
+
+ +
+
شب کاری
+
+ + +
+ +
+ + + +
+
+ + + +
+
+ + + + +
+
+
+
+ +
\ No newline at end of file diff --git a/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalEmployeeSettingPartials/Salary.cshtml b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalEmployeeSettingPartials/Salary.cshtml new file mode 100644 index 00000000..208efa29 --- /dev/null +++ b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalEmployeeSettingPartials/Salary.cshtml @@ -0,0 +1,22 @@ +@using _0_Framework.Domain.CustomizeCheckoutShared.Enums +@model CompanyManagment.App.Contracts.CustomizeWorkshopSettings.EditCustomizeEmployeeSettings + +
+
+
+ + + + + + این تنظیمات در محاسبات فیش حقوق قانونی اداره کار تاثیری نخواهد داشت. +
+
+
+
حقوق
+
+ + ریال +
+
+
\ No newline at end of file diff --git a/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalEmployeeSettingPartials/WorkTimeSetting.cshtml b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalEmployeeSettingPartials/WorkTimeSetting.cshtml new file mode 100644 index 00000000..b46b292d --- /dev/null +++ b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalEmployeeSettingPartials/WorkTimeSetting.cshtml @@ -0,0 +1,110 @@ + + +
+
+
+ + @for (var i=0; i < Model.ShiftsList.Count(); i++) + { +
+
+
+ +
نوبت اول
+
+ +
+
از
+ +
+ +
+
الی
+ +
+ @if (i == 0) + { +
+
+ } + else + { +
+ +
+ } + +
+
+ } + +
+
+ +
+
+

+
+
+
\ No newline at end of file diff --git a/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalGroupSettingPartials/BonusesPayAndBaseYearPay.cshtml b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalGroupSettingPartials/BonusesPayAndBaseYearPay.cshtml new file mode 100644 index 00000000..ae4df038 --- /dev/null +++ b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalGroupSettingPartials/BonusesPayAndBaseYearPay.cshtml @@ -0,0 +1,151 @@ +@using _0_Framework.Domain.CustomizeCheckoutShared.Enums +@model CompanyManagment.App.Contracts.CustomizeWorkshopSettings.EditCustomizeWorkshopGroupSettings + +
+
+
+ + + + + + این تنظیمات در محاسبات فیش حقوق قانونی اداره کار تاثیری نخواهد داشت. +
+
+
+
عیدی
+
+ + +
+
+ + + +
+
+ + + + +
+
+ + +
+
+ + +
+
+ + + + +
+ + @* *@ + +
+
+
+ +
+ + +
+
+ + +
+
+
+
+ + +
+
+
+ +
+
سنوات
+ +
+ + +
+ +
+ + + +
+
+ + + + +
+ @*
+ + +
+
+ + +
*@ +
+ + + + +
+ +
+
+
+ +
+ + +
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalGroupSettingPartials/FineAbsenceDeduction.cshtml b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalGroupSettingPartials/FineAbsenceDeduction.cshtml new file mode 100644 index 00000000..19b9e423 --- /dev/null +++ b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalGroupSettingPartials/FineAbsenceDeduction.cshtml @@ -0,0 +1,206 @@ +@using _0_Framework.Domain.CustomizeCheckoutShared.Enums +@model CompanyManagment.App.Contracts.CustomizeWorkshopSettings.EditCustomizeWorkshopGroupSettings + +
+
+
+ + + + + + این تنظیمات در محاسبات فیش حقوق قانونی اداره کار تاثیری نخواهد داشت. +
+
+
+
جریمه غیبت
+ +
+ + +
+ +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ +
+ + + +
+
+ + + + + +
+
+ + + + +
+
+
+
+ +
+ + + + \ No newline at end of file diff --git a/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalGroupSettingPartials/FridayAndHoliday.cshtml b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalGroupSettingPartials/FridayAndHoliday.cshtml new file mode 100644 index 00000000..5e1ce2c1 --- /dev/null +++ b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalGroupSettingPartials/FridayAndHoliday.cshtml @@ -0,0 +1,45 @@ +@using _0_Framework.Domain.CustomizeCheckoutShared.Enums + +@using _0_Framework.Domain.CustomizeCheckoutShared.Enums +@model CompanyManagment.App.Contracts.CustomizeWorkshopSettings.EditCustomizeWorkshopGroupSettings + +
+
+
+ + + + + + این تنظیمات در محاسبات فیش حقوق قانونی اداره کار تاثیری نخواهد داشت. +
+
+
+
تعطیلات جمعه
+
+ + +
+
+ + +
+
+ +
+
+
+ +
+
تعطیلات رسمی
+
+ + +
+
+ + +
+ +
+
\ No newline at end of file diff --git a/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalGroupSettingPartials/FridayPayAndOvertimePay.cshtml b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalGroupSettingPartials/FridayPayAndOvertimePay.cshtml new file mode 100644 index 00000000..a80fa3b7 --- /dev/null +++ b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalGroupSettingPartials/FridayPayAndOvertimePay.cshtml @@ -0,0 +1,94 @@ +@using _0_Framework.Domain.CustomizeCheckoutShared.Enums +@model CompanyManagment.App.Contracts.CustomizeWorkshopSettings.EditCustomizeWorkshopGroupSettings + +
+
+
+ + + + + + این تنظیمات در محاسبات فیش حقوق قانونی اداره کار تاثیری نخواهد داشت. +
+
+ +
+
جمعه کاری
+ +
+ + +
+ +
+ + + +
+
+ + + +
+
+ + + + +
+
+
+ +
+ + + + +
+
+ + +
+
+
+ +
+
+ + + + + + مبنای محاسبه ساعات اضافه کاری ، ساعات کارکرد پرسنل بیش از ساعات تنظیمی در بخش گروهبندی میباشد. +
+
+ +
+
اضافه کاری
+
+ + +
(با انتخاب این گزینه اگر پرسنل بیش از ساعات تعیین شده اشتغال بکار داشته باشد مبلغی محاسبه نمیگردد)
+
+
+ + + +
+
+ + + +
+ +
+ + + + +
+
+
+
+
diff --git a/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalGroupSettingPartials/LateToWorkAndEarlyExit.cshtml b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalGroupSettingPartials/LateToWorkAndEarlyExit.cshtml new file mode 100644 index 00000000..1b561ef8 --- /dev/null +++ b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalGroupSettingPartials/LateToWorkAndEarlyExit.cshtml @@ -0,0 +1,311 @@ + +@using _0_Framework.Domain.CustomizeCheckoutShared.Enums +@model CompanyManagment.App.Contracts.CustomizeWorkshopSettings.EditCustomizeWorkshopGroupSettings + +
+
+
+ + + + + + این تنظیمات در محاسبات فیش حقوق قانونی اداره کار تاثیری نخواهد داشت. +
+
+
+
تاخیر در ورود
+ +
+ + +
+ +
+ + + +
+
+ + + +
+
+ + + + +
+
+
+ +
+
+
+ +
+
در صورت تمایل به جرائم بیشتر از گزینه‌های زیر استفاده نمایید:
+
در صورت تاخیر پرسنل در ورود به مجموعه:
+
(توجه داشته باشید، مبلغ این جریمه مضاف بر مبالغ کسر شده بخش بالا محاسبه می‌گردد و در صورت تکمیل هر سه مرحله این بخش از جرائم، در صورتی که پرسنل از شروط دو سه مرحله عدول نماید. مجموع کل جرائم شامل محاسبه می‌گردد.)
+
+ + +
+ 0 } && + !String.IsNullOrWhiteSpace(Model.LateToWork.LateToWorkTimeFinesVewModels[0].Minute) && + Model.LateToWork.LateToWorkTimeFinesVewModels[0].FineMoney > 0 ? "checked" : "")/> + + @* *@ + + @* value="@(Model.FridayPay.FridayPayType == FridayPayType.MoneyPerFridayPerHour ? Model.FridayPay.Value : "")" @((Model.FridayPay.Value != 0 && Model.FridayPay.FridayPayType == FridayPayType.MoneyPerFridayPerHour) ? "" : "disabled") *@ + 0 } && !String.IsNullOrWhiteSpace(Model.LateToWork?.LateToWorkTimeFinesVewModels[0].Minute) ? "" : "disabled") : "disabled") /> + + 0 } && (Model.LateToWork?.LateToWorkTimeFinesVewModels[0].FineMoney > 0) ? "" : "disabled") : "disabled") /> + +
+ +
+ 1 } && + !String.IsNullOrWhiteSpace(Model.LateToWork.LateToWorkTimeFinesVewModels[1].Minute) && + Model.LateToWork.LateToWorkTimeFinesVewModels[1]?.FineMoney > 0 ? "checked" : "") + /> + + + 1 } && !String.IsNullOrWhiteSpace(Model.LateToWork?.LateToWorkTimeFinesVewModels[1].Minute) ? "" : "disabled") : "disabled") /> + + 1 } && Model.LateToWork?.LateToWorkTimeFinesVewModels[1].FineMoney > 0 ? "" : "disabled") : "disabled") /> + +
+ +
+ 2 } && + !String.IsNullOrWhiteSpace(Model.LateToWork.LateToWorkTimeFinesVewModels[2].Minute) && + Model.LateToWork.LateToWorkTimeFinesVewModels[2].FineMoney > 0 ? "checked" : "") + /> + + + 2 } && !String.IsNullOrWhiteSpace(Model.LateToWork?.LateToWorkTimeFinesVewModels[2].Minute) ? "" : "disabled") : "disabled") /> + + 2 } && Model.LateToWork?.LateToWorkTimeFinesVewModels[2].FineMoney > 0 ? "" : "disabled") : "disabled") /> + +
+
+ +
+
+
+ +
+
تعجیل در خروج
+
+ + +
+ +
+ + + +
+
+ + + + +
+
+ + + + +
+
+
+ +
+
+
+ +
+
در صورت تمایل به جرائم بیشتر از گزینه‌های زیر استفاده نمایید:
+
در صورت تاخیر پرسنل در ورود به مجموعه:
+
(توجه داشته باشید، مبلغ این جریمه مضاف بر مبالغ کسر شده بخش بالا محاسبه می‌گردد و در صورت تکمیل هر سه مرحله این بخش از جرائم، در صورتی که پرسنل از شروط دو سه مرحله عدول نماید. مجموع کل جرائم شامل محاسبه می‌گردد.)
+
+ +
+ 0 } && + !String.IsNullOrWhiteSpace(Model.EarlyExit.EarlyExitTimeFinesViewModels[0].Minute) && + Model.EarlyExit.EarlyExitTimeFinesViewModels[0].FineMoney > 0 ? "checked" : "") + /> + + 0 } && !String.IsNullOrWhiteSpace(Model.EarlyExit?.EarlyExitTimeFinesViewModels[0].Minute) ? "" : "disabled") : "disabled") /> + + 0 } && Model.EarlyExit?.EarlyExitTimeFinesViewModels[0].FineMoney > 0 ? "" : "disabled") : "disabled") /> + +
+ +
+ 1 } && + !String.IsNullOrWhiteSpace(Model.EarlyExit.EarlyExitTimeFinesViewModels[1].Minute) && + Model.EarlyExit.EarlyExitTimeFinesViewModels[1].FineMoney > 0 ? "checked" : "") + /> + + 1 } && !String.IsNullOrWhiteSpace(Model.EarlyExit?.EarlyExitTimeFinesViewModels[1].Minute) ? "" : "disabled") : "disabled") /> + + 1 } && Model.EarlyExit?.EarlyExitTimeFinesViewModels[1].FineMoney > 0 ? "" : "disabled") : "disabled") /> + +
+ +
+ 2 } && + !String.IsNullOrWhiteSpace(Model.EarlyExit.EarlyExitTimeFinesViewModels[2].Minute) && + Model.EarlyExit.EarlyExitTimeFinesViewModels[2].FineMoney > 0 ? "checked" : "") + /> + + 2 } && !String.IsNullOrWhiteSpace(Model.EarlyExit?.EarlyExitTimeFinesViewModels[2].Minute) ? "" : "disabled") : "disabled") /> + + 2 } && Model.EarlyExit?.EarlyExitTimeFinesViewModels[2].FineMoney > 0 ? "" : "disabled") : "disabled") /> + +
+
+ +
+ + \ No newline at end of file diff --git a/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalGroupSettingPartials/LeavePayAndInsuranceDeduction.cshtml b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalGroupSettingPartials/LeavePayAndInsuranceDeduction.cshtml new file mode 100644 index 00000000..a69650ae --- /dev/null +++ b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalGroupSettingPartials/LeavePayAndInsuranceDeduction.cshtml @@ -0,0 +1,60 @@ +@using _0_Framework.Domain.CustomizeCheckoutShared.Enums + +@using Microsoft.AspNetCore.Mvc.TagHelpers +@model CompanyManagment.App.Contracts.CustomizeWorkshopSettings.EditCustomizeWorkshopGroupSettings + +
+
+
+ + + + + + این تنظیمات در محاسبات فیش حقوق قانونی اداره کار تاثیری نخواهد داشت. +
+
+
+
مزد مرخصی
+
+ + +
+
+ + + + +
+
+ +
+
+
+ +
+
حق بیمه
+
+ + +
+
+ + +
+
+ + + +
+
+ + + + +
+
+
\ No newline at end of file diff --git a/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalGroupSettingPartials/MarriedAllowanceAndFamilyAllowance.cshtml b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalGroupSettingPartials/MarriedAllowanceAndFamilyAllowance.cshtml new file mode 100644 index 00000000..b5d80a09 --- /dev/null +++ b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalGroupSettingPartials/MarriedAllowanceAndFamilyAllowance.cshtml @@ -0,0 +1,62 @@ +@using _0_Framework.Domain.CustomizeCheckoutShared +@using _0_Framework.Domain.CustomizeCheckoutShared.Enums +@model CompanyManagment.App.Contracts.CustomizeWorkshopSettings.EditCustomizeWorkshopGroupSettings + +
+
+
+ + + + + + این تنظیمات در محاسبات فیش حقوق قانونی اداره کار تاثیری نخواهد داشت. +
+
+
+
حق تاهل
+
+ + +
+
+ + + + +
+
+ + +
+
+
+ +
+
حق اولاد
+
+ + +
(جهت استفاده از این بخش میبایست در فرم اطلاعات پرسنل تعداد فرزندان و سال تولد آن ها را وارد نمائید)
+
+
+ + + +
+
+ + + +
+
+ + + + +
+
+
+
+
\ No newline at end of file diff --git a/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalGroupSettingPartials/NightWork.cshtml b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalGroupSettingPartials/NightWork.cshtml new file mode 100644 index 00000000..994527c1 --- /dev/null +++ b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalGroupSettingPartials/NightWork.cshtml @@ -0,0 +1,43 @@ +@using _0_Framework.Domain.CustomizeCheckoutShared.Enums +@model CompanyManagment.App.Contracts.CustomizeWorkshopSettings.EditCustomizeWorkshopGroupSettings + +
+
+
+ + + + + + این تنظیمات در محاسبات فیش حقوق قانونی اداره کار تاثیری نخواهد داشت. +
+
+ +
+
شب کاری
+
+ + +
+ +
+ + + +
+
+ + + +
+
+ + + + +
+
+
+
+ +
\ No newline at end of file diff --git a/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalGroupSettingPartials/Salary.cshtml b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalGroupSettingPartials/Salary.cshtml new file mode 100644 index 00000000..92e3cd5f --- /dev/null +++ b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalGroupSettingPartials/Salary.cshtml @@ -0,0 +1,22 @@ +@using _0_Framework.Domain.CustomizeCheckoutShared.Enums +@model CompanyManagment.App.Contracts.CustomizeWorkshopSettings.EditCustomizeWorkshopGroupSettings + +
+
+
+ + + + + + این تنظیمات در محاسبات فیش حقوق قانونی اداره کار تاثیری نخواهد داشت. +
+
+
+
حقوق
+
+ + ریال +
+
+
\ No newline at end of file diff --git a/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalGroupSettingPartials/WorkTimeSetting.cshtml b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalGroupSettingPartials/WorkTimeSetting.cshtml new file mode 100644 index 00000000..b46b292d --- /dev/null +++ b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalGroupSettingPartials/WorkTimeSetting.cshtml @@ -0,0 +1,110 @@ + + +
+
+
+ + @for (var i=0; i < Model.ShiftsList.Count(); i++) + { +
+
+
+ +
نوبت اول
+
+ +
+
از
+ +
+ +
+
الی
+ +
+ @if (i == 0) + { +
+
+ } + else + { +
+ +
+ } + +
+
+ } + +
+
+ +
+
+

+
+
+
\ No newline at end of file diff --git a/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalPartials/BonusesPayAndBaseYearPay.cshtml b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalPartials/BonusesPayAndBaseYearPay.cshtml new file mode 100644 index 00000000..f081e1c1 --- /dev/null +++ b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalPartials/BonusesPayAndBaseYearPay.cshtml @@ -0,0 +1,151 @@ +@using _0_Framework.Domain.CustomizeCheckoutShared.Enums +@model CompanyManagment.App.Contracts.CustomizeWorkshopSettings.EditCustomizeWorkshopSettings + +
+
+
+ + + + + + این تنظیمات در محاسبات فیش حقوق قانونی اداره کار تاثیری نخواهد داشت. +
+
+
+
عیدی
+
+ + +
+
+ + + +
+
+ + + + +
+
+ + +
+
+ + +
+
+ + + + +
+ + @* *@ + +
+
+
+ +
+ + +
+
+ + +
+
+
+
+ + +
+
+
+ +
+
سنوات
+ +
+ + +
+ +
+ + + +
+
+ + + + +
+ @*
+ + +
+
+ + +
*@ +
+ + + + +
+ +
+
+
+ +
+ + +
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalPartials/EditAccountSetting.cshtml b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalPartials/EditAccountSetting.cshtml new file mode 100644 index 00000000..711c6438 --- /dev/null +++ b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalPartials/EditAccountSetting.cshtml @@ -0,0 +1,192 @@ +@model CompanyManagment.App.Contracts.CustomizeWorkshopSettings.EditCustomizeWorkshopSettings +@{ + +} + +
+ +
+
+ +
+ + +
+
+ Loading... +
+ + + + + + + +
+
+
+
+
+
+ +
+ + + + + +
+ +
+ +
+ +
+
+
+
+
+
+
+ +
+
+ ضعیف +
+ +
+ متوسط +
+ +
+ خوب +
+ +
+ عالی +
+
+
+ +
+
+
+
+
+ + +
+
+
+
+

+
+
diff --git a/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalPartials/FineAbsenceDeduction.cshtml b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalPartials/FineAbsenceDeduction.cshtml new file mode 100644 index 00000000..2c7cb69e --- /dev/null +++ b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalPartials/FineAbsenceDeduction.cshtml @@ -0,0 +1,210 @@ +@using _0_Framework.Domain.CustomizeCheckoutShared.Enums + +@model CompanyManagment.App.Contracts.CustomizeWorkshopSettings.EditCustomizeWorkshopSettings +@{ + var dayViewModels = Model.FineAbsenceDeduction.FineAbsenceDayOfWeekViewModels; +} + +
+
+
+ + + + + + این تنظیمات در محاسبات فیش حقوق قانونی اداره کار تاثیری نخواهد داشت. +
+
+
+
جریمه غیبت
+ +
+ + +
+ +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ +
+ + + +
+
+ + + + + +
+
+ + + + +
+
+
+
+ +
+ + + + \ No newline at end of file diff --git a/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalPartials/FridayAndHoliday.cshtml b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalPartials/FridayAndHoliday.cshtml new file mode 100644 index 00000000..c75f37b8 --- /dev/null +++ b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalPartials/FridayAndHoliday.cshtml @@ -0,0 +1,139 @@ +@using _0_Framework.Domain.CustomizeCheckoutShared.Enums +@model CompanyManagment.App.Contracts.CustomizeWorkshopSettings.EditCustomizeWorkshopSettings + +
+
+
+ + + + + + این تنظیمات در محاسبات فیش حقوق قانونی اداره کار تاثیری نخواهد داشت. +
+
+
+
تعطیلات جمعه
+
+ + +
+
+ + +
+
+ +
+
+
+ +
+
تعطیلات رسمی
+
+ + +
+
+ + +
+ +
+ + + + +
+
+
+ +
+
+
+ +
+
+
+ +
+
تعلق گرفتن عیدی
+
+ + @{ + int checkedValid = 0; + switch (Model.BonusesPaysInEndOfMonth) + { + case BonusesPaysInEndOfYear.EndOfYear: + checkedValid = 0; + break; + case BonusesPaysInEndOfYear.WhenEverEmployeeLeftWork: + checkedValid = 1; + break; + } + } + + +
+
+ +
+
+
+ +
+
تعلق گرفتن سنوات
+
+ @{ + int checkedBaseYearValid = 0; + switch (Model.BonusesPaysInEndOfMonth) + { + case BonusesPaysInEndOfYear.EndOfYear: + checkedBaseYearValid = 0; + break; + case BonusesPaysInEndOfYear.WhenEverEmployeeLeftWork: + checkedBaseYearValid = 1; + break; + } + } + + +
+
+ +
+
+
+ +
+
تعداد روز مجاز برای مرخصی
+
+ + +
+
+ + +
+ + + + \ No newline at end of file diff --git a/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalPartials/FridayPayAndOvertimePay.cshtml b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalPartials/FridayPayAndOvertimePay.cshtml new file mode 100644 index 00000000..93fb5268 --- /dev/null +++ b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalPartials/FridayPayAndOvertimePay.cshtml @@ -0,0 +1,102 @@ + +@using _0_Framework.Domain.CustomizeCheckoutShared.Enums +@model CompanyManagment.App.Contracts.CustomizeWorkshopSettings.EditCustomizeWorkshopSettings + +
+
+
+ + + + + + این تنظیمات در محاسبات فیش حقوق قانونی اداره کار تاثیری نخواهد داشت. +
+
+ +
+
جمعه کاری
+ +
+ + +
+ +
+ + + +
+
+ + + +
+
+ + + + +
+
+
+ +
+ + + + +
+
+ + +
+
+
+ +
+
+ + + + + + مبنای محاسبه ساعات اضافه کاری ، ساعات کارکرد پرسنل بیش از ساعات تنظیمی در بخش گروهبندی میباشد. +
+
+ +
+
اضافه کاری
+
+ + +
(با انتخاب این گزینه اگر پرسنل بیش از ساعات تعیین شده اشتغال بکار داشته باشد مبلغی محاسبه نمیگردد)
+
+
+ + + +
+
+ + + +
+ +
+ + + + +
+
+
+ +@*
+ + + + +
*@ +
+
diff --git a/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalPartials/LateToWorkAndEarlyExit.cshtml b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalPartials/LateToWorkAndEarlyExit.cshtml new file mode 100644 index 00000000..1392d310 --- /dev/null +++ b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalPartials/LateToWorkAndEarlyExit.cshtml @@ -0,0 +1,338 @@ +@using _0_Framework.Domain.CustomizeCheckoutShared.Enums +@model CompanyManagment.App.Contracts.CustomizeWorkshopSettings.EditCustomizeWorkshopSettings + +
+
+
+ + + + + + این تنظیمات در محاسبات فیش حقوق قانونی اداره کار تاثیری نخواهد داشت. +
+
+
+
تاخیر در ورود
+ +
+ + +
+ +
+ + + +
+
+ + + +
+
+ + + + +
+
+
+ +@*
+ + + + +
+ +
+ + + + +
*@ + +
+
+
+ +
+
در صورت تمایل به جرائم بیشتر از گزینه‌های زیر استفاده نمایید:
+
در صورت تاخیر پرسنل در ورود به مجموعه:
+
(توجه داشته باشید، مبلغ این جریمه مضاف بر مبالغ کسر شده بخش بالا محاسبه می‌گردد و در صورت تکمیل هر سه مرحله این بخش از جرائم، در صورتی که پرسنل از شروط دو سه مرحله عدول نماید. مجموع کل جرائم شامل محاسبه می‌گردد.)
+
+ + +
+ 0 } && + !String.IsNullOrWhiteSpace(Model.LateToWork.LateToWorkTimeFinesVewModels[0].Minute) && + Model.LateToWork.LateToWorkTimeFinesVewModels[0].FineMoney > 0 ? "checked" : "")/> + + @* *@ + + @* value="@(Model.FridayPay.FridayPayType == FridayPayType.MoneyPerFridayPerHour ? Model.FridayPay.Value : "")" @((Model.FridayPay.Value != 0 && Model.FridayPay.FridayPayType == FridayPayType.MoneyPerFridayPerHour) ? "" : "disabled") *@ + 0 } && !String.IsNullOrWhiteSpace(Model.LateToWork?.LateToWorkTimeFinesVewModels[0].Minute) ? "" : "disabled") : "disabled") /> + + 0 } && (Model.LateToWork?.LateToWorkTimeFinesVewModels[0].FineMoney > 0) ? "" : "disabled") : "disabled") /> + +
+ +
+ 1 } && + !String.IsNullOrWhiteSpace(Model.LateToWork.LateToWorkTimeFinesVewModels[1].Minute) && + Model.LateToWork.LateToWorkTimeFinesVewModels[1]?.FineMoney > 0 ? "checked" : "") + /> + + + 1 } && !String.IsNullOrWhiteSpace(Model.LateToWork?.LateToWorkTimeFinesVewModels[1].Minute) ? "" : "disabled") : "disabled") /> + + 1 } && Model.LateToWork?.LateToWorkTimeFinesVewModels[1].FineMoney > 0 ? "" : "disabled") : "disabled") /> + +
+ +
+ 2 } && + !String.IsNullOrWhiteSpace(Model.LateToWork.LateToWorkTimeFinesVewModels[2].Minute) && + Model.LateToWork.LateToWorkTimeFinesVewModels[2].FineMoney > 0 ? "checked" : "") + /> + + + 2 } && !String.IsNullOrWhiteSpace(Model.LateToWork?.LateToWorkTimeFinesVewModels[2].Minute) ? "" : "disabled") : "disabled") /> + + 2 } && Model.LateToWork?.LateToWorkTimeFinesVewModels[2].FineMoney > 0 ? "" : "disabled") : "disabled") /> + +
+
+ + + + + + +
+
+
+ +
+
تعجیل در خروج
+
+ + +
+ +
+ + + +
+
+ + + + +
+
+ + + + +
+
+
+ +@*
+ + + + +
*@ + +
+
+
+ +
+
در صورت تمایل به جرائم بیشتر از گزینه‌های زیر استفاده نمایید:
+
در صورت تاخیر پرسنل در ورود به مجموعه:
+
(توجه داشته باشید، مبلغ این جریمه مضاف بر مبالغ کسر شده بخش بالا محاسبه می‌گردد و در صورت تکمیل هر سه مرحله این بخش از جرائم، در صورتی که پرسنل از شروط دو سه مرحله عدول نماید. مجموع کل جرائم شامل محاسبه می‌گردد.)
+
+ +
+ 0 } && + !String.IsNullOrWhiteSpace(Model.EarlyExit.EarlyExitTimeFinesViewModels[0].Minute) && + Model.EarlyExit.EarlyExitTimeFinesViewModels[0].FineMoney > 0 ? "checked" : "") + /> + + 0 } && !String.IsNullOrWhiteSpace(Model.EarlyExit?.EarlyExitTimeFinesViewModels[0].Minute) ? "" : "disabled") : "disabled") /> + + 0 } && Model.EarlyExit?.EarlyExitTimeFinesViewModels[0].FineMoney > 0 ? "" : "disabled") : "disabled") /> + +
+ +
+ 1 } && + !String.IsNullOrWhiteSpace(Model.EarlyExit.EarlyExitTimeFinesViewModels[1].Minute) && + Model.EarlyExit.EarlyExitTimeFinesViewModels[1].FineMoney > 0 ? "checked" : "") + /> + + 1 } && !String.IsNullOrWhiteSpace(Model.EarlyExit?.EarlyExitTimeFinesViewModels[1].Minute) ? "" : "disabled") : "disabled") /> + + 1 } && Model.EarlyExit?.EarlyExitTimeFinesViewModels[1].FineMoney > 0 ? "" : "disabled") : "disabled") /> + +
+ +
+ 2 } && + !String.IsNullOrWhiteSpace(Model.EarlyExit.EarlyExitTimeFinesViewModels[2].Minute) && + Model.EarlyExit.EarlyExitTimeFinesViewModels[2].FineMoney > 0 ? "checked" : "") + /> + + 2 } && !String.IsNullOrWhiteSpace(Model.EarlyExit?.EarlyExitTimeFinesViewModels[2].Minute) ? "" : "disabled") : "disabled") /> + + 2 } && Model.EarlyExit?.EarlyExitTimeFinesViewModels[2].FineMoney > 0 ? "" : "disabled") : "disabled") /> + +
+
+ +
+ + \ No newline at end of file diff --git a/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalPartials/LeavePayAndInsuranceDeduction.cshtml b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalPartials/LeavePayAndInsuranceDeduction.cshtml new file mode 100644 index 00000000..ccc8dbe3 --- /dev/null +++ b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalPartials/LeavePayAndInsuranceDeduction.cshtml @@ -0,0 +1,59 @@ +@using _0_Framework.Domain.CustomizeCheckoutShared.Enums + +@model CompanyManagment.App.Contracts.CustomizeWorkshopSettings.EditCustomizeWorkshopSettings + +
+
+
+ + + + + + این تنظیمات در محاسبات فیش حقوق قانونی اداره کار تاثیری نخواهد داشت. +
+
+
+
مزد مرخصی
+
+ + +
+
+ + + + +
+
+ +
+
+
+ +
+
حق بیمه
+
+ + +
+
+ + +
+
+ + + +
+
+ + + + +
+
+
\ No newline at end of file diff --git a/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalPartials/MarriedAllowanceAndFamilyAllowance.cshtml b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalPartials/MarriedAllowanceAndFamilyAllowance.cshtml new file mode 100644 index 00000000..5fdb5b31 --- /dev/null +++ b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalPartials/MarriedAllowanceAndFamilyAllowance.cshtml @@ -0,0 +1,62 @@ +@using _0_Framework.Domain.CustomizeCheckoutShared +@using _0_Framework.Domain.CustomizeCheckoutShared.Enums +@model CompanyManagment.App.Contracts.CustomizeWorkshopSettings.EditCustomizeWorkshopSettings + +
+
+
+ + + + + + این تنظیمات در محاسبات فیش حقوق قانونی اداره کار تاثیری نخواهد داشت. +
+
+
+
حق تاهل
+
+ + +
+
+ + + + +
+
+ + +
+
+
+ +
+
حق اولاد
+
+ + +
(جهت استفاده از این بخش میبایست در فرم اطلاعات پرسنل تعداد فرزندان و سال تولد آن ها را وارد نمائید)
+
+
+ + + +
+
+ + + +
+
+ + + + +
+
+
+
+
\ No newline at end of file diff --git a/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalPartials/NightWork.cshtml b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalPartials/NightWork.cshtml new file mode 100644 index 00000000..6b182ad2 --- /dev/null +++ b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalPartials/NightWork.cshtml @@ -0,0 +1,44 @@ + +@using _0_Framework.Domain.CustomizeCheckoutShared.Enums +@model CompanyManagment.App.Contracts.CustomizeWorkshopSettings.EditCustomizeWorkshopSettings + +
+
+
+ + + + + + این تنظیمات در محاسبات فیش حقوق قانونی اداره کار تاثیری نخواهد داشت. +
+
+ +
+
شب کاری
+
+ + +
+ +
+ + + +
+
+ + + +
+
+ + + + +
+
+
+
+ +
\ No newline at end of file diff --git a/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalPartials/WorkTimeSetting.cshtml b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalPartials/WorkTimeSetting.cshtml new file mode 100644 index 00000000..f1130c82 --- /dev/null +++ b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_ModalPartials/WorkTimeSetting.cshtml @@ -0,0 +1,125 @@ +@model CompanyManagment.App.Contracts.CustomizeWorkshopSettings.EditCustomizeWorkshopSettings + + + +
+
+
+ + @for (var i=0; i < Model.ShiftsList.Count(); i++) + { +
+
+
+ +
+ @if (i == 0) + { + @("نوبت اول") + } + else if (i == 1) + { + @("نوبت دوم") + } + else + { + @("نوبت سوم") + } +
+
+ +
+
از
+ +
+ +
+
الی
+ +
+ @if (i == 0) + { +
+
+ } + else + { +
+ +
+ } + +
+
+ } + +
+
+ +
+
+

+
+
+
\ No newline at end of file diff --git a/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_Partials/ConfirmEmployeeChangeModal.cshtml b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_Partials/ConfirmEmployeeChangeModal.cshtml new file mode 100644 index 00000000..7d234868 --- /dev/null +++ b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_Partials/ConfirmEmployeeChangeModal.cshtml @@ -0,0 +1,61 @@ +@{ + string clientVersion = _0_Framework.Application.Version.StyleVersion; +} + + + + + + + \ No newline at end of file diff --git a/ServiceHost/Areas/Client/Pages/Company/Employees/Index.cshtml b/ServiceHost/Areas/Client/Pages/Company/Employees/Index.cshtml index dddc7c33..e9dba915 100644 --- a/ServiceHost/Areas/Client/Pages/Company/Employees/Index.cshtml +++ b/ServiceHost/Areas/Client/Pages/Company/Employees/Index.cshtml @@ -3,17 +3,18 @@ @model ServiceHost.Areas.Client.Pages.Company.Employees.IndexModel @{ + string clientVerion = _0_Framework.Application.Version.StyleVersion; Layout = "Shared/_ClientLayout"; ViewData["title"] = " - عملیات مربوط به پرسنل"; int index = 1; } @section Styles { - - - - - + + + + + } @@ -75,37 +111,51 @@
@@ -135,7 +250,7 @@ @section Script { - + *@ + + + \ No newline at end of file diff --git a/ServiceHost/Areas/Client/Pages/Company/Fine/Index.cshtml b/ServiceHost/Areas/Client/Pages/Company/Fine/Index.cshtml new file mode 100644 index 00000000..ec655666 --- /dev/null +++ b/ServiceHost/Areas/Client/Pages/Company/Fine/Index.cshtml @@ -0,0 +1,253 @@ +@page +@model ServiceHost.Areas.Client.Pages.Company.Fine.IndexModel + +@{ + string clientVersion = _0_Framework.Application.Version.StyleVersion; + Layout = "Shared/_ClientLayout"; + ViewData["title"] = " - لیست جرائم"; + int index = 1; +} + +@section Styles { + + + + + + + + + + +} + +
+
+
+
+
+ +
+

عملیات جرایم

+
@Model.WorkshopFullName
+
+
+ +
+
+
+ + + +
+
+ +
+
+ +
+ + +
+
+ +
+
+ + +
+
+ +
+
+ + @*
+ + +
*@ +
+
+ + لیست جرایم + +
+
+ @*
+ + +
*@ +
+
+ +
+
+ +
+
+ @*
+ +
*@ + +
+
نام پرسنل
+
شماره پرسنلی
+
عنوان
+
مبلغ
+
تاریخ
+
عملیات
+
+ +
+
+ +
+
+
+
+
+
+ + + + + + + + + + + + +@section Script { + + + + + + +} \ No newline at end of file diff --git a/ServiceHost/Areas/Client/Pages/Company/Fine/Index.cshtml.cs b/ServiceHost/Areas/Client/Pages/Company/Fine/Index.cshtml.cs new file mode 100644 index 00000000..1f47b94f --- /dev/null +++ b/ServiceHost/Areas/Client/Pages/Company/Fine/Index.cshtml.cs @@ -0,0 +1,246 @@ +using System.Security.Claims; +using _0_Framework.Application; +using CompanyManagment.App.Contracts.Employee; +using CompanyManagment.App.Contracts.Error; +using CompanyManagment.App.Contracts.Fine; +using CompanyManagment.App.Contracts.FineSubject; +using CompanyManagment.App.Contracts.Workshop; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.RazorPages; + +namespace ServiceHost.Areas.Client.Pages.Company.Fine +{ + [Authorize] + public class IndexModel : PageModel + { + private readonly IPasswordHasher _passwordHasher; + private readonly IWorkshopApplication _workshopApplication; + private readonly IFineApplication _fineApplication; + private readonly IFineSubjectApplication _fineSubjectApplication; + private readonly IEmployeeApplication _employeeApplication; + + public string WorkshopFullName; + public int PageIndex = 0; + + public IndexModel(IFineApplication fineApplication, IWorkshopApplication workshopApplication, IPasswordHasher passwordHasher, IFineSubjectApplication fineSubjectApplication, IEmployeeApplication employeeApplication) + { + _fineApplication = fineApplication; + _workshopApplication = workshopApplication; + _passwordHasher = passwordHasher; + _fineSubjectApplication = fineSubjectApplication; + _employeeApplication = employeeApplication; + } + + public IActionResult OnGet() + { + var workshopHash = User.FindFirstValue("WorkshopSlug"); + var workshopId = _passwordHasher.SlugDecrypt(workshopHash); + + if (workshopId <= 0) + return BadRequest(); + + var workshopInfo = _workshopApplication.GetWorkshopInfo(workshopId); + WorkshopFullName = workshopInfo.WorkshopFullName; + + return Page(); + } + + public IActionResult OnGetLoadDataAjax(FineSearchViewModel searchViewModel) + { + var workshopHash = User.FindFirstValue("WorkshopSlug"); + var workshopId = _passwordHasher.SlugDecrypt(workshopHash); + + if (workshopId <= 0) + return BadRequest(); + + searchViewModel.WorkshopId = workshopId; + + var result = _fineApplication.GetSearchList(searchViewModel); + return new JsonResult(new + { + success = true, + data = result, + pageIndex = result.Count() + }); + } + + public IActionResult OnGetEmployeeList() + { + var workshopHash = User.FindFirstValue("WorkshopSlug"); + var workshopId = _passwordHasher.SlugDecrypt(workshopHash); + if (workshopId <= 0) + return new JsonResult(new + { + success = false, + message = "کارگاه ای یافت نشد", + }); + + + var employees = _employeeApplication.GetWorkingEmployeesByWorkshopId(workshopId); + + + + return new JsonResult(new + { + success = true, + data = employees + }); + } + + public IActionResult OnGetCreate() + { + var workshopHash = User.FindFirstValue("WorkshopSlug"); + var workshopId = _passwordHasher.SlugDecrypt(workshopHash); + if (workshopId <= 0) + { + var resultError = new ErrorViewModel() + { + Message = "کارگاه شما یافت نشد" + }; + return Partial("../Error/_ErrorModal", resultError); + } + + var command = new CreateFineViewModel(); + return Partial("ModalCreateNewFine", command); + } + + public IActionResult OnPostCreate(CreateFineViewModel command) + { + var workshopHash = User.FindFirstValue("WorkshopSlug"); + var workshopId = _passwordHasher.SlugDecrypt(workshopHash); + if (workshopId <= 0) + return new JsonResult(new + { + IsSuccedded = false, + message = "کارگاه ای یافت نشد", + }); + + command.WorkshopId = workshopId; + var result = _fineApplication.Create(command); + + return new JsonResult(new + { + success = result.IsSuccedded, + message = result.Message, + }); + } + + public IActionResult OnGetEdit(long id) + { + var workshopHash = User.FindFirstValue("WorkshopSlug"); + var workshopId = _passwordHasher.SlugDecrypt(workshopHash); + if (workshopId <= 0) + { + var resultError = new ErrorViewModel() + { + Message = "کارگاه شما یافت نشد" + }; + return Partial("../Error/_ErrorModal", resultError); + } + + var command = _fineApplication.GetDetails(id); + + return Partial("ModalEditFine", command); + } + + public IActionResult OnPostEdit(EditFineViewModel command) + { + var workshopHash = User.FindFirstValue("WorkshopSlug"); + var workshopId = _passwordHasher.SlugDecrypt(workshopHash); + if (workshopId <= 0) + return new JsonResult(new + { + IsSuccedded = false, + message = "کارگاه ای یافت نشد", + }); + + command.WorkshopId = workshopId; + var result = _fineApplication.Edit(command); + + return new JsonResult(new + { + success = result.IsSuccedded, + message = result.Message, + }); + } + + public IActionResult OnPostRemove(long id) + { + var result = _fineApplication.Remove(id); + return new JsonResult(new + { + isSuccess = result.IsSuccedded, + message = result.Message, + }); + } + + #region برای عملیات دلبخواه + + public IActionResult OnPostCreateFineSubject(CreateFineSubjectViewModel command) + { + var workshopHash = User.FindFirstValue("WorkshopSlug"); + var workshopId = _passwordHasher.SlugDecrypt(workshopHash); + if (workshopId <= 0) + return BadRequest(); + + command.WorkshopId = workshopId; + + var result = _fineSubjectApplication.Create(command); + return new JsonResult(new + { + isSuccess = result.IsSuccedded, + message = result.Message, + }); + } + + //برای ویرایش عنوان دلبخواه + public IActionResult OnPostEditFineSubject(EditFineSubjectViewModel command) + { + var workshopHash = User.FindFirstValue("WorkshopSlug"); + var workshopId = _passwordHasher.SlugDecrypt(workshopHash); + if (workshopId <= 0) + return BadRequest(); + + command.WorkshopId = workshopId; + + var result = _fineSubjectApplication.Edit(command); + return new JsonResult(new + { + isSuccess = result.IsSuccedded, + message = result.Message, + }); + } + + // برای حذف عنوان دلبخواه + public IActionResult OnPostRemoveFineSubject(long id) + { + var result = _fineSubjectApplication.Delete(id); + return new JsonResult(new + { + isSuccess = result.IsSuccedded, + message = result.Message, + }); + } + + + public IActionResult OnGetSearchFineSubject() + { + var workshopHash = User.FindFirstValue("WorkshopSlug"); + var workshopId = _passwordHasher.SlugDecrypt(workshopHash); + + if (workshopId <= 0) + return BadRequest(); + + var list = _fineSubjectApplication.GetAll(workshopId); + + return new JsonResult(new + { + isSuccess = true, + data = list + }); + } + + #endregion + } +} diff --git a/ServiceHost/Areas/Client/Pages/Company/Fine/ModalCreateNewFine.cshtml b/ServiceHost/Areas/Client/Pages/Company/Fine/ModalCreateNewFine.cshtml new file mode 100644 index 00000000..b23224a2 --- /dev/null +++ b/ServiceHost/Areas/Client/Pages/Company/Fine/ModalCreateNewFine.cshtml @@ -0,0 +1,107 @@ +@model CompanyManagment.App.Contracts.Fine.CreateFineViewModel + +@{ + string clientVersion = _0_Framework.Application.Version.StyleVersion; + + +} + +
+ + +
+ + + + + + + + + + + + + + \ No newline at end of file diff --git a/ServiceHost/Areas/Client/Pages/Company/Fine/ModalEditFine.cshtml b/ServiceHost/Areas/Client/Pages/Company/Fine/ModalEditFine.cshtml new file mode 100644 index 00000000..7fa569ee --- /dev/null +++ b/ServiceHost/Areas/Client/Pages/Company/Fine/ModalEditFine.cshtml @@ -0,0 +1,76 @@ +@model CompanyManagment.App.Contracts.Fine.EditFineViewModel + +@{ + string clientVersion = _0_Framework.Application.Version.StyleVersion; + + +} + +
+ + +
+ + + + + + \ No newline at end of file diff --git a/ServiceHost/Areas/Client/Pages/Company/Loan/Index.cshtml b/ServiceHost/Areas/Client/Pages/Company/Loan/Index.cshtml new file mode 100644 index 00000000..3610c19f --- /dev/null +++ b/ServiceHost/Areas/Client/Pages/Company/Loan/Index.cshtml @@ -0,0 +1,258 @@ +@page +@model ServiceHost.Areas.Client.Pages.Company.Loan.IndexModel +@{ +} + +@{ + string clientVersion = _0_Framework.Application.Version.StyleVersion; + Layout = "Shared/_ClientLayout"; + ViewData["title"] = " - لیست وام"; + int index = 1; +} + +@section Styles { + + + + + + + + + +} + +
+
+
+
+
+ +
+

عملیات وام

+
@Model.WorkshopFullName
+
+
+ +
+
+
+ + + +
+
+ +
+
+ +
+ + +
+
+ +
+
+ + +
+
+ +
+
+ + @*
+ + +
*@ +
+
+ + لیست وام + +
+
+
+ @* + *@ +
+
+
+ +
+
+ +
+
+ @*
+ +
*@ + +
+
نام پرسنل
+
شماره پرسنلی
+
مبلغ
+
مبلغ هر ماه
+
تاریخ شروع وام
+
تعداد قسط
+
عملیات
+
+ +
+
+ +
+
+
+
+
+
+ + + + + + + + + + + + +@section Script { + + + + + + +} \ No newline at end of file diff --git a/ServiceHost/Areas/Client/Pages/Company/Loan/Index.cshtml.cs b/ServiceHost/Areas/Client/Pages/Company/Loan/Index.cshtml.cs new file mode 100644 index 00000000..bc906d41 --- /dev/null +++ b/ServiceHost/Areas/Client/Pages/Company/Loan/Index.cshtml.cs @@ -0,0 +1,211 @@ +using System.Diagnostics; +using _0_Framework.Application; + +using CompanyManagment.App.Contracts.Workshop; +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.RazorPages; +using System.Security.Claims; +using CompanyManagment.App.Contracts.Employee; +using CompanyManagment.App.Contracts.Error; +using CompanyManagment.App.Contracts.Loan; +using Microsoft.AspNetCore.Authorization; +using static Microsoft.EntityFrameworkCore.DbLoggerCategory.Database; + +namespace ServiceHost.Areas.Client.Pages.Company.Loan +{ + [Authorize] + public class IndexModel : PageModel + { + private readonly IPasswordHasher _passwordHasher; + private readonly IWorkshopApplication _workshopApplication; + private readonly ILoanApplication _loanApplication; + private readonly IEmployeeApplication _employeeApplication; + + public string WorkshopFullName; + public int PageIndex = 0; + + public IndexModel(IWorkshopApplication workshopApplication, IPasswordHasher passwordHasher, ILoanApplication loanApplication, IEmployeeApplication employeeApplication) + { + _workshopApplication = workshopApplication; + _passwordHasher = passwordHasher; + _loanApplication = loanApplication; + _employeeApplication = employeeApplication; + } + + public IActionResult OnGet() + { + var workshopHash = User.FindFirstValue("WorkshopSlug"); + var workshopId = _passwordHasher.SlugDecrypt(workshopHash); + + if (workshopId <= 0) + return BadRequest(); + + var workshopInfo = _workshopApplication.GetWorkshopInfo(workshopId); + WorkshopFullName = workshopInfo.WorkshopFullName; + + return Page(); + } + + public IActionResult OnGetLoadDataAjax(LoanSearchViewModel searchViewModel) + { + + var workshopHash = User.FindFirstValue("WorkshopSlug"); + var workshopId = _passwordHasher.SlugDecrypt(workshopHash); + + if (workshopId <= 0) + return BadRequest(); + + searchViewModel.WorkshopId = workshopId; + + var result = _loanApplication.GetSearchList(searchViewModel); + + return new JsonResult(new + { + success = true, + data = result, + pageIndex = result.Count() + }); + } + + public IActionResult OnGetEmployeeList() + { + var workshopHash = User.FindFirstValue("WorkshopSlug"); + var workshopId = _passwordHasher.SlugDecrypt(workshopHash); + if (workshopId <= 0) + return new JsonResult(new + { + success = false, + message = "کارگاه ای یافت نشد", + }); + + + var employees = _employeeApplication.GetWorkingEmployeesByWorkshopId(workshopId); + + + + return new JsonResult(new + { + success = true, + data = employees + }); + } + + public IActionResult OnGetCreate() + { + var workshopHash = User.FindFirstValue("WorkshopSlug"); + var workshopId = _passwordHasher.SlugDecrypt(workshopHash); + if (workshopId <= 0) + { + var resultError = new ErrorViewModel() + { + Message = "کارگاه شما یافت نشد" + }; + return Partial("../Error/_ErrorModal", resultError); + } + + var command = new CreateLoanViewModel(); + return Partial("ModalCreateNewLoan", command); + } + + public IActionResult OnPostCreate(CreateLoanViewModel command) + { + var workshopHash = User.FindFirstValue("WorkshopSlug"); + var workshopId = _passwordHasher.SlugDecrypt(workshopHash); + if (workshopId <= 0) + return new JsonResult(new + { + IsSuccedded = false, + message = "کارگاه ای یافت نشد", + }); + + command.WorkshopId = workshopId; + var result = _loanApplication.Create(command); + + return new JsonResult(new + { + success = result.IsSuccedded, + message = result.Message, + }); + } + + public IActionResult OnGetCalculateLoan(bool getRounded, string amount, int installmentCount, string loanStartDate, string loanGrantDate) + { + var now = DateTime.Now; + if (amount.Length > 15) + { + return new JsonResult(new + { + Message = "مبلغ وارد شده معتبر نیست", + Success = false + }); + } + if (installmentCount > 60) + { + return new JsonResult(new + { + Message = "تعداد ماه های باز پرداخت نمی تواند بیش 60 ماه باشد", + Success = false + }); + } + if (installmentCount < 1) + { + return new JsonResult(new + { + Message = "تعداد ماه های باز پرداخت نامعتبر می باشد", + Success = false + }); + } + if (!loanStartDate.TryToGeorgianDateTime(out var loanStart)) + { + return new JsonResult(new + { + Message = "تاریخ شروع اقساط نامعتبر است", + Success = false + }); + } + + if (!loanGrantDate.TryToGeorgianDateTime(out var grantDate)) + { + return new JsonResult(new + { + Message = "تاریخ اعطای وام نامعتبر است", + Success = false + }); + } + + if (grantDate > now) + { + return new JsonResult(new + { + Message = "تاریخ اعطای وام می بایست تاریخ امروز یا قبل تر باشد", + Success = false + }); + } + + if (grantDate>loanStart) + { + return new JsonResult(new + { + Message = "تاریخ اعطای وام نمیتواند بعد از شروع اقساط باشد", + Success = false + }); + } + var loanInstallmentViewModels = _loanApplication.CalculateLoanInstallment(amount, installmentCount, loanStartDate, getRounded); + return new JsonResult(new + { + data = loanInstallmentViewModels, + Success = true + }); + } + + public IActionResult OnPostRemove(long id) + { + var result = _loanApplication.Remove(id); + return new JsonResult(new + { + isSuccess = result.IsSuccedded, + message = result.Message, + }); + } + } +} diff --git a/ServiceHost/Areas/Client/Pages/Company/Loan/ModalCreateNewLoan.cshtml b/ServiceHost/Areas/Client/Pages/Company/Loan/ModalCreateNewLoan.cshtml new file mode 100644 index 00000000..5b453a4d --- /dev/null +++ b/ServiceHost/Areas/Client/Pages/Company/Loan/ModalCreateNewLoan.cshtml @@ -0,0 +1,106 @@ +@model CompanyManagment.App.Contracts.Loan.CreateLoanViewModel + +@{ + string clientVersion = _0_Framework.Application.Version.StyleVersion; + + +} + +
+ + +
+ + + + + + \ No newline at end of file diff --git a/ServiceHost/Areas/Client/Pages/Company/Profile/ChangePassword.cshtml b/ServiceHost/Areas/Client/Pages/Company/Profile/ChangePassword.cshtml index 040ea0a1..6769a159 100644 --- a/ServiceHost/Areas/Client/Pages/Company/Profile/ChangePassword.cshtml +++ b/ServiceHost/Areas/Client/Pages/Company/Profile/ChangePassword.cshtml @@ -10,104 +10,129 @@ data-action="changePass"> - + \ No newline at end of file diff --git a/ServiceHost/Areas/Client/Pages/Company/Profile/ModalEditAccount.cshtml b/ServiceHost/Areas/Client/Pages/Company/Profile/ModalEditAccount.cshtml new file mode 100644 index 00000000..ff98a765 --- /dev/null +++ b/ServiceHost/Areas/Client/Pages/Company/Profile/ModalEditAccount.cshtml @@ -0,0 +1,196 @@ +@model AccountManagement.Application.Contracts.Account.EditClientAccount +@{ + string clientVersion = _0_Framework.Application.Version.StyleVersion; + +} + +
+ +
+ + + \ No newline at end of file diff --git a/ServiceHost/Areas/Client/Pages/Company/Profile/ModalEditSubAccount.cshtml b/ServiceHost/Areas/Client/Pages/Company/Profile/ModalEditSubAccount.cshtml new file mode 100644 index 00000000..0efc2baa --- /dev/null +++ b/ServiceHost/Areas/Client/Pages/Company/Profile/ModalEditSubAccount.cshtml @@ -0,0 +1,194 @@ +@model AccountManagement.Application.Contracts.SubAccount.SubAccountViewModel +@{ + string clientVersion = _0_Framework.Application.Version.StyleVersion; + +} + +
+ +
+ + + \ No newline at end of file diff --git a/ServiceHost/Areas/Client/Pages/Company/Profile/Profile.cshtml b/ServiceHost/Areas/Client/Pages/Company/Profile/Profile.cshtml index 83b00864..bbec6b85 100644 --- a/ServiceHost/Areas/Client/Pages/Company/Profile/Profile.cshtml +++ b/ServiceHost/Areas/Client/Pages/Company/Profile/Profile.cshtml @@ -1,29 +1,16 @@ @page @model ServiceHost.Areas.Client.Pages.Company.Profile.ProfileModel @{ - // + + }
@@ -31,9 +18,13 @@
-
-

حساب کاربری

-
+
+ +
+

تنظیمات حساب کاربری

+ @*
کارگاه نورداد مهر گستر کاسپین
*@ +
+
بازگشت @@ -45,250 +36,166 @@
-
+ + @*
+
+
+
+
تنظیمات حساب کاربری
+
+
+
اطلاعات حساب کاربری
+
+
+
+
+
+
+
عنوان
+
+
+
    +
  • + + + + + + + + + اطلاعات حساب کاربری +
  • +
  • + + + + + + + + + اطلاعات کاربران +
  • +
  • + + + + + + + + اطلاعات حساب کاربری دوربین +
  • +
+
+
+
+
+ +
+ + +
+
+
+
+
*@ -
- - - - - - - - -