Compare commits

...

163 Commits

Author SHA1 Message Date
25120ff9c7 add new data for 99 archivecode and rollcall excels 2025-10-02 12:09:12 +03:30
MahanCh
e0129b089b add archive code and add color to true data in export excel 2025-07-13 10:05:33 +03:30
MahanCh
fd2522e507 complete get workshops excel data 2025-07-12 12:57:22 +03:30
ca55ee9aef reafactor: fix error of query getting data for excel data 2025-07-10 22:10:18 +03:30
MahanCh
16c00cbd0e feat: create method for query getting workhsop excel datas 2025-07-10 14:43:13 +03:30
MahanCh
f4ec4f43c6 add institution Contract Excel 2025-07-09 17:19:28 +03:30
MahanCh
e8f7f6b778 fix : update data from edit employee in grouping in cws 2025-07-09 13:01:36 +03:30
MahanCh
b0b8680125 fix: weekly offdays foreign key conflict in CreateEmployeesSettingsAndSetChanges 2025-07-09 12:06:42 +03:30
MahanCh
2714732750 Merge branch 'master' of https://github.com/syntax24/OriginalGozareshgir 2025-07-08 13:51:59 +03:30
MahanCh
2a78a9dc1a change employee upload picture change name style 2025-07-08 13:51:52 +03:30
SamSys
95b09278aa KababMahdi bug fixed merged 2025-07-07 18:08:08 +03:30
SamSys
f2b3a26471 employeeUploadPicture bug fixed merged 2025-07-07 14:12:27 +03:30
SamSys
33e3efeef5 manadatory Compute friday count bug fix 2025-07-07 02:14:38 +03:30
38171581d3 fix : set group for pending create employee group 2025-07-06 13:33:27 +03:30
MahanCh
0d66a79d49 fix some bugs 2025-07-03 15:39:24 +03:30
MahanCh
0ed24dff45 fix : admin monthly overview 2025-07-02 18:02:11 +03:30
MahanCh
53061f29b7 feature: add admin monthly overview condition for employee compute options 2025-07-02 14:57:39 +03:30
SamSys
861efc48e0 Completed new Workshop options 2025-07-02 04:28:38 +03:30
SamSys
eb16bda0ae Merge branch 'master' of https://github.com/samsyntax24/OriginalGozareshgir 2025-07-01 17:31:49 +03:30
SamSys
3285be107e checkout mail list bug fixed 2025-07-01 17:31:40 +03:30
MahanCh
4818fa32f4 fix: throws null error on edit rollcall group 2025-07-01 16:36:40 +03:30
MahanCh
79e5d98ac6 Merge branch 'master' of https://github.com/syntax24/OriginalGozareshgir 2025-07-01 16:24:57 +03:30
MahanCh
73732cfe67 fix: create employee upload picture create bug 2025-07-01 16:24:53 +03:30
MahanCh
f2580c8e28 Fix take image bug 2025-07-01 16:09:37 +03:30
MahanCh
5c5f3eefa6 complete new checkout calcualation for kebab mahdi time differences 2025-06-30 13:30:49 +03:30
MahanCh
b99c503b58 fix create group js bug 2025-06-30 12:16:19 +03:30
SamSys
2fd1878126 Merge weeklyofday 2025-06-29 14:35:43 +03:30
MahanCh
a8c449c101 TOMAM for Change friday work with WeeklyOfDays 2025-06-29 14:30:36 +03:30
MahanCh
80c0ec28d5 finishOffDayOfWeek for CWS 2025-06-29 14:01:47 +03:30
MahanCh
b133aa67d2 merge fom master 2025-06-29 13:25:23 +03:30
SamSys
8122c9d841 Edit Employee Insurance Validation 2025-06-29 13:00:03 +03:30
SamSys
75e2a3c558 Create Employee Validation for InsuranceHistory 2025-06-28 13:33:52 +03:30
MahanCh
3fa027dfd1 change rollcall mandatoory computes 2025-06-26 14:43:11 +03:30
SamSys
6942e55823 Checkout print Change footer merged 2025-06-25 20:14:29 +03:30
SamSys
2314fd456c checkout main list bug fixed - insurance employee id 45280 exception 2025-06-25 16:18:44 +03:30
MahanCh
4415cb8128 change checkout styles 2025-06-25 16:07:02 +03:30
SamSys
f0547828a6 add new metods in workFlow to CreateChekout 2025-06-25 04:48:12 +03:30
SamSys
b5afc9eef0 skipRollCall aded 2025-06-25 03:55:09 +03:30
SamSys
83a17a7e86 Contract Sign opreation completed - new option to check workflow to create checkout 2025-06-25 03:50:39 +03:30
SamSys
8e3a5b46da checkout sign opration completed 2025-06-25 01:17:07 +03:30
SamSys
b15c34373b checkout sign 2025-06-24 14:04:27 +03:30
MahanCh
8284ec199f add new rule for rollcall 2025-06-24 12:02:23 +03:30
MahanCh
fcfe7c7e58 delete friday work 2025-06-24 10:45:41 +03:30
SamSys
9b28c63317 Merge branch 'OpretionForEmployeeOptoins' 2025-06-23 00:34:23 +03:30
SamSys
a861f9f21c check options on create checkout 2025-06-23 00:32:35 +03:30
SamSys
8fd51f4e42 contractTerm And CutEndYear completed on EmployeeOptions 2025-06-22 23:22:19 +03:30
SamSys
146ab74524 employeeOptions bug fixed 2025-06-22 20:58:56 +03:30
SamSys
1d38420ddf add valid leave to checkout sumSpan 2025-06-22 19:21:19 +03:30
SamSys
fcad12d3ef ClientCreateEmployee change merged 2025-06-22 15:11:51 +03:30
SamSys
285e56ce03 change hasRollcall 2025-06-22 15:07:36 +03:30
b2cb3ae173 finish employee unauthorized 2025-06-22 15:05:38 +03:30
8afdf13863 change string and extract number 2025-06-22 13:21:15 +03:30
524086129a Merge branch 'master' of https://github.com/syntax24/OriginalGozareshgir 2025-06-22 12:35:45 +03:30
53d44700b8 fix employeeIds bug 2025-06-22 12:35:30 +03:30
SamSys
84ff2bc8f1 uid bug fixed 2025-06-22 11:36:02 +03:30
3a84c65ce1 change accept left work for being sync with status 2025-06-19 14:47:20 +03:30
a6c25ec8e8 complete front but backend still not finished 2025-06-19 13:51:05 +03:30
SamSys
c69cc41c93 change 2025-06-18 16:00:27 +03:30
423f14a348 Merge branch 'master' of https://github.com/syntax24/OriginalGozareshgir 2025-06-18 15:34:04 +03:30
1bb0f1f1b2 add access to new gharardad arshad to search in monthly overview 2025-06-18 15:33:57 +03:30
7b2eefa954 create employee without auth for client p1 - not finished 2025-06-18 15:31:13 +03:30
SamSys
c80a5dbab7 RotatingShift Joopiter Exeption - Absence change 2025-06-17 20:45:28 +03:30
SamSys
256717c6f8 add new metod 2025-06-17 17:09:16 +03:30
SamSys
0d18d9aa1a Merge branch 'master' of https://github.com/syntax24/OriginalGozareshgir 2025-06-17 15:06:28 +03:30
SamSys
14fbf309a7 checkout bug fixed 2025-06-17 15:06:18 +03:30
SamSys
e379727606 change 2025-06-17 14:45:36 +03:30
3303d4b54a Merge branch 'master' of https://github.com/syntax24/OriginalGozareshgir 2025-06-17 13:47:41 +03:30
dba28b4d89 add move task changer in tester 2025-06-16 21:47:28 +03:30
SamSys
41ec3fb9cf InsuranceDeduction OverTime added for checkout 2025-06-16 17:58:55 +03:30
SamSys
7f98cf8f12 Create checkou bug fixed 2025-06-16 13:22:14 +03:30
SamSys
6c8385061e change 2025-06-15 21:02:26 +03:30
SamSys
a49467ee44 EmployeeComputeOption and Workshop new options merged 2025-06-15 21:02:07 +03:30
e9907650e9 fix - connected personnel on get to show the create and sign options for contract and checkout 2025-06-15 20:05:54 +03:30
fb1db062f3 complete method for weeklyDayOfweek... 2025-06-15 19:44:09 +03:30
SamSys
0e66c5e1a0 SaveRollcall checkout merged 2025-06-15 19:16:44 +03:30
SamSys
27a92f5796 changes 2025-06-15 14:32:48 +03:30
6e5788074c fix goverment list calculation for insurance 2025-06-12 00:27:42 +03:30
831b426f9f initialize options for create and sign in checkout and contract 2025-06-11 21:07:36 +03:30
b29b1335d3 finish saving rollcall to original 2025-06-11 19:00:17 +03:30
SamSys
befcc70d46 Client Sidebar bug fixed 2025-06-11 15:34:40 +03:30
SamSys
f249df5b49 RotatingShiftReport And Compute Changed - StaticWorkongHoures Interference bug fixed 2025-06-10 20:02:50 +03:30
24d41ffc68 add rollcall to checkout 2025-06-10 19:10:33 +03:30
SamSys
c6d4d7d473 add checkoutSaveData in MandatoryCompute 2025-06-09 18:46:46 +03:30
c594cbf523 change checkout application 2025-06-09 17:47:23 +03:30
996adec188 Merge branch 'master' of https://github.com/syntax24/OriginalGozareshgir 2025-06-09 16:52:17 +03:30
6f47948e40 merge from goverment list calculation 2025-06-09 16:52:10 +03:30
SamSys
d135eb73ea Merge branch 'master' of https://github.com/syntax24/OriginalGozareshgir 2025-06-09 16:45:30 +03:30
SamSys
86143a044c report bug fixed 2025-06-09 16:45:23 +03:30
8a6d4e0af6 add insurance list changes 2025-06-09 16:38:46 +03:30
3b2fd137e4 fix some style bug 2025-06-09 16:37:57 +03:30
52976d8965 add calculation for create checkout 2025-06-09 16:07:22 +03:30
ec97274d5e add checkout rollcall domain to Checkout 2025-06-09 15:07:06 +03:30
c9183fb57e add goverment list calculation 2025-06-09 13:51:31 +03:30
SamSys
c4d21be4aa new inurancelist bug fixed - FiexedSalary changes added 2025-06-08 16:20:30 +03:30
SamSys
e9386708dc Merge branch 'master' of https://github.com/syntax24/OriginalGozareshgir 2025-06-08 16:17:16 +03:30
SamSys
d70abb60d7 guid for application download link 2025-06-08 16:17:08 +03:30
2098e843a5 fix conflict 2025-06-08 16:10:03 +03:30
f6b6dfa046 merge from team work 2025-06-08 16:04:54 +03:30
36cdde7e6a change insurance govermentlist 2025-06-08 14:32:43 +03:30
SamSys
34358a36c9 change upload apk 2025-06-07 19:21:34 +03:30
SamSys
babecda188 add new permission to InsuranceList 2025-06-07 16:09:50 +03:30
SamSys
98c3e7c821 New-Insurance-Opration Merged 2025-06-05 02:05:24 +03:30
SamSys
5d91b29f2b Create File Bug Fixed 2025-06-03 21:45:20 +03:30
SamSys
c948498307 merged changes 2025-06-03 21:27:14 +03:30
87b0d248a3 Convert checkoutPrintOne to CheckoutPrintAll for best performance 2025-06-03 19:38:18 +03:30
a410d0c216 Merge branch 'master' of https://github.com/syntax24/OriginalGozareshgir 2025-06-03 19:11:52 +03:30
a640f91703 fix leave hours bugs 2025-06-03 19:11:44 +03:30
SamSys
99c8dcb764 add comment to InsuranceList metod 2025-06-03 16:32:12 +03:30
f35aca8e44 add migration 2025-06-02 22:48:59 +03:30
16d45c6dc4 merge from master 2025-06-02 22:21:30 +03:30
45e746b194 merge from team work 2025-06-02 22:20:04 +03:30
SamSys
d44935329f checkoutBug Fixed 2025-06-02 22:06:41 +03:30
SamSys
3a7fc7087b changesAuthHelper 2025-06-02 22:05:21 +03:30
925f43214c fix checkout bug 2025-06-02 22:02:33 +03:30
SamSys
c2fc7dabc1 print bug fixed 2025-06-02 21:38:56 +03:30
SamSys
dec5666eb7 changes 2025-06-02 21:37:27 +03:30
9271cb5c66 test 2025-06-02 20:14:49 +03:30
aee7e5ce82 add migration 2025-06-02 19:47:45 +03:30
97b4c7dc66 add offdays for cws 2025-06-02 19:42:20 +03:30
e3b6d5f1c9 fix task schedule bug 2025-06-02 16:37:23 +03:30
7c1fe65cf2 add sync employee status with left work method on rollcall employee upload picture 2025-06-02 16:29:03 +03:30
f26fcba165 add permissions for mahan 2025-06-02 15:41:06 +03:30
SamSys
de2a6203df LeavePayAndAbsence merged 2025-06-02 13:34:10 +03:30
SamSys
2208834a0e refactor LeavePayMetotds 2025-06-02 13:33:21 +03:30
de52a0be98 change thumbnails for list 2025-06-01 19:00:57 +03:30
SamSys
5bebec3fde Merge branch 'master' of https://github.com/syntax24/OriginalGozareshgir 2025-06-01 17:50:56 +03:30
SamSys
cad808d73c permission change on menu 2025-06-01 17:50:50 +03:30
abef053f56 Merge branch 'master' of https://github.com/syntax24/OriginalGozareshgir 2025-06-01 17:47:37 +03:30
6469bf5a50 fix createEmployee personnel code bug 2025-06-01 17:43:53 +03:30
SamSys
4fd5ef52ef Permission changed 2025-06-01 16:50:27 +03:30
SamSys
61e2bdaaf5 add permission 2025-06-01 16:42:35 +03:30
8ab22d9948 fix admin monthly overview 2025-06-01 16:40:09 +03:30
SamSys
17b5f5fee5 add new Permission 2025-06-01 16:34:31 +03:30
9e7e4ca655 change create condition for contract 2025-06-01 15:56:49 +03:30
SamSys
100c9367ed editRole 2025-06-01 15:30:02 +03:30
fdb6799c65 change modal left work permission 2025-06-01 15:27:48 +03:30
SamSys
c81da3e787 started 2025-05-31 21:05:01 +03:30
SamSys
d8c0471878 Client CameraAccounts new permission added 2025-05-31 17:40:42 +03:30
MahanCh
8418c2edc4 fix sub account bugs 2025-05-31 13:56:02 +03:30
SamSys
e109a41b90 subAccountRole merged 2025-05-31 00:45:26 +03:30
SamSys
158fc91a67 changes 2025-05-31 00:43:50 +03:30
SamSys
d1fb6e933d Merge branch 'Feature/SubAccount/ChangeRole' of https://github.com/syntax24/OriginalGozareshgir into Feature/SubAccount/ChangeRole 2025-05-31 00:34:43 +03:30
SamSys
0811482370 add selected workshops on editRole subAccount 2025-05-31 00:34:36 +03:30
SamSys
46833f93da changes 2025-05-30 19:06:21 +03:30
SamSys
8d78ea548a Merge branch 'master' of https://github.com/syntax24/OriginalGozareshgir 2025-05-30 19:06:04 +03:30
SamSys
ffbadc5a96 checkout changes 2025-05-30 19:05:55 +03:30
e889b61d27 test 2025-05-30 18:04:12 +03:30
SamSys
baeeec183b Color change 2025-05-29 14:55:50 +03:30
SamSys
3142a80b44 completed 2 2025-05-29 05:04:57 +03:30
SamSys
175158a3d7 Completed 1 2025-05-29 01:31:28 +03:30
SamSys
66ada45d29 change metod 2025-05-27 20:44:25 +03:30
SamSys
e486f20a5a chekcoutRepository GetContractResultToCreateCheckout changes NOT FINISHED 2025-05-27 19:21:49 +03:30
SamSys
22f13aea0b metode change 2025-05-27 16:18:39 +03:30
SamSys
88a9a62dd3 Add new View model : CreateCheckoutListViewModel 2025-05-25 21:20:26 +03:30
SamSys
6fd9b336a9 From Master 2025-05-25 19:09:38 +03:30
SamSys
03e4f7e8c1 metod Extend 2025-05-25 18:29:18 +03:30
SamSys
9311d68a91 create change 2025-05-25 15:33:42 +03:30
SamSys
9e91214941 Master changes Transfer to Current 2025-05-25 15:33:23 +03:30
SamSys
3e3eccf0f0 add new metod to rcheckoutRepository 2025-05-24 16:33:02 +03:30
MahanCh
f04749043e start new insurancelist operations 2025-05-21 18:25:09 +03:30
MahanCh
e8a9a674a1 merge from job Item 2025-05-21 15:54:53 +03:30
MahanCh
d8b6b0f5e8 New Operation InsuranceList Started! 2025-05-21 15:53:05 +03:30
SamSys
789b0fbc24 started 2025-05-17 18:18:22 +03:30
246 changed files with 127737 additions and 36067 deletions

View File

@@ -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
}

View File

@@ -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

View File

@@ -880,7 +880,15 @@ public static class Tools
}
}
numbers = Convert.ToInt32(num);
try
{
numbers = Convert.ToInt32(num);
}
catch (Exception e)
{
return 0;
}
return numbers;
}
public static string ToFarsiMonthByNumber(this string value)
@@ -1396,6 +1404,73 @@ public static class Tools
return false;
return true;
}
/// <summary>
/// چک میکند که در دو شیفت استاتیک تداخل زمانی وجود دارد یا خیر
/// چک میکند که آیا ساعات وارد شده ولید هستند یا خیر
/// </summary>
/// <param name="start1"></param>
/// <param name="end1"></param>
/// <param name="start2"></param>
/// <param name="end2"></param>
/// <returns></returns>
public static bool InterferenceTime(string start1, string end1, string start2, string end2)
{
if (!CheckValidHm(start1))
return true;
if (!CheckValidHm(end1))
return true;
if (!CheckValidHm(start2))
return true;
if (!CheckValidHm(end2))
return true;
//اگه دو شیفت نبود
if (string.IsNullOrWhiteSpace(start1) || string.IsNullOrWhiteSpace(start2))
return false;
try
{
var start1Gr = Convert.ToDateTime(start1);
var end1Gr = Convert.ToDateTime(end1);
if (end1Gr < start1Gr)
end1Gr = end1Gr.AddDays(1);
var start2Gr = Convert.ToDateTime(start2);
var end2Gr = Convert.ToDateTime(end2);
start2Gr = new DateTime(end1Gr.Year, end1Gr.Month, end1Gr.Day, start2Gr.Hour, start2Gr.Minute,
start2Gr.Second);
end2Gr = new DateTime(end1Gr.Year, end1Gr.Month, end1Gr.Day, end2Gr.Hour, end2Gr.Minute,
end2Gr.Second);
if (end2Gr < start2Gr)
end2Gr = end2Gr.AddDays(1);
var diff = (end1Gr - start1Gr).Add((end2Gr - start2Gr));
if (diff > new TimeSpan(24,0,0))
return true;
if (start2Gr <= end1Gr)
return true;
return false;
}
catch (Exception)
{
return true;
}
}
public static DateTime FindFirstDayOfMonthGr(this DateTime date)
{
var pc = new PersianCalendar();

View File

@@ -10,67 +10,70 @@ namespace _0_Framework.Application.UID;
public class UidService : IUidService
{
private readonly HttpClient _httpClient;
private const string BaseUrl= "https://json-api.uid.ir/api/inquiry/";
private readonly HttpClient _httpClient;
private const string BaseUrl = "https://json-api.uid.ir/api/inquiry/";
public UidService()
{
_httpClient = new HttpClient()
{
BaseAddress = new Uri(BaseUrl)
};
}
public UidService()
{
_httpClient = new HttpClient()
{
BaseAddress = new Uri(BaseUrl)
};
}
public async Task<PersonalInfoResponse> GetPersonalInfo(string nationalCode, string birthDate)
{
var request = new PersonalInfoRequest
{
BirthDate = birthDate ,
NationalId = nationalCode,
RequestContext = new UidRequestContext()
};
var json = JsonConvert.SerializeObject(request);
var contentType = new StringContent(json, Encoding.UTF8, "application/json");
public async Task<PersonalInfoResponse> GetPersonalInfo(string nationalCode, string birthDate)
{
var request = new PersonalInfoRequest
{
BirthDate = birthDate,
NationalId = nationalCode,
RequestContext = new UidRequestContext()
};
var json = JsonConvert.SerializeObject(request);
var contentType = new StringContent(json, Encoding.UTF8, "application/json");
var requestResult = await _httpClient.PostAsync("person/v2", contentType);
try
{
if (!requestResult.IsSuccessStatusCode)
return null;
var responseResult = await requestResult.Content.ReadFromJsonAsync<PersonalInfoResponse>();
if (responseResult.BasicInformation != null)
{
responseResult.BasicInformation.FirstName = responseResult.BasicInformation.FirstName?.ToPersian();
responseResult.BasicInformation.LastName = responseResult.BasicInformation.LastName?.ToPersian();
responseResult.BasicInformation.FatherName = responseResult.BasicInformation.FatherName?.ToPersian();
}
try
{
var requestResult = await _httpClient.PostAsync("person/v2", contentType);
if (!requestResult.IsSuccessStatusCode)
return null;
var responseResult = await requestResult.Content.ReadFromJsonAsync<PersonalInfoResponse>();
if (responseResult.BasicInformation != null)
{
responseResult.BasicInformation.FirstName = responseResult.BasicInformation.FirstName?.ToPersian();
responseResult.BasicInformation.LastName = responseResult.BasicInformation.LastName?.ToPersian();
responseResult.BasicInformation.FatherName = responseResult.BasicInformation.FatherName?.ToPersian();
}
return responseResult;
}
catch
{
return responseResult;
}
catch
{
return null;
}
}
return new PersonalInfoResponse(new UidBasicInformation(),
new IdentificationInformation(default, default, default, default, default), new RegistrationStatus(),
new ResponseContext(new UidStatus(14, "")));
}
}
public async Task<MatchMobileWithNationalCodeResponse> IsMachPhoneWithNationalCode(string nationalCode, string phoneNumber)
{
var request = new PersonalInfoRequest
{
MobileNumber = phoneNumber,
NationalId = nationalCode,
RequestContext = new UidRequestContext()
};
var json = JsonConvert.SerializeObject(request);
var contentType = new StringContent(json, Encoding.UTF8, "application/json");
public async Task<MatchMobileWithNationalCodeResponse> IsMachPhoneWithNationalCode(string nationalCode, string phoneNumber)
{
var request = new PersonalInfoRequest
{
MobileNumber = phoneNumber,
NationalId = nationalCode,
RequestContext = new UidRequestContext()
};
var json = JsonConvert.SerializeObject(request);
var contentType = new StringContent(json, Encoding.UTF8, "application/json");
var requestResult = await _httpClient.PostAsync("mobile/owner/v2", contentType);
if (!requestResult.IsSuccessStatusCode)
return null;
var requestResult = await _httpClient.PostAsync("mobile/owner/v2", contentType);
if (!requestResult.IsSuccessStatusCode)
return null;
var responseResult = await requestResult.Content.ReadFromJsonAsync<MatchMobileWithNationalCodeResponse>();
return responseResult;
}
var responseResult = await requestResult.Content.ReadFromJsonAsync<MatchMobileWithNationalCodeResponse>();
return responseResult;
}
}

View File

@@ -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; }
}

View File

@@ -4,12 +4,13 @@ using System.Collections.Generic;
namespace AccountManagement.Application.Contracts.Media
{
public interface IMediaApplication
{
MediaViewModel Get(long id);
OperationResult UploadFile(IFormFile file, string fileLabel, string relativePath, int maximumFileLength, List<string> allowedExtensions);
OperationResult MoveFile(long mediaId, string newRelativePath);
OperationResult DeleteFile(long mediaId);
List<MediaViewModel> GetRange(IEnumerable<long> select);
}
}
public interface IMediaApplication
{
MediaViewModel Get(long id);
OperationResult UploadFile(IFormFile file, string fileLabel, string relativePath, int maximumFileLength,
List<string> allowedExtensions, string category);
OperationResult MoveFile(long mediaId, string newRelativePath);
OperationResult DeleteFile(long mediaId);
List<MediaViewModel> GetRange(IEnumerable<long> select);
}
}

