add new features : WorkFlow - SubAccount - [reward - loan - fine - salaryAid] - CustomizeWorkshopSettings ...
This commit is contained in:
@@ -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.PositionValue = !string.IsNullOrWhiteSpace(claims.FirstOrDefault(x => x.Type == "PositionValue")?.Value) ? int.Parse(claims.FirstOrDefault(x => x.Type == "PositionValue")?.Value) : 0;
|
||||||
result.WorkshopList = Tools.DeserializeFromBsonList<WorkshopClaim>(claims.FirstOrDefault(x => x is { Type: "workshopList" })?.Value);
|
result.WorkshopList = Tools.DeserializeFromBsonList<WorkshopClaim>(claims.FirstOrDefault(x => x is { Type: "workshopList" })?.Value);
|
||||||
result.WorkshopSlug = claims.FirstOrDefault(x => x is { Type: "WorkshopSlug" }).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<int> GetPermissions()
|
public List<int> GetPermissions()
|
||||||
@@ -56,8 +58,13 @@ public class AuthHelper : IAuthHelper
|
|||||||
? long.Parse(_contextAccessor.HttpContext.User.Claims.First(x => x.Type == "AccountId")?.Value)
|
? long.Parse(_contextAccessor.HttpContext.User.Claims.First(x => x.Type == "AccountId")?.Value)
|
||||||
: 0;
|
: 0;
|
||||||
}
|
}
|
||||||
|
public long CurrentSubAccountId()
|
||||||
public string CurrentAccountMobile()
|
{
|
||||||
|
return IsAuthenticated()
|
||||||
|
? long.Parse(_contextAccessor.HttpContext.User.Claims.First(x => x.Type == "SubAccountId")?.Value)
|
||||||
|
: 0;
|
||||||
|
}
|
||||||
|
public string CurrentAccountMobile()
|
||||||
{
|
{
|
||||||
return IsAuthenticated()
|
return IsAuthenticated()
|
||||||
? _contextAccessor.HttpContext.User.Claims.First(x => x.Type == "Mobile")?.Value
|
? _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("Mobile", account.Mobile),
|
||||||
new Claim("ProfilePhoto", account.ProfilePhoto ),
|
new Claim("ProfilePhoto", account.ProfilePhoto ),
|
||||||
new Claim("RoleName", account.RoleName),
|
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("ClientAriaPermission", account.ClientAriaPermission.ToString()),
|
||||||
new Claim("IsCamera", "false"),
|
new Claim("IsCamera", "false"),
|
||||||
new Claim("PositionValue",account.PositionValue.ToString()),
|
new Claim("PositionValue",account.PositionValue.ToString()),
|
||||||
|
|||||||
@@ -24,8 +24,11 @@ public class AuthViewModel
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
public long SubAccountId { get; set; }
|
||||||
|
|
||||||
|
|
||||||
public AuthViewModel(long id, long roleId, string fullname, string username, string mobile,string profilePhoto,
|
public AuthViewModel(long id, long roleId, string fullname, string username, string mobile,string profilePhoto,
|
||||||
List<int> permissions, string roleName, string adminAreaPermission, string clientAriaPermission, int? positionValue)
|
List<int> permissions, string roleName, string adminAreaPermission, string clientAriaPermission, int? positionValue, long subAccountId = 0)
|
||||||
{
|
{
|
||||||
Id = id;
|
Id = id;
|
||||||
RoleId = roleId;
|
RoleId = roleId;
|
||||||
@@ -38,7 +41,7 @@ public class AuthViewModel
|
|||||||
AdminAreaPermission = adminAreaPermission;
|
AdminAreaPermission = adminAreaPermission;
|
||||||
ClientAriaPermission = clientAriaPermission;
|
ClientAriaPermission = clientAriaPermission;
|
||||||
PositionValue = positionValue;
|
PositionValue = positionValue;
|
||||||
|
SubAccountId = subAccountId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AuthViewModel()
|
public AuthViewModel()
|
||||||
|
|||||||
@@ -20,6 +20,6 @@ public interface IAuthHelper
|
|||||||
void UpdateWorkshopSlugClaim(string workshopSlug);
|
void UpdateWorkshopSlugClaim(string workshopSlug);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
long CurrentSubAccountId();
|
||||||
string GetWorkshopSlug();
|
string GetWorkshopSlug();
|
||||||
}
|
}
|
||||||
@@ -1133,6 +1133,36 @@ public static class Tools
|
|||||||
}
|
}
|
||||||
|
|
||||||
#region Mahan
|
#region Mahan
|
||||||
|
/// <summary>
|
||||||
|
/// این متد سعی میکند رشته را به تاریخ برگرداند و یک بول و دیت تایم برمیگرداند
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="persianDate">تاریخ شمسی</param>
|
||||||
|
/// <param name="georgianDateTime">تاریخ</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
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)
|
public static string ToFarsiDuration(this string date)
|
||||||
{
|
{
|
||||||
var today = DateTime.Now.ToFarsi();
|
var today = DateTime.Now.ToFarsi();
|
||||||
@@ -1355,39 +1385,87 @@ public static class Tools
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Pooya
|
#region Pooya
|
||||||
|
/// <summary>
|
||||||
|
/// محاسبه روز های هر ماه شمسی
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="date">تاریخ روزی از ماه</param>
|
||||||
|
public static int CountPersianMonthDays(this DateTime date)
|
||||||
|
{
|
||||||
|
DateTime currentMonthDate, nextMonthDate;
|
||||||
|
currentMonthDate = date.FindFirstDayOfMonth().ToGeorgianDateTime();
|
||||||
|
FindFirstDayOfNextMonth(date, out nextMonthDate);
|
||||||
|
|
||||||
/// <summary>
|
return ((int)(nextMonthDate.Date - currentMonthDate.Date).TotalDays);
|
||||||
/// محاسبه روز های هر ماه شمسی
|
}
|
||||||
/// </summary>
|
|
||||||
/// <param name="date">تاریخ روزی از ماه</param>
|
public static string FindFirstDayOfNextMonth(this DateTime date, out DateTime nextMonthDate)
|
||||||
public static int CountPersianMonthDays(this DateTime date)
|
{
|
||||||
{
|
var dateFa = date.ToFarsi();
|
||||||
var dateFa = date.ToFarsi();
|
int year = Convert.ToInt32(dateFa.Substring(0, 4));
|
||||||
int year = Convert.ToInt32(dateFa.Substring(0, 4));
|
int month = Convert.ToInt32(dateFa.Substring(5, 2));
|
||||||
int month = Convert.ToInt32(dateFa.Substring(5, 2));
|
int nextMonth;
|
||||||
int nextMonth;
|
int nextMonthYear;
|
||||||
int nextMonthYear;
|
if (month == 12)
|
||||||
if (month == 12)
|
{
|
||||||
{
|
nextMonthYear = year + 1;
|
||||||
nextMonthYear = year + 1;
|
nextMonth = 1;
|
||||||
nextMonth = 1;
|
}
|
||||||
}
|
else
|
||||||
else
|
{
|
||||||
{
|
nextMonthYear = year;
|
||||||
nextMonthYear = year;
|
nextMonth = month + 1;
|
||||||
nextMonth = month + 1;
|
}
|
||||||
}
|
nextMonthDate = new DateTime(nextMonthYear, nextMonth, 1, new PersianCalendar());
|
||||||
var currentMonthDate = new DateTime(year, month, 1, new PersianCalendar());
|
return $"{nextMonthYear:0000}/{nextMonth:00}/01";
|
||||||
var nextMonthDate = new DateTime(nextMonthYear, nextMonth, 1, new PersianCalendar());
|
}
|
||||||
|
|
||||||
|
|
||||||
return ((int)(nextMonthDate.Date - currentMonthDate.Date).TotalDays);
|
/// <summary>
|
||||||
}
|
/// اضافه یا کم کردن ماه، توجه داشته باشید خروجی متد همیشه یکم ماه می باشد
|
||||||
|
/// </summary>
|
||||||
|
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);
|
return new DateTime(2121, 03, 21);
|
||||||
}
|
}
|
||||||
@@ -1428,6 +1506,7 @@ public static class Tools
|
|||||||
|
|
||||||
// If all properties are equal, return true
|
// If all properties are equal, return true
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
@@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// جمعه کاری
|
||||||
|
/// </summary>
|
||||||
|
public FridayPay FridayPay { get; protected set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// اضافه کاری
|
||||||
|
/// </summary>
|
||||||
|
public OverTimePay OverTimePay { get; protected set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// سنوات
|
||||||
|
/// </summary>
|
||||||
|
public BaseYearsPay BaseYearsPay { get; protected set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// عیدی
|
||||||
|
/// </summary>
|
||||||
|
public BonusesPay BonusesPay { get; protected set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// شب کاری
|
||||||
|
/// </summary>
|
||||||
|
public NightWorkPay NightWorkPay { get; protected set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// حق تاهل
|
||||||
|
/// </summary>
|
||||||
|
public MarriedAllowance MarriedAllowance { get; protected set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// نوبت کاری
|
||||||
|
/// </summary>
|
||||||
|
public ShiftPay ShiftPay { get; protected set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// حق اولاد(حق فرزند)ء
|
||||||
|
/// </summary>
|
||||||
|
public FamilyAllowance FamilyAllowance { get; protected set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// مزد مرخصی
|
||||||
|
/// </summary>
|
||||||
|
public LeavePay LeavePay { get; protected set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// حق بیمه
|
||||||
|
/// </summary>
|
||||||
|
public InsuranceDeduction InsuranceDeduction { get; protected set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// جریمه غیبت
|
||||||
|
/// </summary>
|
||||||
|
public FineAbsenceDeduction FineAbsenceDeduction { get; protected set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// تاخیر در ورود
|
||||||
|
/// </summary>
|
||||||
|
public LateToWork LateToWork { get; protected set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// نعجیل در خروج
|
||||||
|
/// </summary>
|
||||||
|
public EarlyExit EarlyExit { get; protected set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// آیا جمعه کار میکند یا نه
|
||||||
|
/// </summary>
|
||||||
|
public FridayWork FridayWork { get; protected set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// آیا در روز های تعطیل کار میکند
|
||||||
|
/// </summary>
|
||||||
|
public HolidayWork HolidayWork { get; protected set; }
|
||||||
|
|
||||||
|
|
||||||
|
public BreakTime BreakTime { get; protected set; }
|
||||||
|
}
|
||||||
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace _0_Framework.Domain.CustomizeCheckoutValueObjects;
|
namespace _0_Framework.Domain.CustomizeCheckoutShared.Enums;
|
||||||
|
|
||||||
public enum BaseYearsPayInEndOfYear
|
public enum BaseYearsPayInEndOfYear
|
||||||
{
|
{
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
namespace _0_Framework.Domain.CustomizeCheckoutShared.Enums;
|
||||||
|
|
||||||
|
public enum BaseYearsPayType
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///محاسبه نمیشود
|
||||||
|
/// </summary>
|
||||||
|
None,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// به صورت درصدی از حقوق
|
||||||
|
/// </summary>
|
||||||
|
PercentageOfSalary,
|
||||||
|
/// <summary>
|
||||||
|
/// مبلغ اختصاصی برای سنوات
|
||||||
|
/// </summary>
|
||||||
|
Money
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
namespace _0_Framework.Domain.CustomizeCheckoutShared.Enums;
|
||||||
|
|
||||||
|
public enum BaseYearsPaymentType
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// پرداخت نمیگردد
|
||||||
|
/// </summary>
|
||||||
|
None,
|
||||||
|
/// <summary>
|
||||||
|
/// پرداخت به صورت سالانه در آخر سال پرداخت میگردد
|
||||||
|
/// </summary>
|
||||||
|
YearlyPay,
|
||||||
|
/// <summary>
|
||||||
|
/// پرداخت به صورت ماهانه
|
||||||
|
/// </summary>
|
||||||
|
MonthlyPay
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
namespace _0_Framework.Domain.CustomizeCheckoutShared.Enums;
|
||||||
|
|
||||||
|
public enum BonusesPaymentType
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// پرداخت نمیگردد
|
||||||
|
/// </summary>
|
||||||
|
None,
|
||||||
|
/// <summary>
|
||||||
|
/// پرداخت به صورت سالانه در آخر سال پرداخت میگردد
|
||||||
|
/// </summary>
|
||||||
|
YearlyPay,
|
||||||
|
/// <summary>
|
||||||
|
/// پرداخت به صورت ماهانه
|
||||||
|
/// </summary>
|
||||||
|
MonthlyPay
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace _0_Framework.Domain.CustomizeCheckoutValueObjects;
|
namespace _0_Framework.Domain.CustomizeCheckoutShared.Enums;
|
||||||
|
|
||||||
public enum BonusesPaysInEndOfYear
|
public enum BonusesPaysInEndOfYear
|
||||||
{
|
{
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
namespace _0_Framework.Domain.CustomizeCheckoutShared.Enums;
|
||||||
|
|
||||||
|
public enum BonusesType
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///محاسبه نمیشود
|
||||||
|
/// </summary>
|
||||||
|
None,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// به صورت درصدی از حقوق
|
||||||
|
/// </summary>
|
||||||
|
PercentageOfSalary,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// دوبرابر حقوق
|
||||||
|
/// </summary>
|
||||||
|
TwoTimeOfSalary,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// یک برابر حقوق
|
||||||
|
/// </summary>
|
||||||
|
OneTimeOfSalary,
|
||||||
|
/// <summary>
|
||||||
|
/// مبلغ اختصاصی برای عیدی
|
||||||
|
/// </summary>
|
||||||
|
Money
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
namespace _0_Framework.Domain.CustomizeCheckoutShared.Enums;
|
||||||
|
|
||||||
|
public enum BreakTimeType
|
||||||
|
{
|
||||||
|
None = 0,
|
||||||
|
WithTime,
|
||||||
|
WithoutTime
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
namespace _0_Framework.Domain.CustomizeCheckoutShared.Enums;
|
||||||
|
|
||||||
|
public enum Currency
|
||||||
|
{
|
||||||
|
Rial,
|
||||||
|
Toman
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
namespace _0_Framework.Domain.CustomizeCheckoutShared.Enums;
|
||||||
|
|
||||||
|
public enum EarlyExitType
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// محاسبه نمیشود
|
||||||
|
/// </summary>
|
||||||
|
None,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// هر دقیقه تاخیر به تناسب حقوق مزد روزانه کسر گردد
|
||||||
|
/// </summary>
|
||||||
|
DeductEveryMinuteAccordingToDailyWage,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// هر دقیقه تاخیر مبلغی کسر میگردد
|
||||||
|
/// </summary>
|
||||||
|
MoneyPerMinute
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
namespace _0_Framework.Domain.CustomizeCheckoutShared.Enums;
|
||||||
|
|
||||||
|
public enum FamilyAllowanceType
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///محاسبه نمیشود
|
||||||
|
/// </summary>
|
||||||
|
None,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// به ازای هر فرزند درصدی از مزد روزانه پرمسل
|
||||||
|
/// </summary>
|
||||||
|
Percentage,
|
||||||
|
/// <summary>
|
||||||
|
/// به ازای هر فرزند به صورت مبلغ اختصاصی پرداخت میشود
|
||||||
|
/// </summary>
|
||||||
|
Money
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
namespace _0_Framework.Domain.CustomizeCheckoutShared.Enums;
|
||||||
|
|
||||||
|
public enum FineAbsenceDeductionType
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// محاسبه نمیشود
|
||||||
|
/// </summary>
|
||||||
|
None,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// در صورت استفاده غیر مجاز مرخصی و غیبت چند برابر از مزد روزانه کسر میگردد
|
||||||
|
/// </summary>
|
||||||
|
MultipleTimesOfDailyWage,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// به صورت مبلغ اختصاصی پرداخت میشود
|
||||||
|
/// </summary>
|
||||||
|
Money
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace _0_Framework.Domain.CustomizeCheckoutValueObjects;
|
namespace _0_Framework.Domain.CustomizeCheckoutShared.Enums;
|
||||||
|
|
||||||
public enum FineDeductionType
|
public enum FineDeductionType
|
||||||
{
|
{
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace _0_Framework.Domain.CustomizeCheckoutValueObjects;
|
namespace _0_Framework.Domain.CustomizeCheckoutShared.Enums;
|
||||||
|
|
||||||
public enum FridayPayType
|
public enum FridayPayType
|
||||||
{
|
{
|
||||||
@@ -23,20 +23,4 @@ public enum FridayPayType
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
MoneyPerFridayForDay,
|
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; }
|
|
||||||
}
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace _0_Framework.Domain.CustomizeCheckoutValueObjects;
|
namespace _0_Framework.Domain.CustomizeCheckoutShared.Enums;
|
||||||
|
|
||||||
public enum FridayWork
|
public enum FridayWork
|
||||||
{
|
{
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace _0_Framework.Domain.CustomizeCheckoutValueObjects;
|
namespace _0_Framework.Domain.CustomizeCheckoutShared.Enums;
|
||||||
|
|
||||||
public enum HolidayWork
|
public enum HolidayWork
|
||||||
{
|
{
|
||||||
@@ -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
|
public enum InsuranceDeductionType
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
namespace _0_Framework.Domain.CustomizeCheckoutShared.Enums;
|
||||||
|
|
||||||
|
public enum LateToWorkType
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// محاسبه نمیشود
|
||||||
|
/// </summary>
|
||||||
|
None,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// هر دقیقه تاخیر به تناسب حقوق مزد روزانه کسر گردد
|
||||||
|
/// </summary>
|
||||||
|
DeductEveryMinuteAccordingToDailyWage,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// هر دقیقه تاخیر چند برابر از حقوق کسر میگردد
|
||||||
|
/// </summary>
|
||||||
|
MultiTimesPerMinute
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
namespace _0_Framework.Domain.CustomizeCheckoutShared.Enums;
|
||||||
|
|
||||||
|
public enum LeavePayType
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// محاسبه و پرداخت نمیشود
|
||||||
|
/// </summary>
|
||||||
|
None,
|
||||||
|
/// <summary>
|
||||||
|
/// پرداخت میشود و چند برابر فیش حقوقی است
|
||||||
|
/// </summary>
|
||||||
|
Pay,
|
||||||
|
|
||||||
|
///// <summary>
|
||||||
|
///// به ازای هر روز استفاده نشده از مرخصی درصدی از حقوق
|
||||||
|
///// </summary>
|
||||||
|
//Percentage,
|
||||||
|
///// <summary>
|
||||||
|
///// به ازای هر رور استفاده نشده از مرخصی به صورت مبلغ اختصاصی پرداخت میشود
|
||||||
|
///// </summary>
|
||||||
|
//Money
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
namespace _0_Framework.Domain.CustomizeCheckoutShared.Enums;
|
||||||
|
|
||||||
|
public enum MarriedAllowanceType
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///محاسبه نمیشود
|
||||||
|
/// </summary>
|
||||||
|
None,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// به صورت درصدی
|
||||||
|
/// </summary>
|
||||||
|
PercentageFromSalary,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// به صورت مبلغ اختصاصی پرداخت میشود
|
||||||
|
/// </summary>
|
||||||
|
Money
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
namespace _0_Framework.Domain.CustomizeCheckoutShared.Enums;
|
||||||
|
|
||||||
|
public enum MaxMonthDays
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// تعداد روز های ماه به صورت عادی باشد و تغییری در آن اعمال نشود
|
||||||
|
/// </summary>
|
||||||
|
Default,
|
||||||
|
/// <summary>
|
||||||
|
/// تمامی ماه ها 30 روزه حساب شوند
|
||||||
|
/// </summary>
|
||||||
|
ThirtyDaysForAllMonth,
|
||||||
|
///// <summary>
|
||||||
|
///// تمامی ماه ها 30 روزه حساب شوند ولی اسفند 29 روزه
|
||||||
|
///// </summary>
|
||||||
|
//ThirtyDaysForAllMonthExceptEsfand
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
namespace _0_Framework.Domain.CustomizeCheckoutShared.Enums;
|
||||||
|
|
||||||
|
public enum NightWorkType
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///محاسبه نمیشود
|
||||||
|
/// </summary>
|
||||||
|
None,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// به صورت درصدی از مزد روزانه
|
||||||
|
/// </summary>
|
||||||
|
PercentageFromSalary,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// مقدار پول شخصی سازی شده برای هر ساعت شب کاری
|
||||||
|
/// </summary>
|
||||||
|
MoneyPerHour
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
namespace _0_Framework.Domain.CustomizeCheckoutShared.Enums;
|
||||||
|
|
||||||
|
public enum OverTimePayType
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///محاسبه نمیشود
|
||||||
|
/// </summary>
|
||||||
|
None,
|
||||||
|
/// <summary>
|
||||||
|
/// مقدار پول شخصی سازی شده برای هر ساعت
|
||||||
|
/// </summary>
|
||||||
|
MoneyPerHour,
|
||||||
|
/// <summary>
|
||||||
|
/// به صورت درصدی از مزد روزانه به ازای هر ساعت.
|
||||||
|
/// </summary>
|
||||||
|
PercentagePerHourOfSalary
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
namespace _0_Framework.Domain.CustomizeCheckoutShared.Enums;
|
||||||
|
|
||||||
|
public enum ShiftPayType
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///محاسبه نمیشود
|
||||||
|
/// </summary>
|
||||||
|
None,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// درصدی از حقوق
|
||||||
|
/// </summary>
|
||||||
|
PercentageOfSalary,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// به صورت مبلغ اختصاصی پرداخت میشود
|
||||||
|
/// </summary>
|
||||||
|
Money
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
namespace _0_Framework.Domain.CustomizeCheckoutShared.Enums;
|
||||||
|
|
||||||
|
public enum ShiftPlacement
|
||||||
|
{
|
||||||
|
First,
|
||||||
|
Second,
|
||||||
|
Third
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
namespace _0_Framework.Domain.CustomizeCheckoutShared.Enums;
|
||||||
|
|
||||||
|
public enum ShiftType
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///محاسبه نمیشود
|
||||||
|
/// </summary>
|
||||||
|
None,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// صبح و عصر
|
||||||
|
/// </summary>
|
||||||
|
MorningAndEvening,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// عصر و شب
|
||||||
|
/// </summary>
|
||||||
|
EveningAndNight,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// صبح و عصر و شب
|
||||||
|
/// </summary>
|
||||||
|
MorningAndEveningAndNight
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
namespace _0_Framework.Domain.CustomizeCheckoutShared.Enums;
|
||||||
|
|
||||||
|
public enum WorkshopIrregularShifts
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// غیرفعال
|
||||||
|
/// </summary>
|
||||||
|
None,
|
||||||
|
/// <summary>
|
||||||
|
/// 12 - 24 (دوازده - بیست و چهار)
|
||||||
|
/// </summary>
|
||||||
|
TwelveTwentyFour,
|
||||||
|
/// <summary>
|
||||||
|
/// 24-24 (بیست و چهار - بیست و چهار)
|
||||||
|
/// </summary>
|
||||||
|
TwentyFourTwentyFour,
|
||||||
|
/// <summary>
|
||||||
|
/// 12-36 (دوازده - سی و شش)
|
||||||
|
/// </summary>
|
||||||
|
TwelveThirtySix,
|
||||||
|
/// <summary>
|
||||||
|
/// 24 - 48 (بیست و چهار - چهل و هشت)
|
||||||
|
/// </summary>
|
||||||
|
TwentyFourFortyEight
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
namespace _0_Framework.Domain.CustomizeCheckoutShared.Enums;
|
||||||
|
|
||||||
|
public enum WorkshopShiftStatus
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// منظم
|
||||||
|
/// </summary>
|
||||||
|
Regular,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// نامنظم
|
||||||
|
/// </summary>
|
||||||
|
Irregular
|
||||||
|
}
|
||||||
@@ -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; }
|
||||||
|
}
|
||||||
@@ -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()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// نوع عیدی
|
||||||
|
/// </summary>
|
||||||
|
public BonusesType BonusesPayType { get; private set; }
|
||||||
|
/// <summary>
|
||||||
|
/// مقدار درصد یا مبلغ
|
||||||
|
/// </summary>
|
||||||
|
public double Value { get; private set; }
|
||||||
|
/// <summary>
|
||||||
|
/// نوع پرداخت برای عیدی
|
||||||
|
/// </summary>
|
||||||
|
public BonusesPaymentType PaymentType { get; private set; }
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -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; }
|
||||||
|
|
||||||
|
}
|
||||||
@@ -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<EarlyExitTimeFine> earlyExitTimeFines, double value)
|
||||||
|
{
|
||||||
|
EarlyExitType = earlyExitType;
|
||||||
|
EarlyExitTimeFines = earlyExitTimeFines ?? new();
|
||||||
|
Value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
private EarlyExit()
|
||||||
|
{
|
||||||
|
EarlyExitTimeFines = new();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// نوع حساب کردن تعجیل در خروج
|
||||||
|
/// </summary>
|
||||||
|
public EarlyExitType EarlyExitType { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// جریمه های اختصاصی پله ای
|
||||||
|
/// </summary>
|
||||||
|
public List<EarlyExitTimeFine> EarlyExitTimeFines { get; private set; }
|
||||||
|
|
||||||
|
public double Value { get; private set; }
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//public enum EarlyExitTimeFineType
|
||||||
|
//{
|
||||||
|
// /// <summary>
|
||||||
|
// /// جریمه های زمانی به صورت پله همه باهم جمع گردد
|
||||||
|
// /// </summary>
|
||||||
|
// StepByStep,
|
||||||
|
|
||||||
|
// /// <summary>
|
||||||
|
// /// فقط آخرین جریمه لحاظ شود
|
||||||
|
// /// </summary>
|
||||||
|
// LastStep,
|
||||||
|
//}
|
||||||
@@ -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()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// دقیقه تعیین شده برای جریمه
|
||||||
|
/// </summary>
|
||||||
|
public string Minute { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// مبلغ تعیین شده برای جریمه
|
||||||
|
/// </summary>
|
||||||
|
public double FineMoney { get; private set; }
|
||||||
|
}
|
||||||
@@ -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)
|
public FamilyAllowance(FamilyAllowanceType familyAllowanceType, double value)
|
||||||
{
|
{
|
||||||
@@ -27,22 +29,6 @@ public class FamilyAllowance
|
|||||||
public double Value { get; private set; }
|
public double Value { get; private set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
public enum FamilyAllowanceType
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
///محاسبه نمیشود
|
|
||||||
/// </summary>
|
|
||||||
None,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// به ازای هر فرزند درصدی از مزد روزانه پرمسل
|
|
||||||
/// </summary>
|
|
||||||
Percentage,
|
|
||||||
/// <summary>
|
|
||||||
/// به ازای هر فرزند به صورت مبلغ اختصاصی پرداخت میشود
|
|
||||||
/// </summary>
|
|
||||||
Money
|
|
||||||
}
|
|
||||||
//public enum NumberOfChildren
|
//public enum NumberOfChildren
|
||||||
//{
|
//{
|
||||||
// /// <summary>
|
// /// <summary>
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace _0_Framework.Domain.CustomizeCheckoutShared.ValueObjects;
|
||||||
|
|
||||||
|
public record FineAbsenceDayOfWeek
|
||||||
|
{
|
||||||
|
public FineAbsenceDayOfWeek(DayOfWeek dayOfWeek)
|
||||||
|
{
|
||||||
|
DayOfWeek = dayOfWeek;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private FineAbsenceDayOfWeek()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// روز های هفته
|
||||||
|
/// </summary>
|
||||||
|
public DayOfWeek DayOfWeek { get; private set; }
|
||||||
|
|
||||||
|
}
|
||||||
@@ -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<FineAbsenceDayOfWeek> fineAbsenceDayOfWeekCollection)
|
||||||
|
{
|
||||||
|
FineAbsenceDeductionType = fineAbsenceDeductionType;
|
||||||
|
Value = value;
|
||||||
|
FineAbsenceDayOfWeekCollection = fineAbsenceDayOfWeekCollection ?? new();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// نوع جریمه غیبت
|
||||||
|
/// </summary>
|
||||||
|
public FineAbsenceDeductionType FineAbsenceDeductionType { get; private set; }
|
||||||
|
|
||||||
|
public double Value { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// جریمه های اختصاصی به ازای روز های هفته
|
||||||
|
/// </summary>
|
||||||
|
public List<FineAbsenceDayOfWeek> FineAbsenceDayOfWeekCollection { get; private set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
//public enum FineAbsenceDayOfWeekType
|
||||||
|
//{
|
||||||
|
// /// <summary>
|
||||||
|
// /// مبلغ اختصاصی
|
||||||
|
// /// </summary>
|
||||||
|
// Money,
|
||||||
|
|
||||||
|
// /// <summary>
|
||||||
|
// /// چند برابر کردن جریمه به ازای مقداری که داده شده
|
||||||
|
// /// </summary>
|
||||||
|
// Multiple,
|
||||||
|
|
||||||
|
// /// <summary>
|
||||||
|
// /// درصد از مزد روزانه
|
||||||
|
// /// </summary>
|
||||||
|
// PercentageOfDailyWage
|
||||||
|
//}
|
||||||
@@ -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()
|
private FineDeduction()
|
||||||
{
|
{
|
||||||
@@ -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; }
|
||||||
|
}
|
||||||
@@ -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; }
|
||||||
|
}
|
||||||
@@ -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; }
|
||||||
|
|
||||||
|
}
|
||||||
@@ -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<LateToWorkTimeFine> lateToWorkTimeFines, double value)
|
||||||
|
{
|
||||||
|
LateToWorkType = lateToWorkType;
|
||||||
|
LateToWorkTimeFines = lateToWorkTimeFines ?? new();
|
||||||
|
Value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
private LateToWork()
|
||||||
|
{
|
||||||
|
LateToWorkTimeFines = new();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// نوع حساب کردن تاخیر در ورود
|
||||||
|
/// </summary>
|
||||||
|
public LateToWorkType LateToWorkType { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// این مقدار بستگی به نوع حساب کردن تاخیر در ورود
|
||||||
|
/// </summary>
|
||||||
|
public double Value { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// جریمه های اختصاصی پله ای
|
||||||
|
/// </summary>
|
||||||
|
public List<LateToWorkTimeFine> LateToWorkTimeFines { get; private set; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -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()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// دقیقه تعیین شده برای جریمه
|
||||||
|
/// </summary>
|
||||||
|
public string Minute { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// مبلغ تعیین شده برای جریمه
|
||||||
|
/// </summary>
|
||||||
|
public double FineMoney { get; private set; }
|
||||||
|
}
|
||||||
@@ -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()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// نوع مرخصی
|
||||||
|
/// </summary>
|
||||||
|
public LeavePayType LeavePayType { get; private set; }
|
||||||
|
|
||||||
|
///// <summary>
|
||||||
|
///// تعداد روز های مجاز مرخصی
|
||||||
|
///// </summary>
|
||||||
|
//public string DayCountAllowable { get; set; }
|
||||||
|
|
||||||
|
public double Value { get; private set; }
|
||||||
|
}
|
||||||
@@ -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; }
|
||||||
|
}
|
||||||
@@ -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; }
|
||||||
|
}
|
||||||
@@ -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; }
|
||||||
|
}
|
||||||
@@ -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()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// نوع نوبت کاری را مشخص میکند . به عنوان مثال: صبح و عصر، عصر و شب و غیره...
|
||||||
|
/// </summary>
|
||||||
|
public ShiftType ShiftType { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// نوع پرداخت را مشخص میکند که آیا به صورت درصدی است یا مبلغ اختصاصی.
|
||||||
|
/// </summary>
|
||||||
|
public ShiftPayType ShiftPayType { get; private set; }
|
||||||
|
|
||||||
|
public double Value { get; private set; }
|
||||||
|
}
|
||||||
@@ -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
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
///محاسبه نمیشود
|
|
||||||
/// </summary>
|
|
||||||
None,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// به صورت درصدی از حقوق
|
|
||||||
/// </summary>
|
|
||||||
PercentageOfSalary,
|
|
||||||
/// <summary>
|
|
||||||
/// مبلغ اختصاصی برای سنوات
|
|
||||||
/// </summary>
|
|
||||||
Money
|
|
||||||
}
|
|
||||||
public enum BaseYearsPaymentType
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// پرداخت نمیگردد
|
|
||||||
/// </summary>
|
|
||||||
None,
|
|
||||||
/// <summary>
|
|
||||||
/// پرداخت به صورت سالانه در آخر سال پرداخت میگردد
|
|
||||||
/// </summary>
|
|
||||||
YearlyPay,
|
|
||||||
/// <summary>
|
|
||||||
/// پرداخت به صورت ماهانه
|
|
||||||
/// </summary>
|
|
||||||
MonthlyPay
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -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()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// نوع عیدی
|
|
||||||
/// </summary>
|
|
||||||
public BonusesType BonusesPayType { get; private set; }
|
|
||||||
/// <summary>
|
|
||||||
/// مقدار درصد یا مبلغ
|
|
||||||
/// </summary>
|
|
||||||
public double Value { get; private set; }
|
|
||||||
/// <summary>
|
|
||||||
/// نوع پرداخت برای عیدی
|
|
||||||
/// </summary>
|
|
||||||
public BonusesPaymentType PaymentType { get; private set; }
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public enum BonusesPaymentType
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// پرداخت نمیگردد
|
|
||||||
/// </summary>
|
|
||||||
None,
|
|
||||||
/// <summary>
|
|
||||||
/// پرداخت به صورت سالانه در آخر سال پرداخت میگردد
|
|
||||||
/// </summary>
|
|
||||||
YearlyPay,
|
|
||||||
/// <summary>
|
|
||||||
/// پرداخت به صورت ماهانه
|
|
||||||
/// </summary>
|
|
||||||
MonthlyPay
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum BonusesType
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
///محاسبه نمیشود
|
|
||||||
/// </summary>
|
|
||||||
None,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// به صورت درصدی از حقوق
|
|
||||||
/// </summary>
|
|
||||||
PercentageOfSalary,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// دوبرابر حقوق
|
|
||||||
/// </summary>
|
|
||||||
TwoTimeOfSalary,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// یک برابر حقوق
|
|
||||||
/// </summary>
|
|
||||||
OneTimeOfSalary,
|
|
||||||
/// <summary>
|
|
||||||
/// مبلغ اختصاصی برای عیدی
|
|
||||||
/// </summary>
|
|
||||||
Money
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
namespace _0_Framework.Domain.CustomizeCheckoutValueObjects;
|
|
||||||
|
|
||||||
public enum Currency
|
|
||||||
{
|
|
||||||
Rial,
|
|
||||||
Toman
|
|
||||||
}
|
|
||||||
@@ -1,86 +0,0 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace _0_Framework.Domain.CustomizeCheckoutValueObjects;
|
|
||||||
|
|
||||||
public class EarlyExit
|
|
||||||
{
|
|
||||||
public EarlyExit(EarlyExitType earlyExitType, List<EarlyExitTimeFine> earlyExitTimeFines, double value)
|
|
||||||
{
|
|
||||||
EarlyExitType = earlyExitType;
|
|
||||||
EarlyExitTimeFines = earlyExitTimeFines??new ();
|
|
||||||
Value = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
private EarlyExit()
|
|
||||||
{
|
|
||||||
EarlyExitTimeFines = new();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// نوع حساب کردن تعجیل در خروج
|
|
||||||
/// </summary>
|
|
||||||
public EarlyExitType EarlyExitType { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// جریمه های اختصاصی پله ای
|
|
||||||
/// </summary>
|
|
||||||
public List<EarlyExitTimeFine> EarlyExitTimeFines { get; private set; }
|
|
||||||
|
|
||||||
public double Value { get; private set; }
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public class EarlyExitTimeFine
|
|
||||||
{
|
|
||||||
public EarlyExitTimeFine(string minute, double fineMoney)
|
|
||||||
{
|
|
||||||
Minute = minute;
|
|
||||||
FineMoney = fineMoney;
|
|
||||||
}
|
|
||||||
|
|
||||||
private EarlyExitTimeFine()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// دقیقه تعیین شده برای جریمه
|
|
||||||
/// </summary>
|
|
||||||
public string Minute { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// مبلغ تعیین شده برای جریمه
|
|
||||||
/// </summary>
|
|
||||||
public double FineMoney { get; private set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
//public enum EarlyExitTimeFineType
|
|
||||||
//{
|
|
||||||
// /// <summary>
|
|
||||||
// /// جریمه های زمانی به صورت پله همه باهم جمع گردد
|
|
||||||
// /// </summary>
|
|
||||||
// StepByStep,
|
|
||||||
|
|
||||||
// /// <summary>
|
|
||||||
// /// فقط آخرین جریمه لحاظ شود
|
|
||||||
// /// </summary>
|
|
||||||
// LastStep,
|
|
||||||
//}
|
|
||||||
|
|
||||||
public enum EarlyExitType
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// محاسبه نمیشود
|
|
||||||
/// </summary>
|
|
||||||
None,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// هر دقیقه تاخیر به تناسب حقوق مزد روزانه کسر گردد
|
|
||||||
/// </summary>
|
|
||||||
DeductEveryMinuteAccordingToDailyWage,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// هر دقیقه تاخیر مبلغی کسر میگردد
|
|
||||||
/// </summary>
|
|
||||||
MoneyPerMinute
|
|
||||||
}
|
|
||||||
@@ -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<FineAbsenceDayOfWeek> fineAbsenceDayOfWeekCollection)
|
|
||||||
{
|
|
||||||
FineAbsenceDeductionType = fineAbsenceDeductionType;
|
|
||||||
Value = value;
|
|
||||||
FineAbsenceDayOfWeekCollection = fineAbsenceDayOfWeekCollection ?? new ();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// نوع جریمه غیبت
|
|
||||||
/// </summary>
|
|
||||||
public FineAbsenceDeductionType FineAbsenceDeductionType { get; private set; }
|
|
||||||
|
|
||||||
public double Value { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// جریمه های اختصاصی به ازای روز های هفته
|
|
||||||
/// </summary>
|
|
||||||
public List<FineAbsenceDayOfWeek> FineAbsenceDayOfWeekCollection { get; private set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public class FineAbsenceDayOfWeek
|
|
||||||
{
|
|
||||||
public FineAbsenceDayOfWeek(DayOfWeek dayOfWeek)
|
|
||||||
{
|
|
||||||
DayOfWeek = dayOfWeek;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private FineAbsenceDayOfWeek()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// روز های هفته
|
|
||||||
/// </summary>
|
|
||||||
public DayOfWeek DayOfWeek { get; private set; }
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//public enum FineAbsenceDayOfWeekType
|
|
||||||
//{
|
|
||||||
// /// <summary>
|
|
||||||
// /// مبلغ اختصاصی
|
|
||||||
// /// </summary>
|
|
||||||
// Money,
|
|
||||||
|
|
||||||
// /// <summary>
|
|
||||||
// /// چند برابر کردن جریمه به ازای مقداری که داده شده
|
|
||||||
// /// </summary>
|
|
||||||
// Multiple,
|
|
||||||
|
|
||||||
// /// <summary>
|
|
||||||
// /// درصد از مزد روزانه
|
|
||||||
// /// </summary>
|
|
||||||
// PercentageOfDailyWage
|
|
||||||
//}
|
|
||||||
|
|
||||||
public enum FineAbsenceDeductionType
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// محاسبه نمیشود
|
|
||||||
/// </summary>
|
|
||||||
None,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// در صورت استفاده غیر مجاز مرخصی و غیبت چند برابر از مزد روزانه کسر میگردد
|
|
||||||
/// </summary>
|
|
||||||
MultipleTimesOfDailyWage,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// به صورت مبلغ اختصاصی پرداخت میشود
|
|
||||||
/// </summary>
|
|
||||||
Money
|
|
||||||
}
|
|
||||||
@@ -1,76 +0,0 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace _0_Framework.Domain.CustomizeCheckoutValueObjects;
|
|
||||||
|
|
||||||
public class LateToWork
|
|
||||||
{
|
|
||||||
public LateToWork(LateToWorkType lateToWorkType, List<LateToWorkTimeFine> lateToWorkTimeFines, double value)
|
|
||||||
{
|
|
||||||
LateToWorkType = lateToWorkType;
|
|
||||||
LateToWorkTimeFines = lateToWorkTimeFines??new ();
|
|
||||||
Value = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
private LateToWork()
|
|
||||||
{
|
|
||||||
LateToWorkTimeFines = new ();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// نوع حساب کردن تاخیر در ورود
|
|
||||||
/// </summary>
|
|
||||||
public LateToWorkType LateToWorkType { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// این مقدار بستگی به نوع حساب کردن تاخیر در ورود
|
|
||||||
/// </summary>
|
|
||||||
public double Value { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// جریمه های اختصاصی پله ای
|
|
||||||
/// </summary>
|
|
||||||
public List<LateToWorkTimeFine> LateToWorkTimeFines { get; private set; }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
public enum LateToWorkType
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// محاسبه نمیشود
|
|
||||||
/// </summary>
|
|
||||||
None,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// هر دقیقه تاخیر به تناسب حقوق مزد روزانه کسر گردد
|
|
||||||
/// </summary>
|
|
||||||
DeductEveryMinuteAccordingToDailyWage,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// هر دقیقه تاخیر چند برابر از حقوق کسر میگردد
|
|
||||||
/// </summary>
|
|
||||||
MultiTimesPerMinute
|
|
||||||
}
|
|
||||||
public class LateToWorkTimeFine
|
|
||||||
{
|
|
||||||
public LateToWorkTimeFine(string minute, double fineMoney)
|
|
||||||
{
|
|
||||||
Minute = minute;
|
|
||||||
FineMoney = fineMoney;
|
|
||||||
}
|
|
||||||
|
|
||||||
private LateToWorkTimeFine()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// دقیقه تعیین شده برای جریمه
|
|
||||||
/// </summary>
|
|
||||||
public string Minute { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// مبلغ تعیین شده برای جریمه
|
|
||||||
/// </summary>
|
|
||||||
public double FineMoney { get; private set; }
|
|
||||||
}
|
|
||||||
@@ -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()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// نوع مرخصی
|
|
||||||
/// </summary>
|
|
||||||
public LeavePayType LeavePayType { get; private set; }
|
|
||||||
|
|
||||||
///// <summary>
|
|
||||||
///// تعداد روز های مجاز مرخصی
|
|
||||||
///// </summary>
|
|
||||||
//public string DayCountAllowable { get; set; }
|
|
||||||
|
|
||||||
public double Value { get; private set; }
|
|
||||||
}
|
|
||||||
public enum LeavePayType
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// محاسبه و پرداخت نمیشود
|
|
||||||
/// </summary>
|
|
||||||
None,
|
|
||||||
/// <summary>
|
|
||||||
/// پرداخت میشود و چند برابر فیش حقوقی است
|
|
||||||
/// </summary>
|
|
||||||
Pay,
|
|
||||||
|
|
||||||
///// <summary>
|
|
||||||
///// به ازای هر روز استفاده نشده از مرخصی درصدی از حقوق
|
|
||||||
///// </summary>
|
|
||||||
//Percentage,
|
|
||||||
///// <summary>
|
|
||||||
///// به ازای هر رور استفاده نشده از مرخصی به صورت مبلغ اختصاصی پرداخت میشود
|
|
||||||
///// </summary>
|
|
||||||
//Money
|
|
||||||
}
|
|
||||||
@@ -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
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
///محاسبه نمیشود
|
|
||||||
/// </summary>
|
|
||||||
None,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// به صورت درصدی
|
|
||||||
/// </summary>
|
|
||||||
PercentageFromSalary,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// به صورت مبلغ اختصاصی پرداخت میشود
|
|
||||||
/// </summary>
|
|
||||||
Money
|
|
||||||
}
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
namespace _0_Framework.Domain.CustomizeCheckoutValueObjects;
|
|
||||||
|
|
||||||
public enum MaxMonthDays
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// تعداد روز های ماه به صورت عادی باشد و تغییری در آن اعمال نشود
|
|
||||||
/// </summary>
|
|
||||||
Default,
|
|
||||||
/// <summary>
|
|
||||||
/// تمامی ماه ها 30 روزه حساب شوند
|
|
||||||
/// </summary>
|
|
||||||
ThirtyDaysForAllMonth,
|
|
||||||
/// <summary>
|
|
||||||
/// تمامی ماه ها 30 روزه حساب شوند ولی اسفند 29 روزه
|
|
||||||
/// </summary>
|
|
||||||
ThirtyDaysForAllMonthExceptEsfand
|
|
||||||
}
|
|
||||||
@@ -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
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
///محاسبه نمیشود
|
|
||||||
/// </summary>
|
|
||||||
None,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// به صورت درصدی از مزد روزانه
|
|
||||||
/// </summary>
|
|
||||||
PercentageFromSalary,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// مقدار پول شخصی سازی شده برای هر ساعت شب کاری
|
|
||||||
/// </summary>
|
|
||||||
MoneyPerHour
|
|
||||||
}
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
namespace _0_Framework.Domain.CustomizeCheckoutValueObjects;
|
|
||||||
public enum OverTimePayType
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
///محاسبه نمیشود
|
|
||||||
/// </summary>
|
|
||||||
None,
|
|
||||||
/// <summary>
|
|
||||||
/// مقدار پول شخصی سازی شده برای هر ساعت
|
|
||||||
/// </summary>
|
|
||||||
MoneyPerHour,
|
|
||||||
/// <summary>
|
|
||||||
/// به صورت درصدی از مزد روزانه به ازای هر ساعت.
|
|
||||||
/// </summary>
|
|
||||||
PercentagePerHourOfSalary
|
|
||||||
}
|
|
||||||
public class OverTimePay
|
|
||||||
{
|
|
||||||
public OverTimePay(OverTimePayType overTimePayType, double value)
|
|
||||||
{
|
|
||||||
OverTimePayType = overTimePayType;
|
|
||||||
Value = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
private OverTimePay()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public OverTimePayType OverTimePayType { get; private set; }
|
|
||||||
public double Value { get; private set; }
|
|
||||||
}
|
|
||||||
@@ -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()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// نوع نوبت کاری را مشخص میکند . به عنوان مثال: صبح و عصر، عصر و شب و غیره...
|
|
||||||
/// </summary>
|
|
||||||
public ShiftType ShiftType { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// نوع پرداخت را مشخص میکند که آیا به صورت درصدی است یا مبلغ اختصاصی.
|
|
||||||
/// </summary>
|
|
||||||
public ShiftPayType ShiftPayType { get; private set; }
|
|
||||||
|
|
||||||
public double Value { get; private set; }
|
|
||||||
}
|
|
||||||
public enum ShiftPayType
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
///محاسبه نمیشود
|
|
||||||
/// </summary>
|
|
||||||
None,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// درصدی از حقوق
|
|
||||||
/// </summary>
|
|
||||||
PercentageOfSalary,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// به صورت مبلغ اختصاصی پرداخت میشود
|
|
||||||
/// </summary>
|
|
||||||
Money
|
|
||||||
}
|
|
||||||
public enum ShiftType
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
///محاسبه نمیشود
|
|
||||||
/// </summary>
|
|
||||||
None,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// صبح و عصر
|
|
||||||
/// </summary>
|
|
||||||
MorningAndEvening,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// عصر و شب
|
|
||||||
/// </summary>
|
|
||||||
EveningAndNight,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// صبح و عصر و شب
|
|
||||||
/// </summary>
|
|
||||||
MorningAndEveningAndNight
|
|
||||||
}
|
|
||||||
@@ -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; }
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
public class AccountSearchModel
|
public class AccountSearchModel
|
||||||
{
|
{
|
||||||
|
public long Id { get; set; }
|
||||||
public string Fullname { get; set; }
|
public string Fullname { get; set; }
|
||||||
public string Username { get; set; }
|
public string Username { get; set; }
|
||||||
public string Mobile { get; set; }
|
public string Mobile { get; set; }
|
||||||
|
|||||||
@@ -43,5 +43,14 @@ public interface IAccountApplication
|
|||||||
List<AccountViewModel> GetAccountEqualToLowerPositionValue();
|
List<AccountViewModel> GetAccountEqualToLowerPositionValue();
|
||||||
OperationResult ReLogin();
|
OperationResult ReLogin();
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Pooya
|
||||||
|
|
||||||
|
//UserClaimsResponseDTO GetClaimsForSignIn(Login command);
|
||||||
|
OperationResult ChangePasswordAndPhoneNumber(AccountChangePasswordAndPhoneNumber command);
|
||||||
|
OperationResult IsPhoneNumberAndPasswordValid(long accountId, string phoneNumber, string password, string rePassword);
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
@@ -18,6 +18,8 @@ public interface ICameraAccountApplication
|
|||||||
OperationResult DeActive(long id);
|
OperationResult DeActive(long id);
|
||||||
OperationResult ChangePass(ChangePassword command);
|
OperationResult ChangePass(ChangePassword command);
|
||||||
bool HasCameraAccount(long workshopId, long accountId);
|
bool HasCameraAccount(long workshopId, long accountId);
|
||||||
|
List<CameraAccountViewModel> GetAllByWorkshopIdAndAccountId(long accountId, List<(long Id, string Name)> workshops);
|
||||||
|
|
||||||
OperationResult CheckUsername(string username);
|
OperationResult CheckUsername(string username);
|
||||||
#region Safa
|
#region Safa
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace AccountManagement.Application.Contracts.SubAccount
|
||||||
|
{
|
||||||
|
public class AssignPermissionsToRole
|
||||||
|
{
|
||||||
|
public long RoleId { get; set; }
|
||||||
|
public List<int> Permissions { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
namespace AccountManagement.Application.Contracts.SubAccount
|
||||||
|
{
|
||||||
|
public class AssignSubAccountRole
|
||||||
|
{
|
||||||
|
public long SubAccountRoleId { get; set; }
|
||||||
|
public long SubAccountId { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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<long> WorkshopIds { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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<int> Permissions { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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<long> WorkshopIds { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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; }
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
namespace AccountManagement.Application.Contracts.SubAccount
|
||||||
|
{
|
||||||
|
public class EditSubAccountRole : CreateSubAccountRole
|
||||||
|
{
|
||||||
|
public long Id { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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<long> accountWorkshopsList);
|
||||||
|
OperationResult EditSubAccount(EditSubAccount cmd, List<long> accountWorkshopsList);
|
||||||
|
OperationResult ChangePassword(SubAccountChangePassword cmd);
|
||||||
|
OperationResult Delete(long id);
|
||||||
|
SubAccountViewModel GetDetails(long subAccountId);
|
||||||
|
OperationResult CreateRole(CreateSubAccountRole command);
|
||||||
|
OperationResult EditRole(EditSubAccountRole cmd);
|
||||||
|
List<SubAccountViewModel> GetAllByAccountId(long accountId, int pageIndex);
|
||||||
|
OperationResult AssignRoleToSubAccount(AssignSubAccountRole command);
|
||||||
|
OperationResult DeleteRole(long id);
|
||||||
|
List<SubAccountRoleViewModel> GetSubAccountRolesByAccountId(long accountId);
|
||||||
|
OperationResult Deactivate(long subAccountId);
|
||||||
|
OperationResult Activate(long subAccountId);
|
||||||
|
List<SubAccountsGroupedByRoleViewModel> GetSubAccountsByAccountIdGroupedByRole(long accountId);
|
||||||
|
SubAccountRoleViewModel GetRoleDetails(long subAccountRoleId);
|
||||||
|
OperationResult ChangePasswordAndPhoneNumber(SubAccountChangePasswordAndPhoneNumber cmd);
|
||||||
|
OperationResult IsPhoneNumberAndPasswordValid(long accountId, string phoneNumber, string password, string rePassword);
|
||||||
|
Task<OperationResult> SendVerifyCodeForPasswordChange(string phone, long id);
|
||||||
|
SubAccountViewModel GetByVerifyCodeAndPhoneNumber(string code, string phone);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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; }
|
||||||
|
}
|
||||||
@@ -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<int> Permissions { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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<SubAccountViewModel> SubAccounts { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
namespace AccountManagement.Application.Contracts.SubAccountPermissionSubtitle
|
||||||
|
{
|
||||||
|
public class CreateSubAccountPermissionSubtitle1
|
||||||
|
{
|
||||||
|
public string Title { get; set; }
|
||||||
|
public int Code { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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; }
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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<SubAccountPermissionSubtitleViewModel> GetAllSubtitlesNested();
|
||||||
|
|
||||||
|
|
||||||
|
OperationResult DeleteSubtitle1(long id);
|
||||||
|
OperationResult DeleteSubtitle2(long id);
|
||||||
|
OperationResult DeleteSubtitle3(long id);
|
||||||
|
OperationResult DeleteSubtitle4(long id);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace AccountManagement.Application.Contracts.SubAccountPermissionSubtitle
|
||||||
|
{
|
||||||
|
public class NestedSubAccountPermissionSubtitlesViewModel
|
||||||
|
{
|
||||||
|
public List<SubAccountPermissionSubtitleViewModel> Subtitles1 { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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<SubAccountPermissionSubtitleViewModel> Children { get; set; } = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -18,6 +18,12 @@ using Microsoft.AspNetCore.Mvc.Rendering;
|
|||||||
using static Microsoft.EntityFrameworkCore.DbLoggerCategory.Database;
|
using static Microsoft.EntityFrameworkCore.DbLoggerCategory.Database;
|
||||||
using TaskManager.Domain.PositionAgg;
|
using TaskManager.Domain.PositionAgg;
|
||||||
using Company.Domain.WorkshopAgg;
|
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;
|
//using AccountManagement.Domain.RoleAgg;
|
||||||
|
|
||||||
namespace AccountManagement.Application;
|
namespace AccountManagement.Application;
|
||||||
@@ -34,10 +40,13 @@ public class AccountApplication : IAccountApplication
|
|||||||
private readonly IPositionRepository _positionRepository;
|
private readonly IPositionRepository _positionRepository;
|
||||||
private readonly IAccountLeftworkRepository _accountLeftworkRepository;
|
private readonly IAccountLeftworkRepository _accountLeftworkRepository;
|
||||||
private readonly IWorkshopRepository _workshopRepository;
|
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,
|
||||||
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)
|
||||||
IFileUploader fileUploader, IAuthHelper authHelper, IRoleRepository roleRepository, IWorker worker, ISmsService smsService, ICameraAccountRepository cameraAccountRepository, IPositionRepository positionRepository, IAccountLeftworkRepository accountLeftworkRepository, IWorkshopRepository workshopRepository)
|
|
||||||
{
|
{
|
||||||
_authHelper = authHelper;
|
_authHelper = authHelper;
|
||||||
_roleRepository = roleRepository;
|
_roleRepository = roleRepository;
|
||||||
@@ -46,6 +55,10 @@ public class AccountApplication : IAccountApplication
|
|||||||
_positionRepository = positionRepository;
|
_positionRepository = positionRepository;
|
||||||
_accountLeftworkRepository = accountLeftworkRepository;
|
_accountLeftworkRepository = accountLeftworkRepository;
|
||||||
_workshopRepository = workshopRepository;
|
_workshopRepository = workshopRepository;
|
||||||
|
_subAccountRepository = subAccountRepository;
|
||||||
|
_subAccountRoleRepository = subAccountRoleRepository;
|
||||||
|
_workshopSubAccountRepository = workshopSubAccountRepository;
|
||||||
|
_accountPermissionSubtitle1Repository = accountPermissionSubtitle1Repository;
|
||||||
_fileUploader = fileUploader;
|
_fileUploader = fileUploader;
|
||||||
_passwordHasher = passwordHasher;
|
_passwordHasher = passwordHasher;
|
||||||
_accountRepository = accountRepository;
|
_accountRepository = accountRepository;
|
||||||
@@ -203,8 +216,9 @@ public class AccountApplication : IAccountApplication
|
|||||||
|
|
||||||
var account = _accountRepository.GetBy(command.Username);
|
var account = _accountRepository.GetBy(command.Username);
|
||||||
var cameraAccount = _cameraAccountRepository.GetBy(command.Username);
|
var cameraAccount = _cameraAccountRepository.GetBy(command.Username);
|
||||||
if (account == null && cameraAccount == null)
|
SubAccount subAccount = _subAccountRepository.GetBy(command.Username);
|
||||||
return operation.Failed(ApplicationMessages.WrongUserPass);
|
if (account == null && cameraAccount == null && subAccount == null)
|
||||||
|
return operation.Failed(ApplicationMessages.WrongUserPass);
|
||||||
|
|
||||||
if (account != null)
|
if (account != null)
|
||||||
{
|
{
|
||||||
@@ -230,7 +244,9 @@ public class AccountApplication : IAccountApplication
|
|||||||
if (account.ClientAriaPermission == "true" && account.AdminAreaPermission == "false" &&
|
if (account.ClientAriaPermission == "true" && account.AdminAreaPermission == "false" &&
|
||||||
account.IsActiveString == "true")
|
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()
|
.OrderByDescending(x => x.PersonnelCount).ToList().Select(x => new WorkshopClaim()
|
||||||
{
|
{
|
||||||
Slug = _passwordHasher.SlugHasher(x.Id),
|
Slug = _passwordHasher.SlugHasher(x.Id),
|
||||||
@@ -272,9 +288,35 @@ public class AccountApplication : IAccountApplication
|
|||||||
idAutoriz = 0;
|
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)
|
public OperationResult LoginWithMobile(long id)
|
||||||
{
|
{
|
||||||
@@ -444,6 +486,9 @@ public class AccountApplication : IAccountApplication
|
|||||||
|
|
||||||
|
|
||||||
_authHelper.SignOut();
|
_authHelper.SignOut();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var authViewModel = new AuthViewModel(account.id, account.RoleId, account.Fullname
|
var authViewModel = new AuthViewModel(account.id, account.RoleId, account.Fullname
|
||||||
, account.Username, account.Mobile, account.ProfilePhoto, permissions, account.RoleName, "false", "true",null);
|
, account.Username, account.Mobile, account.ProfilePhoto, permissions, account.RoleName, "false", "true",null);
|
||||||
authViewModel.WorkshopList = _workshopRepository.SearchForClient(new WorkshopSearchModel() { AccountId = account.id })
|
authViewModel.WorkshopList = _workshopRepository.SearchForClient(new WorkshopSearchModel() { AccountId = account.id })
|
||||||
@@ -455,7 +500,10 @@ public class AccountApplication : IAccountApplication
|
|||||||
Id = x.Id
|
Id = x.Id
|
||||||
}
|
}
|
||||||
).ToList();
|
).ToList();
|
||||||
if (authViewModel.WorkshopList.Any())
|
|
||||||
|
var clientPermissions = _accountPermissionSubtitle1Repository.GetAllPermissionCodes();
|
||||||
|
authViewModel.Permissions = clientPermissions;
|
||||||
|
if (authViewModel.WorkshopList.Any())
|
||||||
authViewModel.WorkshopSlug = _passwordHasher.SlugHasher(authViewModel.WorkshopList.First().Id);
|
authViewModel.WorkshopSlug = _passwordHasher.SlugHasher(authViewModel.WorkshopList.First().Id);
|
||||||
_authHelper.Signin(authViewModel);
|
_authHelper.Signin(authViewModel);
|
||||||
return operation.Succcedded(2);
|
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
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -59,6 +59,22 @@ public class CameraAccountApplication : ICameraAccountApplication
|
|||||||
return _cameraAccountRepository.Exists(x => x.WorkshopId == workshopId && x.AccountId == accountId);
|
return _cameraAccountRepository.Exists(x => x.WorkshopId == workshopId && x.AccountId == accountId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<CameraAccountViewModel> 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)
|
public OperationResult CheckUsername(string username)
|
||||||
{
|
{
|
||||||
var operation = new OperationResult();
|
var operation = new OperationResult();
|
||||||
|
|||||||
354
AccountManagement.Application/SubAccountApplication.cs
Normal file
354
AccountManagement.Application/SubAccountApplication.cs
Normal file
@@ -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<OperationResult> 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<long> 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<long> 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<SubAccountViewModel> 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<SubAccountRoleViewModel> GetSubAccountRolesByAccountId(long accountId)
|
||||||
|
{
|
||||||
|
return _subAccountRoleRepository.GetSubAccountRolesByAccountId(accountId);
|
||||||
|
}
|
||||||
|
public List<SubAccountsGroupedByRoleViewModel> 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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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<SubAccountPermissionSubtitleViewModel> GetAllSubtitlesNested()
|
||||||
|
{
|
||||||
|
return _subAccountPermissionSubtitle1Repository.GetAllWithChildren();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,6 +3,8 @@ using AccountManagement.Application.Contracts.Account;
|
|||||||
using AccountManagement.Application.Contracts.CameraAccount;
|
using AccountManagement.Application.Contracts.CameraAccount;
|
||||||
using AccountManagement.Application.Contracts.Position;
|
using AccountManagement.Application.Contracts.Position;
|
||||||
using AccountManagement.Application.Contracts.Role;
|
using AccountManagement.Application.Contracts.Role;
|
||||||
|
using AccountManagement.Application.Contracts.SubAccount;
|
||||||
|
using AccountManagement.Application.Contracts.SubAccountPermissionSubtitle;
|
||||||
using AccountManagement.Application.Contracts.Task;
|
using AccountManagement.Application.Contracts.Task;
|
||||||
using AccountManagement.Application.Contracts.TaskSubject;
|
using AccountManagement.Application.Contracts.TaskSubject;
|
||||||
using AccountManagement.Application.Contracts.Ticket;
|
using AccountManagement.Application.Contracts.Ticket;
|
||||||
@@ -13,6 +15,12 @@ using AccountManagement.Domain.AssignAgg;
|
|||||||
using AccountManagement.Domain.CameraAccountAgg;
|
using AccountManagement.Domain.CameraAccountAgg;
|
||||||
using AccountManagement.Domain.MediaAgg;
|
using AccountManagement.Domain.MediaAgg;
|
||||||
using AccountManagement.Domain.RoleAgg;
|
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.TaskAgg;
|
||||||
using AccountManagement.Domain.TaskMessageAgg;
|
using AccountManagement.Domain.TaskMessageAgg;
|
||||||
using AccountManagement.Domain.TaskSubjectAgg;
|
using AccountManagement.Domain.TaskSubjectAgg;
|
||||||
@@ -73,6 +81,18 @@ namespace AccountManagement.Configuration
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
#region Pooya
|
||||||
|
services.AddTransient<ISubAccountRepository, SubAccountRepository>();
|
||||||
|
services.AddTransient<ISubAccountApplication, SubAccountApplication>();
|
||||||
|
services.AddTransient<ISubAccountRoleRepository, SubAccountRoleRepository>();
|
||||||
|
services.AddTransient<ISubAccountPermissionSubtitle1Repository, SubAccountPermissionSubtitle1Repository>();
|
||||||
|
services.AddTransient<ISubAccountPermissionSubtitle2Repository, SubAccountPermissionSubtitle2Repository>();
|
||||||
|
services.AddTransient<ISubAccountPermissionSubtitle3Repository, SubAccountPermissionSubtitle3Repository>();
|
||||||
|
services.AddTransient<ISubAccountPermissionSubtitle4Repository, SubAccountPermissionSubtitle4Repository>();
|
||||||
|
services.AddTransient<ISubAccountPermissionSubtitleApplication, SubAccountPermissionSubtitleApplication>();
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
services.AddScoped<IWorker, Worker>();
|
services.AddScoped<IWorker, Worker>();
|
||||||
services.AddDbContext<AccountContext>(x => x.UseSqlServer(connectionString));
|
services.AddDbContext<AccountContext>(x => x.UseSqlServer(connectionString));
|
||||||
|
|||||||
@@ -16,6 +16,10 @@ namespace AccountManagement.Domain.CameraAccountAgg
|
|||||||
CameraAccount GetById(long id);
|
CameraAccount GetById(long id);
|
||||||
EditCameraAccount GetDetails(long id);
|
EditCameraAccount GetDetails(long id);
|
||||||
|
|
||||||
|
#region Pooya
|
||||||
|
List<CameraAccountViewModel> GetAllByAccountId(long accountId);
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region Safa
|
#region Safa
|
||||||
|
|
||||||
EditCameraAccount GetDetailsByWorkshop(long workshopId);
|
EditCameraAccount GetDetailsByWorkshop(long workshopId);
|
||||||
|
|||||||
@@ -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<long, SubAccount>
|
||||||
|
{
|
||||||
|
List<SubAccountViewModel> GetAllByAccountId(long accountId, int pageIndex);
|
||||||
|
List<SubAccountsGroupedByRoleViewModel> GetSubAccountsByAccountIdGroupedByRole(long accountId);
|
||||||
|
void Remove(SubAccount subAccount);
|
||||||
|
SubAccount GetDetails(long subAccountId);
|
||||||
|
SubAccount GetBy(string commandUsername);
|
||||||
|
SubAccountViewModel GetByVerifyCodeAndPhoneNumber(string code, string phone);
|
||||||
|
}
|
||||||
|
}
|
||||||
85
AccountManagement.Domain/SubAccountAgg/SubAccount.cs
Normal file
85
AccountManagement.Domain/SubAccountAgg/SubAccount.cs
Normal file
@@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user