From d0f69ea27c3d0deb2cfb53ffabfe61ef603bdac7 Mon Sep 17 00:00:00 2001 From: SamSys Date: Sat, 5 Oct 2024 19:27:04 +0330 Subject: [PATCH] Task Changes And ReportRepository bug fixed --- 0_Framework/0_Framework.csproj | 1 + 0_Framework/Application/AuthHelper.cs | 19 +- 0_Framework/Application/AuthViewModel.cs | 7 + 0_Framework/Application/IsActive.cs | 8 + 0_Framework/Application/Tools.cs | 43 +- 0_Framework/Application/Version.cs | 4 +- 0_Framework/Application/WorkshopClaim.cs | 9 + 0_Framework/libman.json | 5 + .../AccountApplication.cs | 57 +- .../AccountAgg/Account.cs | 2 +- .../Repository/AccountLeftworkRepository.cs | 2 +- .../CustomizeCheckoutAgg/CustomizeCheckout.cs | 209 +++ Company.Domain/EmployeeAgg/Employee.cs | 3 + ...stRollCallEmployeesWithEmployeeLeftWork.cs | 3 +- .../LeftWorkApplication.cs | 65 +- .../Mapping/CustomizeCheckoutMapping.cs | 17 + .../Mapping/EmployeeMapping.cs | 6 + .../Repository/ReportRepository.cs | 30 +- .../Repository/RollCallEmployeeRepository.cs | 77 +- .../RollCallEmployeeStatusRepository.cs | 26 +- .../Repository/WorkshopRepository.cs | 2 +- .../InstitutionContracts/Index.cshtml.cs | 2 +- .../Pages/Company/Workshops/Index.cshtml | 3 +- .../Pages/Company/Task/CreateModal.cshtml | 5 +- .../Pages/Company/Task/DetailsModal.cshtml | 156 +-- .../Task/DetailsTaskTicketsModal.cshtml | 41 +- .../Company/Task/DiagramTaskModal.cshtml | 23 +- .../AdminNew/Pages/Company/Task/Edit.cshtml | 11 +- .../AdminNew/Pages/Company/Task/Index.cshtml | 30 +- .../Pages/Company/Task/Index.cshtml.cs | 32 +- .../Company/Task/OperationRequestModal.cshtml | 144 +- .../Company/Checkouts/CheckoutPrintAll.cshtml | 8 +- .../Pages/Company/Checkouts/Index.cshtml.cs | 80 +- .../Pages/Company/Checkouts/PrintAll.cshtml | 5 +- .../Company/Checkouts/PrintOneRollCall.cshtml | 4 +- .../_Partials/PrintDetailsRollCallRaw.cshtml | 806 ++++++----- .../Company/Contracts/ContractPrintAll.cshtml | 4 +- .../Pages/Company/Contracts/PrintAll.cshtml | 2 +- .../Pages/Company/Contracts/PrintOne.cshtml | 2 +- .../Company/Contracts/PrintOneMobile.cshtml | 2 +- .../Pages/Company/Employees/Index.cshtml | 2 +- .../Pages/Company/Employees/Index.cshtml.cs | 361 +++-- .../PrintAllDetailsPersonnelInfo.cshtml | 982 +++++++------- .../PrintAllDetailsPersonnelInfoMobile.cshtml | 1207 ++++++++--------- .../Company/Employees/PrintAllList.cshtml | 532 ++++---- .../Employees/PrintAllPersonnelInfo.cshtml | 1100 +++++++-------- .../PrintAllPersonnelInfoMobile.cshtml | 886 ++++++------ .../Pages/Company/Employees/PrintOne.cshtml | 198 +-- .../Company/InsuranceList/PrintOne.cshtml | 20 +- .../InsuranceList/PrintOneMobile.cshtml | 20 + .../Company/Reports/CheckoutReport.cshtml | 577 +++++++- .../Reports/PrintAllCheckoutReport.cshtml | 26 +- .../RollCall/EmployeeUploadPicture.cshtml | 16 +- .../RollCall/EmployeeUploadPicture.cshtml.cs | 1 + .../Company/RollCall/ModalTakeImages.cshtml | 20 +- .../Pages/Company/Ticket/Index.cshtml.cs | 27 +- .../Company/Workshop/Employees.cshtml.cs | 53 +- .../Workshop/PrintOnePersonnelInfo.cshtml | 1088 ++++++++------- .../Pages/Shared/_headerAndFooter.cshtml | 111 +- ServiceHost/Pages/Index.cshtml | 15 +- ServiceHost/Pages/Index.cshtml.cs | 4 +- ServiceHost/Properties/launchSettings.json | 4 +- ServiceHost/appsettings.Development.json | 2 +- .../AssetsAdminNew/Tasks/css/DetailModal.css | 115 +- .../Tasks/css/DiagramTaskModal.css | 65 +- .../Tasks/css/task-manager-list.css | 4 +- .../AssetsAdminNew/Tasks/js/DetailModal.js | 125 +- .../Tasks/js/DetailModalSender.js | 104 +- .../Tasks/js/DiagramTaskModal.js | 53 + .../wwwroot/AssetsAdminNew/Tasks/js/Index.js | 10 +- .../Tasks/js/OperationRequestModal.js | 181 ++- .../wwwroot/AssetsAdminNew/Tasks/js/create.js | 3 +- .../AssetsClient/Workshop/js/employees.js | 4 +- .../wwwroot/AssetsClient/css/dropdown.css | 2 +- .../wwwroot/AssetsClient/css/responsive.css | 4 +- .../pages/Checkouts/js/PrintOneRollCall.js | 44 +- .../AssetsClient/pages/RollCall/css/Group.css | 377 +++++ .../pages/RollCall/css/ModalTakeImages.css | 60 +- .../RollCall/js/EmployeeUploadPicture.js | 35 +- .../pages/RollCall/js/ModalTakeImages.js | 69 +- 80 files changed, 6136 insertions(+), 4326 deletions(-) create mode 100644 0_Framework/Application/IsActive.cs create mode 100644 0_Framework/Application/WorkshopClaim.cs create mode 100644 0_Framework/libman.json create mode 100644 Company.Domain/CustomizeCheckoutAgg/CustomizeCheckout.cs create mode 100644 CompanyManagment.EFCore/Mapping/CustomizeCheckoutMapping.cs create mode 100644 ServiceHost/wwwroot/AssetsClient/pages/RollCall/css/Group.css diff --git a/0_Framework/0_Framework.csproj b/0_Framework/0_Framework.csproj index eb73e124..361e9176 100644 --- a/0_Framework/0_Framework.csproj +++ b/0_Framework/0_Framework.csproj @@ -10,6 +10,7 @@ + diff --git a/0_Framework/Application/AuthHelper.cs b/0_Framework/Application/AuthHelper.cs index 4e46f902..9a4997a5 100644 --- a/0_Framework/Application/AuthHelper.cs +++ b/0_Framework/Application/AuthHelper.cs @@ -35,6 +35,8 @@ public class AuthHelper : IAuthHelper 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(claims.FirstOrDefault(x => x is { Type: "workshopList" })?.Value); + result.WorkshopSlug = claims.FirstOrDefault(x => x is { Type: "WorkshopSlug" }).Value; return result; } @@ -45,7 +47,7 @@ public class AuthHelper : IAuthHelper var permissions = _contextAccessor.HttpContext.User.Claims.FirstOrDefault(x => x.Type == "permissions") ?.Value; - return JsonConvert.DeserializeObject>(permissions); + return Tools.DeserializeFromBsonList(permissions); //Mahan } public long CurrentAccountId() @@ -120,7 +122,14 @@ public class AuthHelper : IAuthHelper public void Signin(AuthViewModel account) { - var permissions = JsonConvert.SerializeObject(account.Permissions); + #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 ?? ""; + + #endregion + var claims = new List { new Claim("AccountId", account.Id.ToString()), @@ -134,7 +143,11 @@ public class AuthHelper : IAuthHelper new Claim("AdminAreaPermission", account.AdminAreaPermission.ToString()), new Claim("ClientAriaPermission", account.ClientAriaPermission.ToString()), new Claim("IsCamera", "false"), - new Claim("PositionValue",account.PositionValue.ToString()) + new Claim("PositionValue",account.PositionValue.ToString()), + //mahanChanges + new("workshopList",workshopBson), + new("WorkshopSlug",slug) + }; var claimsIdentity = new ClaimsIdentity(claims, CookieAuthenticationDefaults.AuthenticationScheme); diff --git a/0_Framework/Application/AuthViewModel.cs b/0_Framework/Application/AuthViewModel.cs index 0a1aa59d..39c08a3e 100644 --- a/0_Framework/Application/AuthViewModel.cs +++ b/0_Framework/Application/AuthViewModel.cs @@ -15,7 +15,14 @@ public class AuthViewModel public List Permissions { get; set; } public string AdminAreaPermission { get; set; } public string ClientAriaPermission { get; set; } + + #region Mahan + public int? PositionValue { get; set; } + public string WorkshopSlug { get; set; } + public List WorkshopList { get; set; } + + #endregion public AuthViewModel(long id, long roleId, string fullname, string username, string mobile,string profilePhoto, List permissions, string roleName, string adminAreaPermission, string clientAriaPermission, int? positionValue) diff --git a/0_Framework/Application/IsActive.cs b/0_Framework/Application/IsActive.cs new file mode 100644 index 00000000..e1827783 --- /dev/null +++ b/0_Framework/Application/IsActive.cs @@ -0,0 +1,8 @@ +namespace _0_Framework.Application; + +public enum IsActive +{ + True, + False, + +} \ No newline at end of file diff --git a/0_Framework/Application/Tools.cs b/0_Framework/Application/Tools.cs index 6c3713b7..41f46b2d 100644 --- a/0_Framework/Application/Tools.cs +++ b/0_Framework/Application/Tools.cs @@ -11,6 +11,8 @@ using PersianTools.Core; using static System.Net.Mime.MediaTypeNames; using static Microsoft.EntityFrameworkCore.DbLoggerCategory.Database; using Image = System.Drawing.Image; +using Newtonsoft.Json; +using Newtonsoft.Json.Bson; namespace _0_Framework.Application; @@ -879,9 +881,9 @@ public static class Tools var newImage = new Bitmap(width, height); using (var graphics = Graphics.FromImage(newImage)) { - graphics.CompositingQuality = CompositingQuality.HighQuality; - graphics.InterpolationMode = InterpolationMode.HighQualityBicubic; - graphics.SmoothingMode = SmoothingMode.HighQuality; + graphics.CompositingQuality = CompositingQuality.HighSpeed; + graphics.InterpolationMode = InterpolationMode.Bicubic; + graphics.SmoothingMode = SmoothingMode.HighSpeed; graphics.DrawImage(srcImage, 0, 0, width, height); } @@ -1210,15 +1212,44 @@ public static class Tools return ""; } } + public static string SerializeToBson(object obj) + { + using var memoryStream = new MemoryStream(); + using (BsonDataWriter bsonWriter = new BsonDataWriter(memoryStream)) + { + JsonSerializer serializer = new JsonSerializer(); + serializer.Serialize(bsonWriter, obj); + } + byte[] bsonData = memoryStream.ToArray(); + return Convert.ToBase64String(bsonData); + } + //بیسان هایی که بصورت لیست بودند استخراج میشود + public static List DeserializeFromBsonList(string base64Data) + { + byte[] data = Convert.FromBase64String(base64Data); - #region DayOfWeekMethods + using MemoryStream memoryStream = new MemoryStream(data); + using BsonDataReader reader = new BsonDataReader(memoryStream); + reader.ReadRootValueAsArray = true; + JsonSerializer serializer = new JsonSerializer(); + return serializer.Deserialize>(reader); + } + //بیسان هایی که بصورت تکی بودند استخراج میشود + public static T DeserializeFromBson(string base64Data) + { + byte[] bsonData = Convert.FromBase64String(base64Data); + using MemoryStream memoryStream = new MemoryStream(bsonData); + using BsonDataReader bsonReader = new BsonDataReader(memoryStream); + JsonSerializer serializer = new JsonSerializer(); + return serializer.Deserialize(bsonReader); + } - public static DateTime GetNextDayOfWeek(this DateTime date, DayOfWeek dayOfWeek) + public static DateTime GetNextDayOfWeek(this DateTime date, DayOfWeek dayOfWeek) { int numberOfNextDayOfWeek = ((int)dayOfWeek - (int)date.DayOfWeek + 7) % 7; return date.AddDays(numberOfNextDayOfWeek == 0 ? 7 : numberOfNextDayOfWeek); } - #endregion + //این متد آخر همان روز را به صورت دیت تایم برمیگرداند public static DateTime ToGeorgianDateTime2(this string persianDate) diff --git a/0_Framework/Application/Version.cs b/0_Framework/Application/Version.cs index 1e4f922c..7fa57899 100644 --- a/0_Framework/Application/Version.cs +++ b/0_Framework/Application/Version.cs @@ -10,8 +10,8 @@ public static class Version { static Version() { - StyleVersion = "2.12.14"; - AdminVersion = "2.5.34"; + StyleVersion = "2.12.16"; + AdminVersion = "2.5.36"; CameraVersion = "1.0.7"; } diff --git a/0_Framework/Application/WorkshopClaim.cs b/0_Framework/Application/WorkshopClaim.cs new file mode 100644 index 00000000..a3869a42 --- /dev/null +++ b/0_Framework/Application/WorkshopClaim.cs @@ -0,0 +1,9 @@ +namespace _0_Framework.Application; + +public class WorkshopClaim +{ + public long Id { get; set; } + public string Name { get; set; } + public string Slug { get; set; } + public int PersonnelCount { get; set; } +} \ No newline at end of file diff --git a/0_Framework/libman.json b/0_Framework/libman.json new file mode 100644 index 00000000..ceee2710 --- /dev/null +++ b/0_Framework/libman.json @@ -0,0 +1,5 @@ +{ + "version": "1.0", + "defaultProvider": "cdnjs", + "libraries": [] +} \ No newline at end of file diff --git a/AccountManagement.Application/AccountApplication.cs b/AccountManagement.Application/AccountApplication.cs index 39202547..92542c51 100644 --- a/AccountManagement.Application/AccountApplication.cs +++ b/AccountManagement.Application/AccountApplication.cs @@ -12,10 +12,12 @@ using _0_Framework.Application.Sms; using AccountManagement.Domain.AccountLeftWorkAgg; using AccountManagement.Domain.CameraAccountAgg; using AccountManagement.Domain.RoleAgg; +using CompanyManagment.App.Contracts.Workshop; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc.Rendering; using static Microsoft.EntityFrameworkCore.DbLoggerCategory.Database; using TaskManager.Domain.PositionAgg; +using Company.Domain.WorkshopAgg; //using AccountManagement.Domain.RoleAgg; namespace AccountManagement.Application; @@ -30,11 +32,12 @@ public class AccountApplication : IAccountApplication private readonly ISmsService _smsService; private readonly ICameraAccountRepository _cameraAccountRepository; private readonly IPositionRepository _positionRepository; - private readonly IAccountLeftworkRepository _accountLeftworkRepository; + private readonly IAccountLeftworkRepository _accountLeftworkRepository; + private readonly IWorkshopRepository _workshopRepository; public AccountApplication(IAccountRepository accountRepository, IPasswordHasher passwordHasher, - IFileUploader fileUploader, IAuthHelper authHelper, IRoleRepository roleRepository, IWorker worker, ISmsService smsService, ICameraAccountRepository cameraAccountRepository, IPositionRepository positionRepository, IAccountLeftworkRepository accountLeftworkRepository) + IFileUploader fileUploader, IAuthHelper authHelper, IRoleRepository roleRepository, IWorker worker, ISmsService smsService, ICameraAccountRepository cameraAccountRepository, IPositionRepository positionRepository, IAccountLeftworkRepository accountLeftworkRepository, IWorkshopRepository workshopRepository) { _authHelper = authHelper; _roleRepository = roleRepository; @@ -42,6 +45,7 @@ public class AccountApplication : IAccountApplication _cameraAccountRepository = cameraAccountRepository; _positionRepository = positionRepository; _accountLeftworkRepository = accountLeftworkRepository; + _workshopRepository = workshopRepository; _fileUploader = fileUploader; _passwordHasher = passwordHasher; _accountRepository = accountRepository; @@ -137,8 +141,8 @@ public class AccountApplication : IAccountApplication return opreation.Failed("پر کردن تمامی فیلدها الزامی است"); if (_accountRepository.Exists(x => x.Username == command.Username)) return opreation.Failed("نام کاربری تکراری است"); - if (_accountRepository.Exists(x => x.Mobile == command.Mobile || - (x.NationalCode == command.NationalCode && !string.IsNullOrWhiteSpace(x.NationalCode)))) + if (_accountRepository.Exists(x => x.Mobile == command.Mobile && x.IsActiveString =="true")) + return opreation.Failed("مقادیر وارد شده تکراری است"); //var nationalCodeValidation = command.NationalCode.NationalCodeValid(); @@ -223,6 +227,23 @@ public class AccountApplication : IAccountApplication var authViewModel = new AuthViewModel(account.id, account.RoleId, account.Fullname , account.Username, account.Mobile, account.ProfilePhoto, permissions, account.RoleName, account.AdminAreaPermission, account.ClientAriaPermission, positionValue); + if (account.ClientAriaPermission == "true" && account.AdminAreaPermission == "false" && + account.IsActiveString == "true") + { + var workshopList = _workshopRepository.SearchForClient(new WorkshopSearchModel() { AccountId = account.id }) + .OrderByDescending(x => x.PersonnelCount).ToList().Select(x => new WorkshopClaim() + { + Slug = _passwordHasher.SlugHasher(x.Id), + Name = x.WorkshopFullName, + PersonnelCount = x.PersonnelCount, + Id = x.Id + } + ).ToList(); + authViewModel.WorkshopList = workshopList; + if (workshopList.Any()) + authViewModel.WorkshopSlug = _passwordHasher.SlugHasher(workshopList.First().Id); + } + _authHelper.Signin(authViewModel); if ((account.AdminAreaPermission == "true" && account.ClientAriaPermission == "true" && account.IsActiveString == "true") || (account.AdminAreaPermission == "true" && account.ClientAriaPermission == "false" && account.IsActiveString == "true")) @@ -281,6 +302,23 @@ public class AccountApplication : IAccountApplication var authViewModel = new AuthViewModel(account.id, account.RoleId, account.Fullname , account.Username, account.Mobile, account.ProfilePhoto, permissions, account.RoleName, account.AdminAreaPermission, account.ClientAriaPermission, positionValue); + if (account.ClientAriaPermission == "true" && account.AdminAreaPermission == "false" && + account.IsActiveString == "true") + { + var workshopList = _workshopRepository.SearchForClient(new WorkshopSearchModel() { AccountId = account.id }) + .OrderByDescending(x => x.PersonnelCount).ToList().Select(x => new WorkshopClaim() + { + Slug = _passwordHasher.SlugHasher(x.Id), + Name = x.WorkshopFullName, + PersonnelCount = x.PersonnelCount, + Id = x.Id + } + ).ToList(); + authViewModel.WorkshopList = workshopList; + if (workshopList.Any()) + authViewModel.WorkshopSlug = _passwordHasher.SlugHasher(workshopList.First().Id); + } + _authHelper.Signin(authViewModel); long idAutoriz = 0; if (account.AdminAreaPermission == "true" && account.ClientAriaPermission == "true" || account.AdminAreaPermission == "true" && account.ClientAriaPermission == "false") @@ -408,6 +446,17 @@ public class AccountApplication : IAccountApplication _authHelper.SignOut(); var authViewModel = new AuthViewModel(account.id, account.RoleId, account.Fullname , account.Username, account.Mobile, account.ProfilePhoto, permissions, account.RoleName, "false", "true",null); + authViewModel.WorkshopList = _workshopRepository.SearchForClient(new WorkshopSearchModel() { AccountId = account.id }) + .OrderByDescending(x => x.PersonnelCount).ToList().Select(x => new WorkshopClaim() + { + Slug = _passwordHasher.SlugHasher(x.Id), + Name = x.WorkshopFullName, + PersonnelCount = x.PersonnelCount, + Id = x.Id + } + ).ToList(); + if (authViewModel.WorkshopList.Any()) + authViewModel.WorkshopSlug = _passwordHasher.SlugHasher(authViewModel.WorkshopList.First().Id); _authHelper.Signin(authViewModel); return operation.Succcedded(2); } diff --git a/AccountManagement.Domain/AccountAgg/Account.cs b/AccountManagement.Domain/AccountAgg/Account.cs index 60ba1f0b..26f7df22 100644 --- a/AccountManagement.Domain/AccountAgg/Account.cs +++ b/AccountManagement.Domain/AccountAgg/Account.cs @@ -60,7 +60,7 @@ namespace AccountManagement.Domain.AccountAgg Username = username; Password = password; Mobile = mobile; - NationalCode = nationalCode; + NationalCode = ""; RoleId = 15; RoleName = "کارفرما"; AdminAreaPermission = "false"; diff --git a/AccountMangement.Infrastructure.EFCore/Repository/AccountLeftworkRepository.cs b/AccountMangement.Infrastructure.EFCore/Repository/AccountLeftworkRepository.cs index 77232f33..8fa75641 100644 --- a/AccountMangement.Infrastructure.EFCore/Repository/AccountLeftworkRepository.cs +++ b/AccountMangement.Infrastructure.EFCore/Repository/AccountLeftworkRepository.cs @@ -32,7 +32,7 @@ public class AccountLeftworkRepository : RepositoryBase, var initial = new DateTime(2150, 1, 1); string start = ""; string end = ""; - var res = _accountContext.AccountLeftWorks.FirstOrDefault(x => x.AccountId == accountId); + var res = _accountContext.AccountLeftWorks.Where(x => x.AccountId == accountId).OrderByDescending(x=>x.StartWorkGr).FirstOrDefault(); if (res != null) { start = res.StartWorkGr != initial ? res.StartWorkGr.ToFarsi() : ""; diff --git a/Company.Domain/CustomizeCheckoutAgg/CustomizeCheckout.cs b/Company.Domain/CustomizeCheckoutAgg/CustomizeCheckout.cs new file mode 100644 index 00000000..c7f926ae --- /dev/null +++ b/Company.Domain/CustomizeCheckoutAgg/CustomizeCheckout.cs @@ -0,0 +1,209 @@ +using _0_Framework.Domain; +using System; +using _0_Framework.Application; + + +namespace Company.Domain.CustomizeCheckoutAgg; +/// +/// تصفیه حساب دلخواه +/// +public class CustomizeCheckout : EntityBase +{ + public CustomizeCheckout(DateTime contractStart, DateTime contractEnd, long employeeId, long workshopId, long? contractId, long employerId, double monthlySalary, double fridayPay, double overTimePay, double baseYearsPay, double bonusesPay, double nightWorkPay, double marriedAllowance, double shiftPay, double familyAllowance, double leavePay, double insuranceDeduction, double fineAbsenceDeduction, double lateToWorkDeduction, double earlyExitDeduction, double rewardPay, double salaryAidDeduction, double installmentDeduction, double fineDeduction, double taxDeduction, string sumOfWorkingDays, string totalClaims, string totalDeductions, double totalPayment) + { + YearInt = Convert.ToInt32(contractStart.ToFarsi().Substring(0,4)); + MonthInt = Convert.ToInt32(contractStart.ToFarsi().Substring(5, 2)); + ContractStart = contractStart; + ContractEnd = contractEnd; + EmployeeId = employeeId; + WorkshopId = workshopId; + EmployerId = employerId; + MonthlySalary = monthlySalary; + FridayPay = fridayPay; + OverTimePay = overTimePay; + BaseYearsPay = baseYearsPay; + BonusesPay = bonusesPay; + NightWorkPay = nightWorkPay; + MarriedAllowance = marriedAllowance; + ShiftPay = shiftPay; + FamilyAllowance = familyAllowance; + LeavePay = leavePay; + InsuranceDeduction = insuranceDeduction; + FineAbsenceDeduction = fineAbsenceDeduction; + LateToWorkDeduction = lateToWorkDeduction; + EarlyExitDeduction = earlyExitDeduction; + RewardPay = rewardPay; + SalaryAidDeduction = salaryAidDeduction; + InstallmentDeduction = installmentDeduction; + FineDeduction = fineDeduction; + TaxDeduction = taxDeduction; + SumOfWorkingDays = sumOfWorkingDays; + TotalClaims = totalClaims; + TotalDeductions = totalDeductions; + TotalPayment = totalPayment; + ContractId = contractId; + IsActiveString = IsActive.True; + } + + #region Getters + /// + /// سال به صورت استرینگ + /// + public string Year => $"{YearInt}"; + /// + /// نام ماه شمسی + /// + public string Month => MonthInt.ToFarsiMonthByIntNumber(); + #endregion + + #region DatabaseEntities + + public IsActive IsActiveString { get; private set; } + + /// + /// شماره قرارداد + /// + public string ContractNo { get; private set; } + /// + /// سال + /// + public int YearInt { get; private set; } + /// + /// ماه + /// + public int MonthInt { get; private set; } + + /// + /// حقوق ماهانه + /// + public double MonthlySalary { get; private set; } + + /// + /// شروع تصفیه حساب + /// + public DateTime ContractStart { get; private set; } + + /// + /// پایان تصفیه حساب + /// + public DateTime ContractEnd { get; private set; } + + + /// + /// جمعه کاری + /// + public double FridayPay { get; private set; } + + /// + /// اضافه کاری + /// + public double OverTimePay { get; private set; } + + /// + /// سنوات + /// + public double BaseYearsPay { get; private set; } + + /// + /// عیدی + /// + public double BonusesPay { get; private set; } + + /// + /// شب کاری + /// + public double NightWorkPay { get; private set; } + + /// + /// حق تاهل + /// + public double MarriedAllowance { get; private set; } + + /// + /// نوبت کاری + /// + public double ShiftPay { get; private set; } + + /// + /// حق اولاد(حق فرزند)ء + /// + public double FamilyAllowance { get; private set; } + + /// + /// مزد مرخصی + /// + public double LeavePay { get; private set; } + + /// + /// حق بیمه + /// + public double InsuranceDeduction { get; private set; } + + /// + /// جریمه غیبت + /// + public double FineAbsenceDeduction { get; private set; } + + /// + /// تاخیر در ورود + /// + public double LateToWorkDeduction { get; private set; } + + /// + /// تعجیل در خروج + /// + public double EarlyExitDeduction { get; private set; } + + /// + /// پاداش + /// + public double RewardPay { get; private set; } + + /// + /// مساعده + /// + public double SalaryAidDeduction { get; private set; } + + /// + /// قسط وام + /// + public double InstallmentDeduction { get; private set; } + + /// + /// جریمه + /// + public double FineDeduction { get; private set; } + + /// + /// مالیات + /// + public double TaxDeduction { get; private set; } + + + /// + /// تعداد روزهای کارکرد + /// + public string SumOfWorkingDays { get; private set; } + + /// + /// مجموع مطالبات + /// + public string TotalClaims { get; private set; } + /// + /// مجموع کسورات + /// + public string TotalDeductions { get; private set; } + /// + /// مجموع پرداختی + /// + public double TotalPayment { get; private set; } + + #endregion + + #region Relations + public long EmployeeId { get; private set; } + public long WorkshopId { get; private set; } + public long EmployerId { get; private set; } + public long? ContractId { get; private set; } + #endregion +} \ No newline at end of file diff --git a/Company.Domain/EmployeeAgg/Employee.cs b/Company.Domain/EmployeeAgg/Employee.cs index 6c9b4c8d..07d30456 100644 --- a/Company.Domain/EmployeeAgg/Employee.cs +++ b/Company.Domain/EmployeeAgg/Employee.cs @@ -124,6 +124,9 @@ public class Employee : EntityBase public List EmployeeInsuranceRecords { get; private set; } public List PersonnelCodeList { get; set; } + + public string FullName => $"{FName} {LName}"; + //public List Checkouts { get; set; } public Employee() { diff --git a/CompanyManagment.App.Contracts/RollCallEmployee/AdjustRollCallEmployeesWithEmployeeLeftWork.cs b/CompanyManagment.App.Contracts/RollCallEmployee/AdjustRollCallEmployeesWithEmployeeLeftWork.cs index 2995b7d1..efd1439e 100644 --- a/CompanyManagment.App.Contracts/RollCallEmployee/AdjustRollCallEmployeesWithEmployeeLeftWork.cs +++ b/CompanyManagment.App.Contracts/RollCallEmployee/AdjustRollCallEmployeesWithEmployeeLeftWork.cs @@ -4,7 +4,8 @@ namespace CompanyManagment.App.Contracts.RollCallEmployee { public class AdjustRollCallEmployeesWithEmployeeLeftWork { - public long RollCallEmployeeId { get; set; } + public DateTime LeaveDate { get; set; } + public long RollCallStatusId { get; set; } } } diff --git a/CompanyManagment.Application/LeftWorkApplication.cs b/CompanyManagment.Application/LeftWorkApplication.cs index 94559962..82a96824 100644 --- a/CompanyManagment.Application/LeftWorkApplication.cs +++ b/CompanyManagment.Application/LeftWorkApplication.cs @@ -596,44 +596,39 @@ public class LeftWorkApplication : ILeftWorkApplication //این متد ترک کار های کارمند را با فعالیت حضور غیاب یکپارچه می کند private void IfEmployeeHasNewLeftWorkDateAddEndDateToRollCallStatus(long employeeId) { + //get last leftworks for employee in all workshops + var leftWorks = _leftWorkRepository.search(new LeftWorkSearchModel() { EmployeeId = employeeId }).GroupBy(x => x.WorkshopId).Select(x => + { + var leftWork = x.MaxBy(y => y.StartWorkDateGr); + return new LeftWorkViewModel() + { + EmployeeId = employeeId, + WorkshopId = x.Key, + LeftWorkDateGr = leftWork.LeftWorkDateGr, + StartWorkDateGr = leftWork.StartWorkDateGr + }; + }).ToList(); - //get all leftworks for employee - var leftWorks = _leftWorkRepository.search(new LeftWorkSearchModel() { EmployeeId = employeeId }).GroupBy(x=>x.WorkshopId).Select(x=> - { - var leftwork = x.MaxBy(y => y.StartWorkDateGr); - return new LeftWorkViewModel() - { - EmployeeId = employeeId, - WorkshopId = x.Key, - LeftWorkDateGr = leftwork.LeftWorkDateGr, - StartWorkDateGr = leftwork.StartWorkDateGr - }; - }); + //get rollCallEmployee associated with those leftworks which have a higher end date than leftworkDate + var rollCallsEmployee = _rollCallEmployeeRepository.GetByEmployeeIdWithStatuses(employeeId) + .Where(x => leftWorks.Any(y => y.WorkshopId == x.WorkshopId)).ToList(); - //get rollCallEmployee associated with those leftworks which have a higher end date than leftworkDate - var rollCallsEmployee = _rollCallEmployeeRepository.GetByEmployeeIdWithStatuses(employeeId).GroupBy(x=>x.WorkshopId).Select( - x => - { - var maxRollCall = x.MaxBy(y => y.Statuses); - return new RollCallEmployeeViewModel() - { - WorkshopId = x.Key, - EmployeeId = employeeId, - Id=maxRollCall.Id, - Statuses = maxRollCall.Statuses - }; - }) - .Where(x => leftWorks.Any(y => y.WorkshopId == x.WorkshopId && x.Statuses.Any(z => z.StartDateGr < y.LeftWorkDateGr && z.EndDateGr > y.LeftWorkDateGr))); + var joinedList = rollCallsEmployee.Join(leftWorks, x => x.WorkshopId, y => y.WorkshopId, (x, y) => new + { + x.WorkshopId, + x.EmployeeId, + y.LeftWorkDateGr, + Status = x.Statuses.OrderByDescending(z => z.StartDate).FirstOrDefault(z => z.StartDateGr < y.LeftWorkDateGr && z.EndDateGr > y.LeftWorkDateGr) + }); - //shaping up the list to send as parameter to repository - var newRollCallRecords = rollCallsEmployee.Select(x => new AdjustRollCallEmployeesWithEmployeeLeftWork() - { - LeaveDate = leftWorks.FirstOrDefault(y => y.WorkshopId == x.WorkshopId && y.EmployeeId == x.EmployeeId)!.LeftWorkDateGr, - RollCallEmployeeId = x.Id - }).ToList(); - - - _rollCallEmployeeStatusRepository.AdjustRollCallStatusEndDates(newRollCallRecords); + //shaping up the list to send as parameter to repository + var newRollCallRecords = joinedList.Where(x => x.Status != null).Select(x => new AdjustRollCallEmployeesWithEmployeeLeftWork() + { + LeaveDate = x.LeftWorkDateGr, + RollCallStatusId = x.Status.Id + }).ToList(); + if(newRollCallRecords.Count > 0) + _rollCallEmployeeStatusRepository.AdjustRollCallStatusEndDates(newRollCallRecords); } #endregion diff --git a/CompanyManagment.EFCore/Mapping/CustomizeCheckoutMapping.cs b/CompanyManagment.EFCore/Mapping/CustomizeCheckoutMapping.cs new file mode 100644 index 00000000..f4c2d357 --- /dev/null +++ b/CompanyManagment.EFCore/Mapping/CustomizeCheckoutMapping.cs @@ -0,0 +1,17 @@ +using Company.Domain.CustomizeCheckoutAgg; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; + +namespace CompanyManagment.EFCore.Mapping; + +public class CustomizeCheckoutMapping : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("CustomizeCheckouts"); + builder.HasKey(x => x.id); + + builder.Property(x => x.IsActiveString).HasConversion().HasMaxLength(5); + builder.Property(x => x.ContractNo).HasMaxLength(50); + } +} \ No newline at end of file diff --git a/CompanyManagment.EFCore/Mapping/EmployeeMapping.cs b/CompanyManagment.EFCore/Mapping/EmployeeMapping.cs index e1abec19..5913af19 100644 --- a/CompanyManagment.EFCore/Mapping/EmployeeMapping.cs +++ b/CompanyManagment.EFCore/Mapping/EmployeeMapping.cs @@ -70,6 +70,12 @@ public class EmployeeMapping : IEntityTypeConfiguration .WithOne(x => x.Employee) .HasForeignKey(x => x.EmployeeId); + #region Pooya + + + builder.Ignore(x => x.FullName); + #endregion + } diff --git a/CompanyManagment.EFCore/Repository/ReportRepository.cs b/CompanyManagment.EFCore/Repository/ReportRepository.cs index efced907..dfb94a0c 100644 --- a/CompanyManagment.EFCore/Repository/ReportRepository.cs +++ b/CompanyManagment.EFCore/Repository/ReportRepository.cs @@ -92,7 +92,7 @@ public class ReportRepository : IReportRepository #endregion - }).Where(e => blockContractingPartyIds.Contains(e.ContractingPartId) && e.AccountIdList.Count > 0); + }).Where(e => blockContractingPartyIds.Contains(e.ContractingPartId) && e.AccountIdList.Count > 0).AsSplitQuery(); var workshopsList = workshops.Select(x => new ActiveWorkshops { @@ -114,12 +114,12 @@ public class ReportRepository : IReportRepository CheckoutLeftIds = _context.InstitutionContractSet.Any(c => c.ContractingPartyId == x.ContractingPartId && c.ContractStartGr <= currentMonthStart && c.ContractEndGr >= currentMonthEnd) ? x.CheckoutLeftIds : new List(), #endregion - }); + }).AsSplitQuery(); //var wCount = workshops.Count(); //var partyId = workshops.Select(x => x.ContractingPartId).ToList(); Console.WriteLine("Ripo query 1 >>>>>: " + watch.Elapsed); - var res = workshopsList.ToList(); + var res = workshopsList.AsEnumerable(); watch.Restart(); var result = res.Select(x => new ActiveWorkshops { @@ -162,7 +162,7 @@ public class ReportRepository : IReportRepository (l.ContractEnd >= nextMonthStart && l.ContractEnd <= nextMonthEnd)) : 0, - }); + }).AsEnumerable(); Console.WriteLine("Ripo query 2 >>>>>: " + watch.Elapsed); var contractAccountResult = result.Select(x => new ActiveWorkshops() @@ -182,7 +182,7 @@ public class ReportRepository : IReportRepository IsActiveString = x.IsActiveString, WorkshopFullName = x.WorkshopFullName, - }).Where(x => x.AccountId != 0).ToList(); + }).Where(x => x.AccountId != 0 && x.ContractLeftWorkCount > 0).ToList(); var checkoutAccountResult = result.Select(x => new ActiveWorkshops() { Id = x.Id, @@ -201,7 +201,7 @@ public class ReportRepository : IReportRepository IsActiveString = x.IsActiveString, WorkshopFullName = x.WorkshopFullName, - }).Where(x => x.AccountId != 0).ToList(); + }).Where(x => x.AccountId != 0 && x.CheckoutLeftWorkCount > 0).ToList(); watch.Restart(); //قرارداد هایی که باید اسجاد می شد var contractToBe = contractAccountResult.Sum(x => x.ContractLeftWorkCount); @@ -226,7 +226,7 @@ public class ReportRepository : IReportRepository AccountId = x.Key, AccountFullName = _accountContext.Accounts.FirstOrDefault(a=>a.id == x.Key)!.Fullname, - ContractDonePercent = (x.Sum(c => c.ContrctDoneCount) * 100) / x.Sum(c => c.ContractLeftWorkCount), + ContractDonePercent = (x.Sum(c => c.ContrctDoneCount) * 100) / (x.Sum(c => c.ContractLeftWorkCount)), ContractSignPercent = x.Sum(c => c.ContrctDoneCount) > 0 ? (x.Sum(c => c.ContrctSignDoneCount) * 100) / (x.Sum(c => c.ContrctDoneCount)) : 0, @@ -354,7 +354,7 @@ public class ReportRepository : IReportRepository }).Where(e => blockContractingPartyIds.Contains(e.ContractingPartId)) - .Where(a => a.AccountIdList.Contains(accountId)); + .Where(a => a.AccountIdList.Contains(accountId)).AsSplitQuery(); var workshopsList = workshops.Select(x => new ActiveWorkshops { @@ -488,7 +488,7 @@ public class ReportRepository : IReportRepository }).Where(e => blockContractingPartyIds.Contains(e.ContractingPartId)) - .Where(a => a.AccountIdList.Contains(accountId)); + .Where(a => a.AccountIdList.Contains(accountId)).AsSplitQuery(); var workshopsList = workshops.Select(x => new ActiveWorkshops { Id = x.Id, @@ -628,7 +628,7 @@ public class ReportRepository : IReportRepository #endregion }).Where(e => blockContractingPartyIds.Contains(e.ContractingPartId)) - .Where(a => a.AccountIdList.Contains(accountId)); + .Where(a => a.AccountIdList.Contains(accountId)).AsSplitQuery(); var workshopsList = workshops.Select(x => new ActiveWorkshops { Id = x.Id, @@ -761,7 +761,7 @@ public class ReportRepository : IReportRepository #endregion }).Where(e => blockContractingPartyIds.Contains(e.ContractingPartId)) - .Where(a => a.AccountIdList.Contains(accountId)); + .Where(a => a.AccountIdList.Contains(accountId)).AsSplitQuery(); var workshopsList = workshops.Select(x => new ActiveWorkshops { Id = x.Id, @@ -1087,7 +1087,7 @@ public class ReportRepository : IReportRepository (l.LeftWorkDateGr >= nextMonthStart && l.LeftWorkDateGr <= nextMonthEnd)).Select(l => l.EmployeeId).ToList(), #endregion }).Where(e => blockContractingPartyIds.Contains(e.ContractingPartId)) - .Where(a => a.AccountIdList.Contains(accountId)); + .Where(a => a.AccountIdList.Contains(accountId)).AsSplitQuery(); var workshopsList = workshops.Select(x => new ActiveWorkshops { Id = x.Id, @@ -1221,7 +1221,7 @@ public class ReportRepository : IReportRepository #endregion }).Where(e => blockContractingPartyIds.Contains(e.ContractingPartId)) - .Where(a => a.AccountIdList.Contains(accountId)); + .Where(a => a.AccountIdList.Contains(accountId)).AsSplitQuery(); var workshopsList = workshops.Select(x => new ActiveWorkshops { Id = x.Id, @@ -1363,7 +1363,7 @@ public class ReportRepository : IReportRepository #endregion }).Where(e => blockContractingPartyIds.Contains(e.ContractingPartId)) - .Where(a => a.AccountIdList.Contains(accountId)); + .Where(a => a.AccountIdList.Contains(accountId)).AsSplitQuery(); var workshopsList = workshops.Select(x => new ActiveWorkshops { Id = x.Id, @@ -1493,7 +1493,7 @@ public class ReportRepository : IReportRepository #endregion }).Where(e => blockContractingPartyIds.Contains(e.ContractingPartId)) - .Where(a => a.AccountIdList.Contains(accountId)); + .Where(a => a.AccountIdList.Contains(accountId)).AsSplitQuery(); var workshopsList = workshops.Select(x => new ActiveWorkshops { Id = x.Id, diff --git a/CompanyManagment.EFCore/Repository/RollCallEmployeeRepository.cs b/CompanyManagment.EFCore/Repository/RollCallEmployeeRepository.cs index fad629b0..8036ced1 100644 --- a/CompanyManagment.EFCore/Repository/RollCallEmployeeRepository.cs +++ b/CompanyManagment.EFCore/Repository/RollCallEmployeeRepository.cs @@ -68,36 +68,57 @@ public class RollCallEmployeeRepository : RepositoryBase public List GetPersonnelRollCallListPaginate(RollCallEmployeeSearchModel command) { - var dateNow = DateTime.Now; - var rawQuery = _context.Employees.Include(x => x.LeftWorks).Include(x => x.LeftWorkInsurances) - .Where(x => x.LeftWorks.Any(y => y.WorkshopId == command.WorkshopId && y.StartWorkDate <= dateNow && y.LeftWorkDate > dateNow) || - x.LeftWorkInsurances.Any(y => y.WorkshopId == command.WorkshopId && y.StartWorkDate <= dateNow && - (y.LeftWorkDate > dateNow || y.LeftWorkDate == null))); - if (!string.IsNullOrWhiteSpace(command.Name)) - rawQuery = rawQuery.Where(x => (x.FName + " " + x.LName).Contains(command.Name)); + var dateNow = DateTime.Now; + var rawQuery = _context.Employees.Include(x => x.LeftWorks).Include(x => x.LeftWorkInsurances) + .Where(x => x.LeftWorks.Any(y => + y.WorkshopId == command.WorkshopId && y.StartWorkDate <= dateNow && + y.LeftWorkDate > dateNow) || + x.LeftWorkInsurances.Any(y => + y.WorkshopId == command.WorkshopId && y.StartWorkDate <= dateNow && + (y.LeftWorkDate > dateNow || y.LeftWorkDate == null))).OrderByDescending(x => x.id).AsQueryable().AsSplitQuery(); + if (!string.IsNullOrWhiteSpace(command.Name)) + rawQuery = rawQuery.Where(x => (x.FName + " " + x.LName).Contains(command.Name)); - var list = rawQuery.ToList(); - var res = list.Select(x => new RollCallEmployeeViewModel - { - WorkshopId = command.WorkshopId, - EmployeeId = x.id, - Id = _context.RollCallEmployees.Any(r => r.EmployeeId == x.id && r.WorkshopId == command.WorkshopId) ? - _context.RollCallEmployees.FirstOrDefault(r => r.EmployeeId == x.id && r.WorkshopId == command.WorkshopId)!.id : 0, - EmployeeFullName = $"{x.FName} {x.LName}", - EmployeeSlug = _passwordHasher.SlugHasher(x.id), - NationalCode = _context.Employees.FirstOrDefault(e => e.id == x.id)?.NationalCode, - IsActiveString = _context.RollCallEmployees.Any(r => r.EmployeeId == x.id && r.WorkshopId == command.WorkshopId && r.IsActiveString == "true") ? "true" : "false", - HasUploadedImage = _context.RollCallEmployees.Any(r => r.EmployeeId == x.id && r.WorkshopId == command.WorkshopId && r.HasUploadedImage == "true") ? "true" : "false", - ImagePath = (System.IO.File.Exists(Path.Combine(_webHostEnvironment.ContentRootPath, "Faces", command.WorkshopId.ToString(), x.id.ToString(), "1.jpg"))) - ? Tools.ResizeImage(Path.Combine(_webHostEnvironment.ContentRootPath, "Faces", command.WorkshopId.ToString(), x.id.ToString(), "1.jpg"), 150, 150) - : "", - }).OrderBy(x => x.PersonelCode) - .Skip(command.PageIndex) - .Take(30) - .ToList(); + var rollCallEmployees = _context.RollCallEmployees.Where(x => x.WorkshopId == command.WorkshopId); - return res; - } + + var joinedQuery = from employee in rawQuery + join rollCallEmployee in rollCallEmployees + on employee.id equals rollCallEmployee.EmployeeId into grp + from joinedRollCall in grp.DefaultIfEmpty() + select new RollCallEmployeeViewModel() + { + WorkshopId = command.WorkshopId, + EmployeeId = employee.id, + Id = joinedRollCall == null ? 0 : joinedRollCall.id, + EmployeeFullName = employee.FullName, + NationalCode = employee.NationalCode, + IsActiveString = joinedRollCall == null ? "false" : joinedRollCall.IsActiveString, + HasUploadedImage = joinedRollCall == null ? "false" : joinedRollCall.HasUploadedImage + }; + var firstlist = joinedQuery.AsSplitQuery(); + var list = firstlist.OrderByDescending(x => x.IsActiveString == "true" ? 1 : 0) + .ThenByDescending(x => x.HasUploadedImage == "true" ? 1 : 0) + .Skip(command.PageIndex).Take(30).ToList(); + + list = list.Select(x => new RollCallEmployeeViewModel() + { + WorkshopId = x.WorkshopId, + EmployeeId = x.EmployeeId, + Id = x.Id, + EmployeeFullName = x.EmployeeFullName, + NationalCode = x.NationalCode, + IsActiveString = x.IsActiveString, + HasUploadedImage = x.HasUploadedImage, + EmployeeSlug = _passwordHasher.SlugHasher(x.EmployeeId), + ImagePath = (System.IO.File.Exists(Path.Combine(_webHostEnvironment.ContentRootPath, "Faces", command.WorkshopId.ToString(), x.EmployeeId.ToString(), "1.jpg"))) + ? Tools.ResizeImage(Path.Combine(_webHostEnvironment.ContentRootPath, "Faces", command.WorkshopId.ToString(), x.EmployeeId.ToString(), "1.jpg"), 150, 150) : "" + }).ToList(); + + + + return list; + } public RollCallEmployee GetWithRollCallStatus(long id) { diff --git a/CompanyManagment.EFCore/Repository/RollCallEmployeeStatusRepository.cs b/CompanyManagment.EFCore/Repository/RollCallEmployeeStatusRepository.cs index c54c867e..d0289abf 100644 --- a/CompanyManagment.EFCore/Repository/RollCallEmployeeStatusRepository.cs +++ b/CompanyManagment.EFCore/Repository/RollCallEmployeeStatusRepository.cs @@ -32,23 +32,21 @@ namespace CompanyManagment.EFCore.Repository } public void AdjustRollCallStatusEndDates(List command) { - var rollCallEmployeeIds = command.Select(y => y.RollCallEmployeeId); - var list = _context.RollCallEmployeesStatus.Where(x =>rollCallEmployeeIds.Any(y =>y == x.RollCallEmployeeId)) - .GroupBy(x => x.RollCallEmployeeId).AsEnumerable().Select(x=> new RollCallEmployeeStatusViewModel() - { - Id = x.MaxBy(c=>c.StartDate).id, + var statusIds = command.Select(x => x.RollCallStatusId); + var finalList = _context.RollCallEmployeesStatus.Where(x => statusIds.Contains(x.id)).AsEnumerable(); + finalList.Where(x => command.Any(y => !y.LeaveDate.IsDateUndefined() && y.LeaveDate < x.EndDate)).ToList().ForEach( + z => + { + var cmd = command.FirstOrDefault(y => y.RollCallStatusId == z.id); + if (cmd!.LeaveDate >= z.StartDate) + z.Edit(z.StartDate, cmd!.LeaveDate); + } + ); - }).Select(c=>c.Id); - - var finalList = _context.RollCallEmployeesStatus.Where(x => list.Contains(x.id)).AsEnumerable(); - finalList.Where(x => command.Any(y => !y.LeaveDate.IsDateUndefined() && y.LeaveDate < x.EndDate)).ToList().ForEach(x => - x.Edit(x.StartDate, command.FirstOrDefault(y => y.RollCallEmployeeId == x.RollCallEmployeeId)!.LeaveDate) - ); - - _context.SaveChanges(); - } + _context.SaveChanges(); + } #endregion } } diff --git a/CompanyManagment.EFCore/Repository/WorkshopRepository.cs b/CompanyManagment.EFCore/Repository/WorkshopRepository.cs index 3e52969e..ecd11ece 100644 --- a/CompanyManagment.EFCore/Repository/WorkshopRepository.cs +++ b/CompanyManagment.EFCore/Repository/WorkshopRepository.cs @@ -749,7 +749,7 @@ public class WorkshopRepository : RepositoryBase SearchForClient(WorkshopSearchModel searchModel) { - var acountID = _authHelper.CurrentAccountId(); + var acountID = searchModel.AccountId > 0 ? searchModel.AccountId : _authHelper.CurrentAccountId(); var contracingPartyAcc = _context.ContractingPartyAccounts.FirstOrDefault(x => x.AccountId == acountID); if (contracingPartyAcc == null) { diff --git a/ServiceHost/Areas/Admin/Pages/Company/InstitutionContracts/Index.cshtml.cs b/ServiceHost/Areas/Admin/Pages/Company/InstitutionContracts/Index.cshtml.cs index 188ac642..209d12b6 100644 --- a/ServiceHost/Areas/Admin/Pages/Company/InstitutionContracts/Index.cshtml.cs +++ b/ServiceHost/Areas/Admin/Pages/Company/InstitutionContracts/Index.cshtml.cs @@ -338,7 +338,7 @@ public class IndexModel : PageModel Username = userPass, Password = userPass, Mobile = phone.PhoneNumber, - NationalCode = conractingParty.IsLegal == "حقوقی" ? "حقوقی" : userPass + NationalCode = userPass }; var res = _accountApplication.RegisterClient(createAcc); if (res.IsSuccedded) diff --git a/ServiceHost/Areas/Admin/Pages/Company/Workshops/Index.cshtml b/ServiceHost/Areas/Admin/Pages/Company/Workshops/Index.cshtml index 9dbaabfd..343712f0 100644 --- a/ServiceHost/Areas/Admin/Pages/Company/Workshops/Index.cshtml +++ b/ServiceHost/Areas/Admin/Pages/Company/Workshops/Index.cshtml @@ -889,8 +889,7 @@ asp-page="./AutoExtension" asp-route-id="@item.Id"> - + diff --git a/ServiceHost/Areas/AdminNew/Pages/Company/Task/CreateModal.cshtml b/ServiceHost/Areas/AdminNew/Pages/Company/Task/CreateModal.cshtml index 2e135ebb..eae58f2c 100644 --- a/ServiceHost/Areas/AdminNew/Pages/Company/Task/CreateModal.cshtml +++ b/ServiceHost/Areas/AdminNew/Pages/Company/Task/CreateModal.cshtml @@ -1,11 +1,10 @@ @model AccountManagement.Application.Contracts.Task.CreateTaskModal @* @model ServiceHost.Areas.AdminNew.Pages.Company.Task.CreateModel *@ @inject _0_Framework.Application.IAuthHelper AuthHelper; -@using _0_Framework.Application @{ + string adminVersion = _0_Framework.Application.Version.AdminVersion; ViewData["title"] = " - وظیفه جدید"; - string adminVersion = _0_Framework.Application.Version.AdminVersion; } @@ -334,4 +333,4 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/ServiceHost/Areas/AdminNew/Pages/Company/Task/DetailsModal.cshtml b/ServiceHost/Areas/AdminNew/Pages/Company/Task/DetailsModal.cshtml index 20bfde03..25fe81b4 100644 --- a/ServiceHost/Areas/AdminNew/Pages/Company/Task/DetailsModal.cshtml +++ b/ServiceHost/Areas/AdminNew/Pages/Company/Task/DetailsModal.cshtml @@ -1,8 +1,9 @@ @model AccountManagement.Application.Contracts.Task.EditTask @using System.Security.Claims @using AccountManagement.Application.Contracts.Media -@using Version = _0_Framework.Application.Version @{ + string adminVersion = _0_Framework.Application.Version.AdminVersion; + MediaViewModel voice = null; var userId = Convert.ToInt64(User.FindFirstValue("AccountId")); @@ -18,9 +19,9 @@ int i = 1; - - - + + + if (Model.AssignViewModels?.Count > 1) @@ -87,31 +88,31 @@
-
-
- طرف حساب: - @Model.ContractingPartyName +
+
+ طرف حساب: + @Model.ContractingPartyName
-
- عنوان وظیفه: - @Model.Title +
+ عنوان وظیفه: + @Model.Title
-
-
- تاریخ ایجاد: - @Model.CreateDateFa +
+
+ تاریخ ایجاد: + @Model.CreateDateFa
-
- تاریخ سررسید: - @Model.AssignViewModels?.First().EndTaskDateFa +
+ تاریخ سررسید: + @Model.AssignViewModels?.First().EndTaskDateFa
@if (!String.IsNullOrWhiteSpace(Model.Description)) { +
توضیحات :
-
توضیحات :
@Html.Raw(Model.Description)
} @@ -211,66 +212,69 @@
-
+
+
+
+
- @if (!Model.IsDone && !Model.IsCancel) - { -
-
- - @foreach (var item in Model.AssignsLists) - { - - } - -
- + @foreach (var item in Model.AssignsLists) + { + + } + +
+ - @if (userId == Model.SenderId) - { - - - - - } - else - { - - - - - } -
- - } + @if (userId == Model.SenderId) + { + + + + + } + else + { + + + + + } +
+ } @@ -280,7 +284,7 @@