View File

@@ -9,147 +9,113 @@ using Microsoft.AspNetCore.Http;
namespace AccountManagement.Application
{
public class MediaApplication:IMediaApplication
{
public class MediaApplication : IMediaApplication
{
private const string _basePath = "Medias";
private readonly IMediaRepository _mediaRepository;
private const string _basePath = "Medias";
private readonly IMediaRepository _mediaRepository;
public MediaApplication(IMediaRepository mediaRepository)
{
_mediaRepository = mediaRepository;
}
public MediaApplication(IMediaRepository mediaRepository)
{
_mediaRepository = mediaRepository;
}
/// <summary>
/// دریافت فایل و نوشتن آن در مسیر داده شده، و ثبت مدیا
/// </summary>
/// <param name="file">فایل</param>
/// <param name="fileLabel">برچسب فایل که در نام فایل ظاهر می شود</param>
/// <param name="relativePath">مسیر فایل</param>
/// <param name="allowedExtensions">[.png,.jpg,.jpeg] پسوند های مجاز مثلا </param>
/// <param name="maximumFileLength">حداکثر حجم فایل به مگابایت</param>
/// <returns></returns>
public OperationResult UploadFile(IFormFile file, string fileLabel, string relativePath,int maximumFileLength,List<string> allowedExtensions)
{
OperationResult op = new();
var path = Path.Combine(_basePath, relativePath);
var fileExtension = Path.GetExtension(file.FileName);
if (file == null || file.Length == 0)
return op.Failed("خطای سیستمی");
if (file.Length > (maximumFileLength * 1024 * 1024))
return op.Failed($"حجم فایل نمی تواند بیشتر از " +
$"{maximumFileLength}" +
$"مگابایت باشد");
if (!allowedExtensions.Contains(fileExtension.ToLower()))
{
var operationMessage = ":فرمت فایل باید یکی از موارد زیر باشد";
operationMessage += "\n";
operationMessage += string.Join(" ", allowedExtensions);
return op.Failed(operationMessage);
}
/// <summary>
/// دریافت فایل و نوشتن آن در مسیر داده شده، و ثبت مدیا
/// </summary>
/// <param name="file">فایل</param>
/// <param name="fileLabel">برچسب فایل که در نام فایل ظاهر می شود</param>
/// <param name="relativePath">مسیر فایل</param>
/// <param name="maximumFileLength">حداکثر حجم فایل به مگابایت</param>
/// <param name="allowedExtensions">[.png,.jpg,.jpeg] پسوند های مجاز مثلا </param>
/// <param name="category"></param>
/// <returns></returns>
public OperationResult UploadFile(IFormFile file, string fileLabel, string relativePath, int maximumFileLength,
List<string> allowedExtensions, string category)
{
return _mediaRepository.UploadFile(file, fileLabel, relativePath, maximumFileLength, allowedExtensions, category);
}
Directory.CreateDirectory(path);
/// <summary>
/// حذف فایل
/// </summary>
public OperationResult DeleteFile(long mediaId)
{
OperationResult op = new();
var media = _mediaRepository.Get(mediaId);
if (media == null)
return op.Failed("رکورد مورد نظر یافت نشد");
try
{
if (File.Exists(media.Path))
File.Delete(media.Path);
else
return op.Failed("فایل یافت نشد");
}
catch
{
return op.Failed("خطایی در حذف فایل رخ داده است");
}
var extension = Path.GetExtension(file.FileName);
_mediaRepository.Remove(media.id);
_mediaRepository.SaveChanges();
return op.Succcedded();
}
var uniqueFileName = $"{fileLabel}-{DateTime.Now.Ticks}{extension}";
var filePath = Path.Combine(path, uniqueFileName);
using (var fileStream = new FileStream(filePath, FileMode.CreateNew))
{
file.CopyTo(fileStream);
}
var mediaEntity = new Media(filePath, extension, "فایل", "EmployeeDocuments");
_mediaRepository.Create(mediaEntity);
_mediaRepository.SaveChanges();
/// <summary>
/// جابجا کردن فایل
/// </summary>
public OperationResult MoveFile(long mediaId, string newRelativePath)
{
OperationResult op = new();
var media = _mediaRepository.Get(mediaId);
var oldPath = media.Path;
var path = Path.Combine(_basePath, newRelativePath);
Directory.CreateDirectory(path);
return op.Succcedded(mediaEntity.id);
string filepath = Path.Combine(path, Path.GetFileName(oldPath));
try
{
File.Move(oldPath, filepath);
}
catch
{
return op.Failed("در جابجایی فایل خطایی رخ داده است");
}
}
media.Edit(filepath, media.Type, media.Category);
_mediaRepository.SaveChanges();
return op.Succcedded();
}
public MediaViewModel Get(long id)
{
var media = _mediaRepository.Get(id);
if (media == null)
return new();
return new MediaViewModel()
{
Category = media.Category,
Path = media.Path,
Id = media.id,
Type = media.Type
};
}
/// <summary>
/// حذف فایل
/// </summary>
public OperationResult DeleteFile(long mediaId)
{
OperationResult op = new();
var media = _mediaRepository.Get(mediaId);
if (media == null)
return op.Failed("رکورد مورد نظر یافت نشد");
try
{
if (File.Exists(media.Path))
File.Delete(media.Path);
else
return op.Failed("فایل یافت نشد");
}
catch
{
return op.Failed("خطایی در حذف فایل رخ داده است");
}
public List<MediaViewModel> GetRange(IEnumerable<long> ids)
{
var medias = _mediaRepository.GetRange(ids);
return medias.Select(x => new MediaViewModel()
{
Category = x.Category,
Path = x.Path,
Id = x.id,
Type = x.Type,
}).ToList();
}
_mediaRepository.Remove(media.id);
_mediaRepository.SaveChanges();
return op.Succcedded();
}
/// <summary>
/// جابجا کردن فایل
/// </summary>
public OperationResult MoveFile(long mediaId, string newRelativePath)
{
OperationResult op = new();
var media = _mediaRepository.Get(mediaId);
var oldPath = media.Path;
var path = Path.Combine(_basePath, newRelativePath);
Directory.CreateDirectory(path);
string filepath = Path.Combine(path, Path.GetFileName(oldPath));
try
{
File.Move(oldPath, filepath);
}
catch
{
return op.Failed("در جابجایی فایل خطایی رخ داده است");
}
media.Edit(filepath, media.Type, media.Category);
_mediaRepository.SaveChanges();
return op.Succcedded();
}
public MediaViewModel Get(long id)
{
var media = _mediaRepository.Get(id);
if (media == null)
return new();
return new MediaViewModel()
{
Category = media.Category,
Path = media.Path,
Id = media.id,
Type = media.Type
};
}
public List<MediaViewModel> GetRange(IEnumerable<long> ids)
{
var medias = _mediaRepository.GetRange(ids);
return medias.Select(x=>new MediaViewModel()
{
Category = x.Category,
Path = x.Path,
Id = x.id,
Type = x.Type,
}).ToList();
}
}
}
}

View File

@@ -277,6 +277,8 @@ namespace AccountManagement.Application
}
_subAccountRoleRepository.SaveChanges();
_workshopSubAccountRepository.SaveChanges();
return op.Succcedded();
}
public OperationResult AssignRoleToSubAccount(AssignSubAccountRole command)

View File

@@ -2,6 +2,7 @@
using AccountManagement.Domain.TaskAgg;
using System;
using System.Collections.Generic;
using System.Linq;
using AccountManagement.Domain.TaskMessageAgg;
namespace AccountManagement.Domain.AssignAgg;
@@ -158,4 +159,24 @@ public class Assign : EntityBase
IsDoneRequest=isDoneRequest;
DoneDescription=doneDescription;
}
public void ChangeAssignedId(long assignedId)
{
AssignedId = assignedId;
}
public void SetAssignerId(long assignerId)
{
AssignerId = assignerId;
}
public void ChangeSender(long senderId)
{
Task.SetSender(senderId);
var taskMessageItemsEnumerable =TaskMessageList.SelectMany(m => m.TaskMessageItemsList);
foreach (var taskMessageItems in taskMessageItemsEnumerable)
{
taskMessageItems.SetSenderId(senderId);
}
}
}

View File

@@ -1,12 +1,15 @@
using System.Collections.Generic;
using _0_Framework.Application;
using _0_Framework.Domain;
using AccountManagement.Application.Contracts.Media;
using Microsoft.AspNetCore.Http;
namespace AccountManagement.Domain.MediaAgg;
public interface IMediaRepository:IRepository<long,Media>
public interface IMediaRepository : IRepository<long, Media>
{
public string BasePath { get; protected set; }
void CreateMediaWithTaskMedia(long taskId, long mediaId);
List<MediaViewModel> GetMediaByTaskId(long taskId);
void Remove(long id);
@@ -23,4 +26,6 @@ public interface IMediaRepository:IRepository<long,Media>
#endregion
OperationResult UploadFile(IFormFile file, string fileLabel, string relativePath, int maximumFileLength,
List<string> allowedExtensions, string category);
}

View File

@@ -1,10 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.AccessControl;
using _0_Framework.Domain;
using AccountManagement.Domain.AssignAgg;
using AccountManagement.Domain.TaskMediaAgg;
using AccountManagement.Domain.TaskScheduleAgg;
using OfficeOpenXml.Style;
namespace AccountManagement.Domain.TaskAgg;
@@ -80,4 +82,40 @@ public class Tasks : EntityBase
TaskScheduleId = taskScheduleId;
}
public void ChangeSender(long senderId)
{
var prevSender = SenderId;
var assigners = Assigns.Where(x => x.AssignerId == prevSender).ToList();
foreach (var assigner in assigners)
{
assigner.SetAssignerId(senderId);
}
var senderMessageItem = Assigns
.SelectMany(x=>x.TaskMessageList
.SelectMany(m=>m.TaskMessageItemsList)).Where(x=>x.SenderAccountId == prevSender).ToList();
var receiverMessageItem = Assigns.SelectMany(x=>x.TaskMessageList
.SelectMany(m=>m.TaskMessageItemsList)).Where(x=>x.ReceiverAccountId == prevSender).ToList();
SenderId = senderId;
foreach (var taskMessageItems in senderMessageItem)
{
taskMessageItems.SetSenderId(senderId);
}
foreach (var taskMessageItems in receiverMessageItem)
{
taskMessageItems.SetReceiver(senderId);
}
}
public void SetSender(long senderId)
{
SenderId = senderId;
}
}

View File

@@ -19,4 +19,13 @@ public class TaskMessageItems:EntityBase
public TaskMessage TaskMessage { get; set; }
public void SetSenderId(long senderId)
{
SenderAccountId = senderId;
}
public void SetReceiver(long receiverId)
{
ReceiverAccountId = receiverId;
}
}

View File

@@ -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; }

View File

@@ -1,5 +1,8 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using _0_Framework.Application;
using _0_Framework.InfraStructure;
using AccountManagement.Application.Contracts.Media;
using AccountManagement.Domain.AdminResponseMediaAgg;
@@ -7,27 +10,35 @@ using AccountManagement.Domain.ClientResponseMediaAgg;
using AccountManagement.Domain.MediaAgg;
using AccountManagement.Domain.TaskMediaAgg;
using AccountManagement.Domain.TicketMediasAgg;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.EntityFrameworkCore;
namespace AccountMangement.Infrastructure.EFCore.Repository;
public class MediaRepository:RepositoryBase<long,Media>,IMediaRepository
public class MediaRepository : RepositoryBase<long, Media>, IMediaRepository
{
private const string _basePath = "Storage/Medias";
public string BasePath { get; set; }
private readonly AccountContext _accountContext;
public MediaRepository( AccountContext taskManagerContext) : base(taskManagerContext)
public MediaRepository(AccountContext taskManagerContext, IWebHostEnvironment webHostEnvironment) : base(taskManagerContext)
{
_accountContext = taskManagerContext;
BasePath = webHostEnvironment.ContentRootPath + "/Storage";
}
//ساخت جدول واسط بین مدیا و نسک
//نکته: این متد ذخیره انجام نمیدهد
public void CreateMediaWithTaskMedia(long taskId, long mediaId)
{
var Taskmedias = new TaskMedia(taskId,mediaId);
var Taskmedias = new TaskMedia(taskId, mediaId);
_accountContext.Add(Taskmedias);
}
public void Remove(long id)
{
var media = Get(id);
var media = Get(id);
Remove(media);
}
@@ -77,6 +88,48 @@ public class MediaRepository:RepositoryBase<long,Media>,IMediaRepository
{
return _accountContext.Medias.Where(x => mediaIds.Contains(x.id)).ToList();
}
public OperationResult UploadFile(IFormFile file, string fileLabel, string relativePath, int maximumFileLength,
List<string> allowedExtensions, string category)
{
OperationResult op = new();
var path = Path.Combine(_basePath, relativePath);
var fileExtension = Path.GetExtension(file.FileName);
if (file == null || file.Length == 0)
return op.Failed("خطای سیستمی");
if (file.Length > (maximumFileLength * 1024 * 1024))
return op.Failed($"حجم فایل نمی تواند بیشتر از " +
$"{maximumFileLength}" +
$"مگابایت باشد");
if (!allowedExtensions.Contains(fileExtension.ToLower()))
{
var operationMessage = ":فرمت فایل باید یکی از موارد زیر باشد";
operationMessage += "\n";
operationMessage += string.Join(" ", allowedExtensions);
return op.Failed(operationMessage);
}
Directory.CreateDirectory(path);
var extension = Path.GetExtension(file.FileName);
var uniqueFileName = $"{fileLabel}-{DateTime.Now.Ticks}{extension}";
var filePath = Path.Combine(path, uniqueFileName);
using (var fileStream = new FileStream(filePath, FileMode.CreateNew))
{
file.CopyTo(fileStream);
}
var mediaEntity = new Media(filePath, extension, "فایل", category);
Create(mediaEntity);
SaveChanges();
return op.Succcedded(mediaEntity.id);
}
}
#endregion

View File

@@ -3,6 +3,7 @@ using System.Collections;
using System.Collections.Generic;
using _0_Framework.Application;
using _0_Framework.Domain;
using _0_Framework.Domain.CustomizeCheckoutShared.Enums;
using Company.Domain.CheckoutAgg.ValueObjects;
using Company.Domain.CustomizeCheckoutAgg.ValueObjects;
using Company.Domain.WorkshopAgg;
@@ -29,7 +30,7 @@ public class Checkout : EntityBase
string overNightWorkValue, string fridayWorkValue, string rotatingShifValue, string absenceValue,
string totalDayOfLeaveCompute, string totalDayOfYearsCompute, string totalDayOfBunosesCompute,
ICollection<CheckoutLoanInstallment> loanInstallments,
ICollection<CheckoutSalaryAid> salaryAids)
ICollection<CheckoutSalaryAid> salaryAids,CheckoutRollCall checkoutRollCall)
{
EmployeeFullName = employeeFullName;
FathersName = fathersName;
@@ -88,6 +89,7 @@ public class Checkout : EntityBase
TotalDayOfBunosesCompute = totalDayOfBunosesCompute;
LoanInstallments = loanInstallments;
SalaryAids = salaryAids;
CheckoutRollCall = checkoutRollCall;
}
public string EmployeeFullName { get; private set; }
@@ -196,7 +198,8 @@ public class Checkout : EntityBase
public ICollection<CheckoutLoanInstallment> LoanInstallments { get; set; } = [];
public ICollection<CheckoutSalaryAid> SalaryAids { get; set; } = [];
#endregion
public CheckoutRollCall CheckoutRollCall { get; private set; }
#endregion
public Workshop Workshop { get; set; }
@@ -308,4 +311,149 @@ public class Checkout : EntityBase
LoanInstallments = lonaInstallments;
InstallmentDeduction = installmentsAmount;
}
public void SetCheckoutRollCall(CheckoutRollCall checkoutRollCall)
{
CheckoutRollCall = checkoutRollCall;
}
}
public class CheckoutRollCall
{
private CheckoutRollCall(){}
public CheckoutRollCall(TimeSpan totalMandatoryTimeSpan, TimeSpan totalPresentTimeSpan, TimeSpan totalBreakTimeSpan,
TimeSpan totalWorkingTimeSpan, TimeSpan totalPaidLeaveTmeSpan, TimeSpan totalSickLeaveTimeSpan,
ICollection<CheckoutRollCallDay> rollCallDaysCollection)
{
TotalMandatoryTimeSpan = totalMandatoryTimeSpan;
TotalPresentTimeSpan = totalPresentTimeSpan;
TotalBreakTimeSpan = totalBreakTimeSpan;
TotalWorkingTimeSpan = totalWorkingTimeSpan;
TotalPaidLeaveTmeSpan = totalPaidLeaveTmeSpan;
TotalSickLeaveTimeSpan = totalSickLeaveTimeSpan;
RollCallDaysCollection = rollCallDaysCollection;
}
/// <summary>
/// مجموع ساعت موظفی
/// </summary>
public TimeSpan TotalMandatoryTimeSpan { get; private set; }
/// <summary>
/// مجموع ساعت حضور
/// </summary>
public TimeSpan TotalPresentTimeSpan { get; private set; }
/// <summary>
/// مجموع ساعت استراحت
/// </summary>
public TimeSpan TotalBreakTimeSpan { get; private set; }
/// <summary>
/// مجموع ساعت کارکرد
/// </summary>
public TimeSpan TotalWorkingTimeSpan { get; private set; }
/// <summary>
/// مجموع ساعت مرخصی استحقاقی
/// </summary>
public TimeSpan TotalPaidLeaveTmeSpan { get; private set; }
/// <summary>
/// مجموع ساعت مرخصی استعلاجی
/// </summary>
public TimeSpan TotalSickLeaveTimeSpan { get; private set; }
/// <summary>
/// روز های حضور غیاب
/// </summary>
public ICollection<CheckoutRollCallDay> RollCallDaysCollection { get; private set; }
}
public class CheckoutRollCallDay
{
private CheckoutRollCallDay(){}
public CheckoutRollCallDay(DateTime date, string firstStartDate, string firstEndDate,
string secondStartDate, string secondEndDate, TimeSpan breakTimeSpan,
bool isSliced, TimeSpan workingTimeSpan, bool isAbsent, bool isFriday,
bool isHoliday, string leaveType)
{
Date = date;
FirstStartDate = firstStartDate;
FirstEndDate = firstEndDate;
SecondStartDate = secondStartDate;
SecondEndDate = secondEndDate;
BreakTimeSpan = breakTimeSpan;
IsSliced = isSliced;
WorkingTimeSpan = workingTimeSpan;
IsAbsent = isAbsent;
IsFriday = isFriday;
IsHoliday = isHoliday;
LeaveType = leaveType;
}
public long Id { get; set; }
/// <summary>
/// تاریخ
/// </summary>
public DateTime Date { get; private set; }
/// <summary>
/// ورود اول
/// </summary>
public string FirstStartDate { get; private set; }
/// <summary>
/// خروج اول
/// </summary>
public string FirstEndDate { get; private set; }
/// <summary>
/// ورود دوم
/// </summary>
public string SecondStartDate { get; private set; }
/// <summary>
/// خروج دوم
/// </summary>
public string SecondEndDate { get; private set; }
/// <summary>
/// ساعت استراحت
/// </summary>
public TimeSpan BreakTimeSpan { get; private set; }
/// <summary>
/// مقدار زمان کارکرد
/// </summary>
public TimeSpan WorkingTimeSpan { get; private set; }
/// <summary>
/// آیا منقطع است؟
/// </summary>
public bool IsSliced { get; private set; }
/// <summary>
/// آیا غیبت است
/// </summary>
public bool IsAbsent { get; private set; }
/// <summary>
/// آیا جمعه است
/// </summary>
public bool IsFriday { get; private set; }
/// <summary>
/// آیا تعطیل رسمی است
/// </summary>
public bool IsHoliday { get; private set; }
/// <summary>
/// نوع مرخصی - درصورت نداشتن مرخصی مقدارش null میباشد
/// </summary>
public string LeaveType { get; private set; }
public long CheckoutId { get; set; }
}

View File

@@ -23,6 +23,23 @@ public interface ICheckoutRepository : IRepository<long, Checkout>
EditCheckout GetDetails(long id);
Task CreateCkeckout(Checkout command);
/// <summary>
/// لود لیست اولیه جهت ایجاد فیش حقوقی
/// </summary>
/// <param name="workshopId"></param>
/// <param name="employeeId"></param>
/// <param name="year"></param>
/// <param name="month"></param>
/// <param name="contractStart"></param>
/// <param name="contractEnd"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
Task<CreateCheckoutListViewModel> GetContractResultToCreateCheckout(long workshopId, long employeeId, string year,
string month,
string contractStart, string contractEnd);
//void CreateCkeckout(Checkout command);
Task<List<CheckoutViewModel>> Search(CheckoutSearchModel searchModel);
@@ -42,6 +59,16 @@ public interface ICheckoutRepository : IRepository<long, Checkout>
OperationResult DeleteAllCheckouts(List<long> ids);
OperationResult DeleteCheckout(long id);
List<long> CheckHasSignature(List<long> ids);
/// <summary>
/// لیست تصفیه حساب
/// جدید
///
/// </summary>
/// <param name="searchModel"></param>
/// <returns></returns>
Task<List<CheckoutViewModel>> SearchCheckoutOptimized(CheckoutSearchModel searchModel);
Task<List<CheckoutViewModel>> SearchForMainCheckout(CheckoutSearchModel searchModel);
#endregion

View File

@@ -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;
}
}

View File

