Compare commits
23 Commits
Feature/Ch
...
Feature/CW
| Author | SHA1 | Date | |
|---|---|---|---|
| fb1db062f3 | |||
| 9271cb5c66 | |||
| aee7e5ce82 | |||
| 97b4c7dc66 | |||
| e3b6d5f1c9 | |||
| 7c1fe65cf2 | |||
| f26fcba165 | |||
|
|
de2a6203df | ||
|
|
2208834a0e | ||
| de52a0be98 | |||
|
|
5bebec3fde | ||
|
|
cad808d73c | ||
| abef053f56 | |||
| 6469bf5a50 | |||
|
|
4fd5ef52ef | ||
|
|
61e2bdaaf5 | ||
| 8ab22d9948 | |||
|
|
17b5f5fee5 | ||
| 9e7e4ca655 | |||
|
|
100c9367ed | ||
| fdb6799c65 | |||
|
|
c81da3e787 | ||
|
|
d8c0471878 |
@@ -12,65 +12,65 @@ namespace _0_Framework.Application;
|
||||
|
||||
public class AuthHelper : IAuthHelper
|
||||
{
|
||||
private readonly IHttpContextAccessor _contextAccessor;
|
||||
|
||||
public AuthHelper(IHttpContextAccessor contextAccessor)
|
||||
{
|
||||
_contextAccessor = contextAccessor;
|
||||
}
|
||||
private readonly IHttpContextAccessor _contextAccessor;
|
||||
|
||||
public AuthViewModel CurrentAccountInfo()
|
||||
{
|
||||
var result = new AuthViewModel();
|
||||
if (!IsAuthenticated())
|
||||
return result;
|
||||
public AuthHelper(IHttpContextAccessor contextAccessor)
|
||||
{
|
||||
_contextAccessor = contextAccessor;
|
||||
}
|
||||
|
||||
var claims = _contextAccessor.HttpContext.User.Claims.ToList();
|
||||
result.Id = long.Parse(claims.FirstOrDefault(x => x.Type == "AccountId").Value);
|
||||
result.Username = claims.FirstOrDefault(x => x.Type == "Username")?.Value;
|
||||
result.ProfilePhoto = claims.FirstOrDefault(x => x.Type == "ProfilePhoto")?.Value;
|
||||
result.RoleId = long.Parse(claims.FirstOrDefault(x => x.Type == ClaimTypes.Role)?.Value);
|
||||
result.Fullname = claims.FirstOrDefault(x => x.Type == ClaimTypes.Name)?.Value;
|
||||
result.Role = claims.FirstOrDefault(x => x.Type == "RoleName")?.Value;
|
||||
result.ClientAriaPermission =claims.FirstOrDefault(x => x.Type == "ClientAriaPermission").Value;
|
||||
result.AdminAreaPermission = claims.FirstOrDefault(x => x.Type == "AdminAreaPermission").Value;
|
||||
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.WorkshopSlug = claims.FirstOrDefault(x => x is { Type: "WorkshopSlug" }).Value;
|
||||
result.Mobile = claims.FirstOrDefault(x => x is { Type: "Mobile" }).Value;
|
||||
public AuthViewModel CurrentAccountInfo()
|
||||
{
|
||||
var result = new AuthViewModel();
|
||||
if (!IsAuthenticated())
|
||||
return result;
|
||||
|
||||
var claims = _contextAccessor.HttpContext.User.Claims.ToList();
|
||||
result.Id = long.Parse(claims.FirstOrDefault(x => x.Type == "AccountId").Value);
|
||||
result.Username = claims.FirstOrDefault(x => x.Type == "Username")?.Value;
|
||||
result.ProfilePhoto = claims.FirstOrDefault(x => x.Type == "ProfilePhoto")?.Value;
|
||||
result.RoleId = long.Parse(claims.FirstOrDefault(x => x.Type == ClaimTypes.Role)?.Value);
|
||||
result.Fullname = claims.FirstOrDefault(x => x.Type == ClaimTypes.Name)?.Value;
|
||||
result.Role = claims.FirstOrDefault(x => x.Type == "RoleName")?.Value;
|
||||
result.ClientAriaPermission = claims.FirstOrDefault(x => x.Type == "ClientAriaPermission").Value;
|
||||
result.AdminAreaPermission = claims.FirstOrDefault(x => x.Type == "AdminAreaPermission").Value;
|
||||
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.WorkshopSlug = claims.FirstOrDefault(x => x is { Type: "WorkshopSlug" }).Value;
|
||||
result.Mobile = claims.FirstOrDefault(x => x is { Type: "Mobile" }).Value;
|
||||
result.SubAccountId = long.Parse(claims.FirstOrDefault(x => x.Type == "SubAccountId").Value);
|
||||
result.WorkshopName = claims.FirstOrDefault(x => x is { Type: "WorkshopName" })?.Value;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
public List<int> GetPermissions()
|
||||
{
|
||||
if (!IsAuthenticated())
|
||||
return new List<int>();
|
||||
public List<int> GetPermissions()
|
||||
{
|
||||
if (!IsAuthenticated())
|
||||
return new List<int>();
|
||||
|
||||
var permissions = _contextAccessor.HttpContext.User.Claims.FirstOrDefault(x => x.Type == "permissions")
|
||||
?.Value;
|
||||
return Tools.DeserializeFromBsonList<int>(permissions); //Mahan
|
||||
}
|
||||
var permissions = _contextAccessor.HttpContext.User.Claims.FirstOrDefault(x => x.Type == "permissions")
|
||||
?.Value;
|
||||
return Tools.DeserializeFromBsonList<int>(permissions); //Mahan
|
||||
}
|
||||
|
||||
public long CurrentAccountId()
|
||||
{
|
||||
return IsAuthenticated()
|
||||
? long.Parse(_contextAccessor.HttpContext.User.Claims.First(x => x.Type == "AccountId")?.Value)
|
||||
: 0;
|
||||
}
|
||||
public long CurrentSubAccountId()
|
||||
{
|
||||
return IsAuthenticated()
|
||||
? long.Parse(_contextAccessor.HttpContext.User.Claims.First(x => x.Type == "SubAccountId")?.Value)
|
||||
: 0;
|
||||
}
|
||||
public long CurrentAccountId()
|
||||
{
|
||||
return IsAuthenticated()
|
||||
? long.Parse(_contextAccessor.HttpContext.User.Claims.First(x => x.Type == "AccountId")?.Value)
|
||||
: 0;
|
||||
}
|
||||
public long CurrentSubAccountId()
|
||||
{
|
||||
return IsAuthenticated()
|
||||
? long.Parse(_contextAccessor.HttpContext.User.Claims.First(x => x.Type == "SubAccountId")?.Value)
|
||||
: 0;
|
||||
}
|
||||
public string CurrentAccountMobile()
|
||||
{
|
||||
return IsAuthenticated()
|
||||
? _contextAccessor.HttpContext.User.Claims.First(x => x.Type == "Mobile")?.Value
|
||||
: "";
|
||||
}
|
||||
{
|
||||
return IsAuthenticated()
|
||||
? _contextAccessor.HttpContext.User.Claims.First(x => x.Type == "Mobile")?.Value
|
||||
: "";
|
||||
}
|
||||
|
||||
#region Vafa
|
||||
|
||||
@@ -111,160 +111,166 @@ public class AuthHelper : IAuthHelper
|
||||
}
|
||||
|
||||
public string GetWorkshopSlug()
|
||||
{
|
||||
return CurrentAccountInfo().ClientAriaPermission == "true"
|
||||
? _contextAccessor.HttpContext.User.Claims.First(x => x.Type == "WorkshopSlug")?.Value
|
||||
: "";
|
||||
}
|
||||
public string GetWorkshopName()
|
||||
{
|
||||
var workshopName = _contextAccessor.HttpContext.User.Claims.FirstOrDefault(x => x.Type == "ClientAriaPermission")?.Value == "true";
|
||||
if (workshopName)
|
||||
{
|
||||
return _contextAccessor.HttpContext.User.Claims.First(x => x.Type == "WorkshopName")?.Value;
|
||||
}
|
||||
{
|
||||
return CurrentAccountInfo().ClientAriaPermission == "true"
|
||||
? _contextAccessor.HttpContext.User.Claims.First(x => x.Type == "WorkshopSlug")?.Value
|
||||
: "";
|
||||
}
|
||||
public string GetWorkshopName()
|
||||
{
|
||||
var workshopName = _contextAccessor.HttpContext.User.Claims.FirstOrDefault(x => x.Type == "ClientAriaPermission")?.Value == "true";
|
||||
if (workshopName)
|
||||
{
|
||||
return _contextAccessor.HttpContext.User.Claims.First(x => x.Type == "WorkshopName")?.Value;
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
public string CurrentAccountRole()
|
||||
{
|
||||
if (IsAuthenticated())
|
||||
return _contextAccessor.HttpContext.User.Claims.FirstOrDefault(x => x.Type == ClaimTypes.Role)?.Value;
|
||||
return null;
|
||||
}
|
||||
{
|
||||
if (IsAuthenticated())
|
||||
return _contextAccessor.HttpContext.User.Claims.FirstOrDefault(x => x.Type == ClaimTypes.Role)?.Value;
|
||||
return null;
|
||||
}
|
||||
|
||||
public bool IsAuthenticated()
|
||||
{
|
||||
return _contextAccessor.HttpContext.User.Identity.IsAuthenticated;
|
||||
//var claims = _contextAccessor.HttpContext.User.Claims.ToList();
|
||||
//if (claims.Count > 0)
|
||||
// return true;
|
||||
//return false;
|
||||
//return claims.Count > 0;
|
||||
}
|
||||
public bool IsAuthenticated()
|
||||
{
|
||||
return _contextAccessor.HttpContext.User.Identity.IsAuthenticated;
|
||||
//var claims = _contextAccessor.HttpContext.User.Claims.ToList();
|
||||
//if (claims.Count > 0)
|
||||
// return true;
|
||||
//return false;
|
||||
//return claims.Count > 0;
|
||||
}
|
||||
|
||||
public void Signin(AuthViewModel account)
|
||||
{
|
||||
#region MahanChanges
|
||||
public void Signin(AuthViewModel account)
|
||||
{
|
||||
#region MahanChanges
|
||||
|
||||
var permissions = account.Permissions is { Count: > 0 } ? Tools.SerializeToBson(account.Permissions) : "";
|
||||
var workshopBson = account.WorkshopList is { Count: > 0 } ? Tools.SerializeToBson(account.WorkshopList) : "";
|
||||
var slug = account.WorkshopSlug ?? "";
|
||||
if (account.Id == 322)
|
||||
account.Permissions.AddRange([3060301, 30603, 30604, 30605]);
|
||||
|
||||
#endregion
|
||||
var permissions = account.Permissions is { Count: > 0 } ? Tools.SerializeToBson(account.Permissions) : "";
|
||||
|
||||
var claims = new List<Claim>
|
||||
{
|
||||
new Claim("AccountId", account.Id.ToString()),
|
||||
new Claim(ClaimTypes.Name, account.Fullname),
|
||||
new Claim(ClaimTypes.Role, account.RoleId.ToString()),
|
||||
new Claim("Username", account.Username), // Or Use ClaimTypes.NameIdentifier
|
||||
|
||||
|
||||
var workshopBson = account.WorkshopList is { Count: > 0 } ? Tools.SerializeToBson(account.WorkshopList) : "";
|
||||
var slug = account.WorkshopSlug ?? "";
|
||||
|
||||
#endregion
|
||||
|
||||
var claims = new List<Claim>
|
||||
{
|
||||
new Claim("AccountId", account.Id.ToString()),
|
||||
new Claim(ClaimTypes.Name, account.Fullname),
|
||||
new Claim(ClaimTypes.Role, account.RoleId.ToString()),
|
||||
new Claim("Username", account.Username), // Or Use ClaimTypes.NameIdentifier
|
||||
new Claim("permissions", permissions),
|
||||
new Claim("Mobile", account.Mobile),
|
||||
new Claim("ProfilePhoto", account.ProfilePhoto ),
|
||||
new Claim("RoleName", account.RoleName),
|
||||
new Claim("SubAccountId", account.SubAccountId.ToString()),
|
||||
new Claim("Mobile", account.Mobile),
|
||||
new Claim("ProfilePhoto", account.ProfilePhoto ),
|
||||
new Claim("RoleName", account.RoleName),
|
||||
new Claim("SubAccountId", account.SubAccountId.ToString()),
|
||||
new Claim("AdminAreaPermission", account.AdminAreaPermission.ToString()),
|
||||
new Claim("ClientAriaPermission", account.ClientAriaPermission.ToString()),
|
||||
new Claim("IsCamera", "false"),
|
||||
new Claim("PositionValue",account.PositionValue.ToString()),
|
||||
new Claim("ClientAriaPermission", account.ClientAriaPermission.ToString()),
|
||||
new Claim("IsCamera", "false"),
|
||||
new Claim("PositionValue",account.PositionValue.ToString()),
|
||||
//mahanChanges
|
||||
new("workshopList",workshopBson),
|
||||
new("WorkshopSlug",slug),
|
||||
new("WorkshopName",account.WorkshopName??"")
|
||||
new("WorkshopSlug",slug),
|
||||
new("WorkshopName",account.WorkshopName??"")
|
||||
|
||||
};
|
||||
|
||||
var claimsIdentity = new ClaimsIdentity(claims, CookieAuthenticationDefaults.AuthenticationScheme);
|
||||
var claimsIdentity = new ClaimsIdentity(claims, CookieAuthenticationDefaults.AuthenticationScheme);
|
||||
|
||||
var authProperties = new AuthenticationProperties
|
||||
{
|
||||
ExpiresUtc = DateTimeOffset.UtcNow.AddDays(1)
|
||||
};
|
||||
var authProperties = new AuthenticationProperties
|
||||
{
|
||||
ExpiresUtc = DateTimeOffset.UtcNow.AddDays(1)
|
||||
};
|
||||
|
||||
_contextAccessor.HttpContext.SignInAsync(CookieAuthenticationDefaults.AuthenticationScheme,
|
||||
new ClaimsPrincipal(claimsIdentity),
|
||||
authProperties);
|
||||
}
|
||||
_contextAccessor.HttpContext.SignInAsync(CookieAuthenticationDefaults.AuthenticationScheme,
|
||||
new ClaimsPrincipal(claimsIdentity),
|
||||
authProperties);
|
||||
}
|
||||
|
||||
#region Camera
|
||||
public void CameraSignIn(CameraAuthViewModel account)
|
||||
{
|
||||
var claims = new List<Claim>
|
||||
{
|
||||
new Claim("AccountId", account.Id.ToString()),
|
||||
new Claim("Username", account.Username), // Or Use ClaimTypes.NameIdentifier
|
||||
#region Camera
|
||||
public void CameraSignIn(CameraAuthViewModel account)
|
||||
{
|
||||
var claims = new List<Claim>
|
||||
{
|
||||
new Claim("AccountId", account.Id.ToString()),
|
||||
new Claim("Username", account.Username), // Or Use ClaimTypes.NameIdentifier
|
||||
new Claim("WorkshopId", account.WorkshopId.ToString()),
|
||||
new Claim("WorkshopName", account.WorkshopName),
|
||||
new Claim("Mobile", account.Mobile),
|
||||
new Claim("AccountId", account.AccountId.ToString()),
|
||||
new Claim("IsActiveString", account.IsActiveString),
|
||||
new Claim("IsCamera", "true"),
|
||||
new Claim("WorkshopName", account.WorkshopName),
|
||||
new Claim("Mobile", account.Mobile),
|
||||
new Claim("AccountId", account.AccountId.ToString()),
|
||||
new Claim("IsActiveString", account.IsActiveString),
|
||||
new Claim("IsCamera", "true"),
|
||||
|
||||
};
|
||||
var claimsIdentity = new ClaimsIdentity(claims, CookieAuthenticationDefaults.AuthenticationScheme);
|
||||
};
|
||||
var claimsIdentity = new ClaimsIdentity(claims, CookieAuthenticationDefaults.AuthenticationScheme);
|
||||
|
||||
var authProperties = new AuthenticationProperties
|
||||
{
|
||||
var authProperties = new AuthenticationProperties
|
||||
{
|
||||
|
||||
//ExpiresUtc = DateTimeOffset.UtcNow.AddDays(30)
|
||||
ExpiresUtc = new DateTimeOffset(year: 2100, month: 1, day: 1, hour: 0, minute: 0, second: 0, offset: TimeSpan.Zero)
|
||||
};
|
||||
//ExpiresUtc = DateTimeOffset.UtcNow.AddDays(30)
|
||||
ExpiresUtc = new DateTimeOffset(year: 2100, month: 1, day: 1, hour: 0, minute: 0, second: 0, offset: TimeSpan.Zero)
|
||||
};
|
||||
|
||||
_contextAccessor.HttpContext.SignInAsync(CookieAuthenticationDefaults.AuthenticationScheme,
|
||||
new ClaimsPrincipal(claimsIdentity),
|
||||
authProperties);
|
||||
}
|
||||
_contextAccessor.HttpContext.SignInAsync(CookieAuthenticationDefaults.AuthenticationScheme,
|
||||
new ClaimsPrincipal(claimsIdentity),
|
||||
authProperties);
|
||||
}
|
||||
|
||||
public CameraAuthViewModel CameraAccountInfo()
|
||||
{
|
||||
var result = new CameraAuthViewModel();
|
||||
if (!IsAuthenticated())
|
||||
return result;
|
||||
public CameraAuthViewModel CameraAccountInfo()
|
||||
{
|
||||
var result = new CameraAuthViewModel();
|
||||
if (!IsAuthenticated())
|
||||
return result;
|
||||
|
||||
var claims = _contextAccessor.HttpContext.User.Claims.ToList();
|
||||
result.Id = long.Parse(claims.FirstOrDefault(x => x.Type == "AccountId").Value);
|
||||
result.Username = claims.FirstOrDefault(x => x.Type == "Username")?.Value;
|
||||
result.WorkshopId = long.Parse(claims.FirstOrDefault(x => x.Type == "WorkshopId")?.Value);
|
||||
result.WorkshopName = claims.FirstOrDefault(x => x.Type == "WorkshopName").Value;
|
||||
result.Mobile = claims.FirstOrDefault(x => x.Type == "Mobile").Value;
|
||||
result.AccountId = long.Parse(claims.FirstOrDefault(x => x.Type == "AccountId")?.Value);
|
||||
result.IsActiveString = claims.FirstOrDefault(x => x.Type == "IsActiveString").Value;
|
||||
return result;
|
||||
}
|
||||
#endregion
|
||||
var claims = _contextAccessor.HttpContext.User.Claims.ToList();
|
||||
result.Id = long.Parse(claims.FirstOrDefault(x => x.Type == "AccountId").Value);
|
||||
result.Username = claims.FirstOrDefault(x => x.Type == "Username")?.Value;
|
||||
result.WorkshopId = long.Parse(claims.FirstOrDefault(x => x.Type == "WorkshopId")?.Value);
|
||||
result.WorkshopName = claims.FirstOrDefault(x => x.Type == "WorkshopName").Value;
|
||||
result.Mobile = claims.FirstOrDefault(x => x.Type == "Mobile").Value;
|
||||
result.AccountId = long.Parse(claims.FirstOrDefault(x => x.Type == "AccountId")?.Value);
|
||||
result.IsActiveString = claims.FirstOrDefault(x => x.Type == "IsActiveString").Value;
|
||||
return result;
|
||||
}
|
||||
#endregion
|
||||
|
||||
public void SignOut()
|
||||
{
|
||||
_contextAccessor.HttpContext.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme);
|
||||
}
|
||||
public void SignOut()
|
||||
{
|
||||
_contextAccessor.HttpContext.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme);
|
||||
}
|
||||
|
||||
|
||||
#region Pooya
|
||||
#region Pooya
|
||||
|
||||
public (long Id, UserType userType, long roleId) GetUserTypeWithId()
|
||||
{
|
||||
if (!IsAuthenticated())
|
||||
return (0, UserType.Anonymous, 0);
|
||||
var claims = _contextAccessor.HttpContext.User.Claims.ToList();
|
||||
public (long Id, UserType userType, long roleId) GetUserTypeWithId()
|
||||
{
|
||||
if (!IsAuthenticated())
|
||||
return (0, UserType.Anonymous, 0);
|
||||
var claims = _contextAccessor.HttpContext.User.Claims.ToList();
|
||||
|
||||
var subAccountId = long.Parse(claims.FirstOrDefault(x => x.Type == "SubAccountId")?.Value ?? "0");
|
||||
if (subAccountId > 0)
|
||||
return (subAccountId, UserType.SubAccount, 0);
|
||||
var subAccountId = long.Parse(claims.FirstOrDefault(x => x.Type == "SubAccountId")?.Value ?? "0");
|
||||
if (subAccountId > 0)
|
||||
return (subAccountId, UserType.SubAccount, 0);
|
||||
|
||||
var id = long.Parse(_contextAccessor.HttpContext.User.Claims.First(x => x.Type == "AccountId")?.Value);
|
||||
if (claims.FirstOrDefault(x => x.Type == "AdminAreaPermission")?.Value == "true")
|
||||
{
|
||||
var roleId = long.Parse(claims.FirstOrDefault(x => x.Type == ClaimTypes.Role)?.Value ?? "0");
|
||||
return (id, UserType.Admin, roleId);
|
||||
}
|
||||
var id = long.Parse(_contextAccessor.HttpContext.User.Claims.First(x => x.Type == "AccountId")?.Value);
|
||||
if (claims.FirstOrDefault(x => x.Type == "AdminAreaPermission")?.Value == "true")
|
||||
{
|
||||
var roleId = long.Parse(claims.FirstOrDefault(x => x.Type == ClaimTypes.Role)?.Value ?? "0");
|
||||
return (id, UserType.Admin, roleId);
|
||||
}
|
||||
|
||||
return (id, UserType.Client, 0);
|
||||
}
|
||||
#endregion
|
||||
return (id, UserType.Client, 0);
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
}
|
||||
@@ -385,11 +385,27 @@
|
||||
/// </summary>
|
||||
public const int SetWorkshopWorkingHoursPermissionCode = 10606;
|
||||
|
||||
#region حساب کاربری دوربین
|
||||
|
||||
/// <summary>
|
||||
/// تنظیمات حساب کاربری دوربین
|
||||
/// </summary>
|
||||
public const int CameraAccountSettingsPermissionCode = 10607;
|
||||
|
||||
/// <summary>
|
||||
/// فعال/غیرفعال اکانت دوربین
|
||||
/// </summary>
|
||||
public const int CameraAccountActivationBtnPermissionCode = 1060701;
|
||||
|
||||
/// <summary>
|
||||
/// ویرایش اکانت دوربین
|
||||
/// </summary>
|
||||
public const int CameraAccountEditPermissionCode = 1060702;
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region کارپوشه
|
||||
@@ -744,6 +760,22 @@
|
||||
Code = CameraAccountSettingsPermissionCode,
|
||||
ParentId = RollCallOperationsPermissionCode
|
||||
};
|
||||
|
||||
public static SubAccountPermissionDto CameraAccountActivationBtn { get; } = new()
|
||||
{
|
||||
Id = CameraAccountActivationBtnPermissionCode,
|
||||
Name = "فعال/غیرفعال حساب کاربری دوربین",
|
||||
Code = CameraAccountActivationBtnPermissionCode,
|
||||
ParentId = CameraAccountSettingsPermissionCode
|
||||
};
|
||||
|
||||
public static SubAccountPermissionDto CameraAccountEdit { get; } = new()
|
||||
{
|
||||
Id = CameraAccountEditPermissionCode,
|
||||
Name = "ویراش حساب کاربری دوربین",
|
||||
Code = CameraAccountEditPermissionCode,
|
||||
ParentId = CameraAccountSettingsPermissionCode
|
||||
};
|
||||
#endregion
|
||||
|
||||
#region کارپوشه,ParentId = WorkFlowOperationsPermissionCode
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using _0_Framework.Domain.CustomizeCheckoutShared.Enums;
|
||||
using _0_Framework.Domain.CustomizeCheckoutShared.ValueObjects;
|
||||
using Microsoft.EntityFrameworkCore.Design.Internal;
|
||||
@@ -12,8 +14,7 @@ public class BaseCustomizeEntity : EntityBase
|
||||
}
|
||||
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,int leavePermittedDays)
|
||||
FamilyAllowance familyAllowance, LeavePay leavePay, InsuranceDeduction insuranceDeduction, FineAbsenceDeduction fineAbsenceDeduction, LateToWork lateToWork, EarlyExit earlyExit, HolidayWork holidayWork, BreakTime breakTime,int leavePermittedDays,List<WeeklyOffDay> weeklyOffDays)
|
||||
{
|
||||
|
||||
FridayPay = fridayPay;
|
||||
@@ -29,10 +30,10 @@ public class BaseCustomizeEntity : EntityBase
|
||||
FineAbsenceDeduction = fineAbsenceDeduction;
|
||||
LateToWork = lateToWork;
|
||||
EarlyExit = earlyExit;
|
||||
FridayWork = fridayWork;
|
||||
HolidayWork = holidayWork;
|
||||
BreakTime = breakTime;
|
||||
LeavePermittedDays = leavePermittedDays;
|
||||
WeeklyOffDays = weeklyOffDays.Select(x=> new WeeklyOffDay(x.DayOfWeek)).ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -117,4 +118,28 @@ public class BaseCustomizeEntity : EntityBase
|
||||
|
||||
|
||||
public BreakTime BreakTime { get; protected set; }
|
||||
|
||||
public List<WeeklyOffDay> WeeklyOffDays { get; set; }
|
||||
|
||||
public void FridayWorkToWeeklyDayOfWeek()
|
||||
{
|
||||
if (FridayWork == FridayWork.Default && !WeeklyOffDays.Any(x => x.DayOfWeek == DayOfWeek.Friday))
|
||||
{
|
||||
WeeklyOffDays.Add(new WeeklyOffDay(DayOfWeek.Friday));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public class WeeklyOffDay
|
||||
{
|
||||
public WeeklyOffDay(DayOfWeek dayOfWeek)
|
||||
{
|
||||
DayOfWeek = dayOfWeek;
|
||||
}
|
||||
|
||||
public long Id { get; set; }
|
||||
public DayOfWeek DayOfWeek { get; set; }
|
||||
public long ParentId { get; set; }
|
||||
}
|
||||
@@ -16,7 +16,7 @@ public class TaskSchedule:EntityBase
|
||||
UnitType = unitType;
|
||||
UnitNumber = unitNumber;
|
||||
LastEndTaskDate = lastEndTaskDate;
|
||||
IsActive = IsActive.False;
|
||||
IsActive = IsActive.True;
|
||||
}
|
||||
public string Count { get; private set; }
|
||||
public TaskScheduleType Type { get; private set; }
|
||||
|
||||
@@ -27,12 +27,13 @@ public class CustomizeWorkshopEmployeeSettings : BaseCustomizeEntity
|
||||
FineAbsenceDeduction fineAbsenceDeduction, LateToWork lateToWork, EarlyExit earlyExit, long employeeId,
|
||||
long workshopId, double salary, long customizeWorkshopGroupSettingId,
|
||||
ICollection<CustomizeWorkshopEmployeeSettingsShift> customizeWorkshopEmployeeSettingsShifts,
|
||||
FridayWork fridayWork,
|
||||
HolidayWork holidayWork, IrregularShift irregularShift, WorkshopShiftStatus workshopShiftStatus, BreakTime breakTime, int leavePermittedDays, ICollection<CustomizeRotatingShift> rotatingShifts) :
|
||||
HolidayWork holidayWork, IrregularShift irregularShift, WorkshopShiftStatus workshopShiftStatus, BreakTime breakTime,
|
||||
int leavePermittedDays, ICollection<CustomizeRotatingShift> rotatingShifts
|
||||
, List<WeeklyOffDay> weeklyOffDays) :
|
||||
base(fridayPay, overTimePay,
|
||||
baseYearsPay, bonusesPay, nightWorkPay,
|
||||
marriedAllowance, shiftPay, familyAllowance, leavePay, insuranceDeduction, fineAbsenceDeduction, lateToWork,
|
||||
earlyExit, fridayWork, holidayWork, breakTime, leavePermittedDays)
|
||||
earlyExit, holidayWork, breakTime, leavePermittedDays,weeklyOffDays)
|
||||
{
|
||||
CustomizeWorkshopGroupSettingId = customizeWorkshopGroupSettingId;
|
||||
IsSettingChanged = false;
|
||||
@@ -82,7 +83,6 @@ public class CustomizeWorkshopEmployeeSettings : BaseCustomizeEntity
|
||||
/// <param name="fineAbsenceDeduction">جریمه غیبت</param>
|
||||
/// <param name="lateToWork">تاخیر در ورود</param>
|
||||
/// <param name="earlyExit">تعجیل درخروج</param>
|
||||
/// <param name="fridayWork">آیا در روز های جمعه موظف به کار است</param>
|
||||
/// <param name="holidayWork">آیا در تعطیلات رسمی موظف به کار است</param>
|
||||
/// <param name="workshopIrregularShifts">نوع شیفت کاری </param>
|
||||
/// <param name="workshopShiftStatus">آیا شیفت منظم است یا نا منظم</param>
|
||||
@@ -91,7 +91,7 @@ public class CustomizeWorkshopEmployeeSettings : BaseCustomizeEntity
|
||||
NightWorkPay nightWorkPay, MarriedAllowance marriedAllowance, ShiftPay shiftPay,
|
||||
FamilyAllowance familyAllowance, LeavePay leavePay, InsuranceDeduction insuranceDeduction,
|
||||
FineAbsenceDeduction fineAbsenceDeduction, LateToWork lateToWork, EarlyExit earlyExit,
|
||||
FridayWork fridayWork, HolidayWork holidayWork, IrregularShift irregularShift, bool isSettingChange, int leavePermittedDays)
|
||||
HolidayWork holidayWork, IrregularShift irregularShift, bool isSettingChange, int leavePermittedDays)
|
||||
{
|
||||
SetValueObjects(fridayPay, overTimePay, baseYearsPay, bonusesPay
|
||||
, nightWorkPay, marriedAllowance, shiftPay, familyAllowance, leavePay, insuranceDeduction, fineAbsenceDeduction,
|
||||
@@ -99,7 +99,6 @@ public class CustomizeWorkshopEmployeeSettings : BaseCustomizeEntity
|
||||
|
||||
Salary = salary;
|
||||
IsSettingChanged = isSettingChange;
|
||||
FridayWork = fridayWork;
|
||||
HolidayWork = holidayWork;
|
||||
LeavePermittedDays = leavePermittedDays;
|
||||
}
|
||||
@@ -112,8 +111,8 @@ public class CustomizeWorkshopEmployeeSettings : BaseCustomizeEntity
|
||||
public void SimpleEdit(
|
||||
ICollection<CustomizeWorkshopEmployeeSettingsShift> employeeSettingsShift,
|
||||
IrregularShift irregularShift,
|
||||
WorkshopShiftStatus workshopShiftStatus, BreakTime breakTime, bool isShiftChange, FridayWork fridayWork, HolidayWork holidayWork,
|
||||
ICollection<CustomizeRotatingShift> rotatingShifts)
|
||||
WorkshopShiftStatus workshopShiftStatus, BreakTime breakTime, bool isShiftChange,HolidayWork holidayWork,
|
||||
ICollection<CustomizeRotatingShift> rotatingShifts,List<WeeklyOffDay> weeklyOffDays)
|
||||
{
|
||||
BreakTime = new BreakTime(breakTime.HasBreakTimeValue, breakTime.BreakTimeValue);
|
||||
IsShiftChanged = isShiftChange;
|
||||
@@ -126,9 +125,8 @@ public class CustomizeWorkshopEmployeeSettings : BaseCustomizeEntity
|
||||
: new IrregularShift(irregularShift.StartTime, irregularShift.EndTime, irregularShift.WorkshopIrregularShifts);
|
||||
|
||||
CustomizeRotatingShifts = workshopShiftStatus == WorkshopShiftStatus.Rotating ? rotatingShifts : [];
|
||||
|
||||
FridayWork = fridayWork;
|
||||
HolidayWork = holidayWork;
|
||||
WeeklyOffDays = weeklyOffDays;
|
||||
}
|
||||
|
||||
|
||||
@@ -269,4 +267,6 @@ public class CustomizeWorkshopEmployeeSettings : BaseCustomizeEntity
|
||||
|
||||
IsShiftChanged = isShiftChange;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -27,11 +27,12 @@ public class CustomizeWorkshopGroupSettings : 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, WorkshopShiftStatus workshopShiftStatus, IrregularShift irregularShift, int leavePermittedDays, ICollection<CustomizeRotatingShift> rotatingShifts) :
|
||||
FineAbsenceDeduction fineAbsenceDeduction, LateToWork lateToWork, EarlyExit earlyExit,
|
||||
HolidayWork holidayWork, BreakTime breakTime, WorkshopShiftStatus workshopShiftStatus, IrregularShift irregularShift, int leavePermittedDays,
|
||||
ICollection<CustomizeRotatingShift> rotatingShifts, List<WeeklyOffDay> weeklyOffDays) :
|
||||
base(fridayPay, overTimePay, baseYearsPay, bonusesPay, nightWorkPay,
|
||||
marriedAllowance, shiftPay, familyAllowance, leavePay, insuranceDeduction, fineAbsenceDeduction, lateToWork,
|
||||
earlyExit, fridayWork, holidayWork, breakTime, leavePermittedDays)
|
||||
earlyExit, holidayWork, breakTime, leavePermittedDays,weeklyOffDays)
|
||||
{
|
||||
GroupName = groupName;
|
||||
Salary = salary;
|
||||
@@ -76,7 +77,7 @@ public class CustomizeWorkshopGroupSettings : BaseCustomizeEntity
|
||||
NightWorkPay nightWorkPay, MarriedAllowance marriedAllowance, FamilyAllowance familyAllowance,
|
||||
LeavePay leavePay, InsuranceDeduction insuranceDeduction, FineAbsenceDeduction fineAbsenceDeduction,
|
||||
LateToWork lateToWork, EarlyExit earlyExit,
|
||||
ICollection<CustomizeWorkshopGroupSettingsShift> customizeWorkshopGroupSettingsShifts, FridayWork fridayWork,
|
||||
ICollection<CustomizeWorkshopGroupSettingsShift> customizeWorkshopGroupSettingsShifts,
|
||||
HolidayWork holidayWork, IrregularShift irregularShift, ICollection<CustomizeRotatingShift> rotatingShifts,
|
||||
WorkshopShiftStatus workshopShiftStatus, long customizeWorkshopSettingId, BreakTime breakTime, int leavePermittedDays)
|
||||
{
|
||||
@@ -96,7 +97,6 @@ public class CustomizeWorkshopGroupSettings : BaseCustomizeEntity
|
||||
FineAbsenceDeduction = fineAbsenceDeduction;
|
||||
LateToWork = lateToWork;
|
||||
EarlyExit = earlyExit;
|
||||
FridayWork = fridayWork;
|
||||
HolidayWork = holidayWork;
|
||||
LeavePermittedDays = leavePermittedDays;
|
||||
CustomizeWorkshopGroupSettingsShifts = workshopShiftStatus == WorkshopShiftStatus.Regular ? customizeWorkshopGroupSettingsShifts : [];
|
||||
@@ -123,7 +123,7 @@ public class CustomizeWorkshopGroupSettings : BaseCustomizeEntity
|
||||
OverTimePay overTimePay, BaseYearsPay baseYearsPay, BonusesPay bonusesPay, ShiftPay shiftPay,
|
||||
NightWorkPay nightWorkPay, MarriedAllowance marriedAllowance, FamilyAllowance familyAllowance,
|
||||
LeavePay leavePay, InsuranceDeduction insuranceDeduction, FineAbsenceDeduction fineAbsenceDeduction,
|
||||
LateToWork lateToWork, EarlyExit earlyExit, FridayWork fridayWork, HolidayWork holidayWork, bool isSettingChange, int leavePermittedDays)
|
||||
LateToWork lateToWork, EarlyExit earlyExit, HolidayWork holidayWork, bool isSettingChange, int leavePermittedDays)
|
||||
{
|
||||
GroupName = groupName;
|
||||
Salary = salary;
|
||||
@@ -140,7 +140,6 @@ public class CustomizeWorkshopGroupSettings : BaseCustomizeEntity
|
||||
FineAbsenceDeduction = fineAbsenceDeduction;
|
||||
LateToWork = lateToWork;
|
||||
EarlyExit = earlyExit;
|
||||
FridayWork = fridayWork;
|
||||
HolidayWork = holidayWork;
|
||||
IsSettingChange = isSettingChange;
|
||||
LeavePermittedDays = leavePermittedDays;
|
||||
@@ -154,7 +153,7 @@ public class CustomizeWorkshopGroupSettings : BaseCustomizeEntity
|
||||
{
|
||||
item.EditEmployees(Salary, FridayPay, OverTimePay, BaseYearsPay, BonusesPay
|
||||
, NightWorkPay, MarriedAllowance, ShiftPay, FamilyAllowance, LeavePay, InsuranceDeduction, FineAbsenceDeduction,
|
||||
LateToWork, EarlyExit, FridayWork, HolidayWork, IrregularShift, false, leavePermittedDays);
|
||||
LateToWork, EarlyExit, HolidayWork, IrregularShift, false, leavePermittedDays);
|
||||
}
|
||||
}
|
||||
public void EditAndOverwriteOnAllEmployees(string groupName, double salary,
|
||||
@@ -162,14 +161,13 @@ public class CustomizeWorkshopGroupSettings : BaseCustomizeEntity
|
||||
OverTimePay overTimePay, BaseYearsPay baseYearsPay, BonusesPay bonusesPay, ShiftPay shiftPay,
|
||||
NightWorkPay nightWorkPay, MarriedAllowance marriedAllowance, FamilyAllowance familyAllowance,
|
||||
LeavePay leavePay, InsuranceDeduction insuranceDeduction, FineAbsenceDeduction fineAbsenceDeduction,
|
||||
LateToWork lateToWork, EarlyExit earlyExit, FridayWork fridayWork, HolidayWork holidayWork, bool isSettingChange, int leavePermittedDays)
|
||||
LateToWork lateToWork, EarlyExit earlyExit, HolidayWork holidayWork, bool isSettingChange, int leavePermittedDays)
|
||||
{
|
||||
SetValueObjects(fridayPay, overTimePay, baseYearsPay, bonusesPay
|
||||
, nightWorkPay, marriedAllowance, shiftPay, familyAllowance, leavePay, insuranceDeduction, fineAbsenceDeduction,
|
||||
lateToWork, earlyExit);
|
||||
GroupName = groupName;
|
||||
Salary = salary;
|
||||
FridayWork = fridayWork;
|
||||
HolidayWork = holidayWork;
|
||||
IsSettingChange = isSettingChange;
|
||||
LeavePermittedDays = leavePermittedDays;
|
||||
@@ -182,7 +180,7 @@ public class CustomizeWorkshopGroupSettings : BaseCustomizeEntity
|
||||
{
|
||||
item.EditEmployees(Salary, FridayPay, OverTimePay, BaseYearsPay, BonusesPay
|
||||
, NightWorkPay, MarriedAllowance, ShiftPay, FamilyAllowance, LeavePay, InsuranceDeduction, FineAbsenceDeduction,
|
||||
LateToWork, EarlyExit, FridayWork, HolidayWork, IrregularShift, false, leavePermittedDays);
|
||||
LateToWork, EarlyExit, HolidayWork, IrregularShift, false, leavePermittedDays);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -195,7 +193,7 @@ public class CustomizeWorkshopGroupSettings : BaseCustomizeEntity
|
||||
|
||||
public void EditSimpleAndOverwriteOnEmployee(string groupName, IEnumerable<long> employeeIds,
|
||||
ICollection<CustomizeWorkshopGroupSettingsShift> customizeWorkshopGroupSettingsShifts, WorkshopShiftStatus workshopShiftStatus,
|
||||
IrregularShift irregularShift, BreakTime breakTime, bool isShiftChange, FridayWork fridayWork, HolidayWork holidayWork, ICollection<CustomizeRotatingShift> rotatingShifts)
|
||||
IrregularShift irregularShift, BreakTime breakTime, bool isShiftChange, HolidayWork holidayWork, ICollection<CustomizeRotatingShift> rotatingShifts, List<WeeklyOffDay> weeklyOffDays)
|
||||
{
|
||||
GroupName = groupName;
|
||||
CustomizeWorkshopGroupSettingsShifts = workshopShiftStatus == WorkshopShiftStatus.Regular ? customizeWorkshopGroupSettingsShifts : [];
|
||||
@@ -209,9 +207,11 @@ public class CustomizeWorkshopGroupSettings : BaseCustomizeEntity
|
||||
|
||||
BreakTime = new BreakTime(breakTime.HasBreakTimeValue, breakTime.BreakTimeValue);
|
||||
IsShiftChange = isShiftChange;
|
||||
FridayWork = fridayWork;
|
||||
|
||||
HolidayWork = holidayWork;
|
||||
|
||||
WeeklyOffDays = weeklyOffDays;
|
||||
|
||||
//var employeeSettingsShift = customizeWorkshopGroupSettingsShifts
|
||||
// .Select(x => new CustomizeWorkshopEmployeeSettingsShift(x.StartTime, x.EndTime, x.Placement)).ToList();
|
||||
if (isShiftChange)
|
||||
@@ -227,15 +227,15 @@ public class CustomizeWorkshopGroupSettings : BaseCustomizeEntity
|
||||
.ToList();
|
||||
item.SimpleEdit(customizeWorkshopGroupSettingsShifts
|
||||
.Select(x => new CustomizeWorkshopEmployeeSettingsShift(x.StartTime, x.EndTime, x.Placement)).ToList(),
|
||||
IrregularShift, WorkshopShiftStatus, BreakTime, false, FridayWork, HolidayWork, newRotatingShifts);
|
||||
IrregularShift, WorkshopShiftStatus, BreakTime, false, HolidayWork, newRotatingShifts,WeeklyOffDays.ToList());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void EditSimpleAndOverwriteOnAllEmployees(string groupName,
|
||||
ICollection<CustomizeWorkshopGroupSettingsShift> customizeWorkshopGroupSettingsShifts,
|
||||
WorkshopShiftStatus workshopShiftStatus, IrregularShift irregularShift, BreakTime breakTime, bool isShiftChange,
|
||||
FridayWork fridayWork, HolidayWork holidayWork, ICollection<CustomizeRotatingShift> rotatingShifts)
|
||||
WorkshopShiftStatus workshopShiftStatus, IrregularShift irregularShift, BreakTime breakTime, bool isShiftChange,
|
||||
HolidayWork holidayWork, ICollection<CustomizeRotatingShift> rotatingShifts ,List<WeeklyOffDay> weeklyOffDays)
|
||||
{
|
||||
GroupName = groupName;
|
||||
CustomizeWorkshopGroupSettingsShifts = workshopShiftStatus == WorkshopShiftStatus.Regular ? customizeWorkshopGroupSettingsShifts : [];
|
||||
@@ -251,8 +251,8 @@ public class CustomizeWorkshopGroupSettings : BaseCustomizeEntity
|
||||
BreakTime = new BreakTime(breakTime.HasBreakTimeValue, breakTime.BreakTimeValue);
|
||||
IsShiftChange = isShiftChange;
|
||||
HolidayWork = holidayWork;
|
||||
FridayWork = fridayWork;
|
||||
|
||||
WeeklyOffDays = weeklyOffDays;
|
||||
//var employeeSettingsShift = customizeWorkshopGroupSettingsShifts
|
||||
// .Select(x => new CustomizeWorkshopEmployeeSettingsShift(x.StartTime, x.EndTime, x.Placement)).ToList();
|
||||
|
||||
@@ -262,7 +262,7 @@ public class CustomizeWorkshopGroupSettings : BaseCustomizeEntity
|
||||
.ToList();
|
||||
item.SimpleEdit(customizeWorkshopGroupSettingsShifts
|
||||
.Select(x => new CustomizeWorkshopEmployeeSettingsShift(x.StartTime, x.EndTime, x.Placement)).ToList(),
|
||||
irregularShift, workshopShiftStatus, breakTime, false, FridayWork, HolidayWork, newRotatingShifts);
|
||||
irregularShift, workshopShiftStatus, breakTime, false, HolidayWork, newRotatingShifts,WeeklyOffDays.ToList());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -298,13 +298,14 @@ public class CustomizeWorkshopGroupSettings : BaseCustomizeEntity
|
||||
IrregularShift irregularShift = new(IrregularShift.StartTime, IrregularShift.EndTime,
|
||||
IrregularShift.WorkshopIrregularShifts);
|
||||
BreakTime breakTime = new(BreakTime.HasBreakTimeValue, BreakTime.BreakTimeValue);
|
||||
List<WeeklyOffDay> weeklyOffDays = WeeklyOffDays.Select(x => new WeeklyOffDay(x.DayOfWeek)).ToList();
|
||||
|
||||
var rotatingShift = CustomizeRotatingShifts.Select(x => new CustomizeRotatingShift(x.StartTime, x.EndTime)).ToList();
|
||||
|
||||
var customizeWorkshopEmployeeSettings = new CustomizeWorkshopEmployeeSettings(fridayPay, overTimePay, baseYearsPay, bonusesPay, nightWorkPay,
|
||||
marriedAllowance, shiftPay, familyAllowance, leavePay, insuranceDeduction, fineAbsenceDeduction, lateToWork,
|
||||
earlyExit, employeeId, workshopId, Salary, id, shifts, FridayWork, HolidayWork, irregularShift,
|
||||
WorkshopShiftStatus, breakTime, LeavePermittedDays, rotatingShift);
|
||||
earlyExit, employeeId, workshopId, Salary, id, shifts, HolidayWork, irregularShift,
|
||||
WorkshopShiftStatus, breakTime, LeavePermittedDays, rotatingShift, weeklyOffDays);
|
||||
|
||||
CustomizeWorkshopEmployeeSettingsCollection.Add(customizeWorkshopEmployeeSettings);
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ public class CustomizeWorkshopSettings : BaseCustomizeEntity
|
||||
|
||||
public CustomizeWorkshopSettings(long workshopId,
|
||||
ICollection<CustomizeWorkshopSettingsShift> customizeWorkshopSettingsShifts, int leavePermittedDays,
|
||||
WorkshopShiftStatus workshopShiftStatus,FridayWork fridayWork,HolidayWork holidayWork)
|
||||
WorkshopShiftStatus workshopShiftStatus,HolidayWork holidayWork, List<WeeklyOffDay> weeklyOffDays)
|
||||
{
|
||||
FridayPay = new FridayPay(FridayPayType.None, 0);
|
||||
OverTimePay = new OverTimePay(OverTimePayType.None, 0);
|
||||
@@ -38,11 +38,10 @@ public class CustomizeWorkshopSettings : BaseCustomizeEntity
|
||||
OverTimeThresholdMinute = 0;
|
||||
Currency = Currency.Rial;
|
||||
MaxMonthDays = MaxMonthDays.Default;
|
||||
FridayWork = fridayWork;
|
||||
HolidayWork = holidayWork;
|
||||
BonusesPaysInEndOfMonth = BonusesPaysInEndOfYear.EndOfYear;
|
||||
WorkshopShiftStatus = workshopShiftStatus;
|
||||
|
||||
WeeklyOffDays = weeklyOffDays;
|
||||
HolidayWork = holidayWork;
|
||||
if (workshopShiftStatus == WorkshopShiftStatus.Irregular)
|
||||
return;
|
||||
|
||||
@@ -92,8 +91,7 @@ public class CustomizeWorkshopSettings : BaseCustomizeEntity
|
||||
public void Edit(FridayPay fridayPay, OverTimePay overTimePay, BaseYearsPay baseYearsPay, BonusesPay bonusesPay,
|
||||
NightWorkPay nightWorkPay, MarriedAllowance marriedAllowance, ShiftPay shiftPay,
|
||||
FamilyAllowance familyAllowance, LeavePay leavePay, InsuranceDeduction insuranceDeduction,
|
||||
FineAbsenceDeduction fineAbsenceDeduction, LateToWork lateToWork, EarlyExit earlyExit,
|
||||
FridayWork fridayWork, HolidayWork holidayWork, BonusesPaysInEndOfYear bonusesPaysInEndOfYear,
|
||||
FineAbsenceDeduction fineAbsenceDeduction, LateToWork lateToWork, EarlyExit earlyExit, HolidayWork holidayWork, BonusesPaysInEndOfYear bonusesPaysInEndOfYear,
|
||||
int leavePermittedDays, BaseYearsPayInEndOfYear baseYearsPayInEndOfYear, int overTimeThresholdMinute)
|
||||
{
|
||||
FridayPay = fridayPay;
|
||||
@@ -109,7 +107,6 @@ public class CustomizeWorkshopSettings : BaseCustomizeEntity
|
||||
FineAbsenceDeduction = fineAbsenceDeduction;
|
||||
LateToWork = lateToWork;
|
||||
EarlyExit = earlyExit;
|
||||
FridayWork = fridayWork;
|
||||
HolidayWork = holidayWork;
|
||||
BonusesPaysInEndOfMonth = bonusesPaysInEndOfYear;
|
||||
LeavePermittedDays = leavePermittedDays;
|
||||
@@ -127,19 +124,18 @@ public class CustomizeWorkshopSettings : BaseCustomizeEntity
|
||||
}
|
||||
|
||||
public void ChangeWorkshopShifts(ICollection<CustomizeWorkshopSettingsShift> customizeWorkshopSettingsShifts,
|
||||
WorkshopShiftStatus workshopShiftStatus,FridayWork fridayWork,HolidayWork holidayWork)
|
||||
WorkshopShiftStatus workshopShiftStatus,HolidayWork holidayWork, List<WeeklyOffDay> weeklyOffDays)
|
||||
{
|
||||
WorkshopShiftStatus = workshopShiftStatus;
|
||||
HolidayWork = holidayWork;
|
||||
FridayWork = fridayWork;
|
||||
CustomizeWorkshopSettingsShifts = workshopShiftStatus == WorkshopShiftStatus.Regular ? customizeWorkshopSettingsShifts : new List<CustomizeWorkshopSettingsShift>();
|
||||
WeeklyOffDays = weeklyOffDays;
|
||||
|
||||
if (workshopShiftStatus == WorkshopShiftStatus.Regular)
|
||||
{
|
||||
var date = new DateOnly();
|
||||
var firstStartShift = new DateTime(date, CustomizeWorkshopSettingsShifts.MinBy(x => x.Placement).StartTime);
|
||||
var lastEndShift = new DateTime(date, CustomizeWorkshopSettingsShifts.MaxBy(x => x.Placement).EndTime);
|
||||
|
||||
|
||||
if (lastEndShift > firstStartShift)
|
||||
firstStartShift = firstStartShift.AddDays(1);
|
||||
var offSet = (firstStartShift - lastEndShift).Divide(2);
|
||||
|
||||
@@ -52,5 +52,8 @@ public interface ILeftWorkInsuranceRepository : IRepository<long, LeftWorkInsura
|
||||
/// <returns></returns>
|
||||
List<LeftWorkViewModel> GetEmployeesWithContractExitOnly(long workshopId);
|
||||
|
||||
LeftWorkInsurance GetLastLeftWorkByEmployeeIdAndWorkshopId(long workshopId, long employeeId);
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
@@ -16,7 +16,19 @@ namespace Company.Domain.RollCallAgg;
|
||||
public interface IRollCallMandatoryRepository : IRepository<long, RollCall>
|
||||
{
|
||||
ComputingViewModel MandatoryCompute(long employeeId, long workshopId, DateTime contractStart, DateTime contractEnd, CreateWorkingHoursTemp command, bool holidayWorking, bool isStaticCheckout);
|
||||
TimeSpan AfterSubtract(CreateWorkingHoursTemp command, TimeSpan sumOneDaySpan, DateTime creationDate);
|
||||
|
||||
/// <summary>
|
||||
/// محاسبه ساعات کارکرد پرسنل در صورت داشتن حضور غیاب
|
||||
/// </summary>
|
||||
/// <param name="employeeId"></param>
|
||||
/// <param name="workshopId"></param>
|
||||
/// <param name="contractStart"></param>
|
||||
/// <param name="contractEnd"></param>
|
||||
/// <returns></returns>
|
||||
(bool hasRollCall, TimeSpan sumOfSpan) GetRollCallWorkingSpan(long employeeId, long workshopId,
|
||||
DateTime contractStart, DateTime contractEnd);
|
||||
|
||||
TimeSpan AfterSubtract(CreateWorkingHoursTemp command, TimeSpan sumOneDaySpan, DateTime creationDate);
|
||||
|
||||
List<RotatingShiftViewModel> RotatingShiftCheck(List<GroupedRollCalls> rollCallList);
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using _0_Framework.Domain.CustomizeCheckoutShared.Enums;
|
||||
using _0_Framework.Domain.CustomizeCheckoutShared.ValueObjects;
|
||||
@@ -16,8 +17,9 @@ public class CreateCustomizeWorkshopGroupSettings
|
||||
public IrregularShift IrregularShift { get; set; }
|
||||
public BreakTime BreakTime { get; set; }
|
||||
public int LeavePermittedDays { get; set; }
|
||||
public FridayWork FridayWork { get; set; }
|
||||
//public FridayWork FridayWork { get; set; }
|
||||
public HolidayWork HolidayWork { get; set; }
|
||||
public List<DayOfWeek> OffDayOfWeeks { get; set; }
|
||||
public ICollection<CustomizeRotatingShiftsViewModel> CustomizeRotatingShiftsViewModels { get; set; }
|
||||
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using _0_Framework.Domain.CustomizeCheckoutShared.Enums;
|
||||
using System;
|
||||
using _0_Framework.Domain.CustomizeCheckoutShared.Enums;
|
||||
using CompanyManagment.App.Contracts.CustomizeWorkshopSettings.ValueObjectsViewModel;
|
||||
using System.Collections.Generic;
|
||||
using _0_Framework.Domain.CustomizeCheckoutShared.Enums;
|
||||
@@ -20,16 +21,18 @@ public class CreateCustomizeWorkshopSettings
|
||||
public BreakTime BreakTime { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// آیا جمعه کار میکند یا نه
|
||||
/// </summary>
|
||||
public FridayWork FridayWork { get; set; }
|
||||
///// <summary>
|
||||
///// آیا جمعه کار میکند یا نه
|
||||
///// </summary>
|
||||
//public FridayWork FridayWork { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// آیا در روز های تعطیل کار میکند
|
||||
/// </summary>
|
||||
public HolidayWork HolidayWork { get; set; }
|
||||
|
||||
public List<DayOfWeek> OffDays { get; set; }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using _0_Framework.Domain.CustomizeCheckoutShared.Enums;
|
||||
using System;
|
||||
using _0_Framework.Domain.CustomizeCheckoutShared.Enums;
|
||||
using _0_Framework.Domain.CustomizeCheckoutShared.ValueObjects;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -20,7 +21,8 @@ public class CustomizeWorkshopEmployeeSettingsViewModel
|
||||
public bool ChangeSettingEmployeeShiftIsChange { get; set; }
|
||||
public BreakTime BreakTime { get; set; }
|
||||
public HolidayWork HolidayWork { get; set; }
|
||||
public FridayWork FridayWork { get; set; }
|
||||
//public FridayWork FridayWork { get; set; }
|
||||
public int LeavePermittedDays { get; set; }
|
||||
public ICollection<CustomizeRotatingShiftsViewModel> CustomizeRotatingShiftsViewModels { get; set; }
|
||||
public List<DayOfWeek> WeeklyOffDays { get; set; }
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using _0_Framework.Domain.CustomizeCheckoutShared.Enums;
|
||||
using System;
|
||||
using _0_Framework.Domain.CustomizeCheckoutShared.Enums;
|
||||
using CompanyManagment.App.Contracts.CustomizeWorkshopSettings.ValueObjectsViewModel;
|
||||
using System.Collections.Generic;
|
||||
using _0_Framework.Domain.CustomizeCheckoutShared.ValueObjects;
|
||||
@@ -72,17 +73,19 @@ public class EditCustomizeEmployeeSettings:CreateCustomizeEmployeeSettings
|
||||
/// </summary>
|
||||
public EarlyExitViewModel EarlyExit { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// آیا جمعه کار میکند یا نه
|
||||
/// </summary>
|
||||
public FridayWork FridayWork { get; set; }
|
||||
///// <summary>
|
||||
///// آیا جمعه کار میکند یا نه
|
||||
///// </summary>
|
||||
//public FridayWork FridayWork { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// آیا در روز های تعطیل کار میکند
|
||||
/// </summary>
|
||||
public HolidayWork HolidayWork { get; set; }
|
||||
|
||||
public long Id { get; set; }
|
||||
public List<DayOfWeek> WeeklyOffDays { get; set; }
|
||||
|
||||
public long Id { get; set; }
|
||||
public string Salary { get; set; }
|
||||
public string NameGroup { get; set; }
|
||||
public string EmployeeFullName { get; set; }
|
||||
@@ -91,4 +94,5 @@ public class EditCustomizeEmployeeSettings:CreateCustomizeEmployeeSettings
|
||||
public IEnumerable<CustomizeWorkshopShiftViewModel> ShiftViewModel { get; set; }
|
||||
public ICollection<CustomizeRotatingShiftsViewModel> CustomizeRotatingShifts{ get; set; }
|
||||
public BreakTime BreakTime { get; set; }
|
||||
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
using _0_Framework.Domain.CustomizeCheckoutShared.Enums;
|
||||
using System;
|
||||
using _0_Framework.Domain.CustomizeCheckoutShared.Enums;
|
||||
using CompanyManagment.App.Contracts.CustomizeWorkshopSettings.ValueObjectsViewModel;
|
||||
using System.Collections.Generic;
|
||||
using _0_Framework.Domain.CustomizeCheckoutShared.Base;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.CustomizeWorkshopSettings;
|
||||
|
||||
@@ -75,16 +77,18 @@ public class EditCustomizeWorkshopGroupSettings : CreateCustomizeWorkshopGroupSe
|
||||
/// </summary>
|
||||
public EarlyExitViewModel EarlyExit { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// آیا جمعه کار میکند یا نه
|
||||
/// </summary>
|
||||
public FridayWork FridayWork { get; set; }
|
||||
///// <summary>
|
||||
///// آیا جمعه کار میکند یا نه
|
||||
///// </summary>
|
||||
//public FridayWork FridayWork { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// آیا در روز های تعطیل کار میکند
|
||||
/// </summary>
|
||||
public HolidayWork HolidayWork { get; set; }
|
||||
|
||||
//public List<DayOfWeek> WeeklyOffDays { get; set; }
|
||||
|
||||
public bool IsShiftChanged { get; set; }
|
||||
public bool IsSettingChanged { get; set; }
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using _0_Framework.Application;
|
||||
using System;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Domain.CustomizeCheckoutShared.Enums;
|
||||
using _0_Framework.Domain.CustomizeCheckoutShared.ValueObjects;
|
||||
using CompanyManagment.App.Contracts.Employee;
|
||||
@@ -51,11 +52,14 @@ public interface ICustomizeWorkshopSettingsApplication
|
||||
/// </summary>
|
||||
/// <param name="shiftViewModels">شیفت هت</param>
|
||||
/// <param name="customizeWorkshopSettingsId">آیدی تنظیمات کارگاه</param>
|
||||
/// <param name="replaceChangedGroups"></param>
|
||||
/// <param name="workshopShiftStatus"></param>
|
||||
/// <param name="holidayWork"></param>
|
||||
/// <param name="weeklyOffDays"></param>
|
||||
/// <param name="replaceChangedGroups"></param>
|
||||
/// <returns></returns>
|
||||
OperationResult EditWorkshopSettingShifts(List<CustomizeWorkshopShiftViewModel> shiftViewModels,
|
||||
long customizeWorkshopSettingsId,WorkshopShiftStatus workshopShiftStatus,FridayWork fridayWork,HolidayWork holidayWork);
|
||||
long customizeWorkshopSettingsId, WorkshopShiftStatus workshopShiftStatus,
|
||||
HolidayWork holidayWork, List<DayOfWeek> weeklyOffDays);
|
||||
|
||||
// It will Get the Workshop Settings with its groups and the employees of groups.
|
||||
CustomizeWorkshopSettingsViewModel GetWorkshopSettingsByWorkshopId(long workshopId, AuthViewModel auth);
|
||||
|
||||
@@ -38,4 +38,5 @@ public interface IRollCallEmployeeApplication
|
||||
(int activeEmployees, int deActiveEmployees) GetActiveAndDeActiveRollCallEmployees(long workshopId);
|
||||
bool HasEmployees(long workshopId);
|
||||
#endregion
|
||||
|
||||
}
|
||||
@@ -17,5 +17,7 @@ namespace CompanyManagment.App.Contracts.RollCallEmployeeStatus
|
||||
List<RollCallEmployeeStatusViewModel> GetActiveByWorkshopIdInDate(long workshopId, DateTime startDateGr, DateTime endDateGr);
|
||||
|
||||
bool IsActiveInPeriod(long employeeId, long workshopId, DateTime startDate, DateTime endDate);
|
||||
}
|
||||
void SyncRollCallEmployeeWithLeftWork(long rollCallEmployeeId);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -30,6 +30,7 @@ using Company.Domain.CustomizeWorkshopGroupSettingsAgg;
|
||||
using Company.Domain.LeftWorkAgg;
|
||||
using CompanyManagment.App.Contracts.Employee.DTO;
|
||||
using Company.Domain.EmployeeAuthorizeTempAgg;
|
||||
using Company.Domain.LeftWorkInsuranceAgg;
|
||||
|
||||
namespace CompanyManagment.Application;
|
||||
|
||||
@@ -59,8 +60,9 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
||||
private readonly IEmployeeClientTempRepository _employeeClientTempRepository;
|
||||
private readonly ICustomizeWorkshopGroupSettingsRepository _customizeWorkshopGroupSettingsRepository;
|
||||
private readonly IEmployeeAuthorizeTempRepository _employeeAuthorizeTempRepository;
|
||||
private readonly ILeftWorkInsuranceRepository _leftWorkInsuranceRepository ;
|
||||
|
||||
public EmployeeAplication(IEmployeeRepository employeeRepository, CompanyContext context, IWorkshopRepository workShopRepository, IWebHostEnvironment webHostEnvironment, IRollCallEmployeeStatusApplication rollCallEmployeeStatusApplication, IRollCallEmployeeRepository rollCallEmployeeRepository, ICustomizeWorkshopSettingsApplication customizeWorkshopSettingsApplication, IEmployeeDocumentsApplication employeeDocumentsApplication, IEmployeeDocumentsRepository employeeDocumentsRepository, IEmployeeBankInformationApplication employeeBankInformationApplication, ILeftWorkTempRepository leftWorkTempRepository, IUidService uidService, ICustomizeWorkshopEmployeeSettingsRepository customizeWorkshopEmployeeSettingsRepository, IPersonnelCodeRepository personnelCodeRepository, IEmployeeClientTempRepository employeeClientTempRepository, ICustomizeWorkshopGroupSettingsRepository customizeWorkshopGroupSettingsRepository, ILeftWorkRepository leftWorkRepository, IEmployeeAuthorizeTempRepository employeeAuthorizeTempRepository) : base(context)
|
||||
public EmployeeAplication(IEmployeeRepository employeeRepository, CompanyContext context, IWorkshopRepository workShopRepository, IWebHostEnvironment webHostEnvironment, IRollCallEmployeeStatusApplication rollCallEmployeeStatusApplication, IRollCallEmployeeRepository rollCallEmployeeRepository, ICustomizeWorkshopSettingsApplication customizeWorkshopSettingsApplication, IEmployeeDocumentsApplication employeeDocumentsApplication, IEmployeeDocumentsRepository employeeDocumentsRepository, IEmployeeBankInformationApplication employeeBankInformationApplication, ILeftWorkTempRepository leftWorkTempRepository, IUidService uidService, ICustomizeWorkshopEmployeeSettingsRepository customizeWorkshopEmployeeSettingsRepository, IPersonnelCodeRepository personnelCodeRepository, IEmployeeClientTempRepository employeeClientTempRepository, ICustomizeWorkshopGroupSettingsRepository customizeWorkshopGroupSettingsRepository, ILeftWorkRepository leftWorkRepository, IEmployeeAuthorizeTempRepository employeeAuthorizeTempRepository, ILeftWorkInsuranceRepository leftWorkInsuranceRepository) : base(context)
|
||||
{
|
||||
_context = context;
|
||||
_WorkShopRepository = workShopRepository;
|
||||
@@ -77,6 +79,7 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
||||
_employeeClientTempRepository = employeeClientTempRepository;
|
||||
_leftWorkRepository = leftWorkRepository;
|
||||
_employeeAuthorizeTempRepository = employeeAuthorizeTempRepository;
|
||||
_leftWorkInsuranceRepository = leftWorkInsuranceRepository;
|
||||
_EmployeeRepository = employeeRepository;
|
||||
}
|
||||
|
||||
@@ -1009,7 +1012,9 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
||||
var startLeftWork = command.StartLeftWork.ToGeorgianDateTime();
|
||||
|
||||
var leftWorkViewModel = _leftWorkRepository.GetLastLeftWorkByEmployeeIdAndWorkshopId(command.WorkshopId, employee.id);
|
||||
PersonnelCodeDomain personnelCode = null;
|
||||
|
||||
|
||||
PersonnelCodeDomain personnelCode = null;
|
||||
if (leftWorkViewModel != null)
|
||||
{
|
||||
if (leftWorkViewModel.HasLeft == false && leftWorkViewModel.LeftWorkDate > DateTime.Now)
|
||||
@@ -1024,10 +1029,16 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
|
||||
}
|
||||
else
|
||||
{
|
||||
var lastPersonnelCodeByWorkshop = _personnelCodeRepository.GetLastPersonnelCodeByWorkshop(command.WorkshopId);
|
||||
var insuranceLeftWork =
|
||||
_leftWorkInsuranceRepository.GetLastLeftWorkByEmployeeIdAndWorkshopId(command.WorkshopId, employee.id);
|
||||
if (insuranceLeftWork == null)
|
||||
{
|
||||
var lastPersonnelCodeByWorkshop =
|
||||
_personnelCodeRepository.GetLastPersonnelCodeByWorkshop(command.WorkshopId);
|
||||
|
||||
personnelCode = new PersonnelCodeDomain(command.WorkshopId,
|
||||
employee.id, lastPersonnelCodeByWorkshop + 1);
|
||||
personnelCode = new PersonnelCodeDomain(command.WorkshopId,
|
||||
employee.id, lastPersonnelCodeByWorkshop + 1);
|
||||
}
|
||||
}
|
||||
|
||||
var leftWorkTemp = LeftWorkTemp.CreateStartWork(command.WorkshopId, employee.id, startLeftWork, command.JobId);
|
||||
|
||||
@@ -17,204 +17,206 @@ namespace CompanyManagment.Application;
|
||||
|
||||
public class RollCallEmployeeApplication : IRollCallEmployeeApplication
|
||||
{
|
||||
private readonly IRollCallEmployeeRepository _rollCallEmployeeRepository;
|
||||
private readonly IRollCallEmployeeStatusApplication _rollCallEmployeeStatusApplication;
|
||||
private readonly IEmployeeRepository _employeeRepository;
|
||||
private readonly ILeftWorkRepository _leftWorkRepository;
|
||||
private readonly IRollCallEmployeeStatusRepository _rollCallEmployeeStatusRepository;
|
||||
private readonly IWebHostEnvironment _webHostEnvironment;
|
||||
public RollCallEmployeeApplication(IRollCallEmployeeRepository rollCallEmployeeRepository, IEmployeeRepository employeeRepository, IRollCallEmployeeStatusApplication rollCallEmployeeStatusApplication, ILeftWorkRepository leftWorkRepository, IRollCallEmployeeStatusRepository rollCallEmployeeStatusRepository, IWebHostEnvironment webHostEnvironment)
|
||||
{
|
||||
_rollCallEmployeeRepository = rollCallEmployeeRepository;
|
||||
_employeeRepository = employeeRepository;
|
||||
_rollCallEmployeeStatusApplication = rollCallEmployeeStatusApplication;
|
||||
_leftWorkRepository = leftWorkRepository;
|
||||
_rollCallEmployeeStatusRepository = rollCallEmployeeStatusRepository;
|
||||
_webHostEnvironment = webHostEnvironment;
|
||||
}
|
||||
private readonly IRollCallEmployeeRepository _rollCallEmployeeRepository;
|
||||
private readonly IRollCallEmployeeStatusApplication _rollCallEmployeeStatusApplication;
|
||||
private readonly IEmployeeRepository _employeeRepository;
|
||||
private readonly ILeftWorkRepository _leftWorkRepository;
|
||||
private readonly IRollCallEmployeeStatusRepository _rollCallEmployeeStatusRepository;
|
||||
private readonly IWebHostEnvironment _webHostEnvironment;
|
||||
public RollCallEmployeeApplication(IRollCallEmployeeRepository rollCallEmployeeRepository, IEmployeeRepository employeeRepository, IRollCallEmployeeStatusApplication rollCallEmployeeStatusApplication, ILeftWorkRepository leftWorkRepository, IRollCallEmployeeStatusRepository rollCallEmployeeStatusRepository, IWebHostEnvironment webHostEnvironment)
|
||||
{
|
||||
_rollCallEmployeeRepository = rollCallEmployeeRepository;
|
||||
_employeeRepository = employeeRepository;
|
||||
_rollCallEmployeeStatusApplication = rollCallEmployeeStatusApplication;
|
||||
_leftWorkRepository = leftWorkRepository;
|
||||
_rollCallEmployeeStatusRepository = rollCallEmployeeStatusRepository;
|
||||
_webHostEnvironment = webHostEnvironment;
|
||||
}
|
||||
|
||||
public OperationResult Create(CreateRollCallEmployee command)
|
||||
{
|
||||
var opreation = new OperationResult();
|
||||
public OperationResult Create(CreateRollCallEmployee command)
|
||||
{
|
||||
var opreation = new OperationResult();
|
||||
|
||||
if (_rollCallEmployeeRepository.Exists(x =>
|
||||
x.EmployeeId == command.EmployeeId && x.WorkshopId == command.EmployeeId))
|
||||
return opreation.Succcedded();
|
||||
var fullname = _employeeRepository.GetDetails(command.EmployeeId);
|
||||
if (fullname == null)
|
||||
return opreation.Failed("پرسنل یافت نشد");
|
||||
if (_rollCallEmployeeRepository.Exists(x =>
|
||||
x.EmployeeId == command.EmployeeId && x.WorkshopId == command.EmployeeId))
|
||||
return opreation.Succcedded();
|
||||
var fullname = _employeeRepository.GetDetails(command.EmployeeId);
|
||||
if (fullname == null)
|
||||
return opreation.Failed("پرسنل یافت نشد");
|
||||
var create = new RollCallEmployee(command.WorkshopId, command.EmployeeId, fullname.FName, fullname.LName);
|
||||
_rollCallEmployeeRepository.Create(create);
|
||||
|
||||
if (command.HasUploadedImage == "true")
|
||||
create.HasImage();
|
||||
if (command.HasUploadedImage == "true")
|
||||
create.HasImage();
|
||||
|
||||
_rollCallEmployeeRepository.SaveChanges();
|
||||
return opreation.Succcedded(create.id);
|
||||
_rollCallEmployeeRepository.SaveChanges();
|
||||
return opreation.Succcedded(create.id);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public OperationResult Active(long id)
|
||||
{
|
||||
var opreation = new OperationResult();
|
||||
public OperationResult Active(long id)
|
||||
{
|
||||
var opreation = new OperationResult();
|
||||
|
||||
var emp = _rollCallEmployeeRepository.Get(id);
|
||||
var emp = _rollCallEmployeeRepository.Get(id);
|
||||
|
||||
if (emp == null)
|
||||
return opreation.Failed("پرسنل یافت نشد");
|
||||
if (emp == null)
|
||||
return opreation.Failed("پرسنل یافت نشد");
|
||||
|
||||
if (!_leftWorkRepository.Exists(x => x.EmployeeId == emp.EmployeeId && x.WorkshopId == emp.WorkshopId &&
|
||||
x.StartWorkDate <= DateTime.Now && x.LeftWorkDate > DateTime.Now))
|
||||
return opreation.Failed("کارمند شروع به کار ندارد");
|
||||
if (!_leftWorkRepository.Exists(x => x.EmployeeId == emp.EmployeeId && x.WorkshopId == emp.WorkshopId &&
|
||||
x.StartWorkDate <= DateTime.Now && x.LeftWorkDate > DateTime.Now))
|
||||
return opreation.Failed("کارمند شروع به کار ندارد");
|
||||
|
||||
if (emp.HasUploadedImage == "false")
|
||||
return opreation.Failed("لطفا ابتدا عکس پرسنل را آپلود کنید");
|
||||
if (emp.HasUploadedImage == "false")
|
||||
return opreation.Failed("لطفا ابتدا عکس پرسنل را آپلود کنید");
|
||||
|
||||
using var transaction = new TransactionScope();
|
||||
using var transaction = new TransactionScope();
|
||||
|
||||
emp.Active();
|
||||
|
||||
var operation2 = _rollCallEmployeeStatusApplication.Create(new CreateRollCallEmployeeStatus() { RollCallEmployeeId = id });
|
||||
if (operation2.IsSuccedded == false)
|
||||
return operation2;
|
||||
|
||||
var operation2 = _rollCallEmployeeStatusApplication.Create(new CreateRollCallEmployeeStatus() { RollCallEmployeeId = id });
|
||||
if (operation2.IsSuccedded == false)
|
||||
return operation2;
|
||||
|
||||
_rollCallEmployeeRepository.SaveChanges();
|
||||
transaction.Complete();
|
||||
|
||||
return operation2;
|
||||
}
|
||||
}
|
||||
|
||||
public OperationResult DeActive(long id)
|
||||
{
|
||||
var opreation = new OperationResult();
|
||||
var emp = _rollCallEmployeeRepository.GetWithRollCallStatus(id);
|
||||
if (emp == null)
|
||||
return opreation.Failed("پرسنل یافت نشد");
|
||||
var lastStatus = emp.EmployeesStatus.MaxBy(x => x.StartDate);
|
||||
emp.DeActive();
|
||||
_rollCallEmployeeRepository.SaveChanges();
|
||||
_rollCallEmployeeStatusApplication.Deactivate(lastStatus.id);
|
||||
return opreation.Succcedded();
|
||||
}
|
||||
public OperationResult DeActive(long id)
|
||||
{
|
||||
var opreation = new OperationResult();
|
||||
var emp = _rollCallEmployeeRepository.GetWithRollCallStatus(id);
|
||||
if (emp == null)
|
||||
return opreation.Failed("پرسنل یافت نشد");
|
||||
var lastStatus = emp.EmployeesStatus.MaxBy(x => x.StartDate);
|
||||
emp.DeActive();
|
||||
_rollCallEmployeeRepository.SaveChanges();
|
||||
_rollCallEmployeeStatusApplication.Deactivate(lastStatus.id);
|
||||
return opreation.Succcedded();
|
||||
}
|
||||
|
||||
public OperationResult UploadedImage(long Employeeid, long WorkshopId)
|
||||
{
|
||||
var opreation = new OperationResult();
|
||||
var emp = _rollCallEmployeeRepository.GetByEmployeeIdAndWorkshopId(Employeeid, WorkshopId);
|
||||
if (emp == null)
|
||||
return opreation.Failed("پرسنل یافت نشد");
|
||||
public OperationResult UploadedImage(long Employeeid, long WorkshopId)
|
||||
{
|
||||
var opreation = new OperationResult();
|
||||
var emp = _rollCallEmployeeRepository.GetByEmployeeIdAndWorkshopId(Employeeid, WorkshopId);
|
||||
if (emp == null)
|
||||
return opreation.Failed("پرسنل یافت نشد");
|
||||
|
||||
var rollCall = _rollCallEmployeeRepository.Get(emp.Id);
|
||||
rollCall.HasImage();
|
||||
_rollCallEmployeeRepository.SaveChanges();
|
||||
var path = Path.Combine(_webHostEnvironment.ContentRootPath, "Faces", WorkshopId.ToString(), Employeeid.ToString());
|
||||
var thumbnailPath = Path.Combine(path, "Thumbnail.jpg");
|
||||
try
|
||||
{
|
||||
var thumbnail = Tools.ResizeImage(Path.Combine(path, "1.jpg"), 150, 150);
|
||||
System.IO.File.WriteAllBytes(thumbnailPath, Convert.FromBase64String(thumbnail));
|
||||
}
|
||||
catch
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
var rollCall = _rollCallEmployeeRepository.Get(emp.Id);
|
||||
rollCall.HasImage();
|
||||
_rollCallEmployeeRepository.SaveChanges();
|
||||
var path = Path.Combine(_webHostEnvironment.ContentRootPath, "Faces", WorkshopId.ToString(), Employeeid.ToString());
|
||||
var thumbnailPath = Path.Combine(path, "Thumbnail.jpg");
|
||||
try
|
||||
{
|
||||
var thumbnail = Tools.ResizeImage(Path.Combine(path, "1.jpg"), 150, 150);
|
||||
System.IO.File.WriteAllBytes(thumbnailPath, Convert.FromBase64String(thumbnail));
|
||||
}
|
||||
catch
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
|
||||
return opreation.Succcedded();
|
||||
}
|
||||
return opreation.Succcedded();
|
||||
}
|
||||
|
||||
|
||||
public List<RollCallEmployeeViewModel> GetByWorkshopId(long workshopId)
|
||||
{
|
||||
return _rollCallEmployeeRepository.GetByWorkshopId(workshopId);
|
||||
}
|
||||
public List<RollCallEmployeeViewModel> GetByWorkshopId(long workshopId)
|
||||
{
|
||||
return _rollCallEmployeeRepository.GetByWorkshopId(workshopId);
|
||||
}
|
||||
|
||||
public EditRollCallEmployee GetDetails(long id)
|
||||
{
|
||||
return _rollCallEmployeeRepository.GetDetails(id);
|
||||
}
|
||||
public EditRollCallEmployee GetDetails(long id)
|
||||
{
|
||||
return _rollCallEmployeeRepository.GetDetails(id);
|
||||
}
|
||||
|
||||
public RollCallEmployeeViewModel GetByEmployeeIdAndWorkshopId(long employeeId, long workshopId)
|
||||
{
|
||||
return _rollCallEmployeeRepository.GetByEmployeeIdAndWorkshopId(employeeId, workshopId);
|
||||
}
|
||||
public RollCallEmployeeViewModel GetByEmployeeIdAndWorkshopId(long employeeId, long workshopId)
|
||||
{
|
||||
return _rollCallEmployeeRepository.GetByEmployeeIdAndWorkshopId(employeeId, workshopId);
|
||||
}
|
||||
|
||||
public List<RollCallEmployeeViewModel> GetPersonnelRollCallListPaginate(RollCallEmployeeSearchModel command)
|
||||
{
|
||||
public List<RollCallEmployeeViewModel> GetPersonnelRollCallListPaginate(RollCallEmployeeSearchModel command)
|
||||
{
|
||||
return _rollCallEmployeeRepository.GetPersonnelRollCallListPaginate(command);
|
||||
}
|
||||
|
||||
public int activedPerson(long workshopId)
|
||||
{
|
||||
return _rollCallEmployeeRepository.activedPerson(workshopId);
|
||||
}
|
||||
public int activedPerson(long workshopId)
|
||||
{
|
||||
return _rollCallEmployeeRepository.activedPerson(workshopId);
|
||||
}
|
||||
|
||||
#region Pooya
|
||||
public List<RollCallEmployeeViewModel> GetRollCallEmployeesByWorkshopId(long workshopId)
|
||||
{
|
||||
return _rollCallEmployeeRepository.GetRollCallEmployeesByWorkshopId(workshopId);
|
||||
}
|
||||
public List<RollCallEmployeeViewModel> GetActivePersonnelByWorkshopId(long workshopId)
|
||||
{
|
||||
return _rollCallEmployeeRepository.GetActivePersonnelByWorkshopId(workshopId);
|
||||
}
|
||||
#region Pooya
|
||||
public List<RollCallEmployeeViewModel> GetRollCallEmployeesByWorkshopId(long workshopId)
|
||||
{
|
||||
return _rollCallEmployeeRepository.GetRollCallEmployeesByWorkshopId(workshopId);
|
||||
}
|
||||
public List<RollCallEmployeeViewModel> GetActivePersonnelByWorkshopId(long workshopId)
|
||||
{
|
||||
return _rollCallEmployeeRepository.GetActivePersonnelByWorkshopId(workshopId);
|
||||
}
|
||||
|
||||
|
||||
public bool IsEmployeeRollCallActive(long employeeId, long workshopId)
|
||||
{
|
||||
RollCallEmployeeViewModel rollCallEmployee = _rollCallEmployeeRepository.GetByEmployeeIdAndWorkshopId(employeeId, workshopId);
|
||||
if (rollCallEmployee == null || rollCallEmployee.IsActiveString != "true" || rollCallEmployee.HasUploadedImage != "true")
|
||||
return false;
|
||||
var now = DateTime.Now;
|
||||
return _rollCallEmployeeStatusRepository.Exists(x => x.RollCallEmployeeId == rollCallEmployee.Id && x.StartDate < now && x.EndDate > now);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public List<RollCallEmployeeViewModel> GetEmployeeRollCalls(long workshopId)
|
||||
{
|
||||
return _rollCallEmployeeRepository.GetEmployeeRollCalls(workshopId);
|
||||
}
|
||||
|
||||
public (int activeEmployees, int deActiveEmployees) GetActiveAndDeActiveRollCallEmployees(long workshopId)
|
||||
{
|
||||
return _rollCallEmployeeRepository.GetActiveAndDeActiveRollCallEmployees(workshopId);
|
||||
}
|
||||
|
||||
public List<RollCallEmployeeViewModel> GetPersonnelRollCallListAll(long workshopId)
|
||||
{
|
||||
return _rollCallEmployeeRepository.GetPersonnelRollCallListAll(workshopId);
|
||||
}
|
||||
|
||||
public bool HasEmployees(long workshopId)
|
||||
{
|
||||
return _rollCallEmployeeRepository.HasEmployees(workshopId);
|
||||
}
|
||||
|
||||
public OperationResult ChangeEmployeeRollCallName(long rollCallEmployeeId, string fName, string lName)
|
||||
{
|
||||
OperationResult result = new();
|
||||
if (string.IsNullOrWhiteSpace(lName) || string.IsNullOrWhiteSpace(fName))
|
||||
return result.Failed("نام و نام خانوادگی نمی توانند خالی باشند");
|
||||
fName = fName.Trim();
|
||||
lName = lName.Trim();
|
||||
var fullName = $"{fName} {lName}";
|
||||
var entity = _rollCallEmployeeRepository.Get(rollCallEmployeeId);
|
||||
public bool IsEmployeeRollCallActive(long employeeId, long workshopId)
|
||||
{
|
||||
RollCallEmployeeViewModel rollCallEmployee = _rollCallEmployeeRepository.GetByEmployeeIdAndWorkshopId(employeeId, workshopId);
|
||||
if (rollCallEmployee == null || rollCallEmployee.IsActiveString != "true" || rollCallEmployee.HasUploadedImage != "true")
|
||||
return false;
|
||||
var now = DateTime.Now;
|
||||
return _rollCallEmployeeStatusRepository.Exists(x => x.RollCallEmployeeId == rollCallEmployee.Id && x.StartDate < now && x.EndDate > now);
|
||||
|
||||
|
||||
if (entity == null)
|
||||
return result.Failed(ApplicationMessages.RecordNotFound);
|
||||
|
||||
if (_rollCallEmployeeRepository.Exists(x => x.WorkshopId == entity.WorkshopId && x.EmployeeFullName == fullName && x.id != rollCallEmployeeId))
|
||||
return result.Failed("نام و نام خانوادگی کارمند نمی تواند با نام و نام خانوادگی کارمند دیگری در آن کارگاه یکسان باشد");
|
||||
}
|
||||
|
||||
if (entity.IsActiveString != "true")
|
||||
return result.Failed("امکان تغییر نام برای کارمند غیر فعال وجود ندارد");
|
||||
public List<RollCallEmployeeViewModel> GetEmployeeRollCalls(long workshopId)
|
||||
{
|
||||
return _rollCallEmployeeRepository.GetEmployeeRollCalls(workshopId);
|
||||
}
|
||||
|
||||
public (int activeEmployees, int deActiveEmployees) GetActiveAndDeActiveRollCallEmployees(long workshopId)
|
||||
{
|
||||
return _rollCallEmployeeRepository.GetActiveAndDeActiveRollCallEmployees(workshopId);
|
||||
}
|
||||
|
||||
public List<RollCallEmployeeViewModel> GetPersonnelRollCallListAll(long workshopId)
|
||||
{
|
||||
return _rollCallEmployeeRepository.GetPersonnelRollCallListAll(workshopId);
|
||||
}
|
||||
|
||||
public bool HasEmployees(long workshopId)
|
||||
{
|
||||
return _rollCallEmployeeRepository.HasEmployees(workshopId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public OperationResult ChangeEmployeeRollCallName(long rollCallEmployeeId, string fName, string lName)
|
||||
{
|
||||
OperationResult result = new();
|
||||
if (string.IsNullOrWhiteSpace(lName) || string.IsNullOrWhiteSpace(fName))
|
||||
return result.Failed("نام و نام خانوادگی نمی توانند خالی باشند");
|
||||
fName = fName.Trim();
|
||||
lName = lName.Trim();
|
||||
var fullName = $"{fName} {lName}";
|
||||
var entity = _rollCallEmployeeRepository.Get(rollCallEmployeeId);
|
||||
|
||||
|
||||
entity.ChangeName(fName, lName);
|
||||
_rollCallEmployeeRepository.SaveChanges();
|
||||
return result.Succcedded();
|
||||
}
|
||||
if (entity == null)
|
||||
return result.Failed(ApplicationMessages.RecordNotFound);
|
||||
|
||||
if (_rollCallEmployeeRepository.Exists(x => x.WorkshopId == entity.WorkshopId && x.EmployeeFullName == fullName && x.id != rollCallEmployeeId))
|
||||
return result.Failed("نام و نام خانوادگی کارمند نمی تواند با نام و نام خانوادگی کارمند دیگری در آن کارگاه یکسان باشد");
|
||||
|
||||
if (entity.IsActiveString != "true")
|
||||
return result.Failed("امکان تغییر نام برای کارمند غیر فعال وجود ندارد");
|
||||
|
||||
|
||||
entity.ChangeName(fName, lName);
|
||||
_rollCallEmployeeRepository.SaveChanges();
|
||||
return result.Succcedded();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -134,5 +134,38 @@ namespace CompanyManagment.Application
|
||||
{
|
||||
return _employeeRollCallStatusRepository.GetAll();
|
||||
}
|
||||
}
|
||||
|
||||
public void SyncRollCallEmployeeWithLeftWork(long rollCallEmployeeId)
|
||||
{
|
||||
var rollCallEmployee = _rollCallEmployeeRepository.GetWithRollCallStatus(rollCallEmployeeId);
|
||||
if (rollCallEmployee == null)
|
||||
return;
|
||||
|
||||
var rollCallStatus = rollCallEmployee.EmployeesStatus.MaxBy(x => x.StartDate);
|
||||
|
||||
if (rollCallStatus == null)
|
||||
return;
|
||||
|
||||
var today = DateTime.Today;
|
||||
|
||||
var firstDayOfMonth = today.FindFirstDayOfMonthGr();
|
||||
|
||||
|
||||
|
||||
var employeeId = rollCallEmployee.EmployeeId;
|
||||
var workshopId = rollCallEmployee.WorkshopId;
|
||||
|
||||
var leftWork = _leftWorkRepository.GetLastLeftWorkByEmployeeIdAndWorkshopId(workshopId, employeeId);
|
||||
|
||||
if (leftWork == null)
|
||||
return;
|
||||
|
||||
var startWork = leftWork.StartWorkDate;
|
||||
|
||||
rollCallStatus.Edit(startWork < firstDayOfMonth ? firstDayOfMonth : startWork, rollCallStatus.EndDate);
|
||||
|
||||
_employeeRollCallStatusRepository.SaveChanges();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -228,7 +228,14 @@ public class CustomizeWorkshopEmployeeSettingsMapping : IEntityTypeConfiguration
|
||||
|
||||
});
|
||||
|
||||
builder.OwnsMany(x => x.CustomizeRotatingShifts);
|
||||
builder.OwnsMany(x => x.WeeklyOffDays, offDay =>
|
||||
{
|
||||
offDay.HasKey(x => x.Id);
|
||||
offDay.Property(x => x.DayOfWeek).HasConversion<string>().HasMaxLength(15);
|
||||
offDay.WithOwner().HasForeignKey(x => x.ParentId);
|
||||
});
|
||||
|
||||
builder.OwnsMany(x => x.CustomizeRotatingShifts);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -227,7 +227,15 @@ public class CustomizeWorkshopGroupSettingsMapping : IEntityTypeConfiguration<Cu
|
||||
|
||||
});
|
||||
|
||||
builder.OwnsMany(x => x.CustomizeRotatingShifts);
|
||||
|
||||
builder.OwnsMany(x => x.WeeklyOffDays, offDay =>
|
||||
{
|
||||
offDay.HasKey(x => x.Id);
|
||||
offDay.Property(x => x.DayOfWeek).HasConversion<string>().HasMaxLength(15);
|
||||
offDay.WithOwner().HasForeignKey(x => x.ParentId);
|
||||
});
|
||||
|
||||
builder.OwnsMany(x => x.CustomizeRotatingShifts);
|
||||
|
||||
|
||||
builder.HasOne(x => x.CustomizeWorkshopSettings).WithMany(x => x.CustomizeWorkshopGroupSettingsCollection)
|
||||
|
||||
@@ -221,6 +221,12 @@ public class CustomizeWorkshopSettingsMapping:IEntityTypeConfiguration<Customize
|
||||
|
||||
|
||||
});
|
||||
builder.OwnsMany(x => x.WeeklyOffDays, offDay =>
|
||||
{
|
||||
offDay.HasKey(x => x.Id);
|
||||
offDay.Property(x => x.DayOfWeek).HasConversion<string>().HasMaxLength(15);
|
||||
offDay.WithOwner().HasForeignKey(x => x.ParentId);
|
||||
});
|
||||
|
||||
|
||||
builder.HasMany(x => x.CustomizeWorkshopGroupSettingsCollection).WithOne(x => x.CustomizeWorkshopSettings)
|
||||
|
||||
9744
CompanyManagment.EFCore/Migrations/20250602161025_add offDays to cws.Designer.cs
generated
Normal file
9744
CompanyManagment.EFCore/Migrations/20250602161025_add offDays to cws.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,106 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CompanyManagment.EFCore.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class addoffDaystocws : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "CustomizeWorkshopEmployeeSettings_WeeklyOffDays",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<long>(type: "bigint", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
DayOfWeek = table.Column<string>(type: "nvarchar(15)", maxLength: 15, nullable: false),
|
||||
ParentId = table.Column<long>(type: "bigint", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_CustomizeWorkshopEmployeeSettings_WeeklyOffDays", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_CustomizeWorkshopEmployeeSettings_WeeklyOffDays_CustomizeWorkshopEmployeeSettings_ParentId",
|
||||
column: x => x.ParentId,
|
||||
principalTable: "CustomizeWorkshopEmployeeSettings",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "CustomizeWorkshopGroupSettings_WeeklyOffDays",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<long>(type: "bigint", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
DayOfWeek = table.Column<string>(type: "nvarchar(15)", maxLength: 15, nullable: false),
|
||||
ParentId = table.Column<long>(type: "bigint", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_CustomizeWorkshopGroupSettings_WeeklyOffDays", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_CustomizeWorkshopGroupSettings_WeeklyOffDays_CustomizeWorkshopGroupSettings_ParentId",
|
||||
column: x => x.ParentId,
|
||||
principalTable: "CustomizeWorkshopGroupSettings",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "CustomizeWorkshopSettings_WeeklyOffDays",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<long>(type: "bigint", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
DayOfWeek = table.Column<string>(type: "nvarchar(15)", maxLength: 15, nullable: false),
|
||||
ParentId = table.Column<long>(type: "bigint", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_CustomizeWorkshopSettings_WeeklyOffDays", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_CustomizeWorkshopSettings_WeeklyOffDays_CustomizeWorkshopSettings_ParentId",
|
||||
column: x => x.ParentId,
|
||||
principalTable: "CustomizeWorkshopSettings",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_CustomizeWorkshopEmployeeSettings_WeeklyOffDays_ParentId",
|
||||
table: "CustomizeWorkshopEmployeeSettings_WeeklyOffDays",
|
||||
column: "ParentId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_CustomizeWorkshopGroupSettings_WeeklyOffDays_ParentId",
|
||||
table: "CustomizeWorkshopGroupSettings_WeeklyOffDays",
|
||||
column: "ParentId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_CustomizeWorkshopSettings_WeeklyOffDays_ParentId",
|
||||
table: "CustomizeWorkshopSettings_WeeklyOffDays",
|
||||
column: "ParentId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "CustomizeWorkshopEmployeeSettings_WeeklyOffDays");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "CustomizeWorkshopGroupSettings_WeeklyOffDays");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "CustomizeWorkshopSettings_WeeklyOffDays");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7433,6 +7433,32 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
.HasForeignKey("CustomizeWorkshopEmployeeSettingsid");
|
||||
});
|
||||
|
||||
b.OwnsMany("_0_Framework.Domain.CustomizeCheckoutShared.Base.WeeklyOffDay", "WeeklyOffDays", b1 =>
|
||||
{
|
||||
b1.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b1.Property<long>("Id"));
|
||||
|
||||
b1.Property<string>("DayOfWeek")
|
||||
.IsRequired()
|
||||
.HasMaxLength(15)
|
||||
.HasColumnType("nvarchar(15)");
|
||||
|
||||
b1.Property<long>("ParentId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b1.HasKey("Id");
|
||||
|
||||
b1.HasIndex("ParentId");
|
||||
|
||||
b1.ToTable("CustomizeWorkshopEmployeeSettings_WeeklyOffDays");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("ParentId");
|
||||
});
|
||||
|
||||
b.Navigation("BaseYearsPay");
|
||||
|
||||
b.Navigation("BonusesPay");
|
||||
@@ -7468,6 +7494,8 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
b.Navigation("OverTimePay");
|
||||
|
||||
b.Navigation("ShiftPay");
|
||||
|
||||
b.Navigation("WeeklyOffDays");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Company.Domain.CustomizeWorkshopGroupSettingsAgg.Entities.CustomizeWorkshopGroupSettings", b =>
|
||||
@@ -7991,6 +8019,32 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
.HasForeignKey("CustomizeWorkshopGroupSettingsid");
|
||||
});
|
||||
|
||||
b.OwnsMany("_0_Framework.Domain.CustomizeCheckoutShared.Base.WeeklyOffDay", "WeeklyOffDays", b1 =>
|
||||
{
|
||||
b1.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b1.Property<long>("Id"));
|
||||
|
||||
b1.Property<string>("DayOfWeek")
|
||||
.IsRequired()
|
||||
.HasMaxLength(15)
|
||||
.HasColumnType("nvarchar(15)");
|
||||
|
||||
b1.Property<long>("ParentId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b1.HasKey("Id");
|
||||
|
||||
b1.HasIndex("ParentId");
|
||||
|
||||
b1.ToTable("CustomizeWorkshopGroupSettings_WeeklyOffDays");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("ParentId");
|
||||
});
|
||||
|
||||
b.Navigation("BaseYearsPay");
|
||||
|
||||
b.Navigation("BonusesPay");
|
||||
@@ -8026,6 +8080,8 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
b.Navigation("OverTimePay");
|
||||
|
||||
b.Navigation("ShiftPay");
|
||||
|
||||
b.Navigation("WeeklyOffDays");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Company.Domain.CustomizeWorkshopSettingsAgg.Entities.CustomizeWorkshopSettings", b =>
|
||||
@@ -8476,6 +8532,32 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
.HasForeignKey("CustomizeWorkshopSettingsid");
|
||||
});
|
||||
|
||||
b.OwnsMany("_0_Framework.Domain.CustomizeCheckoutShared.Base.WeeklyOffDay", "WeeklyOffDays", b1 =>
|
||||
{
|
||||
b1.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b1.Property<long>("Id"));
|
||||
|
||||
b1.Property<string>("DayOfWeek")
|
||||
.IsRequired()
|
||||
.HasMaxLength(15)
|
||||
.HasColumnType("nvarchar(15)");
|
||||
|
||||
b1.Property<long>("ParentId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b1.HasKey("Id");
|
||||
|
||||
b1.HasIndex("ParentId");
|
||||
|
||||
b1.ToTable("CustomizeWorkshopSettings_WeeklyOffDays");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("ParentId");
|
||||
});
|
||||
|
||||
b.Navigation("BaseYearsPay");
|
||||
|
||||
b.Navigation("BonusesPay");
|
||||
@@ -8504,6 +8586,8 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
|
||||
b.Navigation("ShiftPay");
|
||||
|
||||
b.Navigation("WeeklyOffDays");
|
||||
|
||||
b.Navigation("Workshop");
|
||||
});
|
||||
|
||||
|
||||
@@ -10,329 +10,340 @@ using AccountMangement.Infrastructure.EFCore;
|
||||
using Company.Domain.AdminMonthlyOverviewAgg;
|
||||
using CompanyManagment.App.Contracts.AdminMonthlyOverview;
|
||||
using Microsoft.AspNetCore.Authentication;
|
||||
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Tools = _0_Framework_b.Application.Tools;
|
||||
|
||||
namespace CompanyManagment.EFCore.Repository;
|
||||
|
||||
public class AdminMonthlyOverviewRepository : RepositoryBase<long, AdminMonthlyOverview>, IAdminMonthlyOverviewRepository
|
||||
{
|
||||
private readonly CompanyContext _companyContext;
|
||||
private readonly AccountContext _accountContext;
|
||||
public AdminMonthlyOverviewRepository(CompanyContext companyContext, AccountContext accountContext) : base(companyContext)
|
||||
{
|
||||
_companyContext = companyContext;
|
||||
_accountContext = accountContext;
|
||||
}
|
||||
private readonly CompanyContext _companyContext;
|
||||
private readonly AccountContext _accountContext;
|
||||
public AdminMonthlyOverviewRepository(CompanyContext companyContext, AccountContext accountContext) : base(companyContext)
|
||||
{
|
||||
_companyContext = companyContext;
|
||||
_accountContext = accountContext;
|
||||
}
|
||||
|
||||
public async Task<List<AdminMonthlyOverviewListViewModel>> GetWorkshopStatus(AdminMonthlyOverviewSearchModel searchModel)
|
||||
{
|
||||
public async Task<List<AdminMonthlyOverviewListViewModel>> GetWorkshopStatus(AdminMonthlyOverviewSearchModel searchModel)
|
||||
{
|
||||
|
||||
var year = searchModel.Year;
|
||||
var month = searchModel.Month;
|
||||
var accountId = searchModel.AdminAccountId;
|
||||
// اگر تبدیل تاریخ به میلادی موفق نبود، لیست خالی برگردان
|
||||
if ($"{year:0000}/{month:00}/01".TryToGeorgianDateTime(out var targetDate) == false)
|
||||
return [];
|
||||
|
||||
_ = $"{year:0000}/{month:00}/01".ToGeorgianDateTime().AddMonthsFa(1, out var nextMonth);
|
||||
|
||||
|
||||
// دریافت اطلاعات ادمین
|
||||
var adminAccount = await _accountContext.Accounts.FirstOrDefaultAsync(x => x.id == searchModel.AdminAccountId);
|
||||
|
||||
// اگر ادمین پیدا نشد، لیست خالی برگردان
|
||||
if (adminAccount == null)
|
||||
return [];
|
||||
|
||||
// دریافت طرف حساب های معتبر برای تاریخ مورد نظر
|
||||
var contractingPartyIds = _companyContext.InstitutionContractSet.AsNoTracking()
|
||||
.Where(c => c.ContractStartGr <= targetDate && c.ContractEndGr >= targetDate)
|
||||
.Select(c => c.ContractingPartyId);
|
||||
|
||||
// دریافت کارگاههای مرتبط با اکانت
|
||||
|
||||
var workshopAccounts = _companyContext.WorkshopAccounts
|
||||
.AsNoTracking()
|
||||
.Where(w => w.AccountId == accountId)
|
||||
.Select(w => w.WorkshopId).ToList();
|
||||
var year = searchModel.Year;
|
||||
var month = searchModel.Month;
|
||||
var accountId = searchModel.AdminAccountId;
|
||||
// اگر تبدیل تاریخ به میلادی موفق نبود، لیست خالی برگردان
|
||||
if ($"{year:0000}/{month:00}/01".TryToGeorgianDateTime(out var targetStartDate) == false)
|
||||
return [];
|
||||
var targetEndDate = Tools.FindeEndOfMonth(targetStartDate.ToFarsi()).ToGeorgianDateTime();
|
||||
|
||||
|
||||
|
||||
var workshopsHasLeftWorkEmployees = _companyContext.LeftWorkList.Where(x =>
|
||||
((x.StartWorkDate <= targetDate && x.LeftWorkDate.AddDays(-1) >= targetDate)
|
||||
|| (x.StartWorkDate <= nextMonth && x.LeftWorkDate.AddDays(-1) >= nextMonth)) && workshopAccounts.Contains(x.WorkshopId)).Select(x => x.WorkshopId);
|
||||
_ = $"{year:0000}/{month:00}/01".ToGeorgianDateTime().AddMonthsFa(1, out var nextFirstMonth);
|
||||
var nextEndMonth = Tools.FindeEndOfMonth(nextFirstMonth.ToFarsi()).ToGeorgianDateTime();
|
||||
|
||||
|
||||
// دریافت اطلاعات ادمین
|
||||
var adminAccount = await _accountContext.Accounts.FirstOrDefaultAsync(x => x.id == searchModel.AdminAccountId);
|
||||
|
||||
// اگر ادمین پیدا نشد، لیست خالی برگردان
|
||||
if (adminAccount == null)
|
||||
return [];
|
||||
|
||||
// دریافت طرف حساب های معتبر برای تاریخ مورد نظر
|
||||
var contractingPartyIds = _companyContext.InstitutionContractSet.AsNoTracking()
|
||||
.Where(c => c.ContractStartGr <= targetEndDate && c.ContractEndGr >= targetStartDate)
|
||||
.Select(c => c.ContractingPartyId);
|
||||
|
||||
// دریافت کارگاههای مرتبط با اکانت
|
||||
|
||||
var workshopAccounts = _companyContext.WorkshopAccounts
|
||||
.AsNoTracking()
|
||||
.Where(w => w.AccountId == accountId)
|
||||
.Select(w => w.WorkshopId).ToList();
|
||||
|
||||
|
||||
|
||||
var workshopsHasLeftWorkEmployees = _companyContext.LeftWorkList.Where(x =>
|
||||
((x.StartWorkDate <= targetEndDate && x.LeftWorkDate.AddDays(-1) >= targetStartDate)
|
||||
|| (x.StartWorkDate <= nextEndMonth && x.LeftWorkDate.AddDays(-1) >= nextFirstMonth)) && workshopAccounts.Contains(x.WorkshopId)).Select(x => x.WorkshopId);
|
||||
|
||||
|
||||
|
||||
|
||||
// دریافت کارگاههای مربوط به طرف حساب و اکانت
|
||||
// Replace the selected code with the following to return a list of anonymous objects containing both workshop and contractingParty
|
||||
var workshopsWithContractingParty = await _companyContext.Workshops
|
||||
.AsNoTracking()
|
||||
.Where(w => workshopsHasLeftWorkEmployees.Contains(w.id) && w.IsActive)
|
||||
.Include(w => w.WorkshopEmployers)
|
||||
.ThenInclude(we => we.Employer)
|
||||
.ThenInclude(e => e.ContractingParty).AsSplitQuery().
|
||||
Where(w => w.WorkshopEmployers.Any(we =>
|
||||
we.Employer != null &&
|
||||
contractingPartyIds.Contains(we.Employer.ContractingPartyId)))
|
||||
.Select(w => new
|
||||
{
|
||||
Workshop = w,
|
||||
ContractingParty = w.WorkshopEmployers
|
||||
.Where(we => we.Employer != null && contractingPartyIds.Contains(we.Employer.ContractingPartyId))
|
||||
.Select(we => we.Employer.ContractingParty)
|
||||
.FirstOrDefault()
|
||||
})
|
||||
.ToListAsync();
|
||||
// دریافت کارگاههای مربوط به طرف حساب و اکانت
|
||||
// Replace the selected code with the following to return a list of anonymous objects containing both workshop and contractingParty
|
||||
var workshopsWithContractingParty = await _companyContext.Workshops
|
||||
.AsNoTracking()
|
||||
.Where(w => workshopsHasLeftWorkEmployees.Contains(w.id) && w.IsActive)
|
||||
.Include(w => w.WorkshopEmployers)
|
||||
.ThenInclude(we => we.Employer)
|
||||
.ThenInclude(e => e.ContractingParty).AsSplitQuery().
|
||||
Where(w => w.WorkshopEmployers.Any(we =>
|
||||
we.Employer != null &&
|
||||
contractingPartyIds.Contains(we.Employer.ContractingPartyId)))
|
||||
.Select(w => new
|
||||
{
|
||||
Workshop = w,
|
||||
ContractingParty = w.WorkshopEmployers
|
||||
.Where(we => we.Employer != null && contractingPartyIds.Contains(we.Employer.ContractingPartyId))
|
||||
.Select(we => we.Employer.ContractingParty)
|
||||
.FirstOrDefault()
|
||||
})
|
||||
.ToListAsync();
|
||||
|
||||
|
||||
var workshopIds = workshopsWithContractingParty.Select(x => x.Workshop.id).ToList();
|
||||
var workshopIds = workshopsWithContractingParty.Select(x => x.Workshop.id).ToList();
|
||||
|
||||
|
||||
// پیدا کردن کارگاههایی که قبلاً برای این ماه/سال AdminMonthlyOverview دارند
|
||||
var adminMonthlyOverviewWorkshopIds = await _companyContext.AdminMonthlyOverviews
|
||||
.AsNoTracking()
|
||||
.Where(x => workshopIds.Contains(x.WorkshopId) && x.Month == month && x.Year == year)
|
||||
.Select(x => x.WorkshopId)
|
||||
.ToListAsync();
|
||||
// پیدا کردن کارگاههایی که قبلاً برای این ماه/سال AdminMonthlyOverview دارند
|
||||
var adminMonthlyOverviewWorkshopIds = await _companyContext.AdminMonthlyOverviews
|
||||
.AsNoTracking()
|
||||
.Where(x => workshopIds.Contains(x.WorkshopId) && x.Month == month && x.Year == year)
|
||||
.Select(x => x.WorkshopId)
|
||||
.ToListAsync();
|
||||
|
||||
// پیدا کردن کارگاههایی که نیاز به ایجاد AdminMonthlyOverview جدید دارند
|
||||
var notExistAdminMonthlyReviewsWorkshopIds = workshopIds
|
||||
.Except(adminMonthlyOverviewWorkshopIds)
|
||||
.ToList();
|
||||
// پیدا کردن کارگاههایی که نیاز به ایجاد AdminMonthlyOverview جدید دارند
|
||||
var notExistAdminMonthlyReviewsWorkshopIds = workshopIds
|
||||
.Except(adminMonthlyOverviewWorkshopIds)
|
||||
.ToList();
|
||||
|
||||
|
||||
|
||||
// ایجاد رکوردهای AdminMonthlyOverview که وجود ندارند
|
||||
if (notExistAdminMonthlyReviewsWorkshopIds.Any())
|
||||
await CreateRangeAdminMonthlyOverview(notExistAdminMonthlyReviewsWorkshopIds, month, year);
|
||||
// ایجاد رکوردهای AdminMonthlyOverview که وجود ندارند
|
||||
if (notExistAdminMonthlyReviewsWorkshopIds.Any())
|
||||
await CreateRangeAdminMonthlyOverview(notExistAdminMonthlyReviewsWorkshopIds, month, year);
|
||||
|
||||
// بهروزرسانی وضعیتها
|
||||
await UpdateAdminMonthlyOverviewStatus(year, month, workshopIds, targetDate, nextMonth);
|
||||
// بهروزرسانی وضعیتها
|
||||
await UpdateAdminMonthlyOverviewStatus(year, month, workshopIds, targetStartDate,targetEndDate, nextFirstMonth,nextEndMonth);
|
||||
|
||||
if (searchModel.ActivationStatus != IsActive.None)
|
||||
{
|
||||
var isBlock = searchModel.ActivationStatus == IsActive.True ? "false" : "true";
|
||||
if (searchModel.ActivationStatus != IsActive.None)
|
||||
{
|
||||
var isBlock = searchModel.ActivationStatus == IsActive.True ? "false" : "true";
|
||||
|
||||
workshopsWithContractingParty = workshopsWithContractingParty
|
||||
.Where(x => x.ContractingParty?.IsBlock == isBlock).ToList();
|
||||
workshopsWithContractingParty = workshopsWithContractingParty
|
||||
.Where(x => x.ContractingParty?.IsBlock == isBlock).ToList();
|
||||
|
||||
workshopIds = workshopsWithContractingParty.Select(x => x.Workshop.id).ToList();
|
||||
}
|
||||
workshopIds = workshopsWithContractingParty.Select(x => x.Workshop.id).ToList();
|
||||
}
|
||||
|
||||
// دریافت همه AdminMonthlyOverview برای این کارگاهها/ماه/سال
|
||||
var adminMonthlyOverviewsQuery = _companyContext.AdminMonthlyOverviews
|
||||
.Where(x => workshopIds.Contains(x.WorkshopId) && x.Month == month && x.Year == year);
|
||||
// دریافت همه AdminMonthlyOverview برای این کارگاهها/ماه/سال
|
||||
var adminMonthlyOverviewsQuery = _companyContext.AdminMonthlyOverviews
|
||||
.Where(x => workshopIds.Contains(x.WorkshopId) && x.Month == month && x.Year == year);
|
||||
|
||||
if (searchModel.WorkshopId > 0)
|
||||
{
|
||||
adminMonthlyOverviewsQuery = adminMonthlyOverviewsQuery.Where(x => x.WorkshopId == searchModel.WorkshopId);
|
||||
}
|
||||
if (searchModel.WorkshopId > 0)
|
||||
{
|
||||
adminMonthlyOverviewsQuery = adminMonthlyOverviewsQuery.Where(x => x.WorkshopId == searchModel.WorkshopId);
|
||||
}
|
||||
|
||||
if (searchModel.EmployerId > 0)
|
||||
{
|
||||
var searchWorkshopId = workshopsWithContractingParty.Where(x => x.Workshop.WorkshopEmployers.Any(e => e.EmployerId == searchModel.EmployerId)).Select(x => x.Workshop.id).ToList();
|
||||
adminMonthlyOverviewsQuery = adminMonthlyOverviewsQuery.Where(x => searchWorkshopId.Contains(x.WorkshopId));
|
||||
}
|
||||
if (searchModel.EmployerId > 0)
|
||||
{
|
||||
var searchWorkshopId = workshopsWithContractingParty.Where(x => x.Workshop.WorkshopEmployers.Any(e => e.EmployerId == searchModel.EmployerId)).Select(x => x.Workshop.id).ToList();
|
||||
adminMonthlyOverviewsQuery = adminMonthlyOverviewsQuery.Where(x => searchWorkshopId.Contains(x.WorkshopId));
|
||||
}
|
||||
|
||||
var employeeCheckoutCounts = _companyContext.LeftWorkList.Where(x =>
|
||||
x.StartWorkDate <= targetDate && x.LeftWorkDate.AddDays(-1) >= targetDate && workshopIds.Contains(x.WorkshopId))
|
||||
.GroupBy(x => x.WorkshopId).Select(x => new { EmployeeCounts = x.Count(), WorkshopId = x.Key }).ToList();
|
||||
var employeeCheckoutCounts = _companyContext.LeftWorkList.Where(x =>
|
||||
x.StartWorkDate <= targetStartDate && x.LeftWorkDate.AddDays(-1) >= targetStartDate && workshopIds.Contains(x.WorkshopId))
|
||||
.GroupBy(x => x.WorkshopId).Select(x => new { EmployeeCounts = x.Count(), WorkshopId = x.Key }).ToList();
|
||||
|
||||
var employeeContractCounts = _companyContext.LeftWorkList.Where(x =>
|
||||
x.StartWorkDate <= nextMonth && x.LeftWorkDate.AddDays(-1) >= nextMonth && workshopIds.Contains(x.WorkshopId))
|
||||
.GroupBy(x => x.WorkshopId).Select(x => new { EmployeeCounts = x.Count(), WorkshopId = x.Key }).ToList();
|
||||
var employeeContractCounts = _companyContext.LeftWorkList.Where(x =>
|
||||
x.StartWorkDate <= nextFirstMonth && x.LeftWorkDate.AddDays(-1) >= nextFirstMonth && workshopIds.Contains(x.WorkshopId))
|
||||
.GroupBy(x => x.WorkshopId).Select(x => new { EmployeeCounts = x.Count(), WorkshopId = x.Key }).ToList();
|
||||
|
||||
var adminMonthlyOverviewsList = await adminMonthlyOverviewsQuery.ToListAsync();
|
||||
var adminMonthlyOverviewsList = await adminMonthlyOverviewsQuery.ToListAsync();
|
||||
|
||||
var now = DateTime.Today;
|
||||
//پرسنل ادمین اجرایی
|
||||
var operatorAdminAccounts = _accountContext.AccountLeftWorks
|
||||
.Where(x => workshopIds.Contains(x.WorkshopId) && x.StartWorkGr <= now && x.LeftWorkGr >= now &&
|
||||
x.RoleId == 5).Select(x => new { x.WorkshopId, x.AccountId })
|
||||
.Join(_accountContext.Accounts,
|
||||
x =>x.AccountId,
|
||||
account=>account.id,(x, account) => new
|
||||
{
|
||||
x.WorkshopId,
|
||||
account.Fullname
|
||||
}).ToList();
|
||||
var now = DateTime.Today;
|
||||
//پرسنل ادمین اجرایی
|
||||
var operatorAdminAccounts = _accountContext.AccountLeftWorks
|
||||
.Where(x => workshopIds.Contains(x.WorkshopId) && x.StartWorkGr <= now && x.LeftWorkGr >= now &&
|
||||
x.RoleId == 5).Select(x => new { x.WorkshopId, x.AccountId })
|
||||
.Join(_accountContext.Accounts,
|
||||
x => x.AccountId,
|
||||
account => account.id, (x, account) => new
|
||||
{
|
||||
x.WorkshopId,
|
||||
account.Fullname
|
||||
}).ToList();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var adminMonthlyOverviewList = adminMonthlyOverviewsList.Select(x =>
|
||||
{
|
||||
var employeeCheckoutCount = employeeCheckoutCounts.FirstOrDefault(e => e.WorkshopId == x.WorkshopId);
|
||||
var employeeContractCount = employeeContractCounts.FirstOrDefault(e => e.WorkshopId == x.WorkshopId);
|
||||
var workshopWithContractingParty =
|
||||
workshopsWithContractingParty.FirstOrDefault(w => w.Workshop.id == x.WorkshopId);
|
||||
var adminMonthlyOverviewList = adminMonthlyOverviewsList.Select(x =>
|
||||
{
|
||||
var employeeCheckoutCount = employeeCheckoutCounts.FirstOrDefault(e => e.WorkshopId == x.WorkshopId);
|
||||
var employeeContractCount = employeeContractCounts.FirstOrDefault(e => e.WorkshopId == x.WorkshopId);
|
||||
var workshopWithContractingParty =
|
||||
workshopsWithContractingParty.FirstOrDefault(w => w.Workshop.id == x.WorkshopId);
|
||||
|
||||
var operatorAccount = operatorAdminAccounts.FirstOrDefault(o => o.WorkshopId == x.WorkshopId);
|
||||
var operatorAccount = operatorAdminAccounts.FirstOrDefault(o => o.WorkshopId == x.WorkshopId);
|
||||
|
||||
var workshop = workshopWithContractingParty?.Workshop;
|
||||
var contractingParty = workshopWithContractingParty?.ContractingParty;
|
||||
var employer = workshop?.WorkshopEmployers.FirstOrDefault()?.Employer;
|
||||
return new AdminMonthlyOverviewListViewModel
|
||||
{
|
||||
WorkshopId = x.WorkshopId,
|
||||
Status = x.Status,
|
||||
Id = x.id,
|
||||
WorkshopName = workshop?.WorkshopFullName ?? "",
|
||||
WorkshopArchiveCode = workshop?.ArchiveCode ?? "",
|
||||
WorkshopArchiveCodeInt = workshop?.ArchiveCode.ExtractIntNumbers() ?? 0,
|
||||
Address = workshop?.Address ?? "",
|
||||
City = workshop?.City ?? "",
|
||||
Province = workshop?.State ?? "",
|
||||
EmployerName = employer?.FullName ?? "",
|
||||
EmployerPhoneNumber = employer?.Phone ?? "",
|
||||
AdminFullName = operatorAccount?.Fullname??"",
|
||||
CheckoutEmployeeCount = employeeCheckoutCount?.EmployeeCounts ?? 0,
|
||||
ContractEmployeeCount = employeeContractCount?.EmployeeCounts ?? 0,
|
||||
AgentPhoneNumber = "",
|
||||
IsBlock = contractingParty?.IsBlock == "true"
|
||||
};
|
||||
}).OrderBy(x => x.IsBlock).ThenBy(x => x.WorkshopArchiveCodeInt).ToList();
|
||||
var workshop = workshopWithContractingParty?.Workshop;
|
||||
var contractingParty = workshopWithContractingParty?.ContractingParty;
|
||||
var employer = workshop?.WorkshopEmployers.FirstOrDefault()?.Employer;
|
||||
return new AdminMonthlyOverviewListViewModel
|
||||
{
|
||||
WorkshopId = x.WorkshopId,
|
||||
Status = x.Status,
|
||||
Id = x.id,
|
||||
WorkshopName = workshop?.WorkshopFullName ?? "",
|
||||
WorkshopArchiveCode = workshop?.ArchiveCode ?? "",
|
||||
WorkshopArchiveCodeInt = workshop?.ArchiveCode.ExtractIntNumbers() ?? 0,
|
||||
Address = workshop?.Address ?? "",
|
||||
City = workshop?.City ?? "",
|
||||
Province = workshop?.State ?? "",
|
||||
EmployerName = employer?.FullName ?? "",
|
||||
EmployerPhoneNumber = employer?.Phone ?? "",
|
||||
AdminFullName = operatorAccount?.Fullname ?? "",
|
||||
CheckoutEmployeeCount = employeeCheckoutCount?.EmployeeCounts ?? 0,
|
||||
ContractEmployeeCount = employeeContractCount?.EmployeeCounts ?? 0,
|
||||
AgentPhoneNumber = "",
|
||||
IsBlock = contractingParty?.IsBlock == "true"
|
||||
};
|
||||
}).OrderBy(x => x.IsBlock).ThenBy(x => x.WorkshopArchiveCodeInt).ToList();
|
||||
|
||||
|
||||
return adminMonthlyOverviewList;
|
||||
}
|
||||
return adminMonthlyOverviewList;
|
||||
}
|
||||
|
||||
public async Task<AdminMonthlyOverViewCounterVm> GetCounter(int year, int month, long accountId)
|
||||
{
|
||||
var searchModel = new AdminMonthlyOverviewSearchModel()
|
||||
{
|
||||
AdminAccountId = accountId,
|
||||
Month = month,
|
||||
Year = year
|
||||
};
|
||||
var list = await GetWorkshopStatus(searchModel);
|
||||
public async Task<AdminMonthlyOverViewCounterVm> GetCounter(int year, int month, long accountId)
|
||||
{
|
||||
var searchModel = new AdminMonthlyOverviewSearchModel()
|
||||
{
|
||||
AdminAccountId = accountId,
|
||||
Month = month,
|
||||
Year = year
|
||||
};
|
||||
var list = await GetWorkshopStatus(searchModel);
|
||||
|
||||
var allCount = list.Count;
|
||||
var archivedCount = list.Count(x => x.Status == AdminMonthlyOverviewStatus.Archived);
|
||||
var createDocCount = list.Count(x => x.Status == AdminMonthlyOverviewStatus.CreateDocuments);
|
||||
var visitCompleteCount = list.Count(x => x.Status == AdminMonthlyOverviewStatus.VisitCompleted);
|
||||
var visitInProgressCount = list.Count(x => x.Status == AdminMonthlyOverviewStatus.VisitInProgress);
|
||||
var visitPendingCount = list.Count(x => x.Status == AdminMonthlyOverviewStatus.VisitPending);
|
||||
var allCount = list.Count;
|
||||
var archivedCount = list.Count(x => x.Status == AdminMonthlyOverviewStatus.Archived);
|
||||
var createDocCount = list.Count(x => x.Status == AdminMonthlyOverviewStatus.CreateDocuments);
|
||||
var visitCompleteCount = list.Count(x => x.Status == AdminMonthlyOverviewStatus.VisitCompleted);
|
||||
var visitInProgressCount = list.Count(x => x.Status == AdminMonthlyOverviewStatus.VisitInProgress);
|
||||
var visitPendingCount = list.Count(x => x.Status == AdminMonthlyOverviewStatus.VisitPending);
|
||||
|
||||
return new AdminMonthlyOverViewCounterVm
|
||||
{
|
||||
All = allCount,
|
||||
Archived = archivedCount,
|
||||
VisitPending = visitPendingCount,
|
||||
VisitInProgress = visitInProgressCount,
|
||||
VisitCompleted = visitCompleteCount,
|
||||
CreateDocument = createDocCount
|
||||
return new AdminMonthlyOverViewCounterVm
|
||||
{
|
||||
All = allCount,
|
||||
Archived = archivedCount,
|
||||
VisitPending = visitPendingCount,
|
||||
VisitInProgress = visitInProgressCount,
|
||||
VisitCompleted = visitCompleteCount,
|
||||
CreateDocument = createDocCount
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private async Task UpdateAdminMonthlyOverviewStatus(int year, int month, List<long> workshopIds, DateTime targetDate, DateTime nextMonth)
|
||||
{
|
||||
var vipGroup = _companyContext.CustomizeWorkshopEmployeeSettings.Where(x => x.CustomizeWorkshopGroupSettingId == 117)
|
||||
.Select(x => x.EmployeeId)
|
||||
.Except([5976]).ToList();
|
||||
private async Task UpdateAdminMonthlyOverviewStatus(int year, int month, List<long> workshopIds, DateTime targetStartDate,DateTime targetEndDate, DateTime nextStartMonth,DateTime nextEndMonth)
|
||||
{
|
||||
var vipGroup = _companyContext.CustomizeWorkshopEmployeeSettings.Where(x => x.CustomizeWorkshopGroupSettingId == 117)
|
||||
.Select(x => x.EmployeeId)
|
||||
.Except([5976]).ToList();
|
||||
|
||||
|
||||
var workingCheckoutEmployeeIds = _companyContext.LeftWorkList.AsNoTracking()
|
||||
.Join(
|
||||
_companyContext.Contracts.AsNoTracking(),
|
||||
leftWork => new { leftWork.EmployeeId, WorkshopId = leftWork.WorkshopId },
|
||||
contract => new { contract.EmployeeId, WorkshopId = contract.WorkshopIds },
|
||||
(leftWork, contract) => new { leftWork, contract }
|
||||
)
|
||||
.Where(x =>
|
||||
workshopIds.Contains(x.leftWork.WorkshopId) &&
|
||||
x.leftWork.StartWorkDate <= targetDate &&
|
||||
x.leftWork.LeftWorkDate.AddDays(-1) >= targetDate &&
|
||||
x.contract.ContarctStart <= targetDate &&
|
||||
x.contract.ContractEnd >= targetDate
|
||||
&& !vipGroup.Contains(x.leftWork.EmployeeId)
|
||||
)
|
||||
.Select(x => new { x.leftWork.WorkshopId, x.leftWork.EmployeeId });
|
||||
var workingCheckoutEmployeeIds = _companyContext.LeftWorkList.AsNoTracking()
|
||||
.Join(
|
||||
_companyContext.Contracts.AsNoTracking(),
|
||||
leftWork => new { leftWork.EmployeeId, WorkshopId = leftWork.WorkshopId },
|
||||
contract => new { contract.EmployeeId, WorkshopId = contract.WorkshopIds },
|
||||
(leftWork, contract) => new { leftWork, contract }
|
||||
)
|
||||
.Where(x =>
|
||||
workshopIds.Contains(x.leftWork.WorkshopId) &&
|
||||
x.leftWork.StartWorkDate <= targetEndDate &&
|
||||
x.leftWork.LeftWorkDate.AddDays(-1) >= targetStartDate &&
|
||||
x.contract.ContarctStart <= targetEndDate &&
|
||||
x.contract.ContractEnd >= targetStartDate &&
|
||||
!vipGroup.Contains(x.leftWork.EmployeeId) &&
|
||||
!_companyContext.EmployeeClientTemps
|
||||
.Any(temp => temp.EmployeeId == x.leftWork.EmployeeId && temp.WorkshopId == x.leftWork.WorkshopId)
|
||||
)
|
||||
.Select(x => new { x.leftWork.WorkshopId, x.leftWork.EmployeeId });
|
||||
|
||||
var workingContractEmployeeIds = _companyContext.LeftWorkList.AsNoTracking()
|
||||
.Where(x => workshopIds.Contains(x.WorkshopId) && x.StartWorkDate <= nextMonth && x.LeftWorkDate.AddDays(-1) >= nextMonth
|
||||
&& !vipGroup.Contains(x.EmployeeId))
|
||||
.Select(x => new { x.WorkshopId, x.EmployeeId });
|
||||
.Where(x => workshopIds.Contains(x.WorkshopId) && x.StartWorkDate <= nextEndMonth && x.LeftWorkDate.AddDays(-1) >= nextStartMonth &&
|
||||
!vipGroup.Contains(x.EmployeeId) &&
|
||||
!_companyContext.EmployeeClientTemps
|
||||
.Any(temp => temp.EmployeeId == x.EmployeeId && temp.WorkshopId == x.WorkshopId)
|
||||
).Select(x => new { x.WorkshopId, x.EmployeeId });
|
||||
|
||||
var contractSet = (await _companyContext.Contracts.AsNoTracking()
|
||||
.Where(x => x.ContarctStart <= nextMonth && x.ContractEnd >= nextMonth && workshopIds.Contains(x.WorkshopIds))
|
||||
.Select(x => new { x.WorkshopIds, x.EmployeeId })
|
||||
.ToListAsync())
|
||||
.Select(x => (x.WorkshopIds, x.EmployeeId))
|
||||
.ToHashSet();
|
||||
var contractSet = (await _companyContext.Contracts.AsNoTracking()
|
||||
.Where(x => x.ContarctStart <= nextEndMonth && x.ContractEnd >= nextStartMonth && workshopIds.Contains(x.WorkshopIds))
|
||||
.Select(x => new { x.WorkshopIds, x.EmployeeId })
|
||||
.ToListAsync())
|
||||
.Select(x => (x.WorkshopIds, x.EmployeeId))
|
||||
.ToHashSet();
|
||||
|
||||
var checkoutSet = (await _companyContext.CheckoutSet.AsNoTracking()
|
||||
.Where(x => x.ContractStart <= targetDate && x.ContractEnd >= targetDate && workshopIds.Contains(x.WorkshopId))
|
||||
.Select(x => new { x.WorkshopId, x.EmployeeId })
|
||||
.ToListAsync())
|
||||
.Select(x => (x.WorkshopId, x.EmployeeId))
|
||||
.ToHashSet();
|
||||
var checkoutSet = (await _companyContext.CheckoutSet.AsNoTracking()
|
||||
.Where(x => x.ContractStart <= targetEndDate && x.ContractEnd >= targetStartDate && workshopIds.Contains(x.WorkshopId))
|
||||
.Select(x => new { x.WorkshopId, x.EmployeeId })
|
||||
.ToListAsync())
|
||||
.Select(x => (x.WorkshopId, x.EmployeeId))
|
||||
.ToHashSet();
|
||||
|
||||
var workingCheckoutGrouping = workingCheckoutEmployeeIds.GroupBy(x => x.WorkshopId).ToList();
|
||||
var workingCheckoutGrouping = workingCheckoutEmployeeIds.GroupBy(x => x.WorkshopId).ToList();
|
||||
|
||||
var workingContractGrouping = workingContractEmployeeIds.GroupBy(x => x.WorkshopId).Select(x => new
|
||||
{
|
||||
WorkshopId = x.Key,
|
||||
Data = x.ToList()
|
||||
}).ToList();
|
||||
var workingContractGrouping = workingContractEmployeeIds.GroupBy(x => x.WorkshopId).Select(x => new
|
||||
{
|
||||
WorkshopId = x.Key,
|
||||
Data = x.ToList()
|
||||
}).ToList();
|
||||
|
||||
var workshopsWithFullContracts = workingContractGrouping
|
||||
.Where(g => g.Data.All(emp => contractSet.Contains((emp.WorkshopId, emp.EmployeeId))))
|
||||
.Select(g => g.WorkshopId)
|
||||
.ToList();
|
||||
var workshopsWithFullContracts = workingContractGrouping
|
||||
.Where(g => g.Data.All(emp => contractSet.Contains((emp.WorkshopId, emp.EmployeeId))))
|
||||
.Select(g => g.WorkshopId)
|
||||
.ToList();
|
||||
|
||||
var workshopsWithFullCheckout = workingCheckoutGrouping
|
||||
.Where(g => g.All(emp => checkoutSet.Contains((emp.WorkshopId, emp.EmployeeId))))
|
||||
.Select(g => g.Key)
|
||||
.ToList();
|
||||
var list = workingContractEmployeeIds.ToList().Where(x=>!contractSet.Any(a=>a.EmployeeId== x.EmployeeId&&a.WorkshopIds == x.WorkshopId)).ToList();
|
||||
|
||||
var workshopsWithFullCheckout = workingCheckoutGrouping
|
||||
.Where(g => g.All(emp => checkoutSet.Contains((emp.WorkshopId, emp.EmployeeId))))
|
||||
.Select(g => g.Key)
|
||||
.ToList();
|
||||
|
||||
|
||||
var fullyCoveredWorkshops = workshopsWithFullContracts.Intersect(workshopsWithFullCheckout).ToList();
|
||||
var fullyCoveredWorkshops = workshopsWithFullContracts.Intersect(workshopsWithFullCheckout).ToList();
|
||||
|
||||
//var notFullyCoveredWorkshops = groupedCheckout
|
||||
// .Where(g => g.Any(emp =>
|
||||
// !contractSet.Contains((emp.WorkshopId, emp.EmployeeId)) ||
|
||||
// !checkoutSet.Contains((emp.WorkshopId, emp.EmployeeId))))
|
||||
// .Select(g => g.Key)
|
||||
// .ToList();
|
||||
//var notFullyCoveredWorkshops = groupedCheckout
|
||||
// .Where(g => g.Any(emp =>
|
||||
// !contractSet.Contains((emp.WorkshopId, emp.EmployeeId)) ||
|
||||
// !checkoutSet.Contains((emp.WorkshopId, emp.EmployeeId))))
|
||||
// .Select(g => g.Key)
|
||||
// .ToList();
|
||||
|
||||
var notFullyCoveredWorkshops = workshopIds.Except(fullyCoveredWorkshops);
|
||||
var notFullyCoveredWorkshops = workshopIds.Except(fullyCoveredWorkshops);
|
||||
|
||||
var adminMonthlyOverviews = _companyContext.AdminMonthlyOverviews
|
||||
.Where(x => x.Month == month && x.Year == year);
|
||||
var adminMonthlyOverviews = _companyContext.AdminMonthlyOverviews
|
||||
.Where(x => x.Month == month && x.Year == year);
|
||||
|
||||
var adminMonthlyOverviewsWithFullContracts = await adminMonthlyOverviews
|
||||
.Where(x => fullyCoveredWorkshops.Contains(x.WorkshopId) && x.Status == AdminMonthlyOverviewStatus.CreateDocuments)
|
||||
.ToListAsync();
|
||||
var adminMonthlyOverviewsWithFullContracts = await adminMonthlyOverviews
|
||||
.Where(x => fullyCoveredWorkshops.Contains(x.WorkshopId) && x.Status == AdminMonthlyOverviewStatus.CreateDocuments)
|
||||
.ToListAsync();
|
||||
|
||||
var adminMonthlyOverviewsWithNotFullContracts = await adminMonthlyOverviews
|
||||
.Where(x => notFullyCoveredWorkshops.Contains(x.WorkshopId) && x.Status != AdminMonthlyOverviewStatus.CreateDocuments)
|
||||
.ToListAsync();
|
||||
var adminMonthlyOverviewsWithNotFullContracts = await adminMonthlyOverviews
|
||||
.Where(x => notFullyCoveredWorkshops.Contains(x.WorkshopId) && x.Status != AdminMonthlyOverviewStatus.CreateDocuments)
|
||||
.ToListAsync();
|
||||
|
||||
foreach (var adminMonthlyOverview in adminMonthlyOverviewsWithFullContracts)
|
||||
adminMonthlyOverview.SetStatus(AdminMonthlyOverviewStatus.VisitPending);
|
||||
foreach (var adminMonthlyOverview in adminMonthlyOverviewsWithFullContracts)
|
||||
adminMonthlyOverview.SetStatus(AdminMonthlyOverviewStatus.VisitPending);
|
||||
|
||||
foreach (var adminMonthlyOverview in adminMonthlyOverviewsWithNotFullContracts)
|
||||
adminMonthlyOverview.SetStatus(AdminMonthlyOverviewStatus.CreateDocuments);
|
||||
foreach (var adminMonthlyOverview in adminMonthlyOverviewsWithNotFullContracts)
|
||||
adminMonthlyOverview.SetStatus(AdminMonthlyOverviewStatus.CreateDocuments);
|
||||
|
||||
await _companyContext.SaveChangesAsync();
|
||||
}
|
||||
await _companyContext.SaveChangesAsync();
|
||||
}
|
||||
|
||||
private async Task CreateRangeAdminMonthlyOverview(List<long> workshopIds, int month, int year)
|
||||
{
|
||||
foreach (var workshopId in workshopIds)
|
||||
{
|
||||
var adminMonthlyOverview =
|
||||
new AdminMonthlyOverview(workshopId, month, year, AdminMonthlyOverviewStatus.CreateDocuments);
|
||||
await _companyContext.AddAsync(adminMonthlyOverview);
|
||||
}
|
||||
private async Task CreateRangeAdminMonthlyOverview(List<long> workshopIds, int month, int year)
|
||||
{
|
||||
foreach (var workshopId in workshopIds)
|
||||
{
|
||||
var adminMonthlyOverview =
|
||||
new AdminMonthlyOverview(workshopId, month, year, AdminMonthlyOverviewStatus.CreateDocuments);
|
||||
await _companyContext.AddAsync(adminMonthlyOverview);
|
||||
}
|
||||
|
||||
await _companyContext.SaveChangesAsync();
|
||||
}
|
||||
await _companyContext.SaveChangesAsync();
|
||||
}
|
||||
}
|
||||
@@ -26,7 +26,6 @@ public class CustomizeWorkshopEmployeeSettingsRepository(CompanyContext companyC
|
||||
return new();
|
||||
return new EditCustomizeEmployeeSettings()
|
||||
{
|
||||
FridayWork = entity.FridayWork,
|
||||
FridayPay = new() { FridayPayType = entity.FridayPay.FridayPayType, Value = entity.FridayPay.Value },
|
||||
LateToWork = new()
|
||||
{
|
||||
|
||||
@@ -265,7 +265,7 @@ public class CustomizeWorkshopGroupSettingsRepository(CompanyContext companyCont
|
||||
var entity = _companyContext.CustomizeWorkshopGroupSettings.AsSplitQuery().FirstOrDefault(x => x.id == groupId);
|
||||
return new EditCustomizeWorkshopGroupSettings()
|
||||
{
|
||||
FridayWork = entity.FridayWork,
|
||||
//FridayWork = entity.FridayWork,
|
||||
FridayPay = new (){ FridayPayType = entity.FridayPay.FridayPayType, Value = entity.FridayPay.Value },
|
||||
LateToWork = new()
|
||||
{
|
||||
@@ -338,8 +338,8 @@ public class CustomizeWorkshopGroupSettingsRepository(CompanyContext companyCont
|
||||
{
|
||||
EndTime = x.EndTime.ToString("HH:mm"),
|
||||
StartTime = x.StartTime.ToString("HH:mm")
|
||||
}).ToList()
|
||||
|
||||
}).ToList(),
|
||||
OffDayOfWeeks = entity.WeeklyOffDays.Select(x=>x.DayOfWeek).ToList()
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -159,7 +159,6 @@ public class CustomizeWorkshopSettingsRepository(CompanyContext companyContext,
|
||||
return new();
|
||||
var viewModel = new EditCustomizeWorkshopSettings()
|
||||
{
|
||||
FridayWork = entity.FridayWork,
|
||||
FridayPay = new() { FridayPayType = entity.FridayPay.FridayPayType, Value = entity.FridayPay.Value },
|
||||
LateToWork = new()
|
||||
{
|
||||
@@ -234,7 +233,8 @@ public class CustomizeWorkshopSettingsRepository(CompanyContext companyContext,
|
||||
LeavePermittedDays = entity.LeavePermittedDays,
|
||||
BaseYearsPayInEndOfYear = entity.BaseYearsPayInEndOfYear,
|
||||
WorkshopId = entity.WorkshopId,
|
||||
WorkshopShiftStatus = entity.WorkshopShiftStatus
|
||||
WorkshopShiftStatus = entity.WorkshopShiftStatus,
|
||||
OffDays = entity.WeeklyOffDays.Select(x=>x.DayOfWeek).ToList()
|
||||
|
||||
};
|
||||
return viewModel;
|
||||
@@ -261,8 +261,8 @@ public class CustomizeWorkshopSettingsRepository(CompanyContext companyContext,
|
||||
Id = entity.id,
|
||||
WorkshopId = entity.WorkshopId,
|
||||
WorkshopShiftStatus = entity.WorkshopShiftStatus,
|
||||
FridayWork = entity.FridayWork,
|
||||
HolidayWork = entity.HolidayWork
|
||||
HolidayWork = entity.HolidayWork,
|
||||
OffDays = entity.WeeklyOffDays.Select(x=>x.DayOfWeek).ToList()
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1173,7 +1173,17 @@ public class EmployeeDocumentsRepository : RepositoryBase<long, EmployeeDocument
|
||||
//RequiredDocuments = requiredDocs
|
||||
};
|
||||
}).ToList();
|
||||
|
||||
result.ForEach(x =>
|
||||
{
|
||||
x.EmployeePicture.PicturePath = GetThumbnailPathFromFilePath(x.EmployeePicture.PicturePath);
|
||||
x.IdCardPage1.PicturePath = GetThumbnailPathFromFilePath(x.IdCardPage1.PicturePath);
|
||||
x.IdCardPage2.PicturePath = GetThumbnailPathFromFilePath(x.IdCardPage2.PicturePath);
|
||||
x.IdCardPage3.PicturePath = GetThumbnailPathFromFilePath(x.IdCardPage3.PicturePath);
|
||||
x.IdCardPage4.PicturePath = GetThumbnailPathFromFilePath(x.IdCardPage4.PicturePath);
|
||||
x.NationalCardFront.PicturePath = GetThumbnailPathFromFilePath(x.NationalCardFront.PicturePath);
|
||||
x.NationalCardRear.PicturePath = GetThumbnailPathFromFilePath(x.NationalCardRear.PicturePath);
|
||||
x.MilitaryServiceCard.PicturePath = GetThumbnailPathFromFilePath(x.MilitaryServiceCard.PicturePath);
|
||||
});
|
||||
return result;
|
||||
|
||||
}
|
||||
@@ -1194,7 +1204,7 @@ public class EmployeeDocumentsRepository : RepositoryBase<long, EmployeeDocument
|
||||
.GroupBy(x => x.WorkshopId).Select(x => new WorkshopWithEmployeeDocumentsViewModel()
|
||||
{
|
||||
WorkshopId = x.Key,
|
||||
WorkshopFullName = x.FirstOrDefault().Workshop.WorkshopName,
|
||||
WorkshopFullName = x.FirstOrDefault().Workshop.WorkshopFullName,
|
||||
EmployeesWithoutDocumentCount = x.Count()
|
||||
});
|
||||
|
||||
@@ -1301,7 +1311,19 @@ public class EmployeeDocumentsRepository : RepositoryBase<long, EmployeeDocument
|
||||
};
|
||||
}).ToList();
|
||||
|
||||
return result;
|
||||
result.ForEach(x =>
|
||||
{
|
||||
x.EmployeePicture.PicturePath = GetThumbnailPathFromFilePath(x.EmployeePicture.PicturePath);
|
||||
x.IdCardPage1.PicturePath = GetThumbnailPathFromFilePath(x.IdCardPage1.PicturePath);
|
||||
x.IdCardPage2.PicturePath = GetThumbnailPathFromFilePath(x.IdCardPage2.PicturePath);
|
||||
x.IdCardPage3.PicturePath = GetThumbnailPathFromFilePath(x.IdCardPage3.PicturePath);
|
||||
x.IdCardPage4.PicturePath = GetThumbnailPathFromFilePath(x.IdCardPage4.PicturePath);
|
||||
x.NationalCardFront.PicturePath = GetThumbnailPathFromFilePath(x.NationalCardFront.PicturePath);
|
||||
x.NationalCardRear.PicturePath = GetThumbnailPathFromFilePath(x.NationalCardRear.PicturePath);
|
||||
x.MilitaryServiceCard.PicturePath = GetThumbnailPathFromFilePath(x.MilitaryServiceCard.PicturePath);
|
||||
});
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public async Task<List<WorkshopWithEmployeeDocumentsViewModel>> GetClientRejectedDocumentWorkshopsForAdmin(List<long> workshops, long roleId)
|
||||
@@ -1463,9 +1485,19 @@ public class EmployeeDocumentsRepository : RepositoryBase<long, EmployeeDocument
|
||||
//RequiredDocuments = requiredDocs
|
||||
};
|
||||
}).ToList();
|
||||
result.ForEach(x =>
|
||||
{
|
||||
x.EmployeePicture.PicturePath = GetThumbnailPathFromFilePath(x.EmployeePicture.PicturePath);
|
||||
x.IdCardPage1.PicturePath = GetThumbnailPathFromFilePath(x.IdCardPage1.PicturePath);
|
||||
x.IdCardPage2.PicturePath = GetThumbnailPathFromFilePath(x.IdCardPage2.PicturePath);
|
||||
x.IdCardPage3.PicturePath = GetThumbnailPathFromFilePath(x.IdCardPage3.PicturePath);
|
||||
x.IdCardPage4.PicturePath = GetThumbnailPathFromFilePath(x.IdCardPage4.PicturePath);
|
||||
x.NationalCardFront.PicturePath = GetThumbnailPathFromFilePath(x.NationalCardFront.PicturePath);
|
||||
x.NationalCardRear.PicturePath = GetThumbnailPathFromFilePath(x.NationalCardRear.PicturePath);
|
||||
x.MilitaryServiceCard.PicturePath = GetThumbnailPathFromFilePath(x.MilitaryServiceCard.PicturePath);
|
||||
});
|
||||
|
||||
|
||||
return result;
|
||||
return result;
|
||||
}
|
||||
|
||||
public async Task<List<EmployeeDocumentsViewModel>> GetClientRejectedDocumentForClient(long workshopId, long accountId)
|
||||
@@ -1568,8 +1600,18 @@ public class EmployeeDocumentsRepository : RepositoryBase<long, EmployeeDocument
|
||||
//RequiredDocuments = requiredDocs
|
||||
};
|
||||
}).ToList();
|
||||
|
||||
return result;
|
||||
result.ForEach(x =>
|
||||
{
|
||||
x.EmployeePicture.PicturePath = GetThumbnailPathFromFilePath(x.EmployeePicture.PicturePath);
|
||||
x.IdCardPage1.PicturePath = GetThumbnailPathFromFilePath(x.IdCardPage1.PicturePath);
|
||||
x.IdCardPage2.PicturePath = GetThumbnailPathFromFilePath(x.IdCardPage2.PicturePath);
|
||||
x.IdCardPage3.PicturePath = GetThumbnailPathFromFilePath(x.IdCardPage3.PicturePath);
|
||||
x.IdCardPage4.PicturePath = GetThumbnailPathFromFilePath(x.IdCardPage4.PicturePath);
|
||||
x.NationalCardFront.PicturePath = GetThumbnailPathFromFilePath(x.NationalCardFront.PicturePath);
|
||||
x.NationalCardRear.PicturePath = GetThumbnailPathFromFilePath(x.NationalCardRear.PicturePath);
|
||||
x.MilitaryServiceCard.PicturePath = GetThumbnailPathFromFilePath(x.MilitaryServiceCard.PicturePath);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
//ToDo آپلود مدارک و افزودن پرسنل
|
||||
@@ -1646,8 +1688,12 @@ public class EmployeeDocumentsRepository : RepositoryBase<long, EmployeeDocument
|
||||
};
|
||||
}
|
||||
|
||||
private static string GetThumbnailPathFromFilePath(string filePath)
|
||||
{
|
||||
return string.IsNullOrWhiteSpace(filePath) ? string.Empty : Path.Combine(Path.GetDirectoryName(filePath)!, Path.GetFileNameWithoutExtension(filePath) + $"-thumbnail{Path.GetExtension(filePath)}");
|
||||
}
|
||||
|
||||
private static EmployeeDocumentItemViewModel GetByLabelAndLoadMedia(List<EmployeeDocumentItemViewModel> items,
|
||||
private static EmployeeDocumentItemViewModel GetByLabelAndLoadMedia(List<EmployeeDocumentItemViewModel> items,
|
||||
List<MediaViewModel> medias, DocumentItemLabel label)
|
||||
{
|
||||
if (items == null || items.Count == 0)
|
||||
|
||||
@@ -796,5 +796,11 @@ public class LeftWorkInsuranceRepository : RepositoryBase<long, LeftWorkInsuranc
|
||||
return insuranceLeftWorkWithContractExitOnly.ToList();
|
||||
}
|
||||
|
||||
public LeftWorkInsurance GetLastLeftWorkByEmployeeIdAndWorkshopId(long workshopId, long employeeId)
|
||||
{
|
||||
return _context.LeftWorkInsuranceList.Where(x => x.WorkshopId == workshopId && x.EmployeeId == employeeId)
|
||||
.OrderByDescending(x => x.StartWorkDate).FirstOrDefault();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -654,7 +654,10 @@ public class LeftWorkRepository : RepositoryBase<long, LeftWork>, ILeftWorkRepos
|
||||
var vipGroup = _context.CustomizeWorkshopEmployeeSettings.Where(x => x.CustomizeWorkshopGroupSettingId == 117)
|
||||
.Select(x => x.EmployeeId)
|
||||
.Except([5976]).ToList();
|
||||
var query = _context.LeftWorkList.Select(x => new LeftWorkViewModel()
|
||||
var clientTemps = _context.EmployeeClientTemps.Where(x => x.WorkshopId == searchModel.WorkshopId)
|
||||
.Select(x => x.EmployeeId);
|
||||
|
||||
var query = _context.LeftWorkList.Select(x => new LeftWorkViewModel()
|
||||
{
|
||||
Id = x.id,
|
||||
LeftWorkDate = x.LeftWorkDate.ToFarsi(),
|
||||
@@ -672,7 +675,7 @@ public class LeftWorkRepository : RepositoryBase<long, LeftWork>, ILeftWorkRepos
|
||||
JobName = _context.Jobs.FirstOrDefault(j => j.id == x.JobId).JobName
|
||||
|
||||
|
||||
}).Where(x=> !vipGroup.Contains(x.EmployeeId));
|
||||
}).Where(x=> !vipGroup.Contains(x.EmployeeId) && !clientTemps.Contains(x.EmployeeId));
|
||||
if (searchModel.WorkshopId != 0 && searchModel.EmployeeId != 0)
|
||||
query = query.Where(x => x.WorkshopId == searchModel.WorkshopId && x.EmployeeId == searchModel.EmployeeId);
|
||||
if (searchModel.EmployeeId != 0 && searchModel.WorkshopId == 0)
|
||||
|
||||
@@ -33,6 +33,7 @@ using CompanyManagment.App.Contracts.Reward.Enums;
|
||||
using static System.Runtime.InteropServices.JavaScript.JSType;
|
||||
using static Microsoft.EntityFrameworkCore.DbLoggerCategory.Database;
|
||||
using Company.Domain.HolidayItemAgg;
|
||||
using Company.Domain.RollCallEmployeeAgg;
|
||||
using PersianTools.Core;
|
||||
|
||||
|
||||
@@ -49,6 +50,7 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
|
||||
private readonly TestDbContext _testDbContext;
|
||||
|
||||
|
||||
|
||||
public RollCallMandatoryRepository(CompanyContext context, IYearlySalaryRepository yearlySalaryRepository,
|
||||
ILeftWorkRepository leftWorkRepository, ILeaveRepository leaveRepository, IHolidayItemRepository holidayItemRepository, TestDbContext testDbContext) : base(context)
|
||||
{
|
||||
@@ -58,7 +60,8 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
|
||||
_leaveRepository = leaveRepository;
|
||||
_holidayItemRepository = holidayItemRepository;
|
||||
_testDbContext = testDbContext;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#region OfficialChckout
|
||||
public ComputingViewModel MandatoryCompute(long employeeId, long workshopId, DateTime contractStart,
|
||||
@@ -724,6 +727,55 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// محاسبه ساعات کارکرد پرسنل در صورت داشتن حضور غیاب
|
||||
/// </summary>
|
||||
/// <param name="employeeId"></param>
|
||||
/// <param name="workshopId"></param>
|
||||
/// <param name="contractStart"></param>
|
||||
/// <param name="contractEnd"></param>
|
||||
/// <returns></returns>
|
||||
public (bool hasRollCall, TimeSpan sumOfSpan) GetRollCallWorkingSpan(long employeeId, long workshopId,
|
||||
DateTime contractStart, DateTime contractEnd)
|
||||
{
|
||||
//bool hasRollcall =
|
||||
// _rollCallEmployeeRepository.HasRollCallRecord(employeeId, workshopId, contractStart, contractEnd);
|
||||
//if (!hasRollcall)
|
||||
// return (false, new TimeSpan());
|
||||
List<RollCallViewModel> rollCallResult;
|
||||
List<GroupedRollCalls> groupedRollCall;
|
||||
|
||||
|
||||
rollCallResult = _context.RollCalls.Where(x =>
|
||||
x.EmployeeId == employeeId && x.WorkshopId == workshopId && x.StartDate.Value.Date >= contractStart.Date &&
|
||||
x.StartDate.Value.Date <= contractEnd.Date && x.EndDate != null).Select(x => new RollCallViewModel()
|
||||
{
|
||||
StartDate = x.StartDate,
|
||||
EndDate = x.EndDate,
|
||||
ShiftSpan = (x.EndDate.Value - x.StartDate.Value),
|
||||
CreationDate = x.ShiftDate,
|
||||
BreakTimeSpan = x.BreakTimeSpan
|
||||
}).ToList();
|
||||
|
||||
groupedRollCall = rollCallResult.GroupBy(x => x.CreationDate.Date).Select(x => new GroupedRollCalls()
|
||||
{
|
||||
CreationDate = x.Key,
|
||||
ShiftList = x.Select(s => new ShiftList() { Start = s.StartDate!.Value, End = s.EndDate!.Value }).ToList(),
|
||||
HasFriday = x.Any(s => s.StartDate != null && s.EndDate != null && (s.StartDate.Value.DayOfWeek == DayOfWeek.Friday || s.EndDate.Value!.DayOfWeek == DayOfWeek.Friday)),
|
||||
SumOneDaySpan = new TimeSpan(x.Sum(shift => shift.ShiftSpan.Ticks)) - CalculateBreakTime(x.First().BreakTimeSpan,
|
||||
new TimeSpan(x.Sum(shift => shift.ShiftSpan.Ticks))),
|
||||
|
||||
BreakTime = CalculateBreakTime(x.First().BreakTimeSpan, new TimeSpan(x.Sum(shift => shift.ShiftSpan.Ticks))),
|
||||
|
||||
}).OrderBy(x => x.CreationDate).ToList();
|
||||
|
||||
|
||||
TimeSpan sumSpans = new TimeSpan(groupedRollCall.Sum(x => x.SumOneDaySpan.Ticks));
|
||||
return (true, sumSpans);
|
||||
}
|
||||
|
||||
|
||||
public async Task<ComputingViewModel> RotatingShiftReport(long workshopId, long employeeId, DateTime contractStart, DateTime contractEnd, string shiftwork, bool hasRollCall, CreateWorkingHoursTemp command, bool holidayWorking)
|
||||
{
|
||||
List<RollCallViewModel> rollCallResult = new List<RollCallViewModel>();
|
||||
@@ -2263,6 +2315,7 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region CustomizeCheckout
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -8,10 +8,13 @@ using _0_Framework.Application;
|
||||
using _0_Framework.InfraStructure;
|
||||
using Company.Domain.LeftWorkAgg;
|
||||
using Company.Domain.MandatoryHoursAgg;
|
||||
using Company.Domain.RollCallAgg;
|
||||
using Company.Domain.RollCallEmployeeAgg;
|
||||
using Company.Domain.YearlySalaryAgg;
|
||||
using CompanyManagment.App.Contracts.Checkout;
|
||||
using CompanyManagment.App.Contracts.Holiday;
|
||||
using CompanyManagment.App.Contracts.LeftWork;
|
||||
using CompanyManagment.App.Contracts.RollCall;
|
||||
using CompanyManagment.App.Contracts.YearlySalary;
|
||||
using CompanyManagment.EFCore.Migrations;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
@@ -27,13 +30,16 @@ public class YearlySalaryRepository : RepositoryBase<long, YearlySalary>, IYearl
|
||||
private readonly CompanyContext _context;
|
||||
private readonly ILeftWorkRepository _leftWorkRepository;
|
||||
private readonly IMandatoryHoursRepository _mandatoryHoursRepository;
|
||||
private readonly IRollCallEmployeeRepository _rollCallEmployeeRepository;
|
||||
|
||||
|
||||
public YearlySalaryRepository(CompanyContext context, ILeftWorkRepository leftWorkRepository, IMandatoryHoursRepository mandatoryHoursRepository) : base(context)
|
||||
|
||||
public YearlySalaryRepository(CompanyContext context, ILeftWorkRepository leftWorkRepository, IMandatoryHoursRepository mandatoryHoursRepository, IRollCallEmployeeRepository rollCallEmployeeRepository) : base(context)
|
||||
{
|
||||
_context = context;
|
||||
_leftWorkRepository = leftWorkRepository;
|
||||
_mandatoryHoursRepository = mandatoryHoursRepository;
|
||||
_rollCallEmployeeRepository = rollCallEmployeeRepository;
|
||||
}
|
||||
// لیست سال های برای دراپ دان
|
||||
#region GetYearsToDropDown
|
||||
@@ -2229,7 +2235,56 @@ public class YearlySalaryRepository : RepositoryBase<long, YearlySalary>, IYearl
|
||||
|
||||
return result;
|
||||
}
|
||||
private static TimeSpan CalculateBreakTime(TimeSpan breakTimeSpan, TimeSpan sumOneDaySpan)
|
||||
{
|
||||
if (breakTimeSpan * 2 >= sumOneDaySpan)
|
||||
return new TimeSpan();
|
||||
return breakTimeSpan; ;
|
||||
}
|
||||
|
||||
private (bool hasRollCall, double WorkingTotalHours) GetTotalWorkingHoursIfHasRollCall(long employeeId,long workshopId, DateTime contractStart, DateTime contractEnd)
|
||||
{
|
||||
bool hasRollCall = _rollCallEmployeeRepository.HasRollCallRecord(employeeId, workshopId,
|
||||
contractStart, contractEnd);
|
||||
double totalWorkingHours = 0;
|
||||
if (!hasRollCall)
|
||||
return (false, 0);
|
||||
|
||||
List<RollCallViewModel> rollCallResult;
|
||||
List<GroupedRollCalls> groupedRollCall;
|
||||
|
||||
|
||||
rollCallResult = _context.RollCalls.Where(x =>
|
||||
x.EmployeeId == employeeId && x.WorkshopId == workshopId && x.StartDate.Value.Date >= contractStart &&
|
||||
x.StartDate.Value.Date <= contractEnd && x.EndDate != null).Select(x => new RollCallViewModel()
|
||||
{
|
||||
StartDate = x.StartDate,
|
||||
EndDate = x.EndDate,
|
||||
ShiftSpan = (x.EndDate.Value - x.StartDate.Value),
|
||||
CreationDate = x.ShiftDate,
|
||||
BreakTimeSpan = x.BreakTimeSpan
|
||||
}).ToList();
|
||||
|
||||
groupedRollCall = rollCallResult.GroupBy(x => x.CreationDate.Date).Select(x => new GroupedRollCalls()
|
||||
{
|
||||
CreationDate = x.Key,
|
||||
ShiftList = x.Select(s => new ShiftList() { Start = s.StartDate!.Value, End = s.EndDate!.Value }).ToList(),
|
||||
HasFriday = x.Any(s => s.StartDate != null && s.EndDate != null && (s.StartDate.Value.DayOfWeek == DayOfWeek.Friday || s.EndDate.Value!.DayOfWeek == DayOfWeek.Friday)),
|
||||
SumOneDaySpan = new TimeSpan(x.Sum(shift => shift.ShiftSpan.Ticks)) - CalculateBreakTime(x.First().BreakTimeSpan,
|
||||
new TimeSpan(x.Sum(shift => shift.ShiftSpan.Ticks))),
|
||||
|
||||
|
||||
|
||||
}).OrderBy(x => x.CreationDate).ToList();
|
||||
|
||||
|
||||
TimeSpan sumSpans = new TimeSpan(groupedRollCall.Sum(x => x.SumOneDaySpan.Ticks));
|
||||
totalWorkingHours = sumSpans.TotalMinutes / 60;
|
||||
|
||||
return (true, totalWorkingHours);
|
||||
|
||||
|
||||
}
|
||||
public List<ContractsCanToLeave> LeftWorkCantoleaveList(DateTime startDate, DateTime endDate, long workshopId, long employeeId, bool hasleft, DateTime leftWorkDate, int fridayStartToEnd, int officialHoliday, string totalHoursH, string totalHorsM, DateTime separationStartDate)
|
||||
{
|
||||
// {مقدار ساعت مجاز مرخصی در برای یک روز{کامل
|
||||
@@ -2238,6 +2293,7 @@ public class YearlySalaryRepository : RepositoryBase<long, YearlySalary>, IYearl
|
||||
var allContractsBetween = _context.Contracts.AsSplitQuery().Include(x => x.WorkingHoursList)
|
||||
.Where(x => x.WorkshopIds == workshopId && x.EmployeeId == employeeId &&
|
||||
x.ContractEnd >= startDate && x.ContarctStart <= endDate).ToList();
|
||||
|
||||
int mandatoryDays = 0;
|
||||
double allCanToLeave = 0;
|
||||
double canToLeave = 0;
|
||||
@@ -2247,11 +2303,14 @@ public class YearlySalaryRepository : RepositoryBase<long, YearlySalary>, IYearl
|
||||
contractCounter += 1;
|
||||
var m = _mandatoryHoursRepository.GetMondatoryDays(contract.ContarctStart,
|
||||
contract.ContractEnd);
|
||||
|
||||
var workinghoursH = contract.WorkingHoursList.Select(x => x.TotalHoursesH).FirstOrDefault();
|
||||
var workinghoursM = contract.WorkingHoursList.Select(x => x.TotalHoursesM).FirstOrDefault();
|
||||
workinghoursM = string.IsNullOrWhiteSpace(workinghoursM) ? "0" : workinghoursM;
|
||||
var workingHoursHDouble = Convert.ToDouble(workinghoursH);
|
||||
var workingHoursMDouble = Convert.ToDouble(workinghoursM);
|
||||
|
||||
|
||||
if (workingHoursMDouble > 0)
|
||||
{
|
||||
//تبیدل دقیه به اعشار
|
||||
@@ -2259,6 +2318,22 @@ public class YearlySalaryRepository : RepositoryBase<long, YearlySalary>, IYearl
|
||||
}
|
||||
//کل ساعت کار پرسنل در این ماه
|
||||
var totalWorkingHours = workingHoursHDouble + workingHoursMDouble;
|
||||
|
||||
#region RollCallSpan
|
||||
|
||||
var contractTotallDays = Convert.ToInt32((contract.ContractEnd - contract.ContarctStart).TotalDays + 1);
|
||||
if (contractTotallDays <= 31)
|
||||
{
|
||||
|
||||
var rollCallTotalHoures = GetTotalWorkingHoursIfHasRollCall(employeeId, workshopId,
|
||||
contract.ContarctStart.Date, contract.ContractEnd.Date);
|
||||
if (rollCallTotalHoures.hasRollCall)
|
||||
{
|
||||
totalWorkingHours = rollCallTotalHoures.WorkingTotalHours;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
// میانگین ساعت کارکرد پرسنل در روز
|
||||
var workingHoursePerDay = totalWorkingHours / m.MoandatoryDays;
|
||||
|
||||
@@ -2753,6 +2828,22 @@ public class YearlySalaryRepository : RepositoryBase<long, YearlySalary>, IYearl
|
||||
}
|
||||
//کل ساعت کار پرسنل در این قرارداد
|
||||
var totalWorkingHours = workingHoursHDouble + workingHoursMDouble;
|
||||
|
||||
#region RollCallSpan
|
||||
|
||||
var contractTotallDays = Convert.ToInt32((contract.ContractEnd - contract.ContarctStart).TotalDays + 1);
|
||||
if (contractTotallDays <= 31)
|
||||
{
|
||||
|
||||
var rollCallTotalHoures = GetTotalWorkingHoursIfHasRollCall(employeeId, workshopId,
|
||||
contract.ContarctStart.Date, contract.ContractEnd.Date);
|
||||
if (rollCallTotalHoures.hasRollCall)
|
||||
{
|
||||
totalWorkingHours = rollCallTotalHoures.WorkingTotalHours;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
// میانگین ساعت کارکرد پرسنل در روز
|
||||
var workingHoursePerDay = totalWorkingHours / m.MoandatoryDays;
|
||||
|
||||
|
||||
@@ -18,6 +18,10 @@
|
||||
margin-right: 80px;
|
||||
}
|
||||
|
||||
.level4 {
|
||||
margin-right: 120px;
|
||||
}
|
||||
|
||||
.parent {
|
||||
border-radius: 10px 0px 0px 10px;
|
||||
min-width: 220px;
|
||||
@@ -42,6 +46,16 @@
|
||||
border: 1px solid #666666 !important;
|
||||
margin-right: -4px;
|
||||
}
|
||||
|
||||
.parentLevel3 {
|
||||
border-radius: 10px 0px 0px 10px;
|
||||
min-width: 220px !important;
|
||||
text-align: start;
|
||||
background-color: #666666 !important;
|
||||
border: 1px solid #666666 !important;
|
||||
margin-right: -4px;
|
||||
}
|
||||
|
||||
.ion-plus {
|
||||
position: relative !important;
|
||||
top: 4px !important;
|
||||
@@ -536,15 +550,45 @@
|
||||
<label class="btn btn-icon waves-effect btn-default m-b-5 open-close">
|
||||
<i class="ion-plus"></i> <i class="ion-minus" style="display: none;"></i><input type="checkbox" style="display: none" class="open-btn"/>
|
||||
</label>
|
||||
<label class="btn btn-inverse waves-effect waves-light m-b-5 parentLevel2"> <input type="checkbox" disabled="disabled" value="306" class="check-btn"> <span style="bottom: 2px;position: relative"> مدیریت کاربران </span> </label>
|
||||
</div>
|
||||
@* تشخیص چهره *@
|
||||
<div class="child-check level2">
|
||||
<label class="btn btn-icon waves-effect btn-default m-b-5 open-close">
|
||||
<i class="ion-plus"></i> <i class="ion-minus" style="display: none;"></i><input type="checkbox" style="display: none" class="open-btn"/>
|
||||
</label>
|
||||
<label class="btn btn-inverse waves-effect waves-light m-b-5 parentLevel2"> <input type="checkbox" disabled="disabled" value="308" class="check-btn"> <span style="bottom: 2px;position: relative"> تشخیص چهره </span> </label>
|
||||
<label class="btn btn-inverse waves-effect waves-light m-b-5 parentLevel2"> <input type="checkbox" disabled="disabled" value="306" class="check-btn"> <span style="bottom: 2px;position: relative"> مدیریت کاربران </span> </label>
|
||||
@*لیست کاربران کلاینت*@
|
||||
<div class="child-check level3">
|
||||
<label class="btn btn-icon waves-effect btn-default m-b-5 open-close">
|
||||
<i class="ion-plus"></i> <i class="ion-minus" style="display: none;"></i><input type="checkbox" style="display: none" class="open-btn"/>
|
||||
</label>
|
||||
<label class="btn btn-inverse waves-effect waves-light m-b-5 parentLevel3"><input type="checkbox" disabled="disabled" value="30603" class="check-btn"> <span style="bottom: 2px;position: relative"> لیست کاربران کلاینت </span> </label>
|
||||
|
||||
<div class="child-check level4">
|
||||
<label class="btn btn-inverse waves-effect waves-light m-b-5 children "><input type="checkbox" disabled="disabled" value="3060301" class="check-btn"> <span style="bottom: 2px;position: relative"> ورود به کلاینت </span> </label>
|
||||
</div>
|
||||
<div class="child-check level4">
|
||||
<label class="btn btn-inverse waves-effect waves-light m-b-5 children "><input type="checkbox" disabled="disabled" value="3060302" class="check-btn"> <span style="bottom: 2px;position: relative"> تغییر رمز </span> </label>
|
||||
</div>
|
||||
<div class="child-check level4">
|
||||
<label class="btn btn-inverse waves-effect waves-light m-b-5 children "><input type="checkbox" disabled="disabled" value="3060303" class="check-btn"> <span style="bottom: 2px;position: relative"> ویرایش </span> </label>
|
||||
</div>
|
||||
<div class="child-check level4">
|
||||
<label class="btn btn-inverse waves-effect waves-light m-b-5 children "><input type="checkbox" disabled="disabled" value="3060304" class="check-btn"> <span style="bottom: 2px;position: relative"> حذف </span> </label>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="child-check level3">
|
||||
<label class="btn btn-inverse waves-effect waves-light m-b-5 children "><input type="checkbox" disabled="disabled" value="30601" class="check-btn"> <span style="bottom: 2px;position: relative"> ایجادکاربر جدید </span> </label>
|
||||
</div>
|
||||
<div class="child-check level3">
|
||||
<label class="btn btn-inverse waves-effect waves-light m-b-5 children "><input type="checkbox" disabled="disabled" value="30602" class="check-btn"> <span style="bottom: 2px;position: relative"> ایجاد نقش جدید </span> </label>
|
||||
</div>
|
||||
|
||||
<div class="child-check level3">
|
||||
<label class="btn btn-inverse waves-effect waves-light m-b-5 children "><input type="checkbox" disabled="disabled" value="30604" class="check-btn"> <span style="bottom: 2px;position: relative"> لیست کاربران ادمین </span> </label>
|
||||
</div>
|
||||
<div class="child-check level3">
|
||||
<label class="btn btn-inverse waves-effect waves-light m-b-5 children "><input type="checkbox" disabled="disabled" value="30605" class="check-btn"> <span style="bottom: 2px;position: relative"> نقش ها </span> </label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@* گزارشات *@
|
||||
<div class="child-check level2">
|
||||
<label class="btn btn-icon waves-effect btn-default m-b-5 open-close">
|
||||
|
||||
@@ -18,6 +18,11 @@
|
||||
margin-right: 80px;
|
||||
}
|
||||
|
||||
.level4 {
|
||||
margin-right: 120px;
|
||||
}
|
||||
|
||||
|
||||
.parent {
|
||||
border-radius: 10px 0px 0px 10px;
|
||||
min-width: 220px;
|
||||
@@ -42,6 +47,15 @@
|
||||
margin-right: -4px;
|
||||
}
|
||||
|
||||
.parentLevel3 {
|
||||
border-radius: 10px 0px 0px 10px;
|
||||
min-width: 220px !important;
|
||||
text-align: start;
|
||||
background-color: #666666 !important;
|
||||
border: 1px solid #666666 !important;
|
||||
margin-right: -4px;
|
||||
}
|
||||
|
||||
.ion-plus {
|
||||
position: relative !important;
|
||||
top: 4px !important;
|
||||
@@ -478,7 +492,15 @@
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@*ایجاد عناوین مقادیر سالانه*@
|
||||
@*حضورغیاب*@
|
||||
<div class="child-check level2">
|
||||
<label class="btn btn-icon waves-effect btn-default m-b-5 open-close">
|
||||
<i class="ion-plus"></i> <i class="ion-minus" style="display: none;"></i><input type="checkbox" style="display: none" class="open-btn"/>
|
||||
</label>
|
||||
<label class="btn btn-inverse waves-effect waves-light m-b-5 parentLevel2"> <input type="checkbox" disabled="disabled" value="308" class="check-btn"> <span style="bottom: 2px;position: relative"> حضورغیاب </span> </label>
|
||||
|
||||
</div>
|
||||
@*ایجاد عناوین مقادیر سالانه*@
|
||||
<div class="child-check level2">
|
||||
<label class="btn btn-icon waves-effect btn-default m-b-5 open-close">
|
||||
<i class="ion-plus"></i> <i class="ion-minus" style="display: none;"></i><input type="checkbox" style="display: none" class="open-btn"/>
|
||||
@@ -539,15 +561,45 @@
|
||||
<label class="btn btn-icon waves-effect btn-default m-b-5 open-close">
|
||||
<i class="ion-plus"></i> <i class="ion-minus" style="display: none;"></i><input type="checkbox" style="display: none" class="open-btn"/>
|
||||
</label>
|
||||
<label class="btn btn-inverse waves-effect waves-light m-b-5 parentLevel2"> <input type="checkbox" disabled="disabled" value="306" class="check-btn"> <span style="bottom: 2px;position: relative"> مدیریت کاربران </span> </label>
|
||||
</div>
|
||||
@* تشخیص چهره *@
|
||||
<div class="child-check level2">
|
||||
<label class="btn btn-icon waves-effect btn-default m-b-5 open-close">
|
||||
<i class="ion-plus"></i> <i class="ion-minus" style="display: none;"></i><input type="checkbox" style="display: none" class="open-btn"/>
|
||||
</label>
|
||||
<label class="btn btn-inverse waves-effect waves-light m-b-5 parentLevel2"> <input type="checkbox" disabled="disabled" value="308" class="check-btn"> <span style="bottom: 2px;position: relative"> تشخیص چهره </span> </label>
|
||||
<label class="btn btn-inverse waves-effect waves-light m-b-5 parentLevel2"> <input type="checkbox" disabled="disabled" value="306" class="check-btn"> <span style="bottom: 2px;position: relative"> مدیریت کاربران </span> </label>
|
||||
@*لیست کاربران کلاینت*@
|
||||
<div class="child-check level3">
|
||||
<label class="btn btn-icon waves-effect btn-default m-b-5 open-close">
|
||||
<i class="ion-plus"></i> <i class="ion-minus" style="display: none;"></i><input type="checkbox" style="display: none" class="open-btn"/>
|
||||
</label>
|
||||
<label class="btn btn-inverse waves-effect waves-light m-b-5 parentLevel3"><input type="checkbox" disabled="disabled" value="30603" class="check-btn"> <span style="bottom: 2px;position: relative"> لیست کاربران کلاینت </span> </label>
|
||||
|
||||
<div class="child-check level4">
|
||||
<label class="btn btn-inverse waves-effect waves-light m-b-5 children "><input type="checkbox" disabled="disabled" value="3060301" class="check-btn"> <span style="bottom: 2px;position: relative"> ورود به کلاینت </span> </label>
|
||||
</div>
|
||||
<div class="child-check level4">
|
||||
<label class="btn btn-inverse waves-effect waves-light m-b-5 children "><input type="checkbox" disabled="disabled" value="3060302" class="check-btn"> <span style="bottom: 2px;position: relative"> تغییر رمز </span> </label>
|
||||
</div>
|
||||
<div class="child-check level4">
|
||||
<label class="btn btn-inverse waves-effect waves-light m-b-5 children "><input type="checkbox" disabled="disabled" value="3060303" class="check-btn"> <span style="bottom: 2px;position: relative"> ویرایش </span> </label>
|
||||
</div>
|
||||
<div class="child-check level4">
|
||||
<label class="btn btn-inverse waves-effect waves-light m-b-5 children "><input type="checkbox" disabled="disabled" value="3060304" class="check-btn"> <span style="bottom: 2px;position: relative"> حذف </span> </label>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="child-check level3">
|
||||
<label class="btn btn-inverse waves-effect waves-light m-b-5 children "><input type="checkbox" disabled="disabled" value="30601" class="check-btn"> <span style="bottom: 2px;position: relative"> ایجادکاربر جدید </span> </label>
|
||||
</div>
|
||||
<div class="child-check level3">
|
||||
<label class="btn btn-inverse waves-effect waves-light m-b-5 children "><input type="checkbox" disabled="disabled" value="30602" class="check-btn"> <span style="bottom: 2px;position: relative"> ایجاد نقش جدید </span> </label>
|
||||
</div>
|
||||
|
||||
<div class="child-check level3">
|
||||
<label class="btn btn-inverse waves-effect waves-light m-b-5 children "><input type="checkbox" disabled="disabled" value="30604" class="check-btn"> <span style="bottom: 2px;position: relative"> لیست کاربران ادمین </span> </label>
|
||||
</div>
|
||||
<div class="child-check level3">
|
||||
<label class="btn btn-inverse waves-effect waves-light m-b-5 children "><input type="checkbox" disabled="disabled" value="30605" class="check-btn"> <span style="bottom: 2px;position: relative"> نقش ها </span> </label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@* گزارشات *@
|
||||
<div class="child-check level2">
|
||||
<label class="btn btn-icon waves-effect btn-default m-b-5 open-close">
|
||||
|
||||
@@ -3,12 +3,14 @@
|
||||
@using Microsoft.EntityFrameworkCore
|
||||
@using _0_Framework.Application
|
||||
@model ServiceHost.Areas.Admin.Pages.Accounts.Account.IndexModel
|
||||
@inject IAuthHelper _AuthHelper;
|
||||
|
||||
@{
|
||||
|
||||
var i = 1;
|
||||
var j = 1;
|
||||
var r = 1;
|
||||
var permissionList = _AuthHelper.GetPermissions();
|
||||
//string colaps = "in";
|
||||
//string act = "active";
|
||||
}
|
||||
@@ -64,11 +66,11 @@
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
|
||||
<p class="pull-right">
|
||||
<p class="pull-right" permission="30601">
|
||||
<a href="#showmodal=@Url.Page("./Index", "Create")" class="btn btn-success btn-rounded waves-effect waves-light m-b-5" style=" background-color: #f5f5f5; border-color: #0f9500; font-family: 'Web_Yekan' !important; color: #0f9500 !important; border-top-left-radius: 0px; border-bottom-left-radius: 0px "> <i class="fa fa-user-plus" style="padding-left: 3px; font-size: 14px; color: #0f9500 !important "></i> ایجاد کاربر جدید</a>
|
||||
|
||||
</p>
|
||||
<p class="pull-right">
|
||||
<p class="pull-right" permission="30602">
|
||||
<a href="#showmodal=@Url.Page("./Index", "CreateRole")" class="btn btn-success btn-rounded waves-effect waves-light m-b-5" style=" background-color: #f5f5f5; border-color: #605f5f; font-family: 'Web_Yekan' !important; color: #605f5f !important; border-top-right-radius: 0px; border-bottom-right-radius: 0px "> <i class="fa fa-group" style="padding-left: 3px; font-size: 14px; color: #605f5f !important "></i> ایجاد نقش جدید</a>
|
||||
|
||||
</p>
|
||||
@@ -99,17 +101,17 @@
|
||||
|
||||
<ul class="nav nav-tabs tabs" id="myTab">
|
||||
@* ============================================RolesTab=================*@
|
||||
<li class="tab">
|
||||
<li class="tab @(permissionList.All(x => x != 30604) && permissionList.All(x => x != 30603)? "active" : "") " permission="30605">
|
||||
<a href="#profile-21" data-toggle="tab" aria-expanded="false" class=" ac">
|
||||
<span class="visible-xs">
|
||||
<i class="fa fa-group" style="display: block;padding: 20px 0 0 0;"></i>
|
||||
<span class="visible-xs">
|
||||
<i class="fa fa-group" style="display: block;padding: 20px 0 0 0;"></i>
|
||||
<span class="textMenu">نقش ها</span>
|
||||
</span>
|
||||
</span>
|
||||
<h3 class="hideInMobile" style="font-family: 'Web_Yekan' !important; font-size: 18px !important"><i class="fa fa-group fa-2x" style="padding-left: 3px;"></i> نقش ها</h3>
|
||||
</a>
|
||||
</li>
|
||||
</li>
|
||||
@* ===============================================AdminTab=================*@
|
||||
<li class="tab active">
|
||||
<li class="tab active" permission="30604">
|
||||
<a href="#home-21" data-toggle="tab" aria-expanded="false" class="active ac">
|
||||
<span class="visible-xs">
|
||||
<i class="fa fa-user" style="display: block;padding: 20px 0 0 0;"></i>
|
||||
@@ -119,20 +121,21 @@
|
||||
</a>
|
||||
</li>
|
||||
@* ===============================================ClientTab=================*@
|
||||
<li class="tab">
|
||||
<li class="tab @(permissionList.All(x => x != 30604) ? "active" : "")" permission="30603">
|
||||
<a href="#Client-21" data-toggle="tab" aria-expanded="false" class=" ac">
|
||||
<span class="visible-xs" >
|
||||
<i class="fa fa-group" style="display: block;padding: 20px 0 0 0;"></i>
|
||||
<span class="textMenu">لیست موازی</span>
|
||||
</span>
|
||||
<h3 class="hideInMobile" style="font-family: 'Web_Yekan' !important; font-size: 18px !important"><i class="fa fa-group fa-2x" style="padding-left: 3px;"></i> لیست کاربران ( موازی) (@Model.ClientAccounts.Count) </h3>
|
||||
<span class="visible-xs" >
|
||||
<i class="fa fa-group" style="display: block;padding: 20px 0 0 0;"></i>
|
||||
<span class="textMenu">لیست کلاینت</span>
|
||||
</span>
|
||||
<h3 class="hideInMobile" style="font-family: 'Web_Yekan' !important; font-size: 18px !important"><i class="fa fa-group fa-2x" style="padding-left: 3px;"></i> لیست کاربران ( کلاینت) (@Model.ClientAccounts.Count) </h3>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
<div class="tab-content">
|
||||
@*==================================================================Adminusers=====*@
|
||||
<div class="tab-pane active" id="home-21">
|
||||
<div class="tab-pane active" id="home-21" permission="30604">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
@@ -298,7 +301,7 @@
|
||||
</div>
|
||||
|
||||
@*==================================================================roles=====*@
|
||||
<div class="tab-pane" id="profile-21">
|
||||
<div class="tab-pane @(permissionList.All(x => x != 30604) && permissionList.All(x => x != 30603)? "active" : "") " id="profile-21" permission="30605">
|
||||
|
||||
|
||||
|
||||
@@ -367,7 +370,7 @@
|
||||
</div>
|
||||
|
||||
@*==================================================================Clientusers=====*@
|
||||
<div class="tab-pane" id="Client-21">
|
||||
<div class="tab-pane @(permissionList.All(x => x != 30604) ? "active" : "")" id="Client-21" permission="30603">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
@@ -485,27 +488,27 @@
|
||||
j++;
|
||||
}
|
||||
<td>
|
||||
<a class="btn btn-success pull-right m-rl-5 red" onclick="directLogin(@item.Id)">
|
||||
<a permission="3060301" class="btn btn-success pull-right m-rl-5 red" onclick="directLogin(@item.Id)">
|
||||
<i class="fa fa-sign-in faSize"></i><span style="position: relative;bottom: 3px;">ورود به کلاینت</span>
|
||||
</a>
|
||||
<a class="btn btn-info pull-right m-rl-5 red"
|
||||
<a permission="3060302" class="btn btn-info pull-right m-rl-5 red"
|
||||
href="#showmodal=@Url.Page("./Index", "ChangePassword", new { item.Id })">
|
||||
<i class="fa fa-key faSize"></i>
|
||||
</a>
|
||||
<a class="btn btn-warning pull-right m-rl-5 red"
|
||||
<a permission="3060303" class="btn btn-warning pull-right m-rl-5 red"
|
||||
href="#showmodal=@Url.Page("./Index", "Edit", new { item.Id })">
|
||||
<i class="fa fa-edit faSize"></i>
|
||||
</a>
|
||||
|
||||
@if (item.IsActiveString == "true" && item.Role != "مدیر سیستم")
|
||||
{
|
||||
<a onclick="deActive(@item.Id, '@item.Fullname')" class="btn btn-danger pull-right m-rl-5 red">
|
||||
<a permission="3060304" onclick="deActive(@item.Id, '@item.Fullname')" class="btn btn-danger pull-right m-rl-5 red">
|
||||
<i class="fa faSize fa-trash"></i>
|
||||
</a>
|
||||
}
|
||||
else if (item.IsActiveString == "false")
|
||||
{
|
||||
<a onclick="Active(@item.Id, '@item.Fullname')" class=" btn btn-success pull-right m-rl-5 red">
|
||||
<a permission="3060304" onclick="Active(@item.Id, '@item.Fullname')" class=" btn btn-success pull-right m-rl-5 red">
|
||||
<i class="fa faSize fa-rotate-left"></i>
|
||||
</a>
|
||||
}
|
||||
|
||||
@@ -1483,8 +1483,8 @@ public class IndexModel : PageModel
|
||||
return Partial("../Error/_ErrorModal", resultError);
|
||||
}
|
||||
|
||||
var clientTemps = _employeeClientTempApplication.GetByEmployeeId(employeeId).GetAwaiter().GetResult();
|
||||
if (leftWorks.Any(x => x.LeftWorkType == LeftWorkTempType.StartWork) || clientTemps.Any())
|
||||
//var clientTemps = _employeeClientTempApplication.GetByEmployeeId(employeeId).GetAwaiter().GetResult();
|
||||
if (leftWorks.Any(x => x.LeftWorkType == LeftWorkTempType.StartWork) /*|| clientTemps.Any()*/)
|
||||
{
|
||||
var resultError = new ErrorViewModel()
|
||||
{
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
}
|
||||
</style>
|
||||
|
||||
var accountId = AuthHelper.CurrentAccountId();
|
||||
|
||||
}
|
||||
<div class="left side-menu">
|
||||
<div class="sidebar-inner slimscrollleft">
|
||||
@@ -177,19 +179,24 @@
|
||||
</svg>
|
||||
حضورغیاب </a>
|
||||
</li>
|
||||
<li permission="306">
|
||||
<a class="clik3" href="/AdminNew/Company/Bank">
|
||||
<svg width="13" height="13" viewBox="0 0 13 13" fill="none" xmlns="http://www.w3.org/2000/svg" style="width: 7px;margin: 0 6px;">
|
||||
<circle cx="6.5" cy="6.5" r="6.5" fill="white"/>
|
||||
</svg>
|
||||
بانک ها </a>
|
||||
</li>
|
||||
<li permission="306"><a class="clik3" asp-page="/Company/SmsResult/Index">
|
||||
<svg width="13" height="13" viewBox="0 0 13 13" fill="none" xmlns="http://www.w3.org/2000/svg" style="width: 7px;margin: 0 6px;">
|
||||
<circle cx="6.5" cy="6.5" r="6.5" fill="white"/>
|
||||
</svg>
|
||||
گزارش پیامک خودکار</a>
|
||||
</li>
|
||||
@if (accountId is 2 or 3)
|
||||
{
|
||||
<li permission="307">
|
||||
<a class="clik3" href="/AdminNew/Company/Bank">
|
||||
<svg width="13" height="13" viewBox="0 0 13 13" fill="none" xmlns="http://www.w3.org/2000/svg" style="width: 7px;margin: 0 6px;">
|
||||
<circle cx="6.5" cy="6.5" r="6.5" fill="white"/>
|
||||
</svg>
|
||||
بانک ها </a>
|
||||
</li>
|
||||
<li permission="307">
|
||||
<a class="clik3" asp-page="/Company/SmsResult/Index">
|
||||
<svg width="13" height="13" viewBox="0 0 13 13" fill="none" xmlns="http://www.w3.org/2000/svg" style="width: 7px;margin: 0 6px;">
|
||||
<circle cx="6.5" cy="6.5" r="6.5" fill="white"/>
|
||||
</svg>
|
||||
گزارش پیامک خودکار</a>
|
||||
</li>
|
||||
}
|
||||
|
||||
<li permission="301"><a class="clik3" asp-page="/Company/YearlySalaryTitles/Index">
|
||||
<svg width="13" height="13" viewBox="0 0 13 13" fill="none" xmlns="http://www.w3.org/2000/svg" style="width: 7px;margin: 0 6px;">
|
||||
<circle cx="6.5" cy="6.5" r="6.5" fill="white"/>
|
||||
|
||||
@@ -228,7 +228,7 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.RollCall
|
||||
}
|
||||
|
||||
public IActionResult OnPostEditSettingWorkTime(List<CustomizeWorkshopShiftViewModel> shiftViewModels,
|
||||
long customizeWorkshopSettingsId, WorkshopShiftStatus workshopShiftStatus, long workshopId,FridayWork fridayWork,HolidayWork holidayWork)
|
||||
long customizeWorkshopSettingsId, WorkshopShiftStatus workshopShiftStatus, long workshopId,FridayWork fridayWork,HolidayWork holidayWork,List<DayOfWeek> offDayOfWeeks)
|
||||
{
|
||||
if (workshopId < 1)
|
||||
return new JsonResult(new
|
||||
@@ -240,7 +240,7 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.RollCall
|
||||
//Todo:Vafa!!
|
||||
//Todo: Vafa : to in ja bool replaceChange group ro ezafe kon. hatman ham workshopShiftStatus az front pas bede be in.
|
||||
var result = _customizeWorkshopSettingsApplication
|
||||
.EditWorkshopSettingShifts(shiftViewModels, customizeWorkshopSettingsId, workshopShiftStatus, fridayWork, holidayWork);
|
||||
.EditWorkshopSettingShifts(shiftViewModels, customizeWorkshopSettingsId, workshopShiftStatus, holidayWork, offDayOfWeeks);
|
||||
|
||||
return new JsonResult(new
|
||||
{
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
@inject ITicketAccessAccountRepository TicketAccessAccount;
|
||||
@inject _0_Framework.Application.IAuthHelper AuthHelper;
|
||||
@{
|
||||
|
||||
var accountId = AuthHelper.CurrentAccountId();
|
||||
<style>
|
||||
.showCount span {
|
||||
background-color: #dd2a2a;
|
||||
@@ -241,21 +241,25 @@
|
||||
</svg>
|
||||
حضورغیاب </a>
|
||||
</li>
|
||||
<li permission="306">
|
||||
<a class="clik3" href="/AdminNew/Company/Bank">
|
||||
<svg width="13" height="13" viewBox="0 0 13 13" fill="none" xmlns="http://www.w3.org/2000/svg" style="width: 7px;margin: 0 6px;">
|
||||
<circle cx="6.5" cy="6.5" r="6.5" fill="white"/>
|
||||
</svg>
|
||||
بانک ها </a>
|
||||
</li>
|
||||
<li permission="306">
|
||||
<a class="clik3" asp-area="Admin" asp-page="/Company/SmsResult/Index">
|
||||
<svg width="13" height="13" viewBox="0 0 13 13" fill="none" xmlns="http://www.w3.org/2000/svg" style="width: 7px;margin: 0 6px;">
|
||||
<circle cx="6.5" cy="6.5" r="6.5" fill="white" />
|
||||
</svg>
|
||||
گزارش پیامک خودکار
|
||||
</a>
|
||||
</li>
|
||||
@if (accountId is 2 or 3)
|
||||
{
|
||||
<li permission="307">
|
||||
<a class="clik3" href="/AdminNew/Company/Bank">
|
||||
<svg width="13" height="13" viewBox="0 0 13 13" fill="none" xmlns="http://www.w3.org/2000/svg" style="width: 7px;margin: 0 6px;">
|
||||
<circle cx="6.5" cy="6.5" r="6.5" fill="white"/>
|
||||
</svg>
|
||||
بانک ها </a>
|
||||
</li>
|
||||
<li permission="307">
|
||||
<a class="clik3" asp-area="Admin" asp-page="/Company/SmsResult/Index">
|
||||
<svg width="13" height="13" viewBox="0 0 13 13" fill="none" xmlns="http://www.w3.org/2000/svg" style="width: 7px;margin: 0 6px;">
|
||||
<circle cx="6.5" cy="6.5" r="6.5" fill="white" />
|
||||
</svg>
|
||||
گزارش پیامک خودکار
|
||||
</a>
|
||||
</li>
|
||||
}
|
||||
|
||||
<li permission="301">
|
||||
<a class="clik3" asp-area="Admin" asp-page="/Company/YearlySalaryTitles/Index">
|
||||
<svg width="13" height="13" viewBox="0 0 13 13" fill="none" xmlns="http://www.w3.org/2000/svg" style="width: 7px;margin: 0 6px;">
|
||||
|
||||
@@ -58,14 +58,14 @@
|
||||
|
||||
<div class="col-12 group-container">
|
||||
<div class="titleSettingRollCall">وضعیت فعالیت مجموعه در روز های جمعه</div>
|
||||
<div class="form-group my-1 group">
|
||||
@* <div class="form-group my-1 group">
|
||||
<input type="radio" name="Command.FridayWork" id="Friday1" class="form-check-input Main-Radio" @(Model.FridayWork == FridayWork.Default ? "checked" : "") value="@((int)(FridayWork.Default))" />
|
||||
<label for="Friday1">پرسنل در روزهای جمعه کار نمیکند.</label>
|
||||
</div>
|
||||
<div class="form-group my-1 group">
|
||||
<input type="radio" name="Command.FridayWork" id="Friday2" class="form-check-input Main-Radio" @(Model.FridayWork == FridayWork.WorkInFriday ? "checked" : "") value="@((int)(FridayWork.WorkInFriday))" />
|
||||
<label for="Friday2">پرسنل در روزهای جمعه کار میکند.</label>
|
||||
</div>
|
||||
</div> *@
|
||||
</div>
|
||||
|
||||
<div class="col-12">
|
||||
|
||||
@@ -56,14 +56,14 @@
|
||||
|
||||
<div class="col-12 group-container">
|
||||
<div class="titleSettingRollCall">وضعیت فعالیت مجموعه در روز های جمعه</div>
|
||||
<div class="form-group my-1 group">
|
||||
@* <div class="form-group my-1 group">
|
||||
<input type="radio" name="Command.FridayWork" id="Friday1" class="form-check-input Main-Radio" @(Model.FridayWork == FridayWork.Default ? "checked" : "") value="@((int)(FridayWork.Default))" />
|
||||
<label for="Friday1">پرسنل در روزهای جمعه کار نمیکند.</label>
|
||||
</div>
|
||||
<div class="form-group my-1 group">
|
||||
<input type="radio" name="Command.FridayWork" id="Friday2" class="form-check-input Main-Radio" @(Model.FridayWork == FridayWork.WorkInFriday ? "checked" : "") value="@((int)(FridayWork.WorkInFriday))" />
|
||||
<label for="Friday2">پرسنل در روزهای جمعه کار میکند.</label>
|
||||
</div>
|
||||
</div> *@
|
||||
</div>
|
||||
|
||||
<div class="col-12">
|
||||
|
||||
@@ -29,14 +29,14 @@
|
||||
|
||||
<div class="col-12 group-container">
|
||||
<div class="titleSettingRollCall">وضعیت فعالیت مجموعه در روز های جمعه</div>
|
||||
<div class="form-group my-1 group">
|
||||
@* <div class="form-group my-1 group">
|
||||
<input type="radio" name="Command.FridayWork" id="Friday1" class="form-check-input Main-Radio" @(Model.FridayWork == FridayWork.Default ? "checked" : "") value="@((int)(FridayWork.Default))" />
|
||||
<label for="Friday1">پرسنل در روزهای جمعه کار نمیکند.</label>
|
||||
</div>
|
||||
<div class="form-group my-1 group">
|
||||
<input type="radio" name="Command.FridayWork" id="Friday2" class="form-check-input Main-Radio" @(Model.FridayWork == FridayWork.WorkInFriday ? "checked" : "") value="@((int)(FridayWork.WorkInFriday))" />
|
||||
<label for="Friday2">پرسنل در روزهای جمعه کار میکند.</label>
|
||||
</div>
|
||||
</div> *@
|
||||
</div>
|
||||
|
||||
<div class="col-12">
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
@page
|
||||
@using _0_Framework.Application
|
||||
@using Microsoft.AspNetCore.Mvc.TagHelpers
|
||||
@model ServiceHost.Areas.Client.Pages.Company.RollCall.CameraAccounts.IndexModel
|
||||
|
||||
@inject _0_Framework.Application.IAuthHelper authHelper
|
||||
@{
|
||||
string clientVersion = _0_Framework.Application.Version.StyleVersion;
|
||||
ViewData["Title"] = " - " + "تنظیمات حساب کاربری دوربین";
|
||||
@@ -207,6 +209,9 @@
|
||||
// check and show modal Camera Account And Workshop Setting
|
||||
var statusCameraAccountAndWorkshopSettingUrl = `@Url.Page("./../Index", "StatusCameraAccountAndWorkshopSetting")`;
|
||||
var modalCreateCameraAccountUrl = `@Url.Page("./Index", "CreateCameraAccount")`;
|
||||
|
||||
var hasActiveDeActvePersmission = @(authHelper.GetPermissions().Contains(SubAccountPermissionHelper.CameraAccountActivationBtnPermissionCode) ? "true" : "false");
|
||||
var hasEditCameraAccountPermission = @(authHelper.GetPermissions().Contains(SubAccountPermissionHelper.CameraAccountEditPermissionCode) ? "true" : "false");
|
||||
</script>
|
||||
<script src="~/assetsclient/pages/RollCall/js/CameraAccounts.js?ver=@clientVersion"></script>
|
||||
}
|
||||
@@ -360,8 +360,10 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall
|
||||
message = createRollCallEmployeeStatus.Message,
|
||||
});
|
||||
}
|
||||
}
|
||||
else
|
||||
_rollCallEmployeeStatusApplication.SyncRollCallEmployeeWithLeftWork(result.SendId);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( rollCallEmployee.Statuses == null || rollCallEmployee.Statuses?.Any(x => x.StartDateGr <= DateTime.Now.Date && x.EndDateGr >= DateTime.Now.Date)== false)
|
||||
{
|
||||
|
||||
@@ -240,9 +240,10 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall
|
||||
BreakTime = employee.BreakTime,
|
||||
WorkshopShiftStatus = employee.WorkshopShiftStatus,
|
||||
IrregularShift = employee.IrregularShift,
|
||||
FridayWork = employee.FridayWork,
|
||||
//FridayWork = employee.FridayWork,
|
||||
HolidayWork = employee.HolidayWork,
|
||||
CustomizeRotatingShifts = employee.CustomizeRotatingShiftsViewModels
|
||||
CustomizeRotatingShifts = employee.CustomizeRotatingShiftsViewModels,
|
||||
WeeklyOffDays = employee.WeeklyOffDays
|
||||
};
|
||||
return Partial("ModalEditEmployeeFromGroup", command);
|
||||
}
|
||||
|
||||
@@ -310,7 +310,7 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall
|
||||
}
|
||||
|
||||
public IActionResult OnPostEditSettingWorkTime(List<CustomizeWorkshopShiftViewModel> shiftViewModels,
|
||||
long customizeWorkshopSettingsId, WorkshopShiftStatus workshopShiftStatus,FridayWork fridayWork,HolidayWork holidayWork)
|
||||
long customizeWorkshopSettingsId, WorkshopShiftStatus workshopShiftStatus,FridayWork fridayWork,HolidayWork holidayWork,List<DayOfWeek> offDayOfWeeks)
|
||||
{
|
||||
var workshopHash = User.FindFirstValue("WorkshopSlug");
|
||||
var workshopId = _passwordHasher.SlugDecrypt(workshopHash);
|
||||
@@ -324,7 +324,7 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall
|
||||
//Todo:Vafa!!
|
||||
//Todo: Vafa : to in ja bool replaceChange group ro ezafe kon. hatman ham workshopShiftStatus az front pas bede be in.
|
||||
var result = _customizeWorkshopSettingsApplication
|
||||
.EditWorkshopSettingShifts(shiftViewModels, customizeWorkshopSettingsId, workshopShiftStatus,fridayWork, holidayWork);
|
||||
.EditWorkshopSettingShifts(shiftViewModels, customizeWorkshopSettingsId, workshopShiftStatus, holidayWork, offDayOfWeeks);
|
||||
|
||||
return new JsonResult(new
|
||||
{
|
||||
|
||||
@@ -230,14 +230,14 @@
|
||||
<div class="col-6 p-0">
|
||||
<div class="group-container">
|
||||
@* <div class="lableCheckBreakTime">وضعیت فعالیت مجموعه در روز های جمعه</div> *@
|
||||
<div class="d-flex form-group my-1 group">
|
||||
@* <div class="d-flex form-group my-1 group">
|
||||
<input type="radio" name="Command.FridayWork" id="Friday1" class="form-check-input Main-Radio" @(Model.FridayWork == FridayWork.Default ? "checked" : "") value="@((int)(FridayWork.Default))"/>
|
||||
<label for="Friday1" class="lableCheckBreakTime">پرسنل در روزهای جمعه کار نمیکند.</label>
|
||||
</div>
|
||||
<div class="d-flex form-group my-1 group">
|
||||
<input type="radio" name="Command.FridayWork" id="Friday2" class="form-check-input Main-Radio" @(Model.FridayWork == FridayWork.WorkInFriday ? "checked" : "") value="@((int)(FridayWork.WorkInFriday))"/>
|
||||
<label for="Friday2" class="lableCheckBreakTime">پرسنل در روزهای جمعه کار میکند.</label>
|
||||
</div>
|
||||
</div> *@
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -389,14 +389,14 @@
|
||||
<div class="col-6 p-0">
|
||||
<div class="group-container">
|
||||
@* <div class="lableCheckBreakTime">وضعیت فعالیت مجموعه در روز های جمعه</div> *@
|
||||
<div class="d-flex form-group my-1 group">
|
||||
@* <div class="d-flex form-group my-1 group">
|
||||
<input type="radio" name="FridayWork" id="Friday1" class="form-check-input Main-Radio" @(Model.FridayWork == FridayWork.Default ? "checked" : "") value="@((int)(FridayWork.Default))" />
|
||||
<label for="Friday1" class="lableCheckBreakTime">پرسنل در روزهای جمعه کار نمیکند.</label>
|
||||
</div>
|
||||
<div class="d-flex form-group my-1 group">
|
||||
<input type="radio" name="FridayWork" id="Friday2" class="form-check-input Main-Radio" @(Model.FridayWork == FridayWork.WorkInFriday ? "checked" : "") value="@((int)(FridayWork.WorkInFriday))" />
|
||||
<label for="Friday2" class="lableCheckBreakTime">پرسنل در روزهای جمعه کار میکند.</label>
|
||||
</div>
|
||||
</div> *@
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -400,14 +400,14 @@
|
||||
<div class="col-6 p-0">
|
||||
<div class="group-container">
|
||||
@* <div class="lableCheckBreakTime">وضعیت فعالیت مجموعه در روز های جمعه</div> *@
|
||||
<div class="d-flex form-group my-1 group">
|
||||
@* <div class="d-flex form-group my-1 group">
|
||||
<input type="radio" name="FridayWork" id="Friday1" class="form-check-input Main-Radio" @(Model.FridayWork == FridayWork.Default ? "checked" : "") value="@((int)(FridayWork.Default))" />
|
||||
<label for="Friday1" class="lableCheckBreakTime">پرسنل در روزهای جمعه کار نمیکند.</label>
|
||||
</div>
|
||||
<div class="d-flex form-group my-1 group">
|
||||
<input type="radio" name="FridayWork" id="Friday2" class="form-check-input Main-Radio" @(Model.FridayWork == FridayWork.WorkInFriday ? "checked" : "") value="@((int)(FridayWork.WorkInFriday))" />
|
||||
<label for="Friday2" class="lableCheckBreakTime">پرسنل در روزهای جمعه کار میکند.</label>
|
||||
</div>
|
||||
</div> *@
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -162,14 +162,14 @@
|
||||
<div class="col-6 p-0">
|
||||
<div class="group-container">
|
||||
@* <div class="lableCheckBreakTime">وضعیت فعالیت مجموعه در روز های جمعه</div> *@
|
||||
<div class="d-flex form-group my-1 group">
|
||||
@* <div class="d-flex form-group my-1 group">
|
||||
<input type="radio" name="FridayWork" id="Friday1" class="form-check-input Main-Radio" @(Model.FridayWork == FridayWork.Default ? "checked" : "") value="@((int)(FridayWork.Default))"/>
|
||||
<label for="Friday1" class="lableCheckBreakTime">پرسنل در روزهای جمعه کار نمیکند.</label>
|
||||
</div>
|
||||
<div class="d-flex form-group my-1 group">
|
||||
<input type="radio" name="FridayWork" id="Friday2" class="form-check-input Main-Radio" @(Model.FridayWork == FridayWork.WorkInFriday ? "checked" : "") value="@((int)(FridayWork.WorkInFriday))"/>
|
||||
<label for="Friday2" class="lableCheckBreakTime">پرسنل در روزهای جمعه کار میکند.</label>
|
||||
</div>
|
||||
</div> *@
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -103,7 +103,7 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall._WorkshopSetting
|
||||
}
|
||||
|
||||
public IActionResult OnPostEditSettingWorkTime(List<CustomizeWorkshopShiftViewModel> shiftViewModels,
|
||||
long customizeWorkshopSettingsId, WorkshopShiftStatus workshopShiftStatus, FridayWork fridayWork, HolidayWork holidayWork)
|
||||
long customizeWorkshopSettingsId, WorkshopShiftStatus workshopShiftStatus, FridayWork fridayWork, HolidayWork holidayWork,List<DayOfWeek> offDayOfWeeks)
|
||||
{
|
||||
var workshopHash = User.FindFirstValue("WorkshopSlug");
|
||||
var workshopId = _passwordHasher.SlugDecrypt(workshopHash);
|
||||
@@ -115,7 +115,7 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall._WorkshopSetting
|
||||
});
|
||||
|
||||
var result = _customizeWorkshopSettingsApplication
|
||||
.EditWorkshopSettingShifts(shiftViewModels, customizeWorkshopSettingsId, workshopShiftStatus, fridayWork, holidayWork);
|
||||
.EditWorkshopSettingShifts(shiftViewModels, customizeWorkshopSettingsId, workshopShiftStatus, holidayWork, offDayOfWeeks);
|
||||
|
||||
return new JsonResult(new
|
||||
{
|
||||
|
||||
@@ -98,14 +98,14 @@
|
||||
<div class="col-6 p-0">
|
||||
<div class="group-container">
|
||||
@* <div class="lableCheckBreakTime">وضعیت فعالیت مجموعه در روز های جمعه</div> *@
|
||||
<div class="d-flex form-group my-1 group">
|
||||
@* <div class="d-flex form-group my-1 group">
|
||||
<input type="radio" name="FridayWork" id="Friday1" class="form-check-input Main-Radio" @(Model.FridayWork == FridayWork.Default ? "checked" : "") value="@((int)(FridayWork.Default))" />
|
||||
<label for="Friday1" class="lableCheckBreakTime">پرسنل در روزهای جمعه کار نمیکند.</label>
|
||||
</div>
|
||||
<div class="d-flex form-group my-1 group">
|
||||
<input type="radio" name="FridayWork" id="Friday2" class="form-check-input Main-Radio" @(Model.FridayWork == FridayWork.WorkInFriday ? "checked" : "") value="@((int)(FridayWork.WorkInFriday))" />
|
||||
<label for="Friday2" class="lableCheckBreakTime">پرسنل در روزهای جمعه کار میکند.</label>
|
||||
</div>
|
||||
</div> *@
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -162,14 +162,14 @@
|
||||
<div class="col-6 p-0">
|
||||
<div class="group-container">
|
||||
@* <div class="lableCheckBreakTime">وضعیت فعالیت مجموعه در روز های جمعه</div> *@
|
||||
<div class="d-flex form-group my-1 group">
|
||||
@* <div class="d-flex form-group my-1 group">
|
||||
<input type="radio" name="FridayWork" id="Friday1" class="form-check-input Main-Radio" @(Model.FridayWork == FridayWork.Default ? "checked" : "") value="@((int)(FridayWork.Default))"/>
|
||||
<label for="Friday1" class="lableCheckBreakTime">پرسنل در روزهای جمعه کار نمیکند.</label>
|
||||
</div>
|
||||
<div class="d-flex form-group my-1 group">
|
||||
<input type="radio" name="FridayWork" id="Friday2" class="form-check-input Main-Radio" @(Model.FridayWork == FridayWork.WorkInFriday ? "checked" : "") value="@((int)(FridayWork.WorkInFriday))"/>
|
||||
<label for="Friday2" class="lableCheckBreakTime">پرسنل در روزهای جمعه کار میکند.</label>
|
||||
</div>
|
||||
</div> *@
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -15,14 +15,14 @@
|
||||
</div>
|
||||
<div class="col-12 group-container">
|
||||
<div class="titleSettingRollCall">تعطیلات جمعه</div>
|
||||
<div class="form-group my-1 group">
|
||||
@* <div class="form-group my-1 group">
|
||||
<input type="radio" name="Command.FridayWork" id="Friday1" class="form-check-input Main-Radio" @(Model.FridayWork == FridayWork.Default ? "checked" : "") value="@((int)(FridayWork.Default))" />
|
||||
<label for="Friday1">پرسنل در روزهای جمعه کار نمیکند.</label>
|
||||
</div>
|
||||
<div class="form-group my-1 group">
|
||||
<input type="radio" name="Command.FridayWork" id="Friday2" class="form-check-input Main-Radio" @(Model.FridayWork == FridayWork.WorkInFriday ? "checked" : "") value="@((int)(FridayWork.WorkInFriday))" />
|
||||
<label for="Friday2">پرسنل در روزهای جمعه کار میکند.</label>
|
||||
</div>
|
||||
</div> *@
|
||||
</div>
|
||||
|
||||
<div class="col-12">
|
||||
|
||||
@@ -16,14 +16,14 @@
|
||||
</div>
|
||||
<div class="col-12 group-container">
|
||||
<div class="titleSettingRollCall">تعطیلات جمعه</div>
|
||||
<div class="form-group my-1 group">
|
||||
@* <div class="form-group my-1 group">
|
||||
<input type="radio" name="Command.FridayWork" id="Friday1" class="form-check-input Main-Radio" @(Model.FridayWork == FridayWork.Default ? "checked" : "") value="@((int)(FridayWork.Default))" />
|
||||
<label for="Friday1">پرسنل در روزهای جمعه کار نمیکند.</label>
|
||||
</div>
|
||||
<div class="form-group my-1 group">
|
||||
<input type="radio" name="Command.FridayWork" id="Friday2" class="form-check-input Main-Radio" @(Model.FridayWork == FridayWork.WorkInFriday ? "checked" : "") value="@((int)(FridayWork.WorkInFriday))" />
|
||||
<label for="Friday2">پرسنل در روزهای جمعه کار میکند.</label>
|
||||
</div>
|
||||
</div> *@
|
||||
</div>
|
||||
|
||||
<div class="col-12">
|
||||
|
||||
@@ -14,14 +14,14 @@
|
||||
</div>
|
||||
<div class="col-12 group-container">
|
||||
<div class="titleSettingRollCall">تعطیلات جمعه</div>
|
||||
<div class="form-group my-1 group">
|
||||
@* <div class="form-group my-1 group">
|
||||
<input type="radio" name="Command.FridayWork" id="Friday1" class="form-check-input Main-Radio" @(Model.FridayWork == FridayWork.Default ? "checked" : "") value="@((int)(FridayWork.Default))" />
|
||||
<label for="Friday1">پرسنل در روزهای جمعه کار نمیکند.</label>
|
||||
</div>
|
||||
<div class="form-group my-1 group">
|
||||
<input type="radio" name="Command.FridayWork" id="Friday2" class="form-check-input Main-Radio" @(Model.FridayWork == FridayWork.WorkInFriday ? "checked" : "") value="@((int)(FridayWork.WorkInFriday))" />
|
||||
<label for="Friday2">پرسنل در روزهای جمعه کار میکند.</label>
|
||||
</div>
|
||||
</div> *@
|
||||
</div>
|
||||
|
||||
<div class="col-12">
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using System.Diagnostics;
|
||||
using _0_Framework.Domain.CustomizeCheckoutShared.Enums;
|
||||
using CompanyManagment.App.Contracts.AdminMonthlyOverview;
|
||||
using CompanyManagment.EFCore;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using ServiceHost.Areas.AdminNew.Pages.Company.RollCall;
|
||||
|
||||
namespace ServiceHost.Test;
|
||||
@@ -18,9 +20,38 @@ public class Tester
|
||||
public async Task Test()
|
||||
{
|
||||
|
||||
// await AdminMonthlyOverviewTest();
|
||||
// await AdminMonthlyOverviewTest();
|
||||
//await ChangeFridayWorkToWeeklyDayOfWeek();
|
||||
|
||||
}
|
||||
|
||||
private async Task ChangeFridayWorkToWeeklyDayOfWeek()
|
||||
{
|
||||
var employeeSettingsEnumerable =await _companyContext.CustomizeWorkshopEmployeeSettings.Where(x=>x.FridayWork ==FridayWork.Default).ToListAsync();
|
||||
foreach (var employeeSetting in employeeSettingsEnumerable)
|
||||
{
|
||||
employeeSetting.FridayWorkToWeeklyDayOfWeek();
|
||||
}
|
||||
|
||||
var groupSettings = await _companyContext.CustomizeWorkshopGroupSettings
|
||||
.Where(x => x.FridayWork == FridayWork.Default).ToListAsync();
|
||||
|
||||
foreach (var groupSetting in groupSettings)
|
||||
{
|
||||
groupSetting.FridayWorkToWeeklyDayOfWeek();
|
||||
}
|
||||
|
||||
var workshopSettings = await _companyContext.CustomizeWorkshopSettings
|
||||
.Where(x => x.FridayWork == FridayWork.Default).ToListAsync();
|
||||
foreach (var workshopSetting in workshopSettings)
|
||||
{
|
||||
workshopSetting.FridayWorkToWeeklyDayOfWeek();
|
||||
}
|
||||
|
||||
await _companyContext.SaveChangesAsync();
|
||||
|
||||
}
|
||||
|
||||
private async Task AdminMonthlyOverviewTest()
|
||||
{
|
||||
var acc = _companyContext.WorkshopAccounts.FirstOrDefault(x => x.AccountId == 322);
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
//"MesbahDb": "Data Source=DESKTOP-NUE119G\\MSNEW;Initial Catalog=Mesbah_db;Integrated Security=True"
|
||||
|
||||
//server
|
||||
//"MesbahDb": "Data Source=171.22.24.15;Initial Catalog=mesbah_db;Persist Security Info=False;User ID=ir_db;Password=R2rNp[170]is[3019]#@ATt;TrustServerCertificate=true;",
|
||||
|
||||
//"MesbahDb": "Data Source=171.22.24.15;Initial Catalog=mesbah_db;Persist Security Info=False;User ID=ir_db;Password=R2rNp[170]18[3019]#@ATt;TrustServerCertificate=true;",
|
||||
|
||||
|
||||
//local
|
||||
"MesbahDb": "Data Source=.;Initial Catalog=mesbah_db;Integrated Security=True;TrustServerCertificate=true;",
|
||||
|
||||
@@ -61,7 +61,7 @@ function loadDataCameraAccountAjax() {
|
||||
|
||||
<div class="Rtable-cell d-md-flex d-none justify-content-center width5">
|
||||
<div class="Rtable-cell--content align-items-center d-flex d-md-flex text-end me-3">
|
||||
<div class="d-flex align-items-center justify-content-center">
|
||||
<div class="d-flex align-items-center justify-content-center ${hasActiveDeActvePersmission ? `` : `disable`}">
|
||||
<span class="mx-1 df">فعال</span>
|
||||
<label class="switch">
|
||||
<input type="checkbox"
|
||||
@@ -77,14 +77,26 @@ function loadDataCameraAccountAjax() {
|
||||
|
||||
<div class="Rtable-cell d-md-flex justify-content-end width6">
|
||||
<div class="Rtable-cell--content align-items-center d-flex d-md-flex justify-content-end">
|
||||
<button class="btn-pass ChangePassword d-none d-md-block" onclick="showModalCameraAccountChangePassword(${item.id})" id="CameraAccountChangePassword_${item.id}" type="button">
|
||||
|
||||
${hasEditCameraAccountPermission ?
|
||||
`<button class="btn-pass ChangePassword d-none d-md-block" onclick="showModalCameraAccountChangePassword(${item.id})" id="CameraAccountChangePassword_${item.id}" type="button">
|
||||
<span class="spanTxt d-none">تغییر گذرواژه</span>
|
||||
<span class="spanSvg">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-6">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M15.75 5.25a3 3 0 0 1 3 3m3 0a6 6 0 0 1-7.029 5.912c-.563-.097-1.159.026-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 1 1 21.75 8.25Z" />
|
||||
</svg>
|
||||
</span>
|
||||
</button>
|
||||
</button>`
|
||||
:
|
||||
`<button class="btn-pass ChangePassword d-none d-md-block disable" type="button">
|
||||
<span class="spanTxt d-none">تغییر گذرواژه</span>
|
||||
<span class="spanSvg">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-6">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M15.75 5.25a3 3 0 0 1 3 3m3 0a6 6 0 0 1-7.029 5.912c-.563-.097-1.159.026-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 1 1 21.75 8.25Z" />
|
||||
</svg>
|
||||
</span>
|
||||
</button>`
|
||||
}
|
||||
|
||||
<button type="button" class="btn-more position-relative d-md-none d-flex" style="width: 36px;padding: 0;height: 36px;align-items: center;justify-content: center;position: relative !important;">
|
||||
<span class="mx-1 align-items-center d-flex justify-content-center"></span>
|
||||
@@ -109,7 +121,7 @@ function loadDataCameraAccountAjax() {
|
||||
</div>
|
||||
<div class="d-flex align-items-center justify-content-between my-1">
|
||||
<span class="span1">وضعیت:</span>
|
||||
<div class="d-flex align-items-center justify-content-center">
|
||||
<div class="d-flex align-items-center justify-content-center ${hasActiveDeActvePersmission ? `` : `disable`}">
|
||||
<span class="span1 mx-1 df">فعال</span>
|
||||
<label class="switch">
|
||||
<input type="checkbox"
|
||||
@@ -133,14 +145,25 @@ function loadDataCameraAccountAjax() {
|
||||
</span>
|
||||
</button>
|
||||
|
||||
<button class="btn-pass ChangePassword w-100" onclick="showModalCameraAccountChangePassword(${item.id})" id="ChangePassword_${item.id}" type="button">
|
||||
<span class="spanTxt">تغییر گذرواژه</span>
|
||||
<span class="spanSvg">
|
||||
<svg width="24" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M15.75 5.25a3 3 0 0 1 3 3m3 0a6 6 0 0 1-7.029 5.912c-.563-.097-1.159.026-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 1 1 21.75 8.25Z" />
|
||||
</svg>
|
||||
</span>
|
||||
</button>
|
||||
${hasEditCameraAccountPermission ?
|
||||
`<button class="btn-pass ChangePassword w-100" onclick="showModalCameraAccountChangePassword(${item.id})" id="ChangePassword_${item.id}" type="button">
|
||||
<span class="spanTxt">تغییر گذرواژه</span>
|
||||
<span class="spanSvg">
|
||||
<svg width="24" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M15.75 5.25a3 3 0 0 1 3 3m3 0a6 6 0 0 1-7.029 5.912c-.563-.097-1.159.026-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 1 1 21.75 8.25Z" />
|
||||
</svg>
|
||||
</span>
|
||||
</button>`
|
||||
:
|
||||
`<button class="btn-pass ChangePassword w-100 disable" type="button">
|
||||
<span class="spanTxt">تغییر گذرواژه</span>
|
||||
<span class="spanSvg">
|
||||
<svg width="24" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M15.75 5.25a3 3 0 0 1 3 3m3 0a6 6 0 0 1-7.029 5.912c-.563-.097-1.159.026-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 1 1 21.75 8.25Z" />
|
||||
</svg>
|
||||
</span>
|
||||
</button>`
|
||||
}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user