From 774c0e8463e10e048795bab16a514e319c074619 Mon Sep 17 00:00:00 2001 From: SamSys Date: Mon, 16 Sep 2024 19:48:56 +0330 Subject: [PATCH] task changes from mahan --- .../Position/IPositionApplication.cs | 1 + .../PositionApplication.cs | 5 ++ .../PositionAgg/IPositionRepository.cs | 4 +- .../Repository/PositionRepository.cs | 5 ++ .../Repository/TaskMessageRepository.cs | 4 +- .../Repository/TaskRepository.cs | 65 +++++++++--------- .../InsuranceListApplication.cs | 4 +- .../Repository/RollCallRepository.cs | 14 ++-- .../Company/InsuranceList/Index.cshtml.cs | 2 +- .../Pages/Company/Task/Index.cshtml.cs | 13 +++- .../InsuranceList/546/1403_05/DSKKAR00.dbf | Bin 0 -> 1326 bytes .../InsuranceList/546/1403_05/DSKWOR00.dbf | Bin 0 -> 7098 bytes ServiceHost/Properties/launchSettings.json | 4 +- ServiceHost/wwwroot/AssetsCamera/js/Index.js | 8 ++- 14 files changed, 78 insertions(+), 51 deletions(-) create mode 100644 ServiceHost/InsuranceList/546/1403_05/DSKKAR00.dbf create mode 100644 ServiceHost/InsuranceList/546/1403_05/DSKWOR00.dbf diff --git a/AccountManagement.Application.Contracts/Position/IPositionApplication.cs b/AccountManagement.Application.Contracts/Position/IPositionApplication.cs index 03340563..366e87c8 100644 --- a/AccountManagement.Application.Contracts/Position/IPositionApplication.cs +++ b/AccountManagement.Application.Contracts/Position/IPositionApplication.cs @@ -20,4 +20,5 @@ public interface IPositionApplication OperationResult RemoveAccountListFromPosition(List accountIdList, long PositionId); List GetLowerPosition(); int GetLastPositionValue(); + bool HasPositionValue(long accountId); } \ No newline at end of file diff --git a/AccountManagement.Application/PositionApplication.cs b/AccountManagement.Application/PositionApplication.cs index b53570fd..e8085197 100644 --- a/AccountManagement.Application/PositionApplication.cs +++ b/AccountManagement.Application/PositionApplication.cs @@ -193,4 +193,9 @@ public class PositionApplication : IPositionApplication { return _positionRepository.GetLastPositionValue(); } + + public bool HasPositionValue(long accountId) + { + return _positionRepository.HasPositionValue(accountId); + } } \ No newline at end of file diff --git a/AccountManagement.Domain/PositionAgg/IPositionRepository.cs b/AccountManagement.Domain/PositionAgg/IPositionRepository.cs index 348aab22..1227265d 100644 --- a/AccountManagement.Domain/PositionAgg/IPositionRepository.cs +++ b/AccountManagement.Domain/PositionAgg/IPositionRepository.cs @@ -21,5 +21,7 @@ public interface IPositionRepository : IRepository void Remove(long id); int GetLastPositionValue(); - + bool HasPositionValue(long accountId); + + } \ No newline at end of file diff --git a/AccountMangement.Infrastructure.EFCore/Repository/PositionRepository.cs b/AccountMangement.Infrastructure.EFCore/Repository/PositionRepository.cs index 3da08f6b..4f187bac 100644 --- a/AccountMangement.Infrastructure.EFCore/Repository/PositionRepository.cs +++ b/AccountMangement.Infrastructure.EFCore/Repository/PositionRepository.cs @@ -108,4 +108,9 @@ public class PositionRepository : RepositoryBase, IPositionRepos } + public bool HasPositionValue(long accountId) + { + var userPositionId= _accountContext.Accounts.Find(accountId); + return userPositionId.PositionId is > 0 && userPositionId.PositionIsActive == "true"; + } } \ No newline at end of file diff --git a/AccountMangement.Infrastructure.EFCore/Repository/TaskMessageRepository.cs b/AccountMangement.Infrastructure.EFCore/Repository/TaskMessageRepository.cs index 46b7c67a..a66a101b 100644 --- a/AccountMangement.Infrastructure.EFCore/Repository/TaskMessageRepository.cs +++ b/AccountMangement.Infrastructure.EFCore/Repository/TaskMessageRepository.cs @@ -35,9 +35,9 @@ public class TaskMessageRepository : RepositoryBase, ITaskMes public List GetTaskMessages(long assignId) { var accountId = long.Parse(_contextAccessor.HttpContext.User.FindFirst("AccountId").Value); + var positionId =int.Parse(_contextAccessor.HttpContext.User.FindFirst("PositionValue").Value); var raw = _accountContext.TaskMessages.Include(x => x.TaskMessageItemsList).Include(x => x.Assign).Where(x => - x.AssignId == assignId && - x.TaskMessageItemsList.Any(x => x.ReceiverAccountId == accountId || x.SenderAccountId == accountId)).Select( + x.AssignId == assignId ).Select( x => new TaskMessageViewModel() { SenderId = x.TaskMessageItemsList.First().SenderAccountId, diff --git a/AccountMangement.Infrastructure.EFCore/Repository/TaskRepository.cs b/AccountMangement.Infrastructure.EFCore/Repository/TaskRepository.cs index f7c3bdd6..f01871e6 100644 --- a/AccountMangement.Infrastructure.EFCore/Repository/TaskRepository.cs +++ b/AccountMangement.Infrastructure.EFCore/Repository/TaskRepository.cs @@ -73,7 +73,7 @@ public class AssignViewModels = x.Assigns.Select(a => new AssignViewModel() { Id = a.id, - EndTaskDateFa = a.EndTaskDate.ToFarsiFull(), + EndTaskDateFa = a.EndTaskDate.ToFarsi(), IsCancel = a.IsCancel, IsCanceledRequest = a.IsCanceledRequest, IsDone = a.IsDone, @@ -1656,27 +1656,27 @@ public class var task = Get(id); EditTask res; - if (task.SenderId == _authHelper.CurrentAccountId()) - { - var query = _accountContext.Tasks.Include(x => x.Assigns).Where(x => x.id == id).Select(x => new EditTask() - { + if (task.SenderId == _authHelper.CurrentAccountId()|| int.Parse(_contextAccessor.HttpContext.User.FindFirst("PositionValue").Value) == 1) + { + var query = _accountContext.Tasks.Include(x => x.Assigns).Where(x => x.id == id).Select(x => new EditTask() + { - Description = x.Description, - Id = x.id, - Title = x.Title, - medias = _accountContext.TaskMedias.Include(z => z.Media).Where(e => e.TaskId == x.id).Select(m => - new MediaViewModel() - { - Path = m.Media.Path, - Type = m.Media.Type, - Category = m.Media.Category, - Id = m.Media.id - }).ToList(), - ContractingPartyName = x.ContractingPartyName, - ReceiverId = _accountContext.Assigns.Where(a => a.TaskId == x.id).Select(a => a.AssignedId).ToList(), - SenderId = x.SenderId, - CreateDateFa = x.CreationDate.ToFarsi(), - TicketId = x.TicketId, + Description = x.Description, + Id = x.id, + Title = x.Title, + medias = _accountContext.TaskMedias.Include(z => z.Media).Where(e => e.TaskId == x.id).Select(m => + new MediaViewModel() + { + Path = m.Media.Path, + Type = m.Media.Type, + Category = m.Media.Category, + Id = m.Media.id + }).ToList(), + ContractingPartyName = x.ContractingPartyName, + ReceiverId = _accountContext.Assigns.Where(a => a.TaskId == x.id).Select(a => a.AssignedId).ToList(), + SenderId = x.SenderId, + CreateDateFa = x.CreationDate.ToFarsi(), + TicketId = x.TicketId, AssignViewModels = x.Assigns.Where(a => a.IsCanceledRequest || a.IsDoneRequest || a.TimeRequest).Select( a => new AssignViewModel() @@ -1692,20 +1692,19 @@ public class AssignedId = a.AssignedId, RequestDateFa = a.RequestDate.ToFarsi() - }).ToList(), - + }).ToList(), - }).FirstOrDefault(); - query.TicketViewModel = query.TicketId != null && query.TicketId > 0 - ? _ticketRepository.GetDetails(query.TicketId.Value) - : null; + }).FirstOrDefault(); - return query; - } - else - return new(); - } + query.TicketViewModel = query.TicketId != null && query.TicketId > 0 + ? _ticketRepository.GetDetails(query.TicketId.Value) + : null; + + return query; + } + return new(); + } public string GetWebEnvironmentPath() @@ -1779,7 +1778,7 @@ public class .ThenInclude(x => x.Media) .Where(x => x.Task.IsActiveString == "true" && (x.AssignerId == accountId && x.AssignedId == accountId) && - (!x.IsCanceledRequest && !x.TimeRequest && !x.IsDoneRequest)) + (!x.IsCanceledRequest && !x.TimeRequest && !x.IsDoneRequest) && x.Task.Assigns.Count == 1) .Select(x => new TaskViewModel() { diff --git a/CompanyManagment.Application/InsuranceListApplication.cs b/CompanyManagment.Application/InsuranceListApplication.cs index 1c8652f5..45c6c881 100644 --- a/CompanyManagment.Application/InsuranceListApplication.cs +++ b/CompanyManagment.Application/InsuranceListApplication.cs @@ -622,7 +622,7 @@ public class InsuranceListApplication: IInsuranceListApplication } //farokhiChanges if (item.EmployeeId == 42783) - employeeDetailsForInsuranceObj.MonthlyBenefits = 5382855; + employeeDetailsForInsuranceObj.MonthlyBenefits = 53082855; employeeDetailsForInsuranceObj.BenefitsIncludedContinuous =employeeDetailsForInsuranceObj.MonthlyBenefits + employeeDetailsForInsuranceObj.MonthlySalary; @@ -666,7 +666,7 @@ public class InsuranceListApplication: IInsuranceListApplication employeeDetailsForInsuranceObj.StartWorkDateGr = item.StartWorkDateGr; //farokhiChanges if (item.EmployeeId == 42783) - employeeDetailsForInsuranceObj.MonthlyBenefits = 5382855; + employeeDetailsForInsuranceObj.MonthlyBenefits = 53082855; list.Add(employeeDetailsForInsuranceObj); } diff --git a/CompanyManagment.EFCore/Repository/RollCallRepository.cs b/CompanyManagment.EFCore/Repository/RollCallRepository.cs index f5e709ba..7967a2d1 100644 --- a/CompanyManagment.EFCore/Repository/RollCallRepository.cs +++ b/CompanyManagment.EFCore/Repository/RollCallRepository.cs @@ -95,7 +95,7 @@ public class RollCallRepository : RepositoryBase, IRollCallRepos { StartDate = x.StartDate, EndDate = x.EndDate, - TotalWorkingHours = $"{x.TotalhourseSpan.TotalHours.ToString("0")}:{x.TotalhourseSpan.Minutes.ToString("00")}", + TotalWorkingHours = $"{(int)x.TotalhourseSpan.TotalHours}:{(int)x.TotalhourseSpan.Minutes}", DayOfWeek = x.DayOfWeek, RollCallDateFa = x.RollCallDateFa, DateTimeGr = x.DateTimeGr, @@ -237,8 +237,8 @@ public class RollCallRepository : RepositoryBase, IRollCallRepos IsHoliday = _holidayItemApplication.IsHoliday(x.DateGr), IsAbsent = !x.RollCallTimesList.Any(), RollCallTimesList = x.RollCallTimesList, - TotalWorkingHours = $"{x.TotalWorkingHoursSpan.TotalHours.ToString("0")}:{x.TotalWorkingHoursSpan.Minutes.ToString("00")}", - }).ToList(); + TotalWorkingHours = $"{(int)x.TotalWorkingHoursSpan.TotalHours}:{(int)x.TotalWorkingHoursSpan.Minutes}", + }).ToList(); return new EmployeeRollCallsByMonthViewModel() { PersianMonthName = selectedMonthPersian.ToString("MMMM"), @@ -362,8 +362,8 @@ public class RollCallRepository : RepositoryBase, IRollCallRepos HasLeave = x.HasLeave, IsAbsent = x.IsAbsent, PersonnelCode = x.PersonnelCode, - TotalWorkingHours = $"{x.TotalWorkingHoursSpan.TotalHours.ToString("0")}:{x.TotalWorkingHoursSpan.Minutes.ToString("00")}" - }); + TotalWorkingHours = $"{(int)x.TotalWorkingHoursSpan.TotalHours}:{(int)x.TotalWorkingHoursSpan.Minutes}", + }); return result; } @@ -443,8 +443,8 @@ public class RollCallRepository : RepositoryBase, IRollCallRepos EmployeeFullName = x.EmployeeFullName, EmployeeId = x.EmployeeId, TotalWorkingHours = - $"{x.TotalWorkingHoursSpan.TotalHours.ToString("0")}:{x.TotalWorkingHoursSpan.Minutes.ToString("00")}", - RollCallTimesList = x.RollCallTimesList + $"{(int)x.TotalWorkingHoursSpan.TotalHours}:{(int)x.TotalWorkingHoursSpan.Minutes}", + RollCallTimesList = x.RollCallTimesList }).ToList(); //absent ones are those who are active and not on the roll call list diff --git a/ServiceHost/Areas/Admin/Pages/Company/InsuranceList/Index.cshtml.cs b/ServiceHost/Areas/Admin/Pages/Company/InsuranceList/Index.cshtml.cs index 56d87b1a..ce0172d3 100644 --- a/ServiceHost/Areas/Admin/Pages/Company/InsuranceList/Index.cshtml.cs +++ b/ServiceHost/Areas/Admin/Pages/Company/InsuranceList/Index.cshtml.cs @@ -844,7 +844,7 @@ public class IndexModel : PageModel if (workingDaysL == endMonthCurrentDayL) benefitsIncludedContinuousL = sum; //farokhiChanges if (employeeId == 42783) - benefitsIncludedContinuousL = 5382855; + benefitsIncludedContinuousL = 53082855; if (workingDaysL < endMonthCurrentDayL) { if (endMonthCurrentDayL == 29) diff --git a/ServiceHost/Areas/AdminNew/Pages/Company/Task/Index.cshtml.cs b/ServiceHost/Areas/AdminNew/Pages/Company/Task/Index.cshtml.cs index 9d2b44b5..eda9740a 100644 --- a/ServiceHost/Areas/AdminNew/Pages/Company/Task/Index.cshtml.cs +++ b/ServiceHost/Areas/AdminNew/Pages/Company/Task/Index.cshtml.cs @@ -17,6 +17,7 @@ using CompanyManagment.Application; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.Filters; using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.AspNetCore.Mvc.Rendering; using Newtonsoft.Json.Linq; @@ -57,9 +58,17 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.Task public int UserPositionValue { get; set; } public List YearlyList { get; set; } + public override void OnPageHandlerExecuting(PageHandlerExecutingContext context) + { + bool hasAccessToTask = _positionApplication.HasPositionValue(_authHelper.CurrentAccountId()); + if (!hasAccessToTask) + { + context.Result = Forbid(); + } + base.OnPageHandlerExecuting(context); + } - - public IActionResult OnGet(TaskSearchModel searchModel) + public IActionResult OnGet(TaskSearchModel searchModel) { if (_authHelper.GetPermissions().Any(x => x == 901)) { diff --git a/ServiceHost/InsuranceList/546/1403_05/DSKKAR00.dbf b/ServiceHost/InsuranceList/546/1403_05/DSKKAR00.dbf new file mode 100644 index 0000000000000000000000000000000000000000..68d0431d64f298d7678c1e84b3d3784efd8bf561 GIT binary patch literal 1326 zcmb`FKWp1i5WwY{bf}ZLODQ)O4DacWC6z9+lwx7)DOl>@E?&C#tJDBZ|8D3P1ADu;xqjGCqYtehJiHu zyvR`6;lr~_eR1JuK+Q2jRcEJLM6@o69zD2|Xn&*Jqs z{)qkkR@6@;uYzIXkD6n+CjP2<&X|6Mk-#7lNkAff|o;DpC$@; zoUHxUy_EhR@e+B~{tgxn;uZ3&`(k@?Kd&?LN3m!gG~|8!H^}qU$%^cO%b25^+%ni~ zKKuputvk4G4Pf%6cQYQL^5e2UhONn@H6NV<%<$=rzi%<|N{74z7sECbp)>f3^R!|1 zZQ4bpJDB#-dfU3{P5bB2Ig~z!WSb1Lr8H8oKW4OzO7F zxZ!YJQp?7RI+g{%nQ7}fa~<;4&BP^TRXt9NQ#_pvEap(6U?>3GVy>oH!v4h`3R=5|uW> znu@5Z7V$rD?E$GO70co#T~dp0oVayL9IaNFl#%6mp3gJydFJz*H*bA!ZSB=c zrSir4k1wJ6PpP%<-fz^h=IR=%*KWLF@q72O#_)AiHwUqJvpK=61-7^br}DBOn|kq zSSI#uZ&iVR41C`BjoL=X+V>OiSBjk>+y0wV{O1z9UH{Pbs{R6eeNO*yqm$vk0-rZO zt?G7${|0=XeeJ3KIu>u9ef25cEWvBF%&71K;J9Xr{l1-6>mxLVcLB~@-{!`%0!p}pS>@+BeBetP)zRl6JE;a?|l z_mDh^k^?siFseC@hRz0`4lG4bRPo@*6d#?+Oh`@xrq2(_c-S>**J?A-{=n>+flJNI zqm(krPzx%VV&DuROt64+p{=NWUkDjw?Vwt~18HS0VXyK$dP646m(pjF5lV%pq~yxe z+zW&!77*48sINK0{9l^ik1?dvG9F@P2g5UR87KX0s+X^B_i6OQsOM<#skvAtzhL=_ z3CpPBY=*EGaWo+2PZOOLtXi@NqH+ex=EI7K#6=MJJo|rrk4h?4CUXILqu95#f8Ab` ziSo6OATp&Ke*srgXrX-1Uqo0z;dq%P?8yG4xiyaJ2j)@VjNEE5y)(CL#oP!XyuuWj zXy{yJt_~hnfv~e4c2$I>-g6T+xFRg}@GHU=WkP)B6$vXnu6-pu#uj*3!88W3uKQw` zxQ+-&+%;r;nx6La>32|%pFVz+INqWecC&)%=gH`#@aR-zLSbX3@-{qd782xNw|o!F zmC{@zvRFu1Dzpr!AmltX1J}XdH__QYF&QUt=J|Ioy?&BDP6m!09@klPmfL=jo|vO9 zet85uu77%XSe!fP?Suq0aOq*WkMIIJJ_3vdhb|p(#w0?5-C=r|uYju>gf$~vdmwFU z+yq?a#Ca%An4oX9;L%UKgnB{TVKY{9F2T!Co9sGkW~{FF|3MBa-AhuRSe6xOAjkqpp{e-N40Vf zYqJD6q~XkakviYb$lvj4LdN@p9<)V!CD3jOo6qXMQPi8l literal 0 HcmV?d00001 diff --git a/ServiceHost/Properties/launchSettings.json b/ServiceHost/Properties/launchSettings.json index 651ca407..cddd38ed 100644 --- a/ServiceHost/Properties/launchSettings.json +++ b/ServiceHost/Properties/launchSettings.json @@ -19,8 +19,8 @@ "sqlDebugging": true, "dotnetRunMessages": "true", "nativeDebugging": true, - //"applicationUrl": "https://localhost:5004;http://localhost:5003;http://192.168.0.118:82;https://192.168.0.118:83", - "applicationUrl": "https://localhost:5004;http://localhost:5003", + "applicationUrl": "https://localhost:5004;http://localhost:5003;http://192.168.0.118:82;https://192.168.0.118:83", + //"applicationUrl": "https://localhost:5004;http://localhost:5003", "jsWebView2Debugging": false, "hotReloadEnabled": true }, diff --git a/ServiceHost/wwwroot/AssetsCamera/js/Index.js b/ServiceHost/wwwroot/AssetsCamera/js/Index.js index 16702a60..729e1464 100644 --- a/ServiceHost/wwwroot/AssetsCamera/js/Index.js +++ b/ServiceHost/wwwroot/AssetsCamera/js/Index.js @@ -1,4 +1,5 @@ -$(document).ready(function () { + +$(document).ready(function () { if ($(window).width() > 992) { $('#desktopDisplay').show(); $('#mobileDisplay').hide(); @@ -520,6 +521,11 @@ function inCom(employeeId) { // ------------------------------------------------------------- keyboard number $(document).ready(function () { + //const androidUserAgentString = window.navigator.userAgent.slice(window.navigator.userAgent.indexOf("Android")); + //const androidDeviceName = androidUserAgentString.slice(androidUserAgentString.indexOf("; ") + 1, androidUserAgentString.indexOf(")")); + //console.log(androidDeviceName); + + $('#errorMessage').text(androidUserAgentString); $('.keypad-numbers .item').click(function () { let number = $(this).text().trim();