@@ -17,340 +17,344 @@ namespace Company.Domain.CustomizeWorkshopGroupSettingsAgg.Entities;
public class CustomizeWorkshopGroupSettings : BaseCustomizeEntity
{
public CustomizeWorkshopGroupSettings()
{
public CustomizeWorkshopGroupSettings()
{
}
}
public CustomizeWorkshopGroupSettings(string groupName, double salary,
long customizeWorkshopSettingId, ICollection<CustomizeWorkshopGroupSettingsShift> customizeWorkshopGroupSettingsShifts,
FridayPay fridayPay, OverTimePay overTimePay, BaseYearsPay baseYearsPay,
BonusesPay bonusesPay, NightWorkPay nightWorkPay, MarriedAllowance marriedAllowance, ShiftPay shiftPay,
FamilyAllowance familyAllowance, LeavePay leavePay, InsuranceDeduction insuranceDeduction,
FineAbsenceDeduction fineAbsenceDeduction, LateToWork lateToWork, EarlyExit earlyExit, FridayWork fridayWork,
HolidayWork holidayWork, BreakTime breakTime, WorkshopShiftStatus workshopShiftStatus, IrregularShift irregularShift, int leavePermittedDays, ICollection<CustomizeRotatingShift> rotatingShifts) :
base(fridayPay, overTimePay, baseYearsPay, bonusesPay, nightWorkPay,
marriedAllowance, shiftPay, familyAllowance, leavePay, insuranceDeduction, fineAbsenceDeduction, lateToWork,
earlyExit, fridayWork, holidayWork, breakTime, leavePermittedDays)
{
GroupName = groupName;
Salary = salary;
CustomizeWorkshopSettingId = customizeWorkshopSettingId;
GuardGroupShifts(customizeWorkshopGroupSettingsShifts);
WorkshopShiftStatus = workshopShiftStatus;
public CustomizeWorkshopGroupSettings(string groupName, double salary,
long customizeWorkshopSettingId, ICollection<CustomizeWorkshopGroupSettingsShift> customizeWorkshopGroupSettingsShifts,
FridayPay fridayPay, OverTimePay overTimePay, BaseYearsPay baseYearsPay,
BonusesPay bonusesPay, NightWorkPay nightWorkPay, MarriedAllowance marriedAllowance, ShiftPay shiftPay,
FamilyAllowance familyAllowance, LeavePay leavePay, InsuranceDeduction insuranceDeduction,
FineAbsenceDeduction fineAbsenceDeduction, LateToWork lateToWork, EarlyExit earlyExit,
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, holidayWork, breakTime, leavePermittedDays, weeklyOffDays)
{
GroupName = groupName;
Salary = salary;
CustomizeWorkshopSettingId = customizeWorkshopSettingId;
GuardGroupShifts(customizeWorkshopGroupSettingsShifts);
WorkshopShiftStatus = workshopShiftStatus;
CustomizeRotatingShifts = workshopShiftStatus == WorkshopShiftStatus.Rotating ? rotatingShifts : [];
CustomizeRotatingShifts = workshopShiftStatus == WorkshopShiftStatus.Rotating ? rotatingShifts : [];
CustomizeWorkshopGroupSettingsShifts = workshopShiftStatus == WorkshopShiftStatus.Regular ? customizeWorkshopGroupSettingsShifts : [];
CustomizeWorkshopGroupSettingsShifts = workshopShiftStatus == WorkshopShiftStatus.Regular ? customizeWorkshopGroupSettingsShifts : [];
IrregularShift = workshopShiftStatus == WorkshopShiftStatus.Regular ?
new IrregularShift(new TimeOnly(), new TimeOnly(), WorkshopIrregularShifts.None)
: new IrregularShift(irregularShift.StartTime, irregularShift.EndTime, irregularShift.WorkshopIrregularShifts);
}
IrregularShift = workshopShiftStatus == WorkshopShiftStatus.Regular ?
new IrregularShift(new TimeOnly(), new TimeOnly(), WorkshopIrregularShifts.None)
: new IrregularShift(irregularShift.StartTime, irregularShift.EndTime, irregularShift.WorkshopIrregularShifts);
}
private void GuardGroupShifts(ICollection<CustomizeWorkshopGroupSettingsShift> customizeWorkshopGroupSettingsShifts)
{
if (customizeWorkshopGroupSettingsShifts.Count >= 4)
{
throw new InvalidDataException("شما نمیتوانید بیشتر از سه ساعت کاری در کارگاه بگذارید");
}
}
private void GuardGroupShifts(ICollection<CustomizeWorkshopGroupSettingsShift> customizeWorkshopGroupSettingsShifts)
{
if (customizeWorkshopGroupSettingsShifts.Count >= 4)
{
throw new InvalidDataException("شما نمیتوانید بیشتر از سه ساعت کاری در کارگاه بگذارید");
}
}
public string GroupName { get; private set; }
public double Salary { get; private set; }
public long CustomizeWorkshopSettingId { get; private set; }
public WorkshopShiftStatus WorkshopShiftStatus { get; private set; }
public bool MainGroup { get; private set; }
public bool IsShiftChange { get; private set; }
public bool IsSettingChange { get; private set; }
public IrregularShift IrregularShift { get; set; }
public ICollection<CustomizeWorkshopGroupSettingsShift> CustomizeWorkshopGroupSettingsShifts { get; set; }
public ICollection<CustomizeWorkshopEmployeeSettings> CustomizeWorkshopEmployeeSettingsCollection { get; set; }
public ICollection<CustomizeRotatingShift> CustomizeRotatingShifts { get; set; }
public CustomizeWorkshopSettings CustomizeWorkshopSettings { get; set; }
public string GroupName { get; private set; }
public double Salary { get; private set; }
public long CustomizeWorkshopSettingId { get; private set; }
public WorkshopShiftStatus WorkshopShiftStatus { get; private set; }
public bool MainGroup { get; private set; }
public bool IsShiftChange { get; private set; }
public bool IsSettingChange { get; private set; }
public IrregularShift IrregularShift { get; set; }
public ICollection<CustomizeWorkshopGroupSettingsShift> CustomizeWorkshopGroupSettingsShifts { get; set; }
public ICollection<CustomizeWorkshopEmployeeSettings> CustomizeWorkshopEmployeeSettingsCollection { get; set; }
public ICollection<CustomizeRotatingShift> CustomizeRotatingShifts { get; set; }
public CustomizeWorkshopSettings CustomizeWorkshopSettings { get; set; }
public CustomizeWorkshopGroupSettings CreateMainGroup(FridayPay fridayPay,
OverTimePay overTimePay, BaseYearsPay baseYearsPay, BonusesPay bonusesPay, ShiftPay shiftPay,
NightWorkPay nightWorkPay, MarriedAllowance marriedAllowance, FamilyAllowance familyAllowance,
LeavePay leavePay, InsuranceDeduction insuranceDeduction, FineAbsenceDeduction fineAbsenceDeduction,
LateToWork lateToWork, EarlyExit earlyExit,
ICollection<CustomizeWorkshopGroupSettingsShift> customizeWorkshopGroupSettingsShifts, FridayWork fridayWork,
HolidayWork holidayWork, IrregularShift irregularShift, ICollection<CustomizeRotatingShift> rotatingShifts,
WorkshopShiftStatus workshopShiftStatus, long customizeWorkshopSettingId, BreakTime breakTime, int leavePermittedDays)
{
GuardGroupShifts(customizeWorkshopGroupSettingsShifts);
GroupName = "اصلی";
Salary = 0;
FridayPay = fridayPay;
OverTimePay = overTimePay;
BaseYearsPay = baseYearsPay;
BonusesPay = bonusesPay;
NightWorkPay = nightWorkPay;
MarriedAllowance = marriedAllowance;
ShiftPay = shiftPay;
FamilyAllowance = familyAllowance;
LeavePay = leavePay;
InsuranceDeduction = insuranceDeduction;
FineAbsenceDeduction = fineAbsenceDeduction;
LateToWork = lateToWork;
EarlyExit = earlyExit;
FridayWork = fridayWork;
HolidayWork = holidayWork;
LeavePermittedDays = leavePermittedDays;
CustomizeWorkshopGroupSettingsShifts = workshopShiftStatus == WorkshopShiftStatus.Regular ? customizeWorkshopGroupSettingsShifts : [];
public CustomizeWorkshopGroupSettings CreateMainGroup(FridayPay fridayPay,
OverTimePay overTimePay, BaseYearsPay baseYearsPay, BonusesPay bonusesPay, ShiftPay shiftPay,
NightWorkPay nightWorkPay, MarriedAllowance marriedAllowance, FamilyAllowance familyAllowance,
LeavePay leavePay, InsuranceDeduction insuranceDeduction, FineAbsenceDeduction fineAbsenceDeduction,
LateToWork lateToWork, EarlyExit earlyExit,
ICollection<CustomizeWorkshopGroupSettingsShift> customizeWorkshopGroupSettingsShifts,
HolidayWork holidayWork, IrregularShift irregularShift, ICollection<CustomizeRotatingShift> rotatingShifts,
WorkshopShiftStatus workshopShiftStatus, long customizeWorkshopSettingId, BreakTime breakTime, int leavePermittedDays)
{
GuardGroupShifts(customizeWorkshopGroupSettingsShifts);
GroupName = "اصلی";
Salary = 0;
FridayPay = fridayPay;
OverTimePay = overTimePay;
BaseYearsPay = baseYearsPay;
BonusesPay = bonusesPay;
NightWorkPay = nightWorkPay;
MarriedAllowance = marriedAllowance;
ShiftPay = shiftPay;
FamilyAllowance = familyAllowance;
LeavePay = leavePay;
InsuranceDeduction = insuranceDeduction;
FineAbsenceDeduction = fineAbsenceDeduction;
LateToWork = lateToWork;
EarlyExit = earlyExit;
HolidayWork = holidayWork;
LeavePermittedDays = leavePermittedDays;
CustomizeWorkshopGroupSettingsShifts = workshopShiftStatus == WorkshopShiftStatus.Regular ? customizeWorkshopGroupSettingsShifts : [];
CustomizeRotatingShifts = workshopShiftStatus == WorkshopShiftStatus.Rotating ? rotatingShifts : [];
CustomizeRotatingShifts = workshopShiftStatus == WorkshopShiftStatus.Rotating ? rotatingShifts : [];
IrregularShift = workshopShiftStatus == WorkshopShiftStatus.Regular ?
new IrregularShift(new TimeOnly(), new TimeOnly(), WorkshopIrregularShifts.None)
: new IrregularShift(irregularShift.StartTime, irregularShift.EndTime, irregularShift.WorkshopIrregularShifts);
WorkshopShiftStatus = workshopShiftStatus;
CustomizeWorkshopSettingId = customizeWorkshopSettingId;
MainGroup = true;
BreakTime = breakTime;
CustomizeWorkshopEmployeeSettingsCollection = [];
IrregularShift = workshopShiftStatus == WorkshopShiftStatus.Regular ?
new IrregularShift(new TimeOnly(), new TimeOnly(), WorkshopIrregularShifts.None)
: new IrregularShift(irregularShift.StartTime, irregularShift.EndTime, irregularShift.WorkshopIrregularShifts);
WorkshopShiftStatus = workshopShiftStatus;
CustomizeWorkshopSettingId = customizeWorkshopSettingId;
MainGroup = true;
BreakTime = breakTime;
CustomizeWorkshopEmployeeSettingsCollection = [];
return this;
return this;
}
}
public void EditAndOverwriteOnEmployees(string groupName, double salary, IEnumerable<long> employeeIds,
FridayPay fridayPay,
OverTimePay overTimePay, BaseYearsPay baseYearsPay, BonusesPay bonusesPay, ShiftPay shiftPay,
NightWorkPay nightWorkPay, MarriedAllowance marriedAllowance, FamilyAllowance familyAllowance,
LeavePay leavePay, InsuranceDeduction insuranceDeduction, FineAbsenceDeduction fineAbsenceDeduction,
LateToWork lateToWork, EarlyExit earlyExit, FridayWork fridayWork, HolidayWork holidayWork, bool isSettingChange, int leavePermittedDays)
{
GroupName = groupName;
Salary = salary;
FridayPay = fridayPay;
OverTimePay = overTimePay;
BaseYearsPay = baseYearsPay;
BonusesPay = bonusesPay;
NightWorkPay = nightWorkPay;
MarriedAllowance = marriedAllowance;
ShiftPay = shiftPay;
FamilyAllowance = familyAllowance;
LeavePay = leavePay;
InsuranceDeduction = insuranceDeduction;
FineAbsenceDeduction = fineAbsenceDeduction;
LateToWork = lateToWork;
EarlyExit = earlyExit;
FridayWork = fridayWork;
HolidayWork = holidayWork;
IsSettingChange = isSettingChange;
LeavePermittedDays = leavePermittedDays;
public void EditAndOverwriteOnEmployees(string groupName, double salary, IEnumerable<long> employeeIds,
FridayPay fridayPay,
OverTimePay overTimePay, BaseYearsPay baseYearsPay, BonusesPay bonusesPay, ShiftPay shiftPay,
NightWorkPay nightWorkPay, MarriedAllowance marriedAllowance, FamilyAllowance familyAllowance,
LeavePay leavePay, InsuranceDeduction insuranceDeduction, FineAbsenceDeduction fineAbsenceDeduction,
LateToWork lateToWork, EarlyExit earlyExit, HolidayWork holidayWork, bool isSettingChange, int leavePermittedDays)
{
GroupName = groupName;
Salary = salary;
FridayPay = fridayPay;
OverTimePay = overTimePay;
BaseYearsPay = baseYearsPay;
BonusesPay = bonusesPay;
NightWorkPay = nightWorkPay;
MarriedAllowance = marriedAllowance;
ShiftPay = shiftPay;
FamilyAllowance = familyAllowance;
LeavePay = leavePay;
InsuranceDeduction = insuranceDeduction;
FineAbsenceDeduction = fineAbsenceDeduction;
LateToWork = lateToWork;
EarlyExit = earlyExit;
HolidayWork = holidayWork;
IsSettingChange = isSettingChange;
LeavePermittedDays = leavePermittedDays;
var employeeSettingsShift = CustomizeWorkshopGroupSettingsShifts
.Select(x => new CustomizeWorkshopEmployeeSettingsShift(x.StartTime, x.EndTime, x.Placement)).ToList();
var employeeSettingsShift = CustomizeWorkshopGroupSettingsShifts
.Select(x => new CustomizeWorkshopEmployeeSettingsShift(x.StartTime, x.EndTime, x.Placement)).ToList();
var permittedToOverWrite = CustomizeWorkshopEmployeeSettingsCollection.Where(x => employeeIds.Contains(x.EmployeeId));
foreach (var item in permittedToOverWrite)
{
item.EditEmployees(Salary, FridayPay, OverTimePay, BaseYearsPay, BonusesPay
, NightWorkPay, MarriedAllowance, ShiftPay, FamilyAllowance, LeavePay, InsuranceDeduction, FineAbsenceDeduction,
LateToWork, EarlyExit, FridayWork, HolidayWork, IrregularShift, false, leavePermittedDays);
}
}
public void EditAndOverwriteOnAllEmployees(string groupName, double salary,
FridayPay fridayPay,
OverTimePay overTimePay, BaseYearsPay baseYearsPay, BonusesPay bonusesPay, ShiftPay shiftPay,
NightWorkPay nightWorkPay, MarriedAllowance marriedAllowance, FamilyAllowance familyAllowance,
LeavePay leavePay, InsuranceDeduction insuranceDeduction, FineAbsenceDeduction fineAbsenceDeduction,
LateToWork lateToWork, EarlyExit earlyExit, FridayWork fridayWork, HolidayWork holidayWork, bool isSettingChange, 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;
var permittedToOverWrite = CustomizeWorkshopEmployeeSettingsCollection.Where(x => employeeIds.Contains(x.EmployeeId));
foreach (var item in permittedToOverWrite)
{
item.EditEmployees(Salary, FridayPay, OverTimePay, BaseYearsPay, BonusesPay
, NightWorkPay, MarriedAllowance, ShiftPay, FamilyAllowance, LeavePay, InsuranceDeduction, FineAbsenceDeduction,
LateToWork, EarlyExit, HolidayWork, IrregularShift, false, leavePermittedDays);
}
}
public void EditAndOverwriteOnAllEmployees(string groupName, double salary,
FridayPay fridayPay,
OverTimePay overTimePay, BaseYearsPay baseYearsPay, BonusesPay bonusesPay, ShiftPay shiftPay,
NightWorkPay nightWorkPay, MarriedAllowance marriedAllowance, FamilyAllowance familyAllowance,
LeavePay leavePay, InsuranceDeduction insuranceDeduction, FineAbsenceDeduction fineAbsenceDeduction,
LateToWork lateToWork, EarlyExit earlyExit, HolidayWork holidayWork, bool isSettingChange, int leavePermittedDays)
{
SetValueObjects(fridayPay, overTimePay, baseYearsPay, bonusesPay
, nightWorkPay, marriedAllowance, shiftPay, familyAllowance, leavePay, insuranceDeduction, fineAbsenceDeduction,
lateToWork, earlyExit);
GroupName = groupName;
Salary = salary;
HolidayWork = holidayWork;
IsSettingChange = isSettingChange;
LeavePermittedDays = leavePermittedDays;
var employeeSettingsShift = CustomizeWorkshopGroupSettingsShifts
.Select(x => new CustomizeWorkshopEmployeeSettingsShift(x.StartTime, x.EndTime, x.Placement)).ToList();
var employeeSettingsShift = CustomizeWorkshopGroupSettingsShifts
.Select(x => new CustomizeWorkshopEmployeeSettingsShift(x.StartTime, x.EndTime, x.Placement)).ToList();
foreach (var item in CustomizeWorkshopEmployeeSettingsCollection)
{
item.EditEmployees(Salary, FridayPay, OverTimePay, BaseYearsPay, BonusesPay
, NightWorkPay, MarriedAllowance, ShiftPay, FamilyAllowance, LeavePay, InsuranceDeduction, FineAbsenceDeduction,
LateToWork, EarlyExit, FridayWork, HolidayWork, IrregularShift, false, leavePermittedDays);
}
}
foreach (var item in CustomizeWorkshopEmployeeSettingsCollection)
{
item.EditEmployees(Salary, FridayPay, OverTimePay, BaseYearsPay, BonusesPay
, NightWorkPay, MarriedAllowance, ShiftPay, FamilyAllowance, LeavePay, InsuranceDeduction, FineAbsenceDeduction,
LateToWork, EarlyExit, HolidayWork, IrregularShift, false, leavePermittedDays);
}
}
public void RemoveEmployeeFromGroup(long employeeId)
{
var currentItem = CustomizeWorkshopEmployeeSettingsCollection.FirstOrDefault(x => x.EmployeeId == employeeId);
if (currentItem != null)
CustomizeWorkshopEmployeeSettingsCollection.Remove(currentItem);
}
public void RemoveEmployeeFromGroup(long employeeId)
{
var currentItem = CustomizeWorkshopEmployeeSettingsCollection.FirstOrDefault(x => x.EmployeeId == employeeId);
if (currentItem != null)
CustomizeWorkshopEmployeeSettingsCollection.Remove(currentItem);
}
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)
{
GroupName = groupName;
CustomizeWorkshopGroupSettingsShifts = workshopShiftStatus == WorkshopShiftStatus.Regular ? customizeWorkshopGroupSettingsShifts : [];
WorkshopShiftStatus = workshopShiftStatus;
public void EditSimpleAndOverwriteOnEmployee(string groupName, IEnumerable<long> employeeIds,
ICollection<CustomizeWorkshopGroupSettingsShift> customizeWorkshopGroupSettingsShifts, WorkshopShiftStatus workshopShiftStatus,
IrregularShift irregularShift, BreakTime breakTime, bool isShiftChange, HolidayWork holidayWork, ICollection<CustomizeRotatingShift> rotatingShifts, List<WeeklyOffDay> weeklyOffDays)
{
GroupName = groupName;
CustomizeWorkshopGroupSettingsShifts = workshopShiftStatus == WorkshopShiftStatus.Regular ? customizeWorkshopGroupSettingsShifts : [];
WorkshopShiftStatus = workshopShiftStatus;
IrregularShift = workshopShiftStatus == WorkshopShiftStatus.Regular ?
new IrregularShift(new TimeOnly(), new TimeOnly(), WorkshopIrregularShifts.None)
: new IrregularShift(irregularShift.StartTime, irregularShift.EndTime, irregularShift.WorkshopIrregularShifts);
CustomizeRotatingShifts = workshopShiftStatus == WorkshopShiftStatus.Rotating ? rotatingShifts : [];
IrregularShift = workshopShiftStatus == WorkshopShiftStatus.Regular ?
new IrregularShift(new TimeOnly(), new TimeOnly(), WorkshopIrregularShifts.None)
: new IrregularShift(irregularShift.StartTime, irregularShift.EndTime, irregularShift.WorkshopIrregularShifts);
CustomizeRotatingShifts = workshopShiftStatus == WorkshopShiftStatus.Rotating ? rotatingShifts : [];
BreakTime = new BreakTime(breakTime.HasBreakTimeValue, breakTime.BreakTimeValue);
IsShiftChange = isShiftChange;
FridayWork = fridayWork;
HolidayWork = holidayWork;
BreakTime = new BreakTime(breakTime.HasBreakTimeValue, breakTime.BreakTimeValue);
IsShiftChange = isShiftChange;
//var employeeSettingsShift = customizeWorkshopGroupSettingsShifts
// .Select(x => new CustomizeWorkshopEmployeeSettingsShift(x.StartTime, x.EndTime, x.Placement)).ToList();
if (isShiftChange)
{
HolidayWork = holidayWork;
}
WeeklyOffDays = weeklyOffDays;
var permittedToOverWrite = CustomizeWorkshopEmployeeSettingsCollection.Where(x => employeeIds.Contains(x.EmployeeId));
//var employeeSettingsShift = customizeWorkshopGroupSettingsShifts
// .Select(x => new CustomizeWorkshopEmployeeSettingsShift(x.StartTime, x.EndTime, x.Placement)).ToList();
if (isShiftChange)
{
foreach (var item in permittedToOverWrite)
{
var newRotatingShifts = CustomizeRotatingShifts.Select(x => new CustomizeRotatingShift(x.StartTime, x.EndTime))
.ToList();
item.SimpleEdit(customizeWorkshopGroupSettingsShifts
.Select(x => new CustomizeWorkshopEmployeeSettingsShift(x.StartTime, x.EndTime, x.Placement)).ToList(),
IrregularShift, WorkshopShiftStatus, BreakTime, false, FridayWork, HolidayWork, newRotatingShifts);
}
}
}
var permittedToOverWrite = CustomizeWorkshopEmployeeSettingsCollection.Where(x => employeeIds.Contains(x.EmployeeId));
public void EditSimpleAndOverwriteOnAllEmployees(string groupName,
ICollection<CustomizeWorkshopGroupSettingsShift> customizeWorkshopGroupSettingsShifts,
WorkshopShiftStatus workshopShiftStatus, IrregularShift irregularShift, BreakTime breakTime, bool isShiftChange,
FridayWork fridayWork, HolidayWork holidayWork, ICollection<CustomizeRotatingShift> rotatingShifts)
{
GroupName = groupName;
CustomizeWorkshopGroupSettingsShifts = workshopShiftStatus == WorkshopShiftStatus.Regular ? customizeWorkshopGroupSettingsShifts : [];
WorkshopShiftStatus = workshopShiftStatus;
foreach (var item in permittedToOverWrite)
{
var employeeWeeklyOffDays = WeeklyOffDays.Select(x => new WeeklyOffDay(x.DayOfWeek)).ToList();
var newRotatingShifts = CustomizeRotatingShifts.Select(x => new CustomizeRotatingShift(x.StartTime, x.EndTime))
.ToList();
item.SimpleEdit(customizeWorkshopGroupSettingsShifts
.Select(x => new CustomizeWorkshopEmployeeSettingsShift(x.StartTime, x.EndTime, x.Placement)).ToList(),
IrregularShift, WorkshopShiftStatus, BreakTime, false, HolidayWork, newRotatingShifts, employeeWeeklyOffDays);
}
IrregularShift = workshopShiftStatus == WorkshopShiftStatus.Regular ?
new IrregularShift(new TimeOnly(), new TimeOnly(), WorkshopIrregularShifts.None)
: new IrregularShift(irregularShift.StartTime, irregularShift.EndTime, irregularShift.WorkshopIrregularShifts);
}
CustomizeRotatingShifts = workshopShiftStatus == WorkshopShiftStatus.Rotating ? rotatingShifts : [];
public void EditSimpleAndOverwriteOnAllEmployees(string groupName,
ICollection<CustomizeWorkshopGroupSettingsShift> customizeWorkshopGroupSettingsShifts,
WorkshopShiftStatus workshopShiftStatus, IrregularShift irregularShift, BreakTime breakTime, bool isShiftChange,
HolidayWork holidayWork, ICollection<CustomizeRotatingShift> rotatingShifts, List<WeeklyOffDay> weeklyOffDays)
{
GroupName = groupName;
CustomizeWorkshopGroupSettingsShifts = workshopShiftStatus == WorkshopShiftStatus.Regular ? customizeWorkshopGroupSettingsShifts : [];
WorkshopShiftStatus = workshopShiftStatus;
IrregularShift = workshopShiftStatus == WorkshopShiftStatus.Regular ?
new IrregularShift(new TimeOnly(), new TimeOnly(), WorkshopIrregularShifts.None)
: new IrregularShift(irregularShift.StartTime, irregularShift.EndTime, irregularShift.WorkshopIrregularShifts);
CustomizeRotatingShifts = workshopShiftStatus == WorkshopShiftStatus.Rotating ? rotatingShifts : [];
BreakTime = new BreakTime(breakTime.HasBreakTimeValue, breakTime.BreakTimeValue);
IsShiftChange = isShiftChange;
HolidayWork = holidayWork;
FridayWork = fridayWork;
BreakTime = new BreakTime(breakTime.HasBreakTimeValue, breakTime.BreakTimeValue);
IsShiftChange = isShiftChange;
HolidayWork = holidayWork;
//var employeeSettingsShift = customizeWorkshopGroupSettingsShifts
// .Select(x => new CustomizeWorkshopEmployeeSettingsShift(x.StartTime, x.EndTime, x.Placement)).ToList();
foreach (var item in CustomizeWorkshopEmployeeSettingsCollection)
{
var newRotatingShifts = CustomizeRotatingShifts.Select(x => new CustomizeRotatingShift(x.StartTime, x.EndTime))
.ToList();
item.SimpleEdit(customizeWorkshopGroupSettingsShifts
.Select(x => new CustomizeWorkshopEmployeeSettingsShift(x.StartTime, x.EndTime, x.Placement)).ToList(),
irregularShift, workshopShiftStatus, breakTime, false, FridayWork, HolidayWork, newRotatingShifts);
}
}
public void AddEmployeeSettingToGroupWithGroupData(long employeeId, long workshopId)
{
var shifts = CustomizeWorkshopGroupSettingsShifts
.Select(x => new CustomizeWorkshopEmployeeSettingsShift(x.StartTime, x.EndTime, x.Placement)).ToList();
FridayPay fridayPay = new(FridayPay.FridayPayType, FridayPay.Value);
OverTimePay overTimePay = new(OverTimePay.OverTimePayType, OverTimePay.Value);
BaseYearsPay baseYearsPay = new(BaseYearsPay.BaseYearsPayType, BaseYearsPay.Value, BaseYearsPay.PaymentType);
BonusesPay bonusesPay = new(BonusesPay.BonusesPayType, BonusesPay.Value, BonusesPay.PaymentType);
NightWorkPay nightWorkPay = new(NightWorkPay.NightWorkingType, NightWorkPay.Value);
MarriedAllowance marriedAllowance = new(MarriedAllowance.MarriedAllowanceType, MarriedAllowance.Value);
ShiftPay shiftPay = new(ShiftType.None, ShiftPayType.None, 0);
FamilyAllowance familyAllowance = new(FamilyAllowance.FamilyAllowanceType, FamilyAllowance.Value);
LeavePay leavePay = new(LeavePay.LeavePayType, LeavePay.Value);
InsuranceDeduction insuranceDeduction = new(InsuranceDeduction.InsuranceDeductionType, InsuranceDeduction.Value);
FineAbsenceDeduction fineAbsenceDeduction = new(
FineAbsenceDeduction.FineAbsenceDeductionType, FineAbsenceDeduction.Value,
FineAbsenceDeduction.FineAbsenceDayOfWeekCollection
.Select(x => new FineAbsenceDayOfWeek(x.DayOfWeek)).ToList()
);
LateToWork lateToWork = new(
LateToWork.LateToWorkType,
LateToWork.LateToWorkTimeFines.Select(x => new LateToWorkTimeFine(x.Minute, x.FineMoney))
.ToList(), LateToWork.Value
);
EarlyExit earlyExit = new(EarlyExit.EarlyExitType,
EarlyExit.EarlyExitTimeFines.Select(x => new EarlyExitTimeFine(x.Minute, x.FineMoney))
.ToList(), EarlyExit.Value);
IrregularShift irregularShift = new(IrregularShift.StartTime, IrregularShift.EndTime,
IrregularShift.WorkshopIrregularShifts);
BreakTime breakTime = new(BreakTime.HasBreakTimeValue, BreakTime.BreakTimeValue);
var 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);
CustomizeWorkshopEmployeeSettingsCollection.Add(customizeWorkshopEmployeeSettings);
}
WeeklyOffDays = weeklyOffDays;
//var employeeSettingsShift = customizeWorkshopGroupSettingsShifts
// .Select(x => new CustomizeWorkshopEmployeeSettingsShift(x.StartTime, x.EndTime, x.Placement)).ToList();
private void SetValueObjects(FridayPay fridayPay, OverTimePay overTimePay, BaseYearsPay baseYearsPay,
BonusesPay bonusesPay
, NightWorkPay nightWorkPay, MarriedAllowance marriedAllowance, ShiftPay shiftPay,
FamilyAllowance familyAllowance, LeavePay leavePay, InsuranceDeduction insuranceDeduction,
FineAbsenceDeduction fineAbsenceDeduction,
LateToWork lateToWork, EarlyExit earlyExit)
{
FridayPay = new(fridayPay.FridayPayType, fridayPay.Value);
OverTimePay = new(overTimePay.OverTimePayType, overTimePay.Value);
BaseYearsPay = new(baseYearsPay.BaseYearsPayType, baseYearsPay.Value, baseYearsPay.PaymentType);
BonusesPay = new(bonusesPay.BonusesPayType, bonusesPay.Value, bonusesPay.PaymentType);
NightWorkPay = new(nightWorkPay.NightWorkingType, nightWorkPay.Value);
MarriedAllowance = new(marriedAllowance.MarriedAllowanceType, marriedAllowance.Value);
ShiftPay = new(shiftPay.ShiftType, shiftPay.ShiftPayType, shiftPay.Value);
FamilyAllowance = new(familyAllowance.FamilyAllowanceType, familyAllowance.Value);
LeavePay = new(leavePay.LeavePayType, leavePay.Value);
InsuranceDeduction = new(insuranceDeduction.InsuranceDeductionType, insuranceDeduction.Value);
FineAbsenceDeduction = new(
fineAbsenceDeduction.FineAbsenceDeductionType, fineAbsenceDeduction.Value,
fineAbsenceDeduction.FineAbsenceDayOfWeekCollection
.Select(x => new FineAbsenceDayOfWeek(x.DayOfWeek)).ToList()
);
LateToWork = new(
lateToWork.LateToWorkType,
lateToWork.LateToWorkTimeFines.Select(x => new LateToWorkTimeFine(x.Minute, x.FineMoney))
.ToList(), lateToWork.Value
);
EarlyExit = new(earlyExit.EarlyExitType,
earlyExit.EarlyExitTimeFines.Select(x => new EarlyExitTimeFine(x.Minute, x.FineMoney))
.ToList(), earlyExit.Value);
}
foreach (var item in CustomizeWorkshopEmployeeSettingsCollection)
{
var employeeWeeklyOffDays = WeeklyOffDays.Select(x => new WeeklyOffDay(x.DayOfWeek)).ToList();
var newRotatingShifts = CustomizeRotatingShifts.Select(x => new CustomizeRotatingShift(x.StartTime, x.EndTime))
.ToList();
item.SimpleEdit(customizeWorkshopGroupSettingsShifts
.Select(x => new CustomizeWorkshopEmployeeSettingsShift(x.StartTime, x.EndTime, x.Placement)).ToList(),
irregularShift, workshopShiftStatus, breakTime, false, HolidayWork, newRotatingShifts, employeeWeeklyOffDays);
}
}
public void AddEmployeeSettingToGroupWithGroupData(long employeeId, long workshopId)
{
var shifts = CustomizeWorkshopGroupSettingsShifts
.Select(x => new CustomizeWorkshopEmployeeSettingsShift(x.StartTime, x.EndTime, x.Placement)).ToList();
FridayPay fridayPay = new(FridayPay.FridayPayType, FridayPay.Value);
OverTimePay overTimePay = new(OverTimePay.OverTimePayType, OverTimePay.Value);
BaseYearsPay baseYearsPay = new(BaseYearsPay.BaseYearsPayType, BaseYearsPay.Value, BaseYearsPay.PaymentType);
BonusesPay bonusesPay = new(BonusesPay.BonusesPayType, BonusesPay.Value, BonusesPay.PaymentType);
NightWorkPay nightWorkPay = new(NightWorkPay.NightWorkingType, NightWorkPay.Value);
MarriedAllowance marriedAllowance = new(MarriedAllowance.MarriedAllowanceType, MarriedAllowance.Value);
ShiftPay shiftPay = new(ShiftType.None, ShiftPayType.None, 0);
FamilyAllowance familyAllowance = new(FamilyAllowance.FamilyAllowanceType, FamilyAllowance.Value);
LeavePay leavePay = new(LeavePay.LeavePayType, LeavePay.Value);
InsuranceDeduction insuranceDeduction = new(InsuranceDeduction.InsuranceDeductionType, InsuranceDeduction.Value);
FineAbsenceDeduction fineAbsenceDeduction = new(
FineAbsenceDeduction.FineAbsenceDeductionType, FineAbsenceDeduction.Value,
FineAbsenceDeduction.FineAbsenceDayOfWeekCollection
.Select(x => new FineAbsenceDayOfWeek(x.DayOfWeek)).ToList()
);
LateToWork lateToWork = new(
LateToWork.LateToWorkType,
LateToWork.LateToWorkTimeFines.Select(x => new LateToWorkTimeFine(x.Minute, x.FineMoney))
.ToList(), LateToWork.Value
);
EarlyExit earlyExit = new(EarlyExit.EarlyExitType,
EarlyExit.EarlyExitTimeFines.Select(x => new EarlyExitTimeFine(x.Minute, x.FineMoney))
.ToList(), EarlyExit.Value);
IrregularShift irregularShift = new(IrregularShift.StartTime, IrregularShift.EndTime,
IrregularShift.WorkshopIrregularShifts);
BreakTime breakTime = new(BreakTime.HasBreakTimeValue, BreakTime.BreakTimeValue);
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, HolidayWork, irregularShift,
WorkshopShiftStatus, breakTime, LeavePermittedDays, rotatingShift, weeklyOffDays);
CustomizeWorkshopEmployeeSettingsCollection.Add(customizeWorkshopEmployeeSettings);
}
//public void OverWriteEmployeesShiftAndSalary(IEnumerable<long> ids,ICollection<RollCallWorkshopEmployeeSettingsShift> employeeSettingsShifts,double salary)
//{
// var permittedToOverWrite= RollCallWorkshopEmployeeSettingsCollection.Where(x => ids.Contains(x.id));
// foreach (var item in permittedToOverWrite)
// {
// item.OverWriteSalaryAndShift(employeeSettingsShifts, salary);
// }
//}
private void SetValueObjects(FridayPay fridayPay, OverTimePay overTimePay, BaseYearsPay baseYearsPay,
BonusesPay bonusesPay
, NightWorkPay nightWorkPay, MarriedAllowance marriedAllowance, ShiftPay shiftPay,
FamilyAllowance familyAllowance, LeavePay leavePay, InsuranceDeduction insuranceDeduction,
FineAbsenceDeduction fineAbsenceDeduction,
LateToWork lateToWork, EarlyExit earlyExit)
{
FridayPay = new(fridayPay.FridayPayType, fridayPay.Value);
OverTimePay = new(overTimePay.OverTimePayType, overTimePay.Value);
BaseYearsPay = new(baseYearsPay.BaseYearsPayType, baseYearsPay.Value, baseYearsPay.PaymentType);
BonusesPay = new(bonusesPay.BonusesPayType, bonusesPay.Value, bonusesPay.PaymentType);
NightWorkPay = new(nightWorkPay.NightWorkingType, nightWorkPay.Value);
MarriedAllowance = new(marriedAllowance.MarriedAllowanceType, marriedAllowance.Value);
ShiftPay = new(shiftPay.ShiftType, shiftPay.ShiftPayType, shiftPay.Value);
FamilyAllowance = new(familyAllowance.FamilyAllowanceType, familyAllowance.Value);
LeavePay = new(leavePay.LeavePayType, leavePay.Value);
InsuranceDeduction = new(insuranceDeduction.InsuranceDeductionType, insuranceDeduction.Value);
FineAbsenceDeduction = new(
fineAbsenceDeduction.FineAbsenceDeductionType, fineAbsenceDeduction.Value,
fineAbsenceDeduction.FineAbsenceDayOfWeekCollection
.Select(x => new FineAbsenceDayOfWeek(x.DayOfWeek)).ToList()
);
LateToWork = new(
lateToWork.LateToWorkType,
lateToWork.LateToWorkTimeFines.Select(x => new LateToWorkTimeFine(x.Minute, x.FineMoney))
.ToList(), lateToWork.Value
);
EarlyExit = new(earlyExit.EarlyExitType,
earlyExit.EarlyExitTimeFines.Select(x => new EarlyExitTimeFine(x.Minute, x.FineMoney))
.ToList(), earlyExit.Value);
}
//public void OverWriteEmployeesShiftAndSalary(IEnumerable<long> ids,ICollection<RollCallWorkshopEmployeeSettingsShift> employeeSettingsShifts,double salary)
//{
// var permittedToOverWrite= RollCallWorkshopEmployeeSettingsCollection.Where(x => ids.Contains(x.id));
// foreach (var item in permittedToOverWrite)
// {
// item.OverWriteSalaryAndShift(employeeSettingsShifts, salary);
// }
//}
}

View File

@@ -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);

View File

@@ -3,36 +3,110 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using _0_Framework.Application;
using _0_Framework.Domain;
namespace Company.Domain.EmployeeComputeOptionsAgg
{
public class EmployeeComputeOptions : EntityBase
{
public EmployeeComputeOptions(long workshopId, long employeeId, string computeOptions, string bonusesOptions, string yearsOptions)
{
WorkshopId = workshopId;
EmployeeId = employeeId;
ComputeOptions = computeOptions;
BonusesOptions = bonusesOptions;
YearsOptions = yearsOptions;
}
public EmployeeComputeOptions(long workshopId, long employeeId, string computeOptions, string bonusesOptions, string yearsOptions,
bool createContract, bool signContract, bool createCheckout, bool signCheckout, string contractTerm, IsActive cutContractEndOfYear)
{
WorkshopId = workshopId;
EmployeeId = employeeId;
ComputeOptions = computeOptions;
BonusesOptions = bonusesOptions;
YearsOptions = yearsOptions;
ContractTerm = contractTerm;
CutContractEndOfYear = contractTerm == "1" ? IsActive.None : cutContractEndOfYear;
public long WorkshopId { get; private set;}
public long EmployeeId { get; private set;}
SetContractAndCheckoutOptions(createContract, signContract, createCheckout, signCheckout);
}
//نحوه محاسبه مزد مرخصی
public string ComputeOptions { get; private set; }
//نحوه محاسبه عیدی
public string BonusesOptions { get; private set; }
//نحوه محاسبه سنوات
public string YearsOptions { get; private set; }
public void Edit(string computeOptions, string bonusesOptions, string yearsOptions)
{
ComputeOptions = computeOptions;
BonusesOptions = bonusesOptions;
YearsOptions = yearsOptions;
}
}
public long WorkshopId { get; private set; }
public long EmployeeId { get; private set; }
//نحوه محاسبه مزد مرخصی
public string ComputeOptions { get; private set; }
//نحوه محاسبه عیدی
public string BonusesOptions { get; private set; }
//نحوه محاسبه سنوات
public string YearsOptions { get; private set; }
/// <summary>
/// ایجاد قرارداد
/// </summary>
public bool CreateContract { get; private set; }
/// <summary>
/// امضای قرارداد
/// </summary>
public bool SignContract { get; private set; }
/// <summary>
/// ایجاد تصفیه
/// </summary>
public bool CreateCheckout { get; private set; }
/// <summary>
/// امضای تصفیه
/// </summary>
public bool SignCheckout { get; private set; }
/// <summary>
/// مدت قرارداد
/// </summary>
public string ContractTerm { get; private set; }
/// <summary>
/// اگر قرارداد بیش از یک ماه باشد و گزینه انتخاب شده منتهی به پایان سال باشد
/// این آیتم
/// True
/// است
/// </summary>
public IsActive CutContractEndOfYear { get; private set; }
public void Edit(string computeOptions, string bonusesOptions, string yearsOptions, bool createContract, bool signContract, bool createCheckout,
bool signCheckout, string contractTerm, IsActive cutContractEndOfYear)
{
ComputeOptions = computeOptions;
BonusesOptions = bonusesOptions;
YearsOptions = yearsOptions;
ContractTerm = contractTerm;
CutContractEndOfYear = contractTerm == "1" ? IsActive.None : cutContractEndOfYear;
SetContractAndCheckoutOptions(createContract, signContract, createCheckout, signCheckout);
}
private void SetContractAndCheckoutOptions(bool createContract, bool signContract, bool createCheckout,
bool signCheckout)
{
CreateContract = createContract;
if (createContract)
{
SignContract = signContract;
CreateCheckout = createCheckout;
if (createCheckout)
{
SignCheckout = signCheckout;
}
else
{
SignCheckout = false;
}
}
else
{
SignContract = false;
CreateCheckout = false;
SignCheckout = false;
}
}
}
}

View File

@@ -60,4 +60,13 @@ public interface IInsuranceListRepository:IRepository<long, InsuranceList>
#region client
List<InsuranceListViewModel> SearchForClient(InsuranceListSearchModel searchModel);
#endregion
}
#region Mahan
Task<InsuranceListConfirmOperation> GetInsuranceOperationDetails(long id);
Task<InsuranceListTabsCountViewModel> GetTabCounts(InsuranceListSearchModel searchModel);
#endregion
}

View File

@@ -4,7 +4,9 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using _0_Framework.Domain;
using Company.Domain.InsuranceListAgg.ValueObjects;
using Company.Domain.InsuranceWorkshopAgg;
using CompanyManagment.App.Contracts.InsuranceList.Enums;
namespace Company.Domain.InsuranceListAgg;
@@ -151,6 +153,21 @@ public class InsuranceList : EntityBase
/// </summary>
public double SumOfMarriedAllowance { get; private set; }
#region Mahan
/// <summary>
/// بازرسی
/// </summary>
public InsuranceListInspection Inspection { get; set; } =new (InsuranceListInspectionType.None,DateTime.MinValue, 0);
/// <summary>
/// بدهی
/// </summary>
public InsuranceListDebt Debt { get; set; } = new(InsuranceListDebtType.None, DateTime.MinValue, 0, 0);
/// <summary>
/// تاییدیه کارفرما
/// </summary>
public InsuranceListEmployerApproval EmployerApproval { get; set; } = new(InsuranceListEmployerApprovalStatus.None, string.Empty);
#endregion
public List<InsuranceListWorkshop> InsuranceListWorkshops { get; set; }
public void Edit(int sumOfEmployees, int sumOfWorkingDays, double sumOfSalaries, double sumOfBenefitsIncluded, double included,
@@ -174,4 +191,22 @@ public class InsuranceList : EntityBase
SumOfDailyWagePlusBaseYears = sumOfDailyWage + sumOfBaseYears;
}
}
public void SetDebt(InsuranceListDebt debt)
{
Debt = debt;
}
public void SetInspection(InsuranceListInspection inspection)
{
Inspection = inspection;
}
public void SetEmployerApproval(InsuranceListEmployerApproval employerApproval)
{
EmployerApproval = employerApproval;
}
public void SetConfirmSentlist(bool confirmSentlist)
{
ConfirmSentlist = confirmSentlist;
}
}

View File

@@ -0,0 +1,31 @@
using System;
using CompanyManagment.App.Contracts.InsuranceList.Enums;
namespace Company.Domain.InsuranceListAgg.ValueObjects;
public class InsuranceListDebt
{
public InsuranceListDebt(InsuranceListDebtType type, DateTime debtDate, double amount, long mediaId)
{
Type = type;
if (type == InsuranceListDebtType.None)
{
DebtDate = DateTime.MinValue;
Amount = 0;
MediaId = 0;
}
else
{
DebtDate = debtDate;
Amount = amount;
MediaId = mediaId;
IsDone = true;
}
}
public InsuranceListDebtType Type { get; set; }
public DateTime DebtDate { get; set; }
public double Amount { get; set; }
public long MediaId { get; set; }
public bool IsDone { get; set; }
}

View File

@@ -0,0 +1,26 @@
using System.Security.Cryptography;
using CompanyManagment.App.Contracts.InsuranceList.Enums;
namespace Company.Domain.InsuranceListAgg.ValueObjects;
public class InsuranceListEmployerApproval
{
public InsuranceListEmployerApproval(InsuranceListEmployerApprovalStatus status, string description)
{
Status = status;
if (status == InsuranceListEmployerApprovalStatus.None)
{
Description = string.Empty;
}
else
{
Description = description;
IsDone = true;
}
}
public InsuranceListEmployerApprovalStatus Status { get; set; }
public string Description { get; set; }
public bool IsDone { get; set; }
}

View File

@@ -0,0 +1,29 @@
using System;
using CompanyManagment.App.Contracts.InsuranceList.Enums;
namespace Company.Domain.InsuranceListAgg.ValueObjects;
public class InsuranceListInspection
{
public InsuranceListInspection(InsuranceListInspectionType type, DateTime lastInspectionDateTime, long mediaId)
{
Type = type;
if (type == InsuranceListInspectionType.None)
{
LastInspectionDateTime = DateTime.MinValue;
MediaId = 0;
}
else
{
LastInspectionDateTime = lastInspectionDateTime;
MediaId = mediaId;
IsDone = true;
}
}
public InsuranceListInspectionType Type { get; set; }
public DateTime LastInspectionDateTime { get; set; }
public long MediaId { get; set; }
public bool IsDone { get; set; }
}

View File

@@ -5,6 +5,7 @@ using _0_Framework.Application;
using _0_Framework.Domain;
using CompanyManagment.App.Contracts.LeftWork;
using CompanyManagment.App.Contracts.PersonnleCode;
using CompanyManagment.App.Contracts.Workshop.DTOs;
namespace Company.Domain.LeftWorkAgg;
@@ -46,4 +47,11 @@ public interface ILeftWorkRepository : IRepository<long, LeftWork>
Task<LeftWork> GetLastLeftWork(long employeeId, long workshopId);
List<LeftWorkViewModel> SearchCreateContract(LeftWorkSearchModel searchModel);
/// <summary>
/// دریافت اطلاعات کارگاه و پرسنل برای ایجاد قرارداد
/// </summary>
/// <param name="workshopId"></param>
/// <returns></returns>
AutoExtensionDto AutoExtentionEmployees(long workshopId);
}

View File

@@ -52,5 +52,8 @@ public interface ILeftWorkInsuranceRepository : IRepository<long, LeftWorkInsura
/// <returns></returns>
List<LeftWorkViewModel> GetEmployeesWithContractExitOnly(long workshopId);
LeftWorkInsurance GetLastLeftWorkByEmployeeIdAndWorkshopId(long workshopId, long employeeId);
#endregion
}

View File

@@ -15,8 +15,20 @@ 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);
ComputingViewModel MandatoryCompute(long employeeId, long workshopId, DateTime contractStart, DateTime contractEnd, CreateWorkingHoursTemp command, bool holidayWorking, bool isStaticCheckout, bool rotatingShiftCompute);
/// <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);

View File

@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using _0_Framework.Domain;
using CompanyManagment.App.Contracts.RollCallEmployee;
@@ -6,6 +7,7 @@ namespace Company.Domain.RollCallEmployeeAgg;
public interface IRollCallEmployeeRepository : IRepository<long, RollCallEmployee>
{
bool HasRollCallRecord(long employeeId, long workshopId, DateTime contractStart, DateTime contractEnd);
List<RollCallEmployeeViewModel> GetByWorkshopId(long workshopId);
EditRollCallEmployee GetDetails(long id);
RollCallEmployeeViewModel GetByEmployeeIdAndWorkshopId(long employeeId, long workshopId);

View File

@@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.Globalization;
using System.Security.AccessControl;
using _0_Framework.Application;
using _0_Framework.Domain;
using Company.Domain.CheckoutAgg;
using Company.Domain.ClientEmployeeWorkshopAgg;
@@ -76,23 +77,13 @@ public class Workshop : EntityBase
ClientEmployeeWorkshopList = new List<ClientEmployeeWorkshop>();
}
//public Workshop()
//{
// Contracts2 = new List<Contract>();
// WorkshopEmployers = new List<WorkshopEmployer>();
// LeftWorks = new List<LeftWork>();
// LeftWorkInsurances = new List<LeftWorkInsurance>();
// EmployersList = new List<Employer>();
// WorkshopEmployers = new List<WorkshopEmployer>();
// EmployersList = new List<Employer>();
// PersonnelCodeList = new List<PersonnelCodeDomain>();
//}
public Workshop(string workshopName,string workshopSureName, string insuranceCode, string typeOfOwnership, string archiveCode, string agentName, string agentPhone,
string state, string city, string address, string typeOfInsuranceSend, string typeOfContract, string contractTerm,
string agreementNumber, bool fixedSalary, string population,long? insuranceJobId, string zoneName, bool addBonusesPay, bool addYearsPay, bool addLeavePay, bool totalPaymentHide,
bool isClassified, string computeOptions, string bonusesOptions, string yearsOptions, string hasRollCallFreeVip, bool workshopHolidayWorking,
bool insuranceCheckoutOvertime, bool insuranceCheckoutFamilyAllowance)
bool insuranceCheckoutOvertime, bool insuranceCheckoutFamilyAllowance, bool createContract, bool signContract, bool createCheckout, bool signCheckout, IsActive cutContractEndOfYear, bool rotatingShiftCompute, bool isStaticCheckout)
{
WorkshopName = workshopName;
WorkshopSureName = workshopSureName;
@@ -136,6 +127,13 @@ public class Workshop : EntityBase
WorkshopHolidayWorking = workshopHolidayWorking;
InsuranceCheckoutOvertime = insuranceCheckoutOvertime;
InsuranceCheckoutFamilyAllowance = insuranceCheckoutFamilyAllowance;
CreateContract = createContract;
SignContract = signContract;
CreateCheckout = createCheckout;
SignCheckout = signCheckout;
CutContractEndOfYear = cutContractEndOfYear;
RotatingShiftCompute = rotatingShiftCompute;
IsStaticCheckout = isStaticCheckout;
}
@@ -210,9 +208,32 @@ public class Workshop : EntityBase
/// محاسبه حق اولاد در لیست بیمه
/// </summary>
public bool InsuranceCheckoutFamilyAllowance { get; private set; }
public bool CreateContract { get; private set; }
public bool SignContract { get; private set; }
public bool CreateCheckout { get; private set; }
public bool SignCheckout { get; private set; }
/// <summary>
/// اگر قرارداد بیش از یک ماه باشد و گزینه انتخاب شده منتهی به پایان سال باشد
/// این آیتم
/// True
/// است
/// </summary>
public IsActive CutContractEndOfYear { get; private set; }
//public Employer Employer { get; private set; }
public Workshop()
/// <summary>
/// محاسبه نوبت کاری در فیش حقوقی
/// </summary>
public bool RotatingShiftCompute { get; private set; }
/// <summary>
/// تصفیه حساب بصورت استاتیک محاصبه شود
/// </summary>
public bool IsStaticCheckout { get; private set; }
public Workshop()
{
RollCallServicesList = new List<RollCallService>();
CustomizeCheckouts = new List<CustomizeCheckout>();
@@ -243,7 +264,7 @@ public class Workshop : EntityBase
string state, string city, string address, string typeOfInsuranceSend, string typeOfContract, string contractTerm,
string agreementNumber, bool fixedSalary, string population, long? insuranceJobId, string zoneName, bool addBonusesPay, bool addYearsPay, bool addLeavePay,
bool totalPaymentHide, bool isClassified, string computeOptions, string bonusesOptions, string yearsOptions, string hasRollCallFreeVip, bool workshopHolidayWorking,
bool insuranceCheckoutOvertime, bool insuranceCheckoutFamilyAllowance)
bool insuranceCheckoutOvertime, bool insuranceCheckoutFamilyAllowance, bool createContract, bool signContract, bool createCheckout, bool signCheckout, IsActive cutContractEndOfYear, bool rotatingShiftCompute, bool isStaticCheckout)
{
WorkshopName = workshopName;
WorkshopSureName = workshopSureName;
@@ -284,6 +305,13 @@ public class Workshop : EntityBase
WorkshopHolidayWorking = workshopHolidayWorking;
InsuranceCheckoutOvertime = insuranceCheckoutOvertime;
InsuranceCheckoutFamilyAllowance = insuranceCheckoutFamilyAllowance;
CreateContract = createContract;
SignContract = signContract;
CreateCheckout = createCheckout;
SignCheckout = signCheckout;
CutContractEndOfYear = cutContractEndOfYear;
RotatingShiftCompute = rotatingShiftCompute;
IsStaticCheckout = isStaticCheckout;
}

View File

@@ -0,0 +1,262 @@
using _0_Framework.Application;
using CompanyManagement.Infrastructure.Excel.CWS;
using CompanyManagment.App.Contracts.InstitutionContract;
using OfficeOpenXml;
using OfficeOpenXml.Style;
using System.Drawing;
using System.Text.RegularExpressions;
namespace CompanyManagement.Infrastructure.Excel.InstitutionContract;
public class InstitutionContractExcelGenerator
{
public static byte[] GenerateExcel(List<InstitutionContractViewModel> institutionContractViewModels)
{
ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
using var package = new ExcelPackage();
var allWorksheet = package.Workbook.Worksheets.Add("همه");
var blueWorksheet = package.Workbook.Worksheets.Add("آبی");
blueWorksheet.TabColor = Color.LightBlue;
var grayWorksheet = package.Workbook.Worksheets.Add("خاکستری");
grayWorksheet.TabColor = Color.LightGray;
var redWorksheet = package.Workbook.Worksheets.Add("قرمز");
redWorksheet.TabColor = Color.LightCoral;
var purpleWorksheet = package.Workbook.Worksheets.Add("بنفش");
purpleWorksheet.TabColor = Color.MediumPurple;
var blackWorksheet = package.Workbook.Worksheets.Add("مشکی");
blackWorksheet.TabColor = Color.DimGray;
var yellowWorksheet = package.Workbook.Worksheets.Add("زرد");
yellowWorksheet.TabColor = Color.Yellow;
var whiteWorksheet = package.Workbook.Worksheets.Add("سفید");
whiteWorksheet.TabColor = Color.White;
CreateExcelSheet(institutionContractViewModels, allWorksheet);
var blueContracts = institutionContractViewModels.Where(x=>x.ExpireColor == "blue").ToList();
CreateExcelSheet(blueContracts, blueWorksheet);
institutionContractViewModels = institutionContractViewModels.Except(blueContracts).ToList();
var grayContracts = institutionContractViewModels.Where(x => x.IsContractingPartyBlock == "true").ToList();
CreateExcelSheet(grayContracts, grayWorksheet);
institutionContractViewModels = institutionContractViewModels.Except(grayContracts).ToList();
var redContracts = institutionContractViewModels.Where(x=>x.ExpireColor == "red").ToList();
CreateExcelSheet(redContracts, redWorksheet);
institutionContractViewModels = institutionContractViewModels.Except(redContracts).ToList();
var purpleContracts = institutionContractViewModels.Where(x=>x.ExpireColor == "purple").ToList();
CreateExcelSheet(purpleContracts, purpleWorksheet);
institutionContractViewModels = institutionContractViewModels.Except(purpleContracts).ToList();
var blackContracts = institutionContractViewModels.Where(x=>x.ExpireColor == "black").ToList();
CreateExcelSheet(blackContracts, blackWorksheet);
institutionContractViewModels = institutionContractViewModels.Except(blackContracts).ToList();
var yellowContracts = institutionContractViewModels
.Where(x => string.IsNullOrWhiteSpace(x.ExpireColor) && x.WorkshopCount == "0").ToList();
CreateExcelSheet(yellowContracts, yellowWorksheet);
institutionContractViewModels = institutionContractViewModels.Except(yellowContracts).ToList();
var otherContracts = institutionContractViewModels;
CreateExcelSheet(otherContracts, whiteWorksheet);
return package.GetAsByteArray();
}
private static void CreateExcelSheet(List<InstitutionContractViewModel> institutionContractViewModels, ExcelWorksheet worksheet)
{
// Headers
worksheet.Cells[1, 1].Value = "شماره قرارداد";
worksheet.Cells[1, 2].Value = "طرف حساب";
worksheet.Cells[1, 3].Value = "شماره کارفرما";
worksheet.Cells[1, 4].Value = "کارفرما ها";
worksheet.Cells[1, 5].Value = "کارگاه ها";
worksheet.Cells[1, 6].Value = "مجبوع پرسنل";
worksheet.Cells[1, 7].Value = "شروع قرارداد";
worksheet.Cells[1, 8].Value = "پایان قرارداد";
worksheet.Cells[1, 9].Value = "مبلغ قرارداد (بدون کارگاه)";
worksheet.Cells[1, 10].Value = "مبلغ قرارداد";
worksheet.Cells[1, 11].Value = "وضعیت مالی";
using (var range = worksheet.Cells[1, 1, 1, 11])
{
range.Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
range.Style.VerticalAlignment = ExcelVerticalAlignment.Center;
range.Style.Font.Bold = true;
range.Style.Fill.PatternType = ExcelFillStyle.Solid;
range.Style.Fill.BackgroundColor.SetColor(Color.LightGray); // رنگ پس زمینه خاکستری
// اعمال بوردر به همه خطوط
range.Style.Border.Top.Style = ExcelBorderStyle.Thin;
range.Style.Border.Bottom.Style = ExcelBorderStyle.Thin;
range.Style.Border.Left.Style = ExcelBorderStyle.Thin;
range.Style.Border.Right.Style = ExcelBorderStyle.Thin;
// اعمال رنگ مشکی برای بوردرها
range.Style.Border.Top.Color.SetColor(Color.Black);
range.Style.Border.Bottom.Color.SetColor(Color.Black);
range.Style.Border.Left.Color.SetColor(Color.Black);
range.Style.Border.Right.Color.SetColor(Color.Black);
}
int row = 2;
for (int i = 0; i < institutionContractViewModels.Count; i++)
{
var contract = institutionContractViewModels[i];
var employers = contract.EmployerViewModels?.ToList() ?? new();
var workshops = contract.WorkshopViewModels?.ToList() ?? new();
int maxRows = Math.Max(employers.Count, workshops.Count);
maxRows = Math.Max(1, maxRows);
int startRow = row;
int endRow = row + maxRows - 1;
// 🎨 دریافت رنگ پس‌زمینه از مقدار رنگ موجود در داده
string colorName = contract.ExpireColor.ToLower();
var fillColor = GetColorByName(colorName, contract.WorkshopCount, contract.IsContractingPartyBlock);
for (int j = 0; j < maxRows; j++)
{
int currentRow = row + j;
worksheet.Cells[currentRow, 4].Value = j < employers.Count ? employers[j].FullName : null;
worksheet.Cells[currentRow, 5].Value = j < workshops.Count ? workshops[j].WorkshopFullName : null;
for (int col = 1; col <= 11; col++)
{
var cell = worksheet.Cells[currentRow, col];
// 📏 بوردرهای داخلی نازک / نقطه‌چین
cell.Style.Border.Top.Style = ExcelBorderStyle.Dotted;
cell.Style.Border.Bottom.Style = ExcelBorderStyle.Dotted;
cell.Style.Border.Left.Style = ExcelBorderStyle.Thin;
cell.Style.Border.Right.Style = ExcelBorderStyle.Thin;
// 🎯 تراز متن
cell.Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
cell.Style.VerticalAlignment = ExcelVerticalAlignment.Center;
// 🎨 اعمال رنگ پس‌زمینه
cell.Style.Fill.PatternType = ExcelFillStyle.Solid;
cell.Style.Fill.BackgroundColor.SetColor(fillColor);
}
}
// 🧱 مرج و مقداردهی ستون‌های اصلی
worksheet.Cells[startRow, 1, endRow, 1].Merge = true;
worksheet.Cells[startRow, 1].Value = contract.ContractNo;
worksheet.Cells[startRow, 2, endRow, 2].Merge = true;
worksheet.Cells[startRow, 2].Value = contract.ContractingPartyName;
worksheet.Cells[startRow, 3, endRow, 3].Merge = true;
worksheet.Cells[startRow, 3].Value = contract.ArchiveCode;
worksheet.Cells[startRow, 6, endRow, 6].Merge = true;
worksheet.Cells[startRow, 6].Value = contract.EmployeeCount;
worksheet.Cells[startRow, 7, endRow, 7].Merge = true;
worksheet.Cells[startRow, 7].Value = contract.ContractStartFa;
worksheet.Cells[startRow, 8, endRow, 8].Merge = true;
worksheet.Cells[startRow, 8].Value = contract.ContractEndFa;
worksheet.Cells[startRow, 9, endRow, 9].Merge = true;
var contractWithoutWorkshopAmountCell = worksheet.Cells[startRow, 9];
contractWithoutWorkshopAmountCell.Value = contract.WorkshopCount == "0" ? MoneyToDouble(contract.ContractAmount) : "";
contractWithoutWorkshopAmountCell.Style.Numberformat.Format = "#,##0";
worksheet.Cells[startRow, 10, endRow, 10].Merge = true;
var contractAmountCell = worksheet.Cells[startRow, 10];
contractAmountCell.Value = contract.WorkshopCount != "0" ? MoneyToDouble(contract.ContractAmount) : "";
contractAmountCell.Style.Numberformat.Format = "#,##0";
worksheet.Cells[startRow, 11, endRow, 11].Merge = true;
var balance = MoneyToDouble(contract.BalanceStr);
var balanceCell = worksheet.Cells[startRow, 11];
balanceCell.Value = balance;
balanceCell.Style.Numberformat.Format = "#,##0";
if (balance > 0)
balanceCell.Style.Font.Color.SetColor(Color.Red);
else if (balance < 0)
balanceCell.Style.Font.Color.SetColor(Color.Green);
// 📦 بوردر ضخیم خارجی برای هر سطر
var boldRange = worksheet.Cells[startRow, 1, endRow, 11];
boldRange.Style.Border.BorderAround(ExcelBorderStyle.Medium);
row += maxRows;
}
worksheet.PrinterSettings.PaperSize = ePaperSize.A4;
worksheet.PrinterSettings.Orientation = eOrientation.Landscape;
worksheet.PrinterSettings.FitToPage = true;
worksheet.PrinterSettings.FitToWidth = 1;
worksheet.PrinterSettings.FitToHeight = 0;
worksheet.PrinterSettings.Scale = 85;
int contractNoCol = 1;
int contractingPartyNameCol = 2;
int archiveNoCol = 3;
int employersCol = 4;
int workshopsCol = 5;
int employeeCountCol = 6;
int startContractCol = 7;
int endContractCol = 8;
int contractWithoutWorkshopAmountCol = 9;
int contractAmountCol = 10;
int balanceCol = 11;
worksheet.Columns[contractNoCol].Width = 17;
worksheet.Columns[contractingPartyNameCol].Width = 40;
worksheet.Columns[archiveNoCol].Width = 10;
worksheet.Columns[employersCol].Width = 40;
worksheet.Columns[workshopsCol].Width = 45;
worksheet.Columns[employeeCountCol].Width = 12;
worksheet.Columns[startContractCol].Width = 12;
worksheet.Columns[endContractCol].Width = 12;
worksheet.Columns[contractWithoutWorkshopAmountCol].Width = 18;
worksheet.Columns[contractAmountCol].Width = 12;
worksheet.Columns[balanceCol].Width = 12;
worksheet.View.RightToLeft = true; // فارسی
//worksheet.Cells[worksheet.Dimension.Address].AutoFitColumns();
}
private static double MoneyToDouble(string value)
{
Console.WriteLine(value);
var min = value.Length > 1 ? value.Substring(0, 2) : "";
var test = min == "\u200e\u2212" ? value.MoneyToDouble() * -1 : value.MoneyToDouble();
Console.WriteLine(test);
return test;
}
private static Color GetColorByName(string name, string workshopCount, string IsContractingPartyBlock)
{
return name switch
{
"blue" => Color.LightBlue,
_ when IsContractingPartyBlock == "true" => Color.LightGray,
"red" => Color.LightCoral,
"purple" => Color.MediumPurple,
"black" => Color.DimGray,
var n when string.IsNullOrWhiteSpace(n) && workshopCount == "0" => Color.Yellow,
_ => Color.White
};
}
}

View File

@@ -0,0 +1,170 @@
using CompanyManagment.App.Contracts.InstitutionContract;
using OfficeOpenXml;
using OfficeOpenXml.Style;
using System.Drawing;
namespace CompanyManagement.Infrastructure.Excel.Temp;
public class GetAllContractingPartyExcelGenerator
{
public static byte[] GenerateExcel(List<DataExcelResult> dataList)
{
ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
using var package = new ExcelPackage();
var archive99Sheet = package.Workbook.Worksheets.Add("کارگاه های 99");
var rollCallSheet = package.Workbook.Worksheets.Add("حضورغیابی");
var archive99Data = dataList.Where(x => x.Workshops.Any(a => a.ArchiveCode == "99")).ToList();
CreateSheet(archive99Data, archive99Sheet);
CreateSheet(dataList.Where(x=>x.Workshops.Any(w=>w.HasRollCall)).ToList(), rollCallSheet);
return package.GetAsByteArray();
}
private static void CreateSheet(List<DataExcelResult> dataList, ExcelWorksheet ws)
{
string[] headers = new[]
{
"ContractingPartyId", "نام طرف حساب", "EmployerId", "نام کارفرما", "WorkshopId", "کد کارگاه", "نام کارگاه",
"خدمات قرارداد", "خدمات قرارداد حضوری", "خدمات بیمه", "خدمات بیمه حضوری",
"خدمات حضورغیاب", "فیش حقوقی غیر رسمی", "تعداد استند", "تعداد ماه های بدهی قبلی برای حضورغیاب"
};
for (int i = 0; i < headers.Length; i++)
{
var cell = ws.Cells[1, i + 1];
cell.Value = headers[i];
cell.Style.Font.Bold = true;
cell.Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
cell.Style.VerticalAlignment = ExcelVerticalAlignment.Center;
cell.Style.Fill.PatternType = ExcelFillStyle.Solid;
cell.Style.Fill.BackgroundColor.SetColor(Color.LightGray);
cell.Style.Border.BorderAround(ExcelBorderStyle.Thin);
}
int row = 2;
foreach (var data in dataList)
{
int partyStartRow = row;
foreach (var workshop in data.Workshops)
{
int workshopStartRow = row;
var employers = workshop.Employers.Any()
? workshop.Employers
: new List<EmployerExcelResultData> { new() };
foreach (var employer in employers)
{
ws.Cells[row, 1].Value = data.ContractingPartyId;
ws.Cells[row, 2].Value = data.ContractingPartyName;
ws.Cells[row, 3].Value = employer?.Id;
ws.Cells[row, 4].Value = employer?.EmployerName;
ws.Cells[row, 5].Value = workshop.Id;
ws.Cells[row, 6].Value = workshop.ArchiveCode;
ws.Cells[row, 7].Value = workshop.WorkshopName;
ws.Cells[row, 8].Value = Convert.ToInt32(workshop.HasContract);
ws.Cells[row, 9].Value = 0; // فرضی
ws.Cells[row, 10].Value = Convert.ToInt32(workshop.HasInsurance);
ws.Cells[row, 11].Value = 0; // فرضی
ws.Cells[row, 12].Value = Convert.ToInt32(workshop.HasRollCall);
ws.Cells[row, 13].Value = Convert.ToInt32(workshop.HasCustomizeCheckout);
ws.Cells[row, 14].Value = 0;
ws.Cells[row, 15].Value = workshop.DebtRollCallMonth;
// 🌿 رنگ سبز برای سلول‌هایی که مقدارشان 1 است (True)
int[] boolCols = new[] { 8, 10, 12, 13, 14, 15 };
foreach (var col in boolCols)
{
var cell = ws.Cells[row, col];
if (Convert.ToInt32(cell.Value) > 0)
{
cell.Style.Fill.PatternType = ExcelFillStyle.Solid;
cell.Style.Fill.BackgroundColor.SetColor(Color.FromArgb(198, 239, 206)); // سبز اکسل
}
}
// Style: وسط‌چین + بوردر نازک برای همه سلول‌ها
for (int col = 1; col <= 15; col++)
{
var cell = ws.Cells[row, col];
cell.Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
cell.Style.VerticalAlignment = ExcelVerticalAlignment.Center;
cell.Style.Border.Top.Style = ExcelBorderStyle.Thin;
cell.Style.Border.Bottom.Style = ExcelBorderStyle.Thin;
cell.Style.Border.Left.Style = ExcelBorderStyle.Thin;
cell.Style.Border.Right.Style = ExcelBorderStyle.Thin;
}
row++;
}
// Merge Workshop Columns
if (employers.Count > 1)
{
for (int col = 5; col <= 15; col++)
{
ws.Cells[workshopStartRow, col, row - 1, col].Merge = true;
var merged = ws.Cells[workshopStartRow, col, row - 1, col];
merged.Style.VerticalAlignment = ExcelVerticalAlignment.Center;
merged.Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
}
}
}
// Merge Contracting Party Columns
if (row - partyStartRow > 1)
{
for (int col = 1; col <= 2; col++)
{
ws.Cells[partyStartRow, col, row - 1, col].Merge = true;
var merged = ws.Cells[partyStartRow, col, row - 1, col];
merged.Style.VerticalAlignment = ExcelVerticalAlignment.Center;
merged.Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
}
}
// می‌تونی در صورت نیاز خط بالا و پایین ضخیم برای گروه‌ها رو هم فعال کنی اینجا
// for (int col = 1; col <= 15; col++)
// {
// ws.Cells[partyStartRow, col].Style.Border.Top.Style = ExcelBorderStyle.Medium;
// ws.Cells[row - 1, col].Style.Border.Bottom.Style = ExcelBorderStyle.Medium;
// }
}
ws.Cells.AutoFitColumns();
ws.View.RightToLeft = true;
}
}
public class DataExcelResult
{
public long ContractingPartyId { get; set; }
public string ContractingPartyName { get; set; }
public List<WorkshopExcelResultData> Workshops { get; set; }
}
public class EmployerExcelResultData
{
public long Id { get; set; }
public string EmployerName { get; set; }
}
public class WorkshopExcelResultData
{
public long Id { get; set; }
public string WorkshopName { get; set; }
public bool HasContract { get; set; }
public bool HasInsurance { get; set; }
public bool HasRollCall { get; set; }
public bool HasCustomizeCheckout { get; set; }
public List<EmployerExcelResultData> Employers { get; set; }
public int DebtRollCallMonth { get; set; }
public string ArchiveCode { get; set; }
}

View File

@@ -132,7 +132,118 @@ public class CheckoutViewModel
/// مدت مرخصی استحقاقی
/// </summary>
public string TotalPaidLeave { get; set; }
public bool HasSignCheckout { get; set; }
public TimeSpan TotalHourlyLeave { get; set; }
public List<CheckoutDailyRollCallViewModel> MonthlyRollCall { get; set; }
public List<LoanInstallmentViewModel> InstallmentViewModels { get; set; }
public List<SalaryAidViewModel> SalaryAidViewModels { get; set; }
public CheckoutRollCallViewModel CheckoutRollCall { get; set; }
}
public class CheckoutRollCallViewModel
{
/// <summary>
/// مجموع ساعت موظفی
/// </summary>
public TimeSpan TotalMandatoryTimeSpan { get; set; }
/// <summary>
/// مجموع ساعت حضور
/// </summary>
public TimeSpan TotalPresentTimeSpan { get; set; }
/// <summary>
/// مجموع ساعت استراحت
/// </summary>
public TimeSpan TotalBreakTimeSpan { get; set; }
/// <summary>
/// مجموع ساعت کارکرد
/// </summary>
public TimeSpan TotalWorkingTimeSpan { get; set; }
/// <summary>
/// مجموع ساعت مرخصی استحقاقی
/// </summary>
public TimeSpan TotalPaidLeaveTmeSpan { get; set; }
/// <summary>
/// مجموع ساعت مرخصی استعلاجی
/// </summary>
public TimeSpan TotalSickLeaveTimeSpan { get; set; }
/// <summary>
/// روز های حضور غیاب
/// </summary>
public ICollection<CheckoutRollCallDayViewModel> RollCallDaysCollection { get; set; }
}
public class CheckoutRollCallDayViewModel
{
public long Id { get; set; }
/// <summary>
/// تاریخ
/// </summary>
public DateTime Date { get; set; }
/// <summary>
/// ورود اول
/// </summary>
public string FirstStartDate { get; set; }
/// <summary>
/// خروج اول
/// </summary>
public string FirstEndDate { get; set; }
/// <summary>
/// ورود دوم
/// </summary>
public string SecondStartDate { get; set; }
/// <summary>
/// خروج دوم
/// </summary>
public string SecondEndDate { get; set; }
/// <summary>
/// ساعت استراحت
/// </summary>
public TimeSpan BreakTimeSpan { get; set; }
/// <summary>
/// مقدار زمان کارکرد
/// </summary>
public TimeSpan WorkingTimeSpan { get; set; }
/// <summary>
/// آیا منقطع است؟
/// </summary>
public bool IsSliced { get; set; }
/// <summary>
/// آیا غیبت است
/// </summary>
public bool IsAbsent { get; set; }
/// <summary>
/// آیا جمعه است
/// </summary>
public bool IsFriday { get; set; }
/// <summary>
/// آیا تعطیل رسمی است
/// </summary>
public bool IsHoliday { get; set; }
/// <summary>
/// نوع مرخصی - درصورت نداشتن مرخصی مقدارش null میباشد
/// </summary>
public string LeaveType { get; set; }
public long CheckoutId { get; set; }
}

View File

@@ -5,6 +5,7 @@ using System.Text;
using System.Threading.Tasks;
using CompanyManagment.App.Contracts.Contract;
using CompanyManagment.App.Contracts.Employee;
using CompanyManagment.App.Contracts.RollCall;
using CompanyManagment.App.Contracts.YearlySalary;
using Microsoft.AspNetCore.Mvc.Rendering;
@@ -138,4 +139,20 @@ public class CreateCheckout
public string ShiftWork { get; set; }
/// <summary>
/// محاسبه اضافه کار در بیمه
/// </summary>
public bool HasInsuranceChekoutOverTime {get; set; }
public List<GroupedRollCalls> GroupedRollCalls { get; set; }
public TimeSpan TotalWorkingTimeSpan { get; set; }
public TimeSpan TotalBreakTimeSpan { get; set; }
public TimeSpan TotalPresentTimeSpan { get; set; }
public TimeSpan TotalPaidLeave { get; set; }
public TimeSpan TotalSickLeave { get; set; }
}

View File

@@ -0,0 +1,49 @@
using System.Collections.Generic;
namespace CompanyManagment.App.Contracts.Checkout;
public class CreateCheckoutListViewModel
{
public long Id { get; set; }
public long PersonnelCode { get; set; }
public long EmployeeId { get; set; }
public string ContractNo { get; set; }
public string EmployerName { get; set; }
public string WorkshopName { get; set; }
public string EmployeeName { get; set; }
public string ContractStart { get; set; }
public string ContractEnd { get; set; }
public string LeftWorkDate { get; set; }
//public string NextMonthStart { get; set; }
//public bool RedColor { get; set; }
public bool LaterThanEnd { get; set; }
public bool Extension { get; set; }
public bool HasCheckout { get; set; }
//public bool MoreThanOneMonth { get; set; }
//public bool Waiting { get; set; }
public string Description { get; set; }
/// <summary>
/// آیا پرسنل اجازه ایجاد قرارداد دارد
/// </summary>
public bool EmployeeHasCreateCheckout { get; set; }
public bool HasWorkFlow { get; set; }
public List<CreateCheckoutListViewModel> CreateCheckoutList { get; set; }
}

View File

@@ -13,7 +13,28 @@ public interface ICheckoutApplication
OperationResult Edit(EditCheckout command);
EditCheckout GetDetails(long id);
/// <summary>
/// لود لیست اولیه جهت ایجاد فیش حقوقی
/// </summary>
/// <param name="workshopId"></param>
/// <param name="employeeId"></param>
/// <param name="year"></param>
/// <param name="month"></param>
/// <param name="contractStart"></param>
/// <param name="contractEnd"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
Task<CreateCheckoutListViewModel> GetContractResultToCreateCheckout(long workshopId, long employeeId, string year,
string month,
string contractStart, string contractEnd);
/// <summary>
/// لیست تصفیه حساب
/// جدید
///
/// </summary>
/// <param name="searchModel"></param>
/// <returns></returns>
Task<List<CheckoutViewModel>> SearchCheckoutOptimized(CheckoutSearchModel searchModel);
Task<List<CheckoutViewModel>> Search(CheckoutSearchModel searchModel);
List<CheckoutViewModel> SimpleSearch(CheckoutSearchModel searchModel);
List<CheckoutViewModel> PrintAll(List<long> id);

View File

@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using CompanyManagment.App.Contracts.Loan;
using CompanyManagment.App.Contracts.RollCall;
using CompanyManagment.App.Contracts.SalaryAid;
using CompanyManagment.App.Contracts.WorkingHoursTemp;
@@ -45,6 +46,15 @@ public class ComputingViewModel
public bool HasRotatingShift { get; set; }
public List<GroupedRollCalls> GroupedRollCalls { get; set; }
public TimeSpan TotalWorkingTimeSpan { get; set; }
public TimeSpan TotalBreakTimeSpan { get; set; }
public TimeSpan TotalPresentTimeSpan { get; set; }
public TimeSpan TotalPaidLeave { get; set; }
public TimeSpan TotalSickLeave { get; set; }
//public List<string> holidays;
}

View File

@@ -63,6 +63,10 @@ public class ContractViweModel
public string EmployeeLName { get; set; }
public string IsBlockCantracingParty { get; set; }
/// <summary>
/// آیا مجاز به امضاء قرادا می باشد
/// </summary>
public bool HasSignContract { get; set; }
public IQueryable<WorkshopEmployerViewModel> WorkshopEmployerList { get; set; }
public List<EmployerViewModel> Employers { get; set; }
public List<WorkshopViewModel> Workshops { get; set; }

View File

@@ -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; }
}

View File

@@ -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; }

View File

@@ -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; }
}

View File

@@ -1,4 +1,6 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using _0_Framework.Domain.CustomizeCheckoutShared.Base;
using _0_Framework.Domain.CustomizeCheckoutShared.Enums;
using _0_Framework.Domain.CustomizeCheckoutShared.ValueObjects;
@@ -18,4 +20,5 @@ public class CustomizeWorkshopGroupSettingsViewModel
public BreakTime BreakTime { get; set; }
public FridayWork FridayWork { get; set; }
public HolidayWork HolidayWork { get; set; }
public List<DayOfWeek> OffDayOfWeeks { get; set; }
}

View File

@@ -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; }
}

View File

@@ -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; }
}

View File

@@ -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);

View File

@@ -28,6 +28,8 @@ public class CreateEmployeeByClient
public List<AddEmployeeDocumentItem> EmployeeDocumentItems { get; set; }
public bool HasEmployeeDocument { get; set; }
public bool HasRollCallService { get; set; }
public bool CanceledAuthorize { get; set; }
public string BirthDate { get; set; }
}

View File

@@ -17,6 +17,7 @@ public record EmployeeByNationalCodeInWorkshopViewModel
public long PersonnelCode { get; set; }
public List<EmployeeByNationalCodeEmployeeBankInfoViewModel> EmployeeBankInfos { get; set; }
public EmployeeByNationalCodeEmployeeDocumentViewModel EmployeeDocument { get; set; }
public bool AuthorizedCanceled { get; set; }
}

View File

@@ -26,4 +26,5 @@ public class EmployeeDataFromApiViewModel
/// </summary>
public string IdNumberSeri { get; set; }
public bool AuthorizedCanceled { get; set; }
}

View File

@@ -1,4 +1,5 @@
using System;
using _0_Framework.Application;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -17,5 +18,35 @@ namespace CompanyManagment.App.Contracts.EmployeeComputeOptions
public string BonusesOptions { get; set; }
//نحوه محاسبه سنوات
public string YearsOptions { get; set; }
/// <summary>
/// ایجاد قرارداد
/// </summary>
public bool CreateContract { get; set; }
/// <summary>
/// امضای قرارداد
/// </summary>
public bool SignContract { get; set; }
/// <summary>
/// ایجاد تصفیه
/// </summary>
public bool CreateCheckout { get; set; }
/// <summary>
/// امضای تصفیه
/// </summary>
public bool SignCheckout { get; set; }
/// <summary>
/// مدت قرارداد
/// </summary>
public string ContractTerm { get; set; }
/// <summary>
/// اگر قرارداد بیش از یک ماه باشد و گزینه انتخاب شده منتهی به پایان سال باشد
/// این آیتم
/// True
/// است
/// </summary>
public IsActive CutContractEndOfYear { get; set; }
}
}

View File

@@ -1,4 +1,6 @@
namespace CompanyManagment.App.Contracts.EmployeeComputeOptions;
using _0_Framework.Application;
namespace CompanyManagment.App.Contracts.EmployeeComputeOptions;
public class EmployeeComputeOptionsViewModel
{
@@ -12,4 +14,34 @@ public class EmployeeComputeOptionsViewModel
public string BonusesOptions { get; set; }
//نحوه محاسبه سنوات
public string YearsOptions { get; set; }
/// <summary>
/// ایجاد قرارداد
/// </summary>
public bool CreateContract { get; set; }
/// <summary>
/// امضای قرارداد
/// </summary>
public bool SignContract { get; set; }
/// <summary>
/// ایجاد تصفیه
/// </summary>
public bool CreateCheckout { get; set; }
/// <summary>
/// امضای تصفیه
/// </summary>
public bool SignCheckout { get; set; }
/// <summary>
/// مدت قرارداد
/// </summary>
public string ContractTerm { get; set; }
/// <summary>
/// اگر قرارداد بیش از یک ماه باشد و گزینه انتخاب شده منتهی به پایان سال باشد
/// این آیتم
/// True
/// است
/// </summary>
public IsActive CutContractEndOfYear { get; set; }
}

View File

@@ -14,9 +14,6 @@ public class EditInsuranceList:CreateInsuranceList
public bool FixedSalary { get; set; }
public string Population { get; set; }
public long? InsuranceJobId { get; set; }
/// <summary>
/// پرسنل هایی که قرارداد ترک کار کرده اند ولی ترک کار بیمه ندارند
/// </summary>
public List<LeftWorkViewModel> LeftWorkEmployees { get; set; }
}

View File

@@ -298,4 +298,6 @@ public class EmployeeDetailsForInsuranceListViewModel
///// DSK_SPOUSE
///// </summary>
//public double SumOfMarriedAllowance { get; set; }
public string Month { get; set; }
public string Year { get; set; }
}

View File

@@ -0,0 +1,8 @@
namespace CompanyManagment.App.Contracts.InsuranceList.Enums;
public enum InsuranceListDebtType
{
None,
Old,
New
}

View File

@@ -0,0 +1,14 @@
namespace CompanyManagment.App.Contracts.InsuranceList.Enums;
public enum InsuranceListEmployerApprovalStatus
{
None,
/// <summary>
/// تاییدیه شفاهی (اذنی)
/// </summary>
VerbalApproval,
/// <summary>
/// تاییدیه کاغذی
/// </summary>
WrittenApproval
}

View File

@@ -0,0 +1,8 @@
namespace CompanyManagment.App.Contracts.InsuranceList.Enums;
public enum InsuranceListInspectionType
{
None,
Old,
New
}

View File

@@ -5,6 +5,7 @@ using System.Text;
using System.Threading.Tasks;
using _0_Framework.Application;
using CompanyManagment.App.Contracts.InsuranceList;
using Microsoft.AspNetCore.Http;
namespace CompanyManagment.App.Contracts.InsuranceList;
@@ -17,9 +18,9 @@ public interface IInsuranceListApplication
MainEmployeeDetailsViewModel SearchEmployeeForCreateInsuranceList(EmployeeForCreateInsuranceListSearchModel searchModel);
double MarriedAllowance(string maritalStatus, long jobId, bool includedStatus,
int countWorkingDays, double marriedAlowance, int endMonthCurrentDay);
int countWorkingDays, double marriedAlowance, int endMonthCurrentDay);
OperationResult CreateEmployeeDetailsInfo(EmployeeDetailsForInsuranceListViewModel command);
OperationResult CreateEmployeeDetailsInfo(EmployeeDetailsForInsuranceListViewModel command);
OperationResult EditEmployeeDetailsInfo(EmployeeDetailsForInsuranceListViewModel command);
OperationResult Remove(long id);
EditInsuranceList GetDetailsForEdit(long id);
@@ -34,4 +35,16 @@ public interface IInsuranceListApplication
//farokhiChanges
(double basic, int totalYear) BasicYear(long employeeId, long worshopId, DateTime startDate);
double GetMonthlyBaseYear(double dayliBase, int countWorkingDays);
#region Mahan
/// <summary>
/// مراحل اجرایی برای تکمیل و ارسال لیست بیمه
/// </summary>
/// <returns></returns>
Task<OperationResult> ConfirmInsuranceOperation(InsuranceListConfirmOperation command);
Task<InsuranceListConfirmOperation> GetInsuranceOperationDetails(long id);
Task<InsuranceListTabsCountViewModel> GetTabCounts(InsuranceListSearchModel searchModel);
#endregion
}

View File

@@ -0,0 +1,48 @@
using CompanyManagment.App.Contracts.InsuranceList.Enums;
using Microsoft.AspNetCore.Http;
namespace CompanyManagment.App.Contracts.InsuranceList;
public class InsuranceListConfirmOperation
{
public long InsuranceListId { get; set; }
/// <summary>
/// بازرسی
/// </summary>
public CreateInsuranceListInspection Inspection { get; set; }
/// <summary>
/// بدهی
/// </summary>
public CreateInsuranceListDebt Debt { get; set; }
/// <summary>
/// تاییدیه کارفرما
/// </summary>
public CreateInsuranceListApproval Approval { get; set; }
public bool ConfirmSentList { get; set; }
}
public class CreateInsuranceListApproval
{
public InsuranceListEmployerApprovalStatus ApprovalStatus { get; set; }
public string Description { get; set; }
}
public class CreateInsuranceListDebt
{
public InsuranceListDebtType Type { get; set; }
public string DebtDate { get; set; }
public string Amount { get; set; }
public IFormFile DebtFile { get; set; }
public long DebtFileMediaId { get; set; }
public string FilePath { get; set; }
}
public class CreateInsuranceListInspection
{
public InsuranceListInspectionType Type { get; set; }
public string LastInspectionDate { get; set; }
public IFormFile InspectionFile { get; set; }
public long InspectionFileMediaId { get; set; }
public string FilePath { get; set; }
}

View File

@@ -25,4 +25,29 @@ public class InsuranceListSearchModel
public int PageIndex { get; set; }
public bool SearchAll { get; set; }
public InsuranceListSearchStatus Status { get; set; }
}
public enum InsuranceListSearchStatus
{
/// <summary>
/// انجام نشده
/// </summary>
NotStarted = 0,
/// <summary>
/// در حال انجام امور
/// </summary>
InProgress = 1,
/// <summary>
/// آماده ارسال لیست
/// </summary>
ReadyToSendList = 2,
/// <summary>
/// انجام بیمه
/// </summary>
Done = 3
}

View File

@@ -0,0 +1,24 @@
namespace CompanyManagment.App.Contracts.InsuranceList;
public class InsuranceListTabsCountViewModel
{
/// <summary>
/// انجام نشده
/// </summary>
public int NotStarted { get; set; }
/// <summary>
/// در حال انجام امور
/// </summary>
public int InProgress { get; set; }
/// <summary>
/// آماده ارسال لیست
/// </summary>
public int ReadyToSendList { get; set; }
/// <summary>
/// انجام بیمه
/// </summary>
public int Done { get; set; }
}

View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CompanyManagment.App.Contracts.InsuranceList.Enums;
namespace CompanyManagment.App.Contracts.InsuranceList;
@@ -27,4 +28,16 @@ public class InsuranceListViewModel
public long WorkShopId { get; set; }
public string IsBlockCantracingParty { get; set; }
public long EmployerId { get; set; }
/// <summary>وضعیت بازرسی</summary>
public bool InspectionDone { get; set; }
/// <summary>وضعیت بدهی</summary>
public bool DebtDone { get; set; }
/// <summary>تاییدیه کارفرما</summary>
public bool EmployerApproved { get; set; }
/// <summary>
/// نوع تاییدیه کارفرما
/// </summary>
public InsuranceListEmployerApprovalStatus EmployerApprovalStatus { get; set; }
}

View File

@@ -5,6 +5,7 @@ using System.Text;
using System.Threading.Tasks;
using _0_Framework.Application;
using CompanyManagment.App.Contracts.PersonnleCode;
using CompanyManagment.App.Contracts.Workshop.DTOs;
using Microsoft.AspNetCore.Mvc;
namespace CompanyManagment.App.Contracts.LeftWork;
@@ -30,4 +31,10 @@ public interface ILeftWorkApplication
OperationResult CreateLeftWorkByLeftWorkGroups(string employeeFullName, long commandEmployeeId, List<PersonnelCodeViewModel> commandPersonnelCode, List<LeftWorkGroup> leftWorkGroups);
OperationResult CheckDeleteLeftWork(long workshopId, long employeeId, string date, int type);
OperationResult CheckEditLeftWork(long workshopId, long employeeId, string date, int type);
/// <summary>
/// دریافت اطلاعات کارگاه و پرسنل برای ایجاد قرارداد
/// </summary>
/// <param name="workshopId"></param>
/// <returns></returns>
AutoExtensionDto AutoExtentionEmployees(long workshopId);
}

View File

@@ -13,6 +13,10 @@ public class GroupedRollCalls
public TimeSpan BreakTime { get; set; }
public DateTime ShiftDate { get; set; }
/// <summary>
/// تاریخ های جمع کاری
/// </summary>
public DateTime? Fridays { get; set; }
/// <summary>
/// تاخیر در ورود (مدت زمانی که کارمند با تأخیر وارد شده است)
/// </summary>

View File

@@ -8,7 +8,7 @@ namespace CompanyManagment.App.Contracts.RollCall;
public interface IRollCallMandatoryApplication
{
bool HasRollCallRecord(long employeeId, long workshopId, DateTime contractStart);
ComputingViewModel MandatoryCompute(long employeeId, long workshopId, DateTime contractStart, DateTime contractEnd, CreateWorkingHoursTemp command, bool holidayWorking, bool isStaticCheckout);
ComputingViewModel MandatoryCompute(long employeeId, long workshopId, DateTime contractStart, DateTime contractEnd, CreateWorkingHoursTemp command, bool holidayWorking, bool isStaticCheckout, bool rotatingShiftCompute);
/// <summary>
/// گزارش نوبت کاری حضور غیاب

View File

@@ -6,10 +6,12 @@ public class ShiftList
{
public DateTime Start { get; set; }
public DateTime End { get; set; }
/// <summary>
/// تاخیر در ورود (مدت زمانی که کارمند با تأخیر وارد شده است)
/// </summary>
public TimeSpan LateEntryDuration { get; set; }
public DateTime EndWithOutResTime { get; set; }
/// <summary>
/// تاخیر در ورود (مدت زمانی که کارمند با تأخیر وارد شده است)
/// </summary>
public TimeSpan LateEntryDuration { get; set; }
/// <summary>
/// تعجیل در ورود (مدت زمانی که کارمند زودتر از زمان مشخص وارد شده است)

View File

@@ -38,4 +38,5 @@ public interface IRollCallEmployeeApplication
(int activeEmployees, int deActiveEmployees) GetActiveAndDeActiveRollCallEmployees(long workshopId);
bool HasEmployees(long workshopId);
#endregion
}

View File

@@ -35,4 +35,6 @@ public class RollCallEmployeeViewModel : EditRollCallEmployee
public string EmployeeFName { get; set; }
public long RollCallEmployeeId { get; set; }
public bool CreatedByClient { get; set; }
public string RollCallEmployeeName { get; set; }
public bool HasChangedName { get; set; }
}

View File

@@ -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);
}
}

View File

@@ -1,4 +1,5 @@
using System;
using _0_Framework.Application;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -26,4 +27,34 @@ public class ConnectedPersonnelViewModel
public string BonusesOptions { get; set; }
//نحوه محاسبه سنوات
public string YearsOptions { get; set; }
/// <summary>
/// ایجاد قرارداد
/// </summary>
public bool CreateContract { get; set; }
/// <summary>
/// امضای قرارداد
/// </summary>
public bool SignContract { get; set; }
/// <summary>
/// ایجاد تصفیه
/// </summary>
public bool CreateCheckout { get; set; }
/// <summary>
/// امضای تصفیه
/// </summary>
public bool SignCheckout { get; set; }
/// <summary>
/// مدت قرارداد
/// </summary>
public string ContractTerm { get; set; }
/// <summary>
/// اگر قرارداد بیش از یک ماه باشد و گزینه انتخاب شده منتهی به پایان سال باشد
/// این آیتم
/// True
/// است
/// </summary>
public IsActive CutContractEndOfYear { get; set; }
}

View File

@@ -1,5 +1,6 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using _0_Framework.Application;
using AccountManagement.Application.Contracts.Account;
using CompanyManagment.App.Contracts.Employer;
using CompanyManagment.App.Contracts.InsuranceJob;
@@ -116,4 +117,39 @@ public class CreateWorkshop
/// </summary>
public bool InsuranceCheckoutFamilyAllowance { get; set; }
/// <summary>
/// ایجاد قرارداد
/// </summary>
public bool CreateContract { get; set; }
/// <summary>
/// امضاء قراداد
/// </summary>
public bool SignContract { get; set; }
/// <summary>
/// ایجات تصفیه حساب
/// </summary>
public bool CreateCheckout { get; set; }
/// <summary>
/// امضاء تصفیه حساب
/// </summary>
public bool SignCheckout { get; set; }
/// <summary>
/// اگر قرارداد بیش از یک ماه باشد و گزینه انتخاب شده منتهی به پایان سال باشد
/// این آیتم
/// True
/// است
/// </summary>
public IsActive CutContractEndOfYear { get; set; }
/// <summary>
/// محاسبه نوبت کاری در فیش حقوقی
/// </summary>
public bool RotatingShiftCompute { get; set; }
/// <summary>
/// تصفیه حساب بصورت استاتیک محاصبه شود
/// </summary>
public bool IsStaticCheckout { get; set; }
}

View File

@@ -0,0 +1,64 @@
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc.Rendering;
namespace CompanyManagment.App.Contracts.Workshop.DTOs;
public class AutoExtensionDto
{
/// <summary>
/// نام کارگاه
/// </summary>
public string WorkshopName { get; set; }
/// <summary>
/// آیا کارفرما خطای اطلاعات هویتی دارد
/// </summary>
public bool EmployerWarning { get; set; }
/// <summary>
/// پیام خطاهای کارفرما
/// </summary>
public string EmployerWarningMessage { get; set; }
/// <summary>
/// آیا کارگاه پرسنل دارد
/// </summary>
public bool HavingPersonel { get; set; }
/// <summary>
/// آی دی کارگاه
/// </summary>
public long WorkshopId { get; set; }
/// <summary>
/// کد بایگانی کارگاه
/// </summary>
public string ArchiveCode { get; set; }
/// <summary>
/// آدرس کارگاه
/// </summary>
public string WAddress1 { get; set; }
/// <summary>
/// آی دی کارفرما
/// </summary>
public long EmployerId { get; set; }
/// <summary>
/// سلکت لیست پرسنل
/// </summary>
public SelectList EmployeeSelectList { get; set; }
/// <summary>
/// لیست پرسنل
/// </summary>
public List<AutoExtensionEmployeeListDto> EmployeeList { get; set; }
/// <summary>
/// آیا مجاز به ایجاد قراداد است؟
/// </summary>
public bool CreateContract { get; set; }
}

View File

@@ -0,0 +1,38 @@
namespace CompanyManagment.App.Contracts.Workshop.DTOs;
public class AutoExtensionEmployeeListDto
{
/// <summary>
/// آی دی پرسنل
/// </summary>
public long EmployeeId { get; set; }
/// <summary>
/// نام کامل پرسنل
/// </summary>
public string EmployeeName { get; set; }
/// <summary>
/// کد پرسنلی
/// </summary>
public long PersonnelCode { get; set; }
/// <summary>
/// سمت
/// </summary>
public string JobType { get; set; }
/// <summary>
/// آی دی شغل
/// </summary>
public long JobTypeId { get; set; }
/// <summary>
/// آیا پرسنل اجازه ایجاد قرارداد دارد
/// </summary>
public bool EmployeeHasCreateContract { get; set; }
public string ContarctStart { get; set; }
public string ContractEnd { get; set; }
}

View File

@@ -1,4 +1,5 @@
using System.Collections.Generic;
using _0_Framework.Application;
using CompanyManagment.App.Contracts.Employee;
using CompanyManagment.App.Contracts.Employer;
using CompanyManagment.App.Contracts.LeftWork;
@@ -80,5 +81,31 @@ public class WorkshopViewModel
public string HasRollCallFreeVip { get; set; }
#endregion
#endregion
/// <summary>
/// ایجاد قرارداد
/// </summary>
public bool CreateContract { get; set; }
/// <summary>
/// امضاء قراداد
/// </summary>
public bool SignContract { get; set; }
/// <summary>
/// ایجات تصفیه حساب
/// </summary>
public bool CreateCheckout { get; set; }
/// <summary>
/// امضاء تصفیه حساب
/// </summary>
public bool SignCheckout { get; set; }
/// <summary>
/// اگر قرارداد بیش از یک ماه باشد و گزینه انتخاب شده منتهی به پایان سال باشد
/// این آیتم
/// True
/// است
/// </summary>
public IsActive CutContractEndOfYear { get; set; }
}

View File

@@ -25,4 +25,5 @@ public interface IYearlySalaryApplication
InsuranceYearlySalaryModel GetInsuranceItems(DateTime startDate, DateTime endDate, string year);
#endregion
}

View File

@@ -48,9 +48,9 @@ public class AndroidApkVersionApplication : IAndroidApkVersionApplication
Directory.CreateDirectory(path);
var apk = new ApkReader.ApkReader().Read(file.OpenReadStream());
//var apk = new ApkReader.ApkReader().Read(file.OpenReadStream());
string uniqueFileName = $"{Path.GetFileNameWithoutExtension(file.FileName)}.v{apk.VersionName}{Path.GetExtension(file.FileName)}";
string uniqueFileName = $"{Path.GetFileNameWithoutExtension(file.FileName)}{Path.GetExtension(file.FileName)}";
string filepath = Path.Combine(path, uniqueFileName);
@@ -60,7 +60,7 @@ public class AndroidApkVersionApplication : IAndroidApkVersionApplication
await file.CopyToAsync(stream);
}
var entity = new AndroidApkVersion(apk.VersionName, apk.VersionCode, IsActive.True, filepath);
var entity = new AndroidApkVersion("0", "0", IsActive.True, filepath);
_androidApkVersionRepository.Create(entity);
_androidApkVersionRepository.SaveChanges();
return op.Succcedded();

View File

@@ -55,7 +55,7 @@ namespace CompanyManagment.Application
if(command.BankLogoPictureFile != null && command.BankLogoPictureFile.Length >0 )
{
var uploadResult = _mediaApplication.UploadFile(command.BankLogoPictureFile, command.BankName,
_basePath, 10, [".jpg", ".jpeg", ".png",".svg"]);
_basePath, 10, [".jpg", ".jpeg", ".png",".svg"], "Bank");
if (uploadResult.IsSuccedded == false)
return uploadResult;
mediaId = uploadResult.SendId;
@@ -81,7 +81,7 @@ namespace CompanyManagment.Application
if (command.BankLogoPictureFile != null && command.BankLogoPictureFile.Length > 0)
{
var uploadResult = _mediaApplication.UploadFile(command.BankLogoPictureFile, command.BankName,
_basePath, 10, [".jpg", ".jpeg", ".png",".svg"]);
_basePath, 10, [".jpg", ".jpeg", ".png",".svg"], "Bank");
if (uploadResult.IsSuccedded == false)
return uploadResult;
_mediaApplication.DeleteFile(entity.BankLogoMediaId);

File diff suppressed because it is too large Load Diff

View File

@@ -12,6 +12,7 @@ using Company.Domain.YearlySalaryAgg;
using Company.Domain.YearlySalaryItemsAgg;
using CompanyManagment.App.Contracts.Contract;
using CompanyManagment.App.Contracts.Employee;
using CompanyManagment.App.Contracts.EmployeeComputeOptions;
using CompanyManagment.App.Contracts.Employer;
using CompanyManagment.App.Contracts.LeftWork;
using CompanyManagment.App.Contracts.PersonalContractingParty;
@@ -39,6 +40,7 @@ public class ContractApplication : IContractApplication
private readonly IPersonnelCodeRepository _personnelCodeRepository;
private readonly IWorkingHoursTempApplication _workingHoursTempApplication;
private readonly IPersonalContractingPartyApp _contractingPartyApp;
private readonly IEmployeeComputeOptionsApplication _employeeComputeOptionsApplication;
public List<EmployerViewModel> EmpList;
@@ -54,7 +56,7 @@ public class ContractApplication : IContractApplication
IYearlySalaryRepository yearlySalaryRepository,
IYearlySalaryItemRepository yearlySalaryItemRepository
, IEmployeeApplication employeeApplication, IEmployerApplication employerApplication, IWorkshopApplication workshopApplication, IEmployerRepository employerRepository,
IWorkingHoursApplication workingHoursApplication, IWorkingHoursItemsApplication workingHoursItemsApplication, ILeftWorkRepository leftWorkRepository, IPersonnelCodeRepository personnelCodeRepository, IWorkingHoursTempApplication workingHoursTempApplication, IPersonalContractingPartyApp contractingPartyApp)
IWorkingHoursApplication workingHoursApplication, IWorkingHoursItemsApplication workingHoursItemsApplication, ILeftWorkRepository leftWorkRepository, IPersonnelCodeRepository personnelCodeRepository, IWorkingHoursTempApplication workingHoursTempApplication, IPersonalContractingPartyApp contractingPartyApp, IEmployeeComputeOptionsApplication employeeComputeOptionsApplication)
{
_contractRepository = contractRepository;
_holidayItemRepository = holidayItemRepository;
@@ -70,6 +72,7 @@ public class ContractApplication : IContractApplication
_personnelCodeRepository = personnelCodeRepository;
_workingHoursTempApplication = workingHoursTempApplication;
_contractingPartyApp = contractingPartyApp;
_employeeComputeOptionsApplication = employeeComputeOptionsApplication;
//_leftWorkApplication = leftWorkApplication;
}
@@ -3155,7 +3158,7 @@ public class ContractApplication : IContractApplication
EmployeeFName = x.EmployeeFName,
EmployeeLName = x.EmployeeLName,
IsBlockCantracingParty = _contractingPartyApp.IsBlockByEmployerId(x.EmployerId),
HasSignContract = _employeeComputeOptionsApplication.GetEmployeeOptions(x.WorkshopIds,x.EmployeeId).SignContract
}).ToList();

View File

@@ -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;
}
@@ -194,6 +197,7 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
return opration.Failed("کد ملی وارد شده تکراری است");
}
}
@@ -992,10 +996,24 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
//{
// return op.Failed("این پرسنل قبلا افزوده شده است و در انتظار تایید میباشد");
//}
var employee = _EmployeeRepository.GetByNationalCodeIgnoreQueryFilter(command.NationalCode);
var workshop = _WorkShopRepository.GetDetails(command.WorkshopId);
if (employee == null)
if (employee == null && command.CanceledAuthorize)
{
var birthDate = command.BirthDate.ToGeorgianDateTime();
var dateOfIssue = new DateTime(1922, 1, 1);
employee = new Employee(command.FirstName, command.LastName, null, birthDate,
dateOfIssue, null, command.NationalCode, null, command.Gender, "ایرانی", null, null);
_EmployeeRepository.Create(employee);
_EmployeeRepository.SaveChanges();
}
if (employee == null)
{
return op.Failed("خطای سیستمی. لطفا دوباره تلاش کنید . درصورت تکرار این مشکل با تیم پشتیبان تماس بگیرید");
}
@@ -1009,7 +1027,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 +1044,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);
@@ -1230,6 +1256,11 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
if (employee == null)
{
var personalInfo = await _uidService.GetPersonalInfo(nationalCode, birthDate);
if (personalInfo.ResponseContext.Status.Code == 14)
{
return op.Failed("سامانه احراز هویت در دسترس نمیباشد لطفا اطلاعات پرسنل را به صورت دستی وارد کنید",new EmployeeByNationalCodeInWorkshopViewModel(){AuthorizedCanceled = true});
}
if (personalInfo.ResponseContext.Status.Code != 0)
{
return op.Failed("کد ملی و تاریخ تولد با هم همخانی ندارند");
@@ -1528,7 +1559,11 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
if (employee.IsAuthorized == false)
{
var apiResult = await _uidService.GetPersonalInfo(nationalCode, birthDate);
if (apiResult.ResponseContext.Status.Code == 14)
{
return op.Failed("این پرسنل در بانک اطلاعات موجود میباشد");
}
if (apiResult.ResponseContext.Status.Code != 0)
{
return op.Failed("کد ملی و تاریخ تولد با هم همخانی ندارند");
@@ -1584,7 +1619,16 @@ public class EmployeeAplication : RepositoryBase<long, Employee>, IEmployeeAppli
return op.Succcedded(data);
}
var apiResult = await _uidService.GetPersonalInfo(nationalCode, birthDate);
if (apiResult.ResponseContext.Status.Code == 14)
{
return op.Failed("سامانه احراز هویت در دسترس نمیباشد لطفا اطلاعات پرسنل را به صورت دستی وارد کنید", new EmployeeDataFromApiViewModel() { AuthorizedCanceled = true });
}
if (apiResult.ResponseContext.Status.Code == 3)
{
return op.Failed("کد ملی نامعتبر است");
}
if (apiResult.ResponseContext.Status.Code != 0)
{
return op.Failed("کد ملی و تاریخ تولد با هم همخانی ندارند");

View File

@@ -21,41 +21,54 @@ public class EmployeeComputeOptionsApplication : IEmployeeComputeOptionsApplicat
public OperationResult Create(CreateEmployeeComputeOptions command)
{
var opration = new OperationResult();
var opration = new OperationResult();
if (command.CreateContract && command.ContractTerm != "1" && command.CutContractEndOfYear == IsActive.None)
return opration.Failed("لطفا تعیین کنید که قراداد منتهی به پایان سال یاشد یا نباشد");
if (command.ContractTerm == "1")
command.CutContractEndOfYear = IsActive.None;
try
{
if (_employeeComputeOptionsRepository.Exists(x =>
x.EmployeeId == command.EmployeeId && x.WorkshopId == command.WorkshopId))
{
var query = GetEmployeeOptions(command.WorkshopId, command.EmployeeId);
var editOptions = _employeeComputeOptionsRepository.Get(query.Id);
editOptions.Edit(command.ComputeOptions, command.BonusesOptions, command.YearsOptions);
_employeeComputeOptionsRepository.SaveChanges();
return opration.Succcedded();
}
else
{
var createOptions = new EmployeeComputeOptions(command.WorkshopId, command.EmployeeId,
command.ComputeOptions, command.BonusesOptions, command.YearsOptions);
_employeeComputeOptionsRepository.Create(createOptions);
_employeeComputeOptionsRepository.SaveChanges();
return opration.Succcedded();
}
}
catch (Exception a)
{
return opration.Failed("ثبت با خطا مواجه شد");
}
{
if (_employeeComputeOptionsRepository.Exists(x =>
x.EmployeeId == command.EmployeeId && x.WorkshopId == command.WorkshopId))
{
var query = GetEmployeeOptions(command.WorkshopId, command.EmployeeId);
var editOptions = _employeeComputeOptionsRepository.Get(query.Id);
editOptions.Edit(command.ComputeOptions, command.BonusesOptions, command.YearsOptions,
command.CreateContract, command.SignContract, command.CreateCheckout, command.SignCheckout, command.ContractTerm, command.CutContractEndOfYear);
_employeeComputeOptionsRepository.SaveChanges();
return opration.Succcedded();
}
else
{
var createOptions = new EmployeeComputeOptions(command.WorkshopId, command.EmployeeId,
command.ComputeOptions, command.BonusesOptions, command.YearsOptions, command.CreateContract,
command.SignContract, command.CreateCheckout, command.SignCheckout, command.ContractTerm, command.CutContractEndOfYear);
_employeeComputeOptionsRepository.Create(createOptions);
_employeeComputeOptionsRepository.SaveChanges();
return opration.Succcedded();
}
}
catch (Exception a)
{
return opration.Failed("ثبت با خطا مواجه شد");
}
}
public EmployeeComputeOptionsViewModel GetEmployeeOptions(long workshopId, long employeeId)
{
return _employeeComputeOptionsRepository.GetEmployeeOptions(workshopId, employeeId);
return _employeeComputeOptionsRepository.GetEmployeeOptions(workshopId, employeeId);
}
public List<EmployeeComputeOptionsViewModel> GetAllByWorkshopId(long workshopId)
{
return _employeeComputeOptionsRepository.GetAllByWorkshopId(workshopId);
return _employeeComputeOptionsRepository.GetAllByWorkshopId(workshopId);
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -15,6 +15,7 @@ using CompanyManagment.App.Contracts.PersonnleCode;
using CompanyManagment.App.Contracts.RollCallEmployee;
using CompanyManagment.App.Contracts.WorkingHours;
using CompanyManagment.App.Contracts.WorkingHoursItems;
using CompanyManagment.App.Contracts.Workshop.DTOs;
using PersianTools.Core;
namespace CompanyManagment.Application;
@@ -600,6 +601,11 @@ public class LeftWorkApplication : ILeftWorkApplication
return _leftWorkRepository.CheckEditLeftWork(workshopId, employeeId, date.ToGeorgianDateTime(), type);
}
public AutoExtensionDto AutoExtentionEmployees(long workshopId)
{
return _leftWorkRepository.AutoExtentionEmployees(workshopId);
}
#region Pooya
//این متد ترک کار های کارمند را با فعالیت حضور غیاب یکپارچه می کند
private void IfEmployeeHasNewLeftWorkDateAddEndDateToRollCallStatus(long employeeId)

View File

@@ -19,6 +19,7 @@ using CompanyManagment.App.Contracts.LeftWork;
using CompanyManagment.App.Contracts.LeftWorkTemp;
using CompanyManagment.App.Contracts.ReportClient;
using CompanyManagment.App.Contracts.RollCallEmployee;
using CompanyManagment.EFCore.Migrations;
using OperationResult = _0_Framework.Application.OperationResult;
using Tools = _0_Framework.Application.Tools;
@@ -174,8 +175,19 @@ public class LeftWorkTempApplication : ILeftWorkTempApplication
await _leftWorkRepository.CreateAsync(newLeftWork);
_leftWorkTempRepository.Remove(leftWorkTemp);
var rollCallEmployee = _rollCallEmployeeRepository.GetBy(leftWorkTemp.EmployeeId, leftWorkTemp.WorkshopId);
var rollCallStatus = rollCallEmployee?.EmployeesStatus.MaxBy(x => x.StartDate);
if (rollCallStatus != null)
{
var startWork = newLeftWork.StartWorkDate;
rollCallStatus.Edit(startWork, rollCallStatus.EndDate);
}
await _leftWorkRepository.SaveChangesAsync();
await _leftWorkTempRepository.SaveChangesAsync();
return op.Succcedded();
}

View File

@@ -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
}

View File

@@ -89,60 +89,9 @@ namespace CompanyManagment.Application
}
public bool HasRollCallRecord(long employeeId, long workshopId, DateTime contractStart, DateTime contractEnd)
{
//موقت
// دادمهرگستر 11 *
//585 کاشی گالری سرامیس (بابک ابراهیمی )
//آموزشگاه ملل 604 *
//کاریابی ملل 605 *
//368 پیتزا امیر آماده سازی
//367 پیتزا امیر رستوران
//286 مرکز توان بخشی رسالت *
//610 بیمارستان پارس - رازقی طعام
DateTime start1404 = new DateTime(2025, 03, 21);
bool skipRollCallByWorkshopId = false;
if (contractStart < start1404)
{
skipRollCallByWorkshopId = workshopId is 11 or 585 or 604 or 605 or 368 or 367 or 286;
}
else
{
skipRollCallByWorkshopId = workshopId is 368 or 367 or 585 or 610;
}
//#if DEBUG
// skipRollCallByWorkshopId = workshopId is 11 or 585 or 604 or 605 or 368 or 367;
//#endif
if (skipRollCallByWorkshopId)
return false;
// 42550 مصطفی مقدس نژاد فومنی
bool skipRollCallByEmployeeId = employeeId is 42550;
if (skipRollCallByEmployeeId)
return false;
//9211 محسا تازه
if (employeeId == 9211 && contractStart >= start1404)
return false;
var service = _rollCallServiceRepository.GetAllServiceByWorkshopId(workshopId);
if (!service.Any(x => x.StartService.Date <= contractStart.Date && x.EndService.Date >= contractEnd.Date))
return false;
var rollCallEmployee =
_rollCallEmployeeRepository.GetByEmployeeIdAndWorkshopId(employeeId, workshopId);
if (rollCallEmployee == null)
return false;
return _employeeRollCallStatusRepository.Exists(x => x.RollCallEmployeeId == rollCallEmployee.Id &&
x.StartDate.Date <= contractStart.Date &&
x.EndDate.Date >= contractEnd.Date);
}
{
return _rollCallEmployeeRepository.HasRollCallRecord(employeeId, workshopId, contractStart, contractEnd);
}
public List<RollCallEmployeeStatusViewModel> GetActiveByWorkshopIdInDate(long workshopId, DateTime startDateGr, DateTime endDateGr)
{
@@ -185,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();
}
}
}

View File

@@ -21,9 +21,9 @@ public class RollCallMandatoryApplication : IRollCallMandatoryApplication
return _rollCallMandatoryRepository.Exists(x => x.EmployeeId == employeeId && x.WorkshopId == workshopId && x.StartDate.Value.Date >= contractStart.Date);
}
public ComputingViewModel MandatoryCompute(long employeeId, long workshopId, DateTime contractStart, DateTime contractEnd, CreateWorkingHoursTemp command, bool holidayWorking, bool isStaticCheckout)
public ComputingViewModel MandatoryCompute(long employeeId, long workshopId, DateTime contractStart, DateTime contractEnd, CreateWorkingHoursTemp command, bool holidayWorking, bool isStaticCheckout, bool rotatingShiftCompute)
{
return _rollCallMandatoryRepository.MandatoryCompute(employeeId,workshopId, contractStart, contractEnd, command, holidayWorking, isStaticCheckout);
return _rollCallMandatoryRepository.MandatoryCompute(employeeId,workshopId, contractStart, contractEnd, command, holidayWorking, isStaticCheckout, rotatingShiftCompute);
}
public async Task<ComputingViewModel> RotatingShiftReport(long workshopId, long employeeId, DateTime contractStart, DateTime contractEnd,

View File

@@ -73,10 +73,28 @@ public class WorkshopAppliction : IWorkshopApplication
if (string.IsNullOrEmpty(command.WorkshopName) || string.IsNullOrEmpty(command.ArchiveCode))
return operation.Failed("موارد اجباری را پر کنید");
//if (_workshopRepository.Exists(x => x.WorkshopName == command.WorkshopName))
// return operation.Failed("نام کارگاه تکراری است");
//if (_workshopRepository.Exists(x => x.WorkshopName == command.WorkshopName))
// return operation.Failed("نام کارگاه تکراری است");
if (_workshopRepository.Exists(x => !string.IsNullOrEmpty(x.InsuranceCode) && x.InsuranceCode == command.InsuranceCode))
if (command.ContractTerm != "1" && command.ContractTerm != "ForEver" && (command.CutContractEndOfYear != IsActive.False && command.CutContractEndOfYear != IsActive.True))
return operation.Failed("لطفا تیک قرداداد منتهی به پایان سال را تعیین وضعیت کنید");
if (command.ContractTerm == "1" && command.ContractTerm == "ForEver")
command.CutContractEndOfYear = IsActive.None;
if (!command.CreateContract)
{
command.SignContract = false;
command.CreateCheckout = false;
command.SignCheckout = false;
}
if (!command.CreateCheckout)
{
command.SignCheckout = false;
}
if (_workshopRepository.Exists(x => !string.IsNullOrEmpty(x.InsuranceCode) && x.InsuranceCode == command.InsuranceCode))
return operation.Failed("کد بیمه کارگاه تکراری است");
if (!string.IsNullOrEmpty(command.Address) && string.IsNullOrEmpty(command.State))
@@ -130,6 +148,7 @@ public class WorkshopAppliction : IWorkshopApplication
// return operation.Failed("لطفا نوع ارسال لیست بیمه را مشخص کنید");
var account = new AccountViewModel();
var institutionContract = new InstitutionContract();
if (command.HasRollCallFreeVip == "true")
{
institutionContract = _institutionContractRepository.InstitutionContractByEmployerId(employer.FirstOrDefault());
@@ -138,14 +157,18 @@ public class WorkshopAppliction : IWorkshopApplication
account = _personalContractingPartyRepository.GetAccountByPersonalContractingParty(institutionContract.ContractingPartyId);
if(account == null || account.ClientAreaPermission != "true")
return operation.Failed("بدلیل نداشتن حساب کاربری کلاینت نمیتوانید سرویس حضور غیاب را فعال کنید");
}
var workshop = new Workshop(command.WorkshopName, command.WorkshopSureName, command.InsuranceCode,
command.TypeOfOwnership,
command.ArchiveCode, command.AgentName, command.AgentPhone, command.State, command.City,
command.Address,
command.TypeOfInsuranceSend, command.TypeOfContract,command.ContractTerm,command.AgreementNumber
,command.FixedSalary, command.Population,command.InsuranceJobId,command.ZoneName,command.AddBonusesPay,command.AddYearsPay,command.AddLeavePay,command.TotalPaymentHide,command.IsClassified,command.ComputeOptions,command.BonusesOptions,command.YearsOptions,command.HasRollCallFreeVip,command.WorkshopHolidayWorking, command.InsuranceCheckoutOvertime, command.InsuranceCheckoutFamilyAllowance);
,command.FixedSalary, command.Population,command.InsuranceJobId,command.ZoneName,command.AddBonusesPay,
command.AddYearsPay,command.AddLeavePay,command.TotalPaymentHide,command.IsClassified,command.ComputeOptions,
command.BonusesOptions,command.YearsOptions,command.HasRollCallFreeVip,command.WorkshopHolidayWorking,
command.InsuranceCheckoutOvertime, command.InsuranceCheckoutFamilyAllowance, command.CreateContract, command.SignContract,
command.CreateCheckout, command.SignCheckout, command.CutContractEndOfYear,command.RotatingShiftCompute, command.IsStaticCheckout);
_workshopRepository.Create(workshop);
_workshopRepository.SaveChanges();
@@ -211,10 +234,28 @@ public class WorkshopAppliction : IWorkshopApplication
return operation.Failed("لطفا کارفرما را انتخاب نمایید");
var employer = command.EmployerIdList.ToList();
//if (_workshopRepository.Exists(x => x.WorkshopName == command.WorkshopName && x.id != command.Id))
// return operation.Failed(" نام کارگاه تکراری است ");
//if (_workshopRepository.Exists(x => x.WorkshopName == command.WorkshopName && x.id != command.Id))
// return operation.Failed(" نام کارگاه تکراری است ");
if (command.TypeOfInsuranceSend != null && string.IsNullOrEmpty(command.InsuranceCode))
if (command.ContractTerm != "1" && command.ContractTerm != "ForEver" && (command.CutContractEndOfYear != IsActive.False && command.CutContractEndOfYear != IsActive.True))
return operation.Failed("لطفا تیک قرداداد منتهی به پایان سال را تعیین وضعیت کنید");
if (command.ContractTerm == "1" && command.ContractTerm == "ForEver")
command.CutContractEndOfYear = IsActive.None;
if (!command.CreateContract)
{
command.SignContract = false;
command.CreateCheckout = false;
command.SignCheckout = false;
}
if (!command.CreateCheckout)
{
command.SignCheckout = false;
}
if (command.TypeOfInsuranceSend != null && string.IsNullOrEmpty(command.InsuranceCode))
return operation.Failed("لطفا کد بیمه کارگاه را وارد کنید");
if (_workshopRepository.Exists(x => !string.IsNullOrEmpty(x.InsuranceCode) && x.InsuranceCode == command.InsuranceCode && x.id != command.Id))
return operation.Failed("کد بیمه کارگاه تکراری است");
@@ -241,9 +282,11 @@ public class WorkshopAppliction : IWorkshopApplication
}
var account = new AccountViewModel();
var institutionContract = new InstitutionContract();
if (command.HasRollCallFreeVip == "true")
{
institutionContract = _institutionContractRepository.InstitutionContractByEmployerId(employer.FirstOrDefault());
if (institutionContract == null)
return operation.Failed("بدلیل نداشتن قرار داد مالی نمیتوانید سرویس حضور غیاب را فعال کنید");
@@ -315,7 +358,10 @@ public class WorkshopAppliction : IWorkshopApplication
command.Address,
command.TypeOfInsuranceSend, command.TypeOfContract,command.ContractTerm, command.AgreementNumber
, command.FixedSalary, command.Population, command.InsuranceJobId, command.ZoneName,
command.AddBonusesPay, command.AddYearsPay, command.AddLeavePay, command.TotalPaymentHide,command.IsClassified, command.ComputeOptions,command.BonusesOptions, command.YearsOptions,command.HasRollCallFreeVip, command.WorkshopHolidayWorking, command.InsuranceCheckoutOvertime,command.InsuranceCheckoutFamilyAllowance);
command.AddBonusesPay, command.AddYearsPay, command.AddLeavePay, command.TotalPaymentHide,command.IsClassified,
command.ComputeOptions,command.BonusesOptions, command.YearsOptions,command.HasRollCallFreeVip,
command.WorkshopHolidayWorking, command.InsuranceCheckoutOvertime,command.InsuranceCheckoutFamilyAllowance,
command.CreateContract, command.SignContract, command.CreateCheckout, command.SignCheckout, command.CutContractEndOfYear,command.RotatingShiftCompute, command.IsStaticCheckout);
_workshopRepository.SaveChanges();
_workshopRepository.RemoveOldRelation(command.Id);
@@ -535,159 +581,169 @@ public class WorkshopAppliction : IWorkshopApplication
{
return _workshopRepository.SearchForClient(searchModel);
}
public OperationResult CreateForClient(CreateWorkshop command)
{
var accountIds = new List<long>();
var operation = new OperationResult();
//if (command.EmployerIdList == null)
// return operation.Failed("لطفا کارفرما را انتخاب نمایید");
var employer = command.EmployerIdList.ToList();
if (command.AccountIdsList != null)
{
accountIds = command.AccountIdsList.ToList();
}
if (string.IsNullOrEmpty(command.WorkshopName) || string.IsNullOrEmpty(command.ArchiveCode) || command.ArchiveCode == "0")
return operation.Failed("موارد اجباری را پر کنید");
//if (_workshopRepository.Exists(x => x.WorkshopName == command.WorkshopName))
// return operation.Failed("نام کارگاه تکراری است");
if (_workshopRepository.Exists(x => x.InsuranceCode != null && x.InsuranceCode == command.InsuranceCode))
{
if (_workshopRepository.ExistsWorkshopAccountInsuranceCode(command.InsuranceCode))
return operation.Failed("کد بیمه کارگاه تکراری است");
}
if (_workshopRepository.ExistsWorkshopAccountArchiveCode(command.ArchiveCode))
return operation.Failed("شماره بایگانی تکراری است");
if (string.IsNullOrEmpty(command.State)) //(!string.IsNullOrEmpty(command.Address) && string.IsNullOrEmpty(command.State))
return operation.Failed("لطفا استان و شهر را انتخاب کنید");
if (command.City == "0" || command.City == "شهرستان")
return operation.Failed("لطفا شهر را انتخاب کنید");
if (string.IsNullOrEmpty(command.Address))
return operation.Failed("لطفا آدرس را وارد کنید");
if (!string.IsNullOrEmpty(command.TypeOfInsuranceSend) && command.TypeOfInsuranceSend != "false" && string.IsNullOrEmpty(command.InsuranceCode))
return operation.Failed("لطفا کد بیمه کارگاه را وارد کنید");
if (command.FixedSalary)
{
if (command.InsuranceJobId == 0 || command.InsuranceJobId == null)
return operation.Failed("لطفا صنف را انتخاب کنید");
if (string.IsNullOrWhiteSpace(command.Population))
return operation.Failed("لطفا جمعیت شهر را انتخاب کنید");
}
//if (string.IsNullOrWhiteSpace(command.TypeOfInsuranceSend))
// return operation.Failed("لطفا نوع ارسال لیست بیمه را مشخص کنید");
var workshop = new Workshop(command.WorkshopName, command.WorkshopSureName, command.InsuranceCode,command.TypeOfOwnership,
command.ArchiveCode, command.AgentName, command.AgentPhone, command.State, command.City, command.Address,
command.TypeOfInsuranceSend, command.TypeOfContract, command.ContractTerm, command.AgreementNumber, command.FixedSalary,
command.Population, command.InsuranceJobId, command.ZoneName, command.AddBonusesPay,
command.AddYearsPay, command.AddLeavePay,command.TotalPaymentHide, command.IsClassified, command.ComputeOptions,
command.BonusesOptions, command.YearsOptions,command.HasRollCallFreeVip, command.WorkshopHolidayWorking,
command.InsuranceCheckoutOvertime,command.InsuranceCheckoutFamilyAllowance);
_workshopRepository.Create(workshop);
_workshopRepository.SaveChanges();
foreach (var e in employer)
{
_workshopRepository.EmployerWorkshop(workshop.id, e);
}
_workshopRepository.CreateWorkshopAccounts(accountIds, workshop.id);
return operation.Succcedded();
throw new NotImplementedException();
}
public OperationResult EditForClient(EditWorkshop command)
{
var leftSearch = new LeftWorkSearchModel()
{
WorkshopId = command.Id
};
var leftWork = _leftWorkRepository.search(leftSearch);
var accountIds = new List<long>();
var operation = new OperationResult();
var workshop = _workshopRepository.Get(command.Id);
if (command.AccountIdsList != null)
{
accountIds = command.AccountIdsList.ToList();
}
if (workshop == null)
operation.Failed("رکورد مورد نظر وجود ندارد");
if (command.EmployerIdList == null)
return operation.Failed("لطفا کارفرما را انتخاب نمایید");
var employer = command.EmployerIdList.ToList();
if (string.IsNullOrEmpty(command.WorkshopName) || string.IsNullOrEmpty(command.ArchiveCode) || command.ArchiveCode == "0")
return operation.Failed("موارد اجباری را پر کنید");
//if (_workshopRepository.Exists(x => x.WorkshopName == command.WorkshopName && x.id != command.Id))
// return operation.Failed(" رکورد مورد نظر تکراری است ");
if (_workshopRepository.Exists(x =>
x.InsuranceCode != null && x.InsuranceCode == command.InsuranceCode && x.id != command.Id))
{
if (_workshopRepository.ExistsWorkshopAccountInsuranceCodeByworkshopId(command.Id, command.InsuranceCode))
return operation.Failed("کد بیمه کارگاه تکراری است");
}
if (_workshopRepository.ExistsWorkshopAccountArchiveCodeByWorkshopId(command.Id, command.ArchiveCode))
return operation.Failed("شماره بایگانی تکراری است");
if (command.State == null)
return operation.Failed("لطفا استان و شهر را انتخاب کنید");
if ((command.City == "0" || command.City == "شهرستان"))
return operation.Failed("لطفا شهر را انتخاب کنید");
if (command.TypeOfInsuranceSend != null && command.InsuranceCode == null)
return operation.Failed("لطفا کد بیمه کارگاه را وارد کنید");
if (command.Address == null)
return operation.Failed("لطفا آدرس را وارد کنید");
if (command.FixedSalary)
{
if (command.InsuranceJobId == 0 || command.InsuranceJobId == null)
return operation.Failed("لطفا صنف را انتخاب کنید");
if (string.IsNullOrWhiteSpace(command.Population))
return operation.Failed("لطفا جمعیت شهر را انتخاب کنید");
}
workshop.Edit(command.WorkshopName, command.WorkshopSureName, command.InsuranceCode, command.TypeOfOwnership,
command.ArchiveCode, command.AgentName, command.AgentPhone, command.State, command.City,
command.Address,
command.TypeOfInsuranceSend, command.TypeOfContract, command.ContractTerm, command.AgreementNumber
, command.FixedSalary, command.Population, command.InsuranceJobId, command.ZoneName,
command.AddBonusesPay, command.AddYearsPay, command.AddLeavePay,command.TotalPaymentHide,command.IsClassified,
command.ComputeOptions, command.BonusesOptions, command.YearsOptions,command.HasRollCallFreeVip, command.WorkshopHolidayWorking,
command.InsuranceCheckoutOvertime, command.InsuranceCheckoutFamilyAllowance);
_workshopRepository.SaveChanges();
//_workshopRepository.RemoveOldRelation(command.Id);
_workshopRepository.RemoveEmployerWorkshop(command.Id);
foreach (var e in employer)
{
_workshopRepository.EmployerWorkshop(workshop.id, e);
}
// _workshopRepository.WorkshopAccounts(accountIds, workshop.id);
foreach (var item in leftWork)
{
var editLeft = _leftWorkRepository.Get(item.Id);
editLeft.EditBonuses(command.AddBonusesPay, command.AddYearsPay, command.AddLeavePay);
_leftWorkRepository.SaveChanges();
}
return operation.Succcedded();
throw new NotImplementedException();
}
//public OperationResult CreateForClient(CreateWorkshop command)
//{
// var accountIds = new List<long>();
// var operation = new OperationResult();
// //if (command.EmployerIdList == null)
// // return operation.Failed("لطفا کارفرما را انتخاب نمایید");
// var employer = command.EmployerIdList.ToList();
// if (command.AccountIdsList != null)
// {
// accountIds = command.AccountIdsList.ToList();
// }
// if (string.IsNullOrEmpty(command.WorkshopName) || string.IsNullOrEmpty(command.ArchiveCode) || command.ArchiveCode == "0")
// return operation.Failed("موارد اجباری را پر کنید");
// //if (_workshopRepository.Exists(x => x.WorkshopName == command.WorkshopName))
// // return operation.Failed("نام کارگاه تکراری است");
// if (_workshopRepository.Exists(x => x.InsuranceCode != null && x.InsuranceCode == command.InsuranceCode))
// {
// if (_workshopRepository.ExistsWorkshopAccountInsuranceCode(command.InsuranceCode))
// return operation.Failed("کد بیمه کارگاه تکراری است");
// }
// if (_workshopRepository.ExistsWorkshopAccountArchiveCode(command.ArchiveCode))
// return operation.Failed("شماره بایگانی تکراری است");
// if (string.IsNullOrEmpty(command.State)) //(!string.IsNullOrEmpty(command.Address) && string.IsNullOrEmpty(command.State))
// return operation.Failed("لطفا استان و شهر را انتخاب کنید");
// if (command.City == "0" || command.City == "شهرستان")
// return operation.Failed("لطفا شهر را انتخاب کنید");
// if (string.IsNullOrEmpty(command.Address))
// return operation.Failed("لطفا آدرس را وارد کنید");
// if (!string.IsNullOrEmpty(command.TypeOfInsuranceSend) && command.TypeOfInsuranceSend != "false" && string.IsNullOrEmpty(command.InsuranceCode))
// return operation.Failed("لطفا کد بیمه کارگاه را وارد کنید");
// if (command.FixedSalary)
// {
// if (command.InsuranceJobId == 0 || command.InsuranceJobId == null)
// return operation.Failed("لطفا صنف را انتخاب کنید");
// if (string.IsNullOrWhiteSpace(command.Population))
// return operation.Failed("لطفا جمعیت شهر را انتخاب کنید");
// }
// //if (string.IsNullOrWhiteSpace(command.TypeOfInsuranceSend))
// // return operation.Failed("لطفا نوع ارسال لیست بیمه را مشخص کنید");
// var workshop = new Workshop(command.WorkshopName, command.WorkshopSureName, command.InsuranceCode,command.TypeOfOwnership,
// command.ArchiveCode, command.AgentName, command.AgentPhone, command.State, command.City, command.Address,
// command.TypeOfInsuranceSend, command.TypeOfContract, command.ContractTerm, command.AgreementNumber, command.FixedSalary,
// command.Population, command.InsuranceJobId, command.ZoneName, command.AddBonusesPay,
// command.AddYearsPay, command.AddLeavePay,command.TotalPaymentHide, command.IsClassified, command.ComputeOptions,
// command.BonusesOptions, command.YearsOptions,command.HasRollCallFreeVip, command.WorkshopHolidayWorking,
// command.InsuranceCheckoutOvertime,command.InsuranceCheckoutFamilyAllowance);
// _workshopRepository.Create(workshop);
// _workshopRepository.SaveChanges();
// foreach (var e in employer)
// {
// _workshopRepository.EmployerWorkshop(workshop.id, e);
// }
// _workshopRepository.CreateWorkshopAccounts(accountIds, workshop.id);
// return operation.Succcedded();
//}
//public OperationResult EditForClient(EditWorkshop command)
//{
// var leftSearch = new LeftWorkSearchModel()
// {
// WorkshopId = command.Id
// };
// var leftWork = _leftWorkRepository.search(leftSearch);
// var accountIds = new List<long>();
// var operation = new OperationResult();
// var workshop = _workshopRepository.Get(command.Id);
// if (command.AccountIdsList != null)
// {
// accountIds = command.AccountIdsList.ToList();
// }
// if (workshop == null)
// operation.Failed("رکورد مورد نظر وجود ندارد");
// if (command.EmployerIdList == null)
// return operation.Failed("لطفا کارفرما را انتخاب نمایید");
// var employer = command.EmployerIdList.ToList();
// if (string.IsNullOrEmpty(command.WorkshopName) || string.IsNullOrEmpty(command.ArchiveCode) || command.ArchiveCode == "0")
// return operation.Failed("موارد اجباری را پر کنید");
// //if (_workshopRepository.Exists(x => x.WorkshopName == command.WorkshopName && x.id != command.Id))
// // return operation.Failed(" رکورد مورد نظر تکراری است ");
// if (_workshopRepository.Exists(x =>
// x.InsuranceCode != null && x.InsuranceCode == command.InsuranceCode && x.id != command.Id))
// {
// if (_workshopRepository.ExistsWorkshopAccountInsuranceCodeByworkshopId(command.Id, command.InsuranceCode))
// return operation.Failed("کد بیمه کارگاه تکراری است");
// }
// if (_workshopRepository.ExistsWorkshopAccountArchiveCodeByWorkshopId(command.Id, command.ArchiveCode))
// return operation.Failed("شماره بایگانی تکراری است");
// if (command.State == null)
// return operation.Failed("لطفا استان و شهر را انتخاب کنید");
// if ((command.City == "0" || command.City == "شهرستان"))
// return operation.Failed("لطفا شهر را انتخاب کنید");
// if (command.TypeOfInsuranceSend != null && command.InsuranceCode == null)
// return operation.Failed("لطفا کد بیمه کارگاه را وارد کنید");
// if (command.Address == null)
// return operation.Failed("لطفا آدرس را وارد کنید");
// if (command.FixedSalary)
// {
// if (command.InsuranceJobId == 0 || command.InsuranceJobId == null)
// return operation.Failed("لطفا صنف را انتخاب کنید");
// if (string.IsNullOrWhiteSpace(command.Population))
// return operation.Failed("لطفا جمعیت شهر را انتخاب کنید");
// }
// workshop.Edit(command.WorkshopName, command.WorkshopSureName, command.InsuranceCode, command.TypeOfOwnership,
// command.ArchiveCode, command.AgentName, command.AgentPhone, command.State, command.City,
// command.Address,
// command.TypeOfInsuranceSend, command.TypeOfContract, command.ContractTerm, command.AgreementNumber
// , command.FixedSalary, command.Population, command.InsuranceJobId, command.ZoneName,
// command.AddBonusesPay, command.AddYearsPay, command.AddLeavePay,command.TotalPaymentHide,command.IsClassified,
// command.ComputeOptions, command.BonusesOptions, command.YearsOptions,command.HasRollCallFreeVip, command.WorkshopHolidayWorking,
// command.InsuranceCheckoutOvertime, command.InsuranceCheckoutFamilyAllowance);
// _workshopRepository.SaveChanges();
// //_workshopRepository.RemoveOldRelation(command.Id);
// _workshopRepository.RemoveEmployerWorkshop(command.Id);
// foreach (var e in employer)
// {
// _workshopRepository.EmployerWorkshop(workshop.id, e);
// }
// // _workshopRepository.WorkshopAccounts(accountIds, workshop.id);
// foreach (var item in leftWork)
// {
// var editLeft = _leftWorkRepository.Get(item.Id);
// editLeft.EditBonuses(command.AddBonusesPay, command.AddYearsPay, command.AddLeavePay);
// _leftWorkRepository.SaveChanges();
// }
// return operation.Succcedded();
//}
public bool GetWorkshopAccountByAcountID(long acountID)
{

View File

@@ -160,7 +160,7 @@ public class YearlySalaryApplication : IYearlySalaryApplication
public InsuranceYearlySalaryModel GetInsuranceItems(DateTime startDate, DateTime endDate, string year)
{
return _yearlySalaryRepository.GetInsuranceItems(startDate, endDate, year);
}
}
#endregion
}

View File

@@ -1,5 +1,6 @@
using System;
using _0_Framework.Application;
using _0_Framework.InfraStructure;
using Company.Domain.CheckoutAgg;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
@@ -73,5 +74,28 @@ class CheckoutMapping : IEntityTypeConfiguration<Checkout>
salaryAid.Property(x => x.Amount).HasMaxLength(25);
salaryAid.Property(x => x.CalculationDateTimeFa).HasMaxLength(15);
});
builder.OwnsOne(x => x.CheckoutRollCall, rollCall =>
{
rollCall.Property(x => x.TotalPresentTimeSpan).HasTimeSpanConversion();
rollCall.Property(x => x.TotalBreakTimeSpan).HasTimeSpanConversion();
rollCall.Property(x => x.TotalWorkingTimeSpan).HasTimeSpanConversion();
rollCall.Property(x => x.TotalPaidLeaveTmeSpan).HasTimeSpanConversion();
rollCall.Property(x => x.TotalSickLeaveTimeSpan).HasTimeSpanConversion();
rollCall.Property(x => x.TotalMandatoryTimeSpan).HasTimeSpanConversion();
rollCall.OwnsMany(x => x.RollCallDaysCollection, rollCallDay =>
{
rollCallDay.HasKey(x => x.Id);
rollCallDay.WithOwner().HasForeignKey(x => x.CheckoutId);
rollCallDay.Property(x => x.WorkingTimeSpan).HasTimeSpanConversion();
rollCallDay.Property(x => x.BreakTimeSpan).HasTimeSpanConversion();
rollCallDay.Property(x => x.FirstStartDate).HasMaxLength(18);
rollCallDay.Property(x => x.FirstEndDate).HasMaxLength(18);
rollCallDay.Property(x => x.SecondStartDate).HasMaxLength(18);
rollCallDay.Property(x => x.SecondEndDate).HasMaxLength(18);
rollCallDay.Property(x => x.LeaveType).HasMaxLength(18);
});
});
}
}

View File

@@ -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);
}
}

View File

@@ -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)

View File

@@ -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)

View File

@@ -1,4 +1,6 @@
using Company.Domain.EmployeeComputeOptionsAgg;
using System;
using _0_Framework.Application;
using Company.Domain.EmployeeComputeOptionsAgg;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
@@ -16,6 +18,9 @@ public class EmployeeComputeOptionsMapping : IEntityTypeConfiguration<EmployeeCo
builder.Property(x => x.ComputeOptions).HasMaxLength(50);
builder.Property(x => x.YearsOptions).HasMaxLength(50);
builder.Property(x => x.BonusesOptions).HasMaxLength(50);
builder.Property(x => x.ContractTerm).HasMaxLength(10);
builder.Property(x => x.CutContractEndOfYear).HasConversion(x => x.ToString()
, x => ((IsActive)Enum.Parse(typeof(IsActive), x))).HasMaxLength(5);
}
}

View File

@@ -13,5 +13,32 @@ public class InsuranceListMapping : IEntityTypeConfiguration<InsuranceList>
builder.Property(x => x.Year).HasMaxLength(4);
builder.Property(x => x.Month).HasMaxLength(2);
builder.ComplexProperty(x => x.Inspection, inspection =>
{
inspection.IsRequired();
inspection.Property(x => x.Type).HasConversion<string>().HasMaxLength(50);
inspection.Property(x => x.LastInspectionDateTime);
inspection.Property(x => x.MediaId);
});
builder.ComplexProperty(x => x.Debt, debt =>
{
debt.IsRequired();
debt.Property(x => x.Type).HasConversion<string>().HasMaxLength(50);
debt.Property(x => x.DebtDate);
debt.Property(x => x.Amount);
debt.Property(x => x.MediaId);
});
builder.ComplexProperty(x => x.EmployerApproval, approval =>
{
approval.IsRequired();
approval.Property(x => x.Status).HasConversion<string>().HasMaxLength(50);
approval.Property(x => x.Description).HasMaxLength(500);
});
//builder.HasMany(x => x.EmployerSignatures)
// .WithOne(x => x.InsuranceList).HasForeignKey(x => x.InsuranceListId);
}
}

View File

@@ -1,4 +1,6 @@
using Company.Domain.InsurancWorkshopInfoAgg;
using System;
using _0_Framework.Application;
using Company.Domain.InsurancWorkshopInfoAgg;
using Company.Domain.WorkshopAgg;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
@@ -38,10 +40,13 @@ partial class WorkshopMapping : IEntityTypeConfiguration<Workshop>
builder.Property(x => x.IsOldContract);
builder.Property(x => x.HasRollCallFreeVip).HasMaxLength(5);
builder.Property(x => x.WorkshopHolidayWorking);
//builder.HasOne(x => x.Employer)
// .WithMany(x => x.Workshops)
// .HasForeignKey(x => x.EmployerId);
builder.HasMany(x => x.LeftWorks)
builder.Property(x => x.CutContractEndOfYear).HasConversion(x => x.ToString()
, x => ((IsActive)Enum.Parse(typeof(IsActive), x))).HasMaxLength(5);
//builder.HasOne(x => x.Employer)
// .WithMany(x => x.Workshops)
// .HasForeignKey(x => x.EmployerId);
builder.HasMany(x => x.LeftWorks)
.WithOne(x => x.Workshop)
.HasForeignKey(x => x.WorkshopId);

View File

@@ -0,0 +1,121 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace CompanyManagment.EFCore.Migrations
{
/// <inheritdoc />
public partial class addinspectiondebtapprovaltoinsurancelist : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<double>(
name: "Debt_Amount",
table: "InsuranceLists",
type: "float",
nullable: false,
defaultValue: 0.0);
migrationBuilder.AddColumn<DateTime>(
name: "Debt_DebtDate",
table: "InsuranceLists",
type: "datetime2",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
migrationBuilder.AddColumn<long>(
name: "Debt_MediaId",
table: "InsuranceLists",
type: "bigint",
nullable: false,
defaultValue: 0L);
migrationBuilder.AddColumn<string>(
name: "Debt_Type",
table: "InsuranceLists",
type: "nvarchar(50)",
maxLength: 50,
nullable: false,
defaultValue: "None");
migrationBuilder.AddColumn<string>(
name: "EmployerApproval_Description",
table: "InsuranceLists",
type: "nvarchar(500)",
maxLength: 500,
nullable: true);
migrationBuilder.AddColumn<string>(
name: "EmployerApproval_Status",
table: "InsuranceLists",
type: "nvarchar(50)",
maxLength: 50,
nullable: false,
defaultValue: "None");
migrationBuilder.AddColumn<DateTime>(
name: "Inspection_LastInspectionDateTime",
table: "InsuranceLists",
type: "datetime2",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
migrationBuilder.AddColumn<long>(
name: "Inspection_MediaId",
table: "InsuranceLists",
type: "bigint",
nullable: false,
defaultValue: 0L);
migrationBuilder.AddColumn<string>(
name: "Inspection_Type",
table: "InsuranceLists",
type: "nvarchar(50)",
maxLength: 50,
nullable: false,
defaultValue: "None");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Debt_Amount",
table: "InsuranceLists");
migrationBuilder.DropColumn(
name: "Debt_DebtDate",
table: "InsuranceLists");
migrationBuilder.DropColumn(
name: "Debt_MediaId",
table: "InsuranceLists");
migrationBuilder.DropColumn(
name: "Debt_Type",
table: "InsuranceLists");
migrationBuilder.DropColumn(
name: "EmployerApproval_Description",
table: "InsuranceLists");
migrationBuilder.DropColumn(
name: "EmployerApproval_Status",
table: "InsuranceLists");
migrationBuilder.DropColumn(
name: "Inspection_LastInspectionDateTime",
table: "InsuranceLists");
migrationBuilder.DropColumn(
name: "Inspection_MediaId",
table: "InsuranceLists");
migrationBuilder.DropColumn(
name: "Inspection_Type",
table: "InsuranceLists");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -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");
}
}
}

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More