diff --git a/0_Framework/Application/Version.cs b/0_Framework/Application/Version.cs index 8e502ad0..3c1d2c51 100644 --- a/0_Framework/Application/Version.cs +++ b/0_Framework/Application/Version.cs @@ -10,13 +10,12 @@ public static class Version { static Version() { - StyleVersion = "2.12.07"; - AdminVersion = "2.5.27"; - CameraVersion = "1.0.4"; + StyleVersion = "2.12.10"; + AdminVersion = "2.5.30"; + CameraVersion = "1.0.6"; } public static string StyleVersion { get; set; } public static string AdminVersion { get; set; } public static string CameraVersion { get; set; } - } \ No newline at end of file diff --git a/AccountMangement.Infrastructure.EFCore/Repository/AccountRepository.cs b/AccountMangement.Infrastructure.EFCore/Repository/AccountRepository.cs index edaf2ea7..6c448baa 100644 --- a/AccountMangement.Infrastructure.EFCore/Repository/AccountRepository.cs +++ b/AccountMangement.Infrastructure.EFCore/Repository/AccountRepository.cs @@ -224,30 +224,30 @@ public class AccountRepository : RepositoryBase, IAccountReposito - public List GetAccountEqualToLowerPositionValue() - { + public List GetAccountEqualToLowerPositionValue() + { - var account = GetIncludePositions(int.Parse(_contextAccessor.HttpContext.User.FindFirst("AccountId").Value)); - return _context.Accounts.Include(x => x.Position) - .Where(x => x.Position.PositionValue >= account.Position.PositionValue && x.IsActiveString == "true").Select(x => new AccountViewModel() - { - PositionValue = x.Position.PositionValue, - Id = x.id, - Fullname = x.Fullname, - Mobile = x.Mobile, - ProfilePhoto = x.ProfilePhoto, - Role = x.Role.Name, - RoleId = x.RoleId, - Username = x.Username, - RoleName = x.RoleName, - CreationDate = x.CreationDate.ToFarsi(), - IsActiveString = x.IsActiveString, - CreationDateGr = x.CreationDate, + var account = GetIncludePositions(int.Parse(_contextAccessor.HttpContext.User.FindFirst("AccountId").Value)); + return _context.Accounts.Include(x => x.Position) + .Where(x => x.Position.PositionValue >= account.Position.PositionValue && x.IsActiveString == "true" && x.id != account.id).Select(x => new AccountViewModel() + { + PositionValue = x.Position.PositionValue, + Id = x.id, + Fullname = x.Fullname, + Mobile = x.Mobile, + ProfilePhoto = x.ProfilePhoto, + Role = x.Role.Name, + RoleId = x.RoleId, + Username = x.Username, + RoleName = x.RoleName, + CreationDate = x.CreationDate.ToFarsi(), + IsActiveString = x.IsActiveString, + CreationDateGr = x.CreationDate, - }).ToList(); + }).ToList(); - } - public List GetAccountsByIds(List ids) + } + public List GetAccountsByIds(List ids) { var res = _context.Accounts.Include(x => x.Position).Where(x => x.PositionId != null); return res.Where(x => ids.Contains(x.id)).ToList(); diff --git a/CompanyManagment.App.Contracts/Workshop/TakePictureModel.cs b/CompanyManagment.App.Contracts/Workshop/TakePictureModel.cs index e9ea2295..0c811e2c 100644 --- a/CompanyManagment.App.Contracts/Workshop/TakePictureModel.cs +++ b/CompanyManagment.App.Contracts/Workshop/TakePictureModel.cs @@ -13,6 +13,8 @@ namespace CompanyManagment.App.Contracts.Workshop public long EmployeeId { get; set; } public string Name { get; set; } public IFormFile ProfilePhoto { get; set; } - public bool HasPicture { get; set; } + public string Pic1 { get; set; } + public string Pic2 { get; set; } + public bool HasPicture { get; set; } } } diff --git a/CompanyManagment.Application/InsuranceListApplication.cs b/CompanyManagment.Application/InsuranceListApplication.cs index 894d9fc3..1c8652f5 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 = 88000000; + employeeDetailsForInsuranceObj.MonthlyBenefits = 5382855; 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 = 88000000; + employeeDetailsForInsuranceObj.MonthlyBenefits = 5382855; list.Add(employeeDetailsForInsuranceObj); } diff --git a/CompanyManagment.Application/RollCallEmployeeApplication.cs b/CompanyManagment.Application/RollCallEmployeeApplication.cs index 5b39cae8..d8776c6d 100644 --- a/CompanyManagment.Application/RollCallEmployeeApplication.cs +++ b/CompanyManagment.Application/RollCallEmployeeApplication.cs @@ -83,15 +83,16 @@ public class RollCallEmployeeApplication : IRollCallEmployeeApplication public OperationResult UploadedImage(long Employeeid, long WorkshopId) { - var opreation = new OperationResult(); - var emp = _rollCallEmployeeRepository.Get(Employeeid); - if (emp == null) - return opreation.Failed("پرسنل یافت نشد"); + var opreation = new OperationResult(); + var emp = _rollCallEmployeeRepository.GetByEmployeeIdAndWorkshopId(Employeeid, WorkshopId); + if (emp == null) + return opreation.Failed("پرسنل یافت نشد"); - emp.HasImage(); - _rollCallEmployeeRepository.SaveChanges(); - return opreation.Succcedded(); - } + var rollCall = _rollCallEmployeeRepository.Get(emp.Id); + rollCall.HasImage(); + _rollCallEmployeeRepository.SaveChanges(); + return opreation.Succcedded(); + } public List GetByWorkshopId(long workshopId) diff --git a/CompanyManagment.EFCore/Repository/RollCallEmployeeRepository.cs b/CompanyManagment.EFCore/Repository/RollCallEmployeeRepository.cs index 94c84d53..9a667009 100644 --- a/CompanyManagment.EFCore/Repository/RollCallEmployeeRepository.cs +++ b/CompanyManagment.EFCore/Repository/RollCallEmployeeRepository.cs @@ -29,6 +29,7 @@ public class RollCallEmployeeRepository : RepositoryBase var query = _context.RollCallEmployees.Select(x => new RollCallEmployeeViewModel() { Id = x.id, + EmployeeId = x.EmployeeId, WorkshopId = x.WorkshopId, EmployeeFullName = x.EmployeeFullName, IsActiveString = x.IsActiveString, diff --git a/CompanyManagment.EFCore/Repository/RollCallRepository.cs b/CompanyManagment.EFCore/Repository/RollCallRepository.cs index 391b00ab..f5e709ba 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 = $"{Convert.ToInt32(x.TotalhourseSpan.TotalHours)}:{x.TotalhourseSpan.Minutes.ToString("00")}", + TotalWorkingHours = $"{x.TotalhourseSpan.TotalHours.ToString("0")}:{x.TotalhourseSpan.Minutes.ToString("00")}", DayOfWeek = x.DayOfWeek, RollCallDateFa = x.RollCallDateFa, DateTimeGr = x.DateTimeGr, @@ -237,7 +237,7 @@ public class RollCallRepository : RepositoryBase, IRollCallRepos IsHoliday = _holidayItemApplication.IsHoliday(x.DateGr), IsAbsent = !x.RollCallTimesList.Any(), RollCallTimesList = x.RollCallTimesList, - TotalWorkingHours = $"{Convert.ToInt32(x.TotalWorkingHoursSpan.TotalHours)}:{x.TotalWorkingHoursSpan.Minutes.ToString("00")}", + TotalWorkingHours = $"{x.TotalWorkingHoursSpan.TotalHours.ToString("0")}:{x.TotalWorkingHoursSpan.Minutes.ToString("00")}", }).ToList(); return new EmployeeRollCallsByMonthViewModel() { @@ -362,7 +362,7 @@ public class RollCallRepository : RepositoryBase, IRollCallRepos HasLeave = x.HasLeave, IsAbsent = x.IsAbsent, PersonnelCode = x.PersonnelCode, - TotalWorkingHours = $"{Convert.ToInt32(x.TotalWorkingHoursSpan.TotalHours)}:{x.TotalWorkingHoursSpan.Minutes.ToString("00")}" + TotalWorkingHours = $"{x.TotalWorkingHoursSpan.TotalHours.ToString("0")}:{x.TotalWorkingHoursSpan.Minutes.ToString("00")}" }); return result; } @@ -443,7 +443,7 @@ public class RollCallRepository : RepositoryBase, IRollCallRepos EmployeeFullName = x.EmployeeFullName, EmployeeId = x.EmployeeId, TotalWorkingHours = - $"{Convert.ToInt32(x.TotalWorkingHoursSpan.TotalHours)}:{x.TotalWorkingHoursSpan.Minutes.ToString("00")}", + $"{x.TotalWorkingHoursSpan.TotalHours.ToString("0")}:{x.TotalWorkingHoursSpan.Minutes.ToString("00")}", RollCallTimesList = x.RollCallTimesList }).ToList(); diff --git a/CompanyManagment.EFCore/Repository/YearlySalaryRepository.cs b/CompanyManagment.EFCore/Repository/YearlySalaryRepository.cs index 0537e382..e1e876a2 100644 --- a/CompanyManagment.EFCore/Repository/YearlySalaryRepository.cs +++ b/CompanyManagment.EFCore/Repository/YearlySalaryRepository.cs @@ -710,8 +710,7 @@ public class YearlySalaryRepository : RepositoryBase, IYearl BaseResult = Sum + fixFeePrice; //var rondUp = Convert.ToInt32(BaseResult); - - + Console.WriteLine($"{test} - mozdeSaleGhabl[{firstDayliSalary}] - mozdeSaleJari[{BaseResult}] - fixFeePercentage[{fixFeePercentage}] - fixFeePrice[{fixFeePrice}]"); //آی دی سال جاری loopDateId = salary.Where(x => x.StartDate <= LoopDateGr && x.EndDate >= LoopDateGr && x.id != loopDateId).Select(x => x.id).FirstOrDefault(); // ذخیره سال جاری بعنوان سال گذشته برای عملیات بعدی @@ -746,12 +745,12 @@ public class YearlySalaryRepository : RepositoryBase, IYearl var Sum = firstDayliSalary + percntSumDaylifee; //مزد پایه BaseResult = Sum + fixFeePrice; - //var rondUp = Convert.ToInt32(BaseResult); + //var rondUp = Convert.ToInt32(BaseResult); + Console.WriteLine($"{test} - mozdeSaleGhabl[{firstDayliSalary}] - mozdeSaleJari[{BaseResult}] - fixFeePercentage[{fixFeePercentage}] - fixFeePrice[{fixFeePrice}]"); - - //آی دی سال جاری - loopDateId = salary.Where(x => x.StartDate <= LoopDateGr && x.EndDate >= LoopDateGr && x.id != loopDateId).Select(x => x.id).FirstOrDefault(); + //آی دی سال جاری + loopDateId = salary.Where(x => x.StartDate <= LoopDateGr && x.EndDate >= LoopDateGr && x.id != loopDateId).Select(x => x.id).FirstOrDefault(); // ذخیره سال جاری بعنوان سال گذشته برای عملیات بعدی oldYear = loopdateYear; } @@ -774,12 +773,12 @@ public class YearlySalaryRepository : RepositoryBase, IYearl //مزد پایه BaseResult = Sum + fixFeePrice; - //var rondUp = Convert.ToInt32(BaseResult); + //var rondUp = Convert.ToInt32(BaseResult); + Console.WriteLine($"{test} - mozdeSaleGhabl[{firstDayliSalary}] - mozdeSaleJari[{BaseResult}] - fixFeePercentage[{fixFeePercentage}] - fixFeePrice[{fixFeePrice}]"); - - //آی دی سال جاری - loopDateId = salary.Where(x => x.StartDate <= LoopDateGr && x.EndDate >= LoopDateGr && x.id != loopDateId).Select(x => x.id).FirstOrDefault(); + //آی دی سال جاری + loopDateId = salary.Where(x => x.StartDate <= LoopDateGr && x.EndDate >= LoopDateGr && x.id != loopDateId).Select(x => x.id).FirstOrDefault(); // ذخیره سال جاری بعنوان سال گذشته برای عملیات بعدی oldYear = loopdateYear; } @@ -806,8 +805,11 @@ public class YearlySalaryRepository : RepositoryBase, IYearl //پایه سنوات سال جاری بعلاوه مزد پایه BaseResult += Basic; basicResultSum += Basic; - //صفر نمودن شمارنده روزها - DayCounter = 0; + Console.BackgroundColor = ConsoleColor.DarkYellow; + Console.WriteLine($"{test} - mozd[{BaseResult}] - Basic[{Basic}]"); + Console.ResetColor(); + //صفر نمودن شمارنده روزها + DayCounter = 0; } //if (loopdateFa == "1398/12/29") diff --git a/ServiceHost/Areas/Admin/Pages/Company/InsuranceList/Index.cshtml.cs b/ServiceHost/Areas/Admin/Pages/Company/InsuranceList/Index.cshtml.cs index 4abada1d..56d87b1a 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 = 88000000; + benefitsIncludedContinuousL = 5382855; if (workingDaysL < endMonthCurrentDayL) { if (endMonthCurrentDayL == 29) diff --git a/ServiceHost/Areas/AdminNew/Pages/Company/Task/CreateModal.cshtml b/ServiceHost/Areas/AdminNew/Pages/Company/Task/CreateModal.cshtml index 359c9586..2e135ebb 100644 --- a/ServiceHost/Areas/AdminNew/Pages/Company/Task/CreateModal.cshtml +++ b/ServiceHost/Areas/AdminNew/Pages/Company/Task/CreateModal.cshtml @@ -1,16 +1,17 @@ @model AccountManagement.Application.Contracts.Task.CreateTaskModal @* @model ServiceHost.Areas.AdminNew.Pages.Company.Task.CreateModel *@ @inject _0_Framework.Application.IAuthHelper AuthHelper; -@using Version = _0_Framework.Application.Version +@using _0_Framework.Application @{ ViewData["title"] = " - وظیفه جدید"; + string adminVersion = _0_Framework.Application.Version.AdminVersion; } - - - + + + @@ -313,7 +314,7 @@ - + @@ -333,4 +334,4 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/ServiceHost/Areas/AdminNew/Pages/Company/Task/Index.cshtml b/ServiceHost/Areas/AdminNew/Pages/Company/Task/Index.cshtml index 14c6760d..e1938aaf 100644 --- a/ServiceHost/Areas/AdminNew/Pages/Company/Task/Index.cshtml +++ b/ServiceHost/Areas/AdminNew/Pages/Company/Task/Index.cshtml @@ -12,7 +12,7 @@ - + @* ?ver=@Version.AdminVersion *@ diff --git a/ServiceHost/Areas/Camera/Pages/ErrorMessage.cshtml b/ServiceHost/Areas/Camera/Pages/ErrorMessage.cshtml new file mode 100644 index 00000000..55ea471e --- /dev/null +++ b/ServiceHost/Areas/Camera/Pages/ErrorMessage.cshtml @@ -0,0 +1,64 @@ +@page +@model ServiceHost.Areas.Camera.Pages.ErrorMessageModel +@using Version = _0_Framework.Application.Version + +@{ + Layout = "Shared/_Layout"; + ViewData["Title"] = " - " + "خطای سیستمی"; +} + +@section Styles +{ + + +} + +
+
+ + + + + + + + + + + + + + + +
+
+

@Model.Message

+
+
\ No newline at end of file diff --git a/ServiceHost/Areas/Camera/Pages/ErrorMessage.cshtml.cs b/ServiceHost/Areas/Camera/Pages/ErrorMessage.cshtml.cs new file mode 100644 index 00000000..8747bf49 --- /dev/null +++ b/ServiceHost/Areas/Camera/Pages/ErrorMessage.cshtml.cs @@ -0,0 +1,18 @@ +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.RazorPages; + +namespace ServiceHost.Areas.Camera.Pages +{ + public class ErrorMessageModel : PageModel + { + public string Message { get; set; } + public void OnGet(string message) + { + if (message == "ServiceNotFound") + Message = "شما سرویس فعال ندارید."; + + if (message == "EmployeeNotFound") + Message = "شما هیچ پرسنلی را به حضور غیاب اضافه نکرده‌اید."; + } + } +} diff --git a/ServiceHost/Areas/Camera/Pages/Index.cshtml b/ServiceHost/Areas/Camera/Pages/Index.cshtml index 2215e9e1..9834bd9a 100644 --- a/ServiceHost/Areas/Camera/Pages/Index.cshtml +++ b/ServiceHost/Areas/Camera/Pages/Index.cshtml @@ -1,10 +1,14 @@ @page @model ServiceHost.Areas.Camera.Pages.IndexModel -@{ - Layout = "Shared/_CameraLayout"; - ViewData["title"] = "حضور غیاب"; - + .div-logout { + position: fixed; + right: -130px; + top: 110px; + } + } - -
- -
- آماده سازی... -
- -
-
-
-
- +@section Styles +{ + + +} + +
+
+
+ + + + + + + + + + + + + + + +
+
+

برای ساعات حضور و غیاب میباست از گوشی استفاده نمایید!

+ +
+
-
-
-
+
+
+ +
+ +
+ + + + + + + + + + + + + + + +
+ +
+ + +
+ @*
+ + +
*@ + +
+ +
+ +
+
+ +
+ +
+ آماده سازی... +
+ +
+
+@*
+
*@ +
+ + +
+
+
+ + + + + + +@*
+
+
+
*@ +
- @foreach (var item in Model.ImageDataList) - { - - } - - + @foreach (var item in @Model.ImageDataList) + { + + }
@section Script { - @* *@ - @* *@ - - - - + + + @* *@ + @* *@ + + + + } \ No newline at end of file diff --git a/ServiceHost/Areas/Camera/Pages/Index.cshtml.cs b/ServiceHost/Areas/Camera/Pages/Index.cshtml.cs index 2a616316..99cebcb6 100644 --- a/ServiceHost/Areas/Camera/Pages/Index.cshtml.cs +++ b/ServiceHost/Areas/Camera/Pages/Index.cshtml.cs @@ -1,127 +1,162 @@ +using System.Diagnostics; using _0_Framework.Application; using CompanyManagment.App.Contracts.Employee; using CompanyManagment.App.Contracts.RollCall; -using CompanyManagment.App.Contracts.RollCallEmployee; -using CompanyManagment.App.Contracts.RollCallService; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; +using System.IO; +using CompanyManagment.App.Contracts.RollCallEmployee; +using CompanyManagment.App.Contracts.RollCallService; namespace ServiceHost.Areas.Camera.Pages; [Authorize] public class IndexModel : PageModel { - private readonly IAuthHelper _authHelper; - private readonly IConfiguration _configuration; - private readonly IEmployeeApplication _employeeApplication; - private readonly IRollCallApplication _rollCallApplication; - private readonly IRollCallEmployeeApplication _rollCallEmployeeApplication; - private readonly IRollCallServiceApplication _rollCallServiceApplication; - private readonly IWebHostEnvironment _webHostEnvironment; - public string filePath = ""; - public List ImageDataList; - public string modelPath = ""; - public List PersonelIds; - public long WorkshopId; + private readonly IWebHostEnvironment _webHostEnvironment; + private readonly IConfiguration _configuration; + private readonly IEmployeeApplication _employeeApplication; + private readonly IRollCallApplication _rollCallApplication; + private readonly IRollCallServiceApplication _rollCallServiceApplication; + private readonly IRollCallEmployeeApplication _rollCallEmployeeApplication; + private readonly IAuthHelper _authHelper; + public long WorkshopId; + public List ImageDataList; + public List PersonelIds; - public IndexModel(IWebHostEnvironment webHostEnvironment, IConfiguration configuration, - IEmployeeApplication employeeApplication, IRollCallApplication rollCallApplication, IAuthHelper authHelper, - IRollCallServiceApplication rollCallServiceApplication, - IRollCallEmployeeApplication rollCallEmployeeApplication) - { - _webHostEnvironment = webHostEnvironment; - _configuration = configuration; - _employeeApplication = employeeApplication; - _rollCallApplication = rollCallApplication; - _authHelper = authHelper; - _rollCallServiceApplication = rollCallServiceApplication; - _rollCallEmployeeApplication = rollCallEmployeeApplication; - } + public IndexModel(IWebHostEnvironment webHostEnvironment, IConfiguration configuration, IEmployeeApplication employeeApplication, IRollCallApplication rollCallApplication, IAuthHelper authHelper, IRollCallServiceApplication rollCallServiceApplication, IRollCallEmployeeApplication rollCallEmployeeApplication) + { + _webHostEnvironment = webHostEnvironment; + _configuration = configuration; + _employeeApplication = employeeApplication; + _rollCallApplication = rollCallApplication; + _authHelper = authHelper; + _rollCallServiceApplication = rollCallServiceApplication; + _rollCallEmployeeApplication = rollCallEmployeeApplication; + } - public void OnGet() - { - var cameraAccount = _authHelper.CameraAccountInfo(); - WorkshopId = cameraAccount.WorkshopId; - var service = _rollCallServiceApplication.GetActiveServiceByWorkshopId(cameraAccount.WorkshopId); - if (service != null && service.IsActiveString == "true") - if (_rollCallEmployeeApplication.GetByWorkshopId(cameraAccount.WorkshopId).Count > 0) - { - PersonelIds = _rollCallEmployeeApplication.GetByWorkshopId(cameraAccount.WorkshopId) - .Where(x => x.IsActiveString == "true" && x.HasUploadedImage == "true") - .Select(x => x.EmployeeId) - .Take(service.MaxPersonValid) - .ToList(); - var imageData = new List(); - foreach (var personId in PersonelIds) - for (var i = 1; i <= 2; i++) - { - var fileContent = System.IO.File.ReadAllBytes( - $"{_webHostEnvironment.ContentRootPath}\\Faces\\{WorkshopId}\\{personId}\\{i}.jpg"); - imageData.Add(new ImageData - { - ImagePath = Convert.ToBase64String(fileContent), - ImageNumber = i, - Id = personId - }); - } + public IActionResult OnGet() + { + var cameraAccount = _authHelper.CameraAccountInfo(); + WorkshopId = cameraAccount.WorkshopId; + var service = _rollCallServiceApplication.GetActiveServiceByWorkshopId(cameraAccount.WorkshopId); + if (service != null && service.IsActiveString == "true") + { + if (_rollCallEmployeeApplication.GetByWorkshopId(cameraAccount.WorkshopId).Count > 0) + { + var personnelIdsList = _rollCallEmployeeApplication.GetByWorkshopId(cameraAccount.WorkshopId) + .Where(x => x.IsActiveString == "true" && x.HasUploadedImage == "true") + .Select(x => x.EmployeeId); - ImageDataList = imageData; - } - } + if (service.MaxPersonValid != -1) + { + PersonelIds = personnelIdsList.Take(service.MaxPersonValid).ToList(); + } + else + { + PersonelIds = personnelIdsList.ToList(); + } - public IActionResult OnGetEmployeeFlag(long employeeId, long workshopId) - { - var employeeFullName = _rollCallEmployeeApplication.GetByEmployeeIdAndWorkshopId(employeeId, workshopId) - .EmployeeFullName; - var flagId = _rollCallApplication.Flag(employeeId, workshopId); + var imageData = new List(); + foreach (var personId in PersonelIds) + { + for (int i = 1; i <= 2; i++) + { + byte[] fileContent = System.IO.File.ReadAllBytes($"{_webHostEnvironment.ContentRootPath}\\Faces\\{WorkshopId}\\{personId}\\{i}.jpg"); + imageData.Add(new ImageData() + { + ImagePath = Convert.ToBase64String(fileContent), + ImageNumber = i, + Id = personId + }); + } + } + ImageDataList = imageData; + } + else + { + var message = "EmployeeNotFound"; + return Redirect("/Camera/ErrorMessage?message=" + message); + } - return new JsonResult(new - { - employeeName = employeeFullName, - flag = flagId - }); - } + } else + { + var message = "ServiceNotFound"; + return Redirect("/Camera/ErrorMessage?message=" + message); + } - public IActionResult OnGetOut(long flagId) - { - var res = _rollCallApplication.Edit(flagId); - if (res.IsSuccedded) - return new JsonResult(new - { - isSuccess = true - }); - return new JsonResult(new - { - isSuccess = false - }); - } + return Page(); + } - public IActionResult OnGetInCom(long employeeId, long workshopId) - { - var now = DateTime.Now; - var command = new CreateRollCall - { - WorkshopId = workshopId, - EmployeeId = employeeId, - StartDate = now - }; - var res = _rollCallApplication.Create(command); - if (res.IsSuccedded) - return new JsonResult(new - { - isSuccess = true - }); - return new JsonResult(new - { - isSuccess = false - }); - } + public IActionResult OnGetEmployeeFlag(long employeeId, long workshopId) + { + var employeeFullName = _rollCallEmployeeApplication.GetByEmployeeIdAndWorkshopId(employeeId, workshopId).EmployeeFullName; + var flagId = _rollCallApplication.Flag(employeeId, workshopId); + + return new JsonResult(new + { + employeeName = employeeFullName, + flag = flagId + + }); + + } + + public IActionResult OnGetOut(long flagId) + { + var res = _rollCallApplication.Edit(flagId); + if (res.IsSuccedded) + { + return new JsonResult(new + { + isSuccess = true, + }); + } + else + { + return new JsonResult(new + { + isSuccess = false, + }); + } + } + + public IActionResult OnGetInCom(long employeeId, long workshopId) + { + var now = DateTime.Now; + var command = new CreateRollCall() + { + WorkshopId = workshopId, + EmployeeId = employeeId, + StartDate = now, + + }; + var res = _rollCallApplication.Create(command); + if (res.IsSuccedded) + { + return new JsonResult(new + { + isSuccess = true, + }); + } + else + { + return new JsonResult(new + { + isSuccess = false, + }); + } + + } } public class ImageData { - public string ImagePath { get; set; } - public int ImageNumber { get; set; } - public long Id { get; set; } + + public string ImagePath { get; set; } + public int ImageNumber { get; set; } + public long Id { get; set; } + + } \ No newline at end of file diff --git a/ServiceHost/Areas/Camera/Pages/Shared/_AdminLayoutCopy.cshtml b/ServiceHost/Areas/Camera/Pages/Shared/_AdminLayoutCopy.cshtml new file mode 100644 index 00000000..44fd2616 --- /dev/null +++ b/ServiceHost/Areas/Camera/Pages/Shared/_AdminLayoutCopy.cshtml @@ -0,0 +1,154 @@ +@using Microsoft.AspNetCore.Razor.Language.Intermediate +@using Version = _0_Framework.Application.Version + + + + + + + + + + + + @ViewData["Title"] | دادمهر گستر + + + + + + + + + + + + + + + + + + + + + + @**@ + + + + + + + + + + + + + + @* *@ + + @RenderSection("Styles", false) + + + + + +@RenderBody() + + + + + + @**@ + + + + + + + + + + + + + + + + + + + + + @* + + + + + + + *@ + + + + + @**@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @RenderSection("Script", false) + + + + + + + + + + \ No newline at end of file diff --git a/ServiceHost/Areas/Camera/Pages/Shared/_CameraLayout.cshtml b/ServiceHost/Areas/Camera/Pages/Shared/_CameraLayout.cshtml index 5a0a7c04..09be94d1 100644 --- a/ServiceHost/Areas/Camera/Pages/Shared/_CameraLayout.cshtml +++ b/ServiceHost/Areas/Camera/Pages/Shared/_CameraLayout.cshtml @@ -1,26 +1,32 @@  - - - - - حضور و غیاب @ViewData["Title"] + + + + + حضور و غیاب @ViewData["Title"] - + - - + + - + - + - + - *@ + + + + + + +
+
+ + @RenderBody() + +
+
+ + + + + + @RenderSection("Script", false) + + + + \ No newline at end of file diff --git a/ServiceHost/Areas/Camera/Pages/Shared/_ValidationScriptsPartial.cshtml b/ServiceHost/Areas/Camera/Pages/Shared/_ValidationScriptsPartial.cshtml index 660f00c3..5a16d80a 100644 --- a/ServiceHost/Areas/Camera/Pages/Shared/_ValidationScriptsPartial.cshtml +++ b/ServiceHost/Areas/Camera/Pages/Shared/_ValidationScriptsPartial.cshtml @@ -1,2 +1,2 @@  - \ No newline at end of file + diff --git a/ServiceHost/Areas/Camera/Pages/_ViewImports.cshtml b/ServiceHost/Areas/Camera/Pages/_ViewImports.cshtml index 9053e2ec..78140377 100644 --- a/ServiceHost/Areas/Camera/Pages/_ViewImports.cshtml +++ b/ServiceHost/Areas/Camera/Pages/_ViewImports.cshtml @@ -1,3 +1,3 @@ @using ServiceHost @namespace ServiceHost.Pages -@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers \ No newline at end of file +@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers diff --git a/ServiceHost/Areas/Camera/Pages/_ViewStart.cshtml b/ServiceHost/Areas/Camera/Pages/_ViewStart.cshtml index 1a148b27..a5f10045 100644 --- a/ServiceHost/Areas/Camera/Pages/_ViewStart.cshtml +++ b/ServiceHost/Areas/Camera/Pages/_ViewStart.cshtml @@ -1,3 +1,3 @@ @{ - Layout = "_CameraLayout"; -} \ No newline at end of file + Layout = "_Layout"; +} diff --git a/ServiceHost/Areas/Client/Pages/Company/RollCall/CaseHistory.cshtml b/ServiceHost/Areas/Client/Pages/Company/RollCall/CaseHistory.cshtml index 0ad47ed8..af3d1ca0 100644 --- a/ServiceHost/Areas/Client/Pages/Company/RollCall/CaseHistory.cshtml +++ b/ServiceHost/Areas/Client/Pages/Company/RollCall/CaseHistory.cshtml @@ -35,15 +35,38 @@ border-radius: 7px; } - @@media (max-width: 767px) { - .table-rollcall .width2 { - width: 35% !important; - overflow: hidden; - } + .goToTop { + position: fixed; + bottom: -10px; + margin-right: 100px; + z-index: 100; + color: #fff; + background-color: #25acacd6; + } + + .goToTop:hover { + color: #fff; + background-color: #2ca4a4; + } + + @@media screen and (max-width: 767px) { + .table-rollcall .width2 { + width: 35% !important; + overflow: hidden; + } .sticky { top: 48px !important; } + + .goToTop { + position: fixed; + bottom: 54px; + margin-right: 39%; + z-index: 100; + color: #fff; + background-color: #25acac70; + } } } @@ -79,6 +102,16 @@
+ +
diff --git a/ServiceHost/Areas/Client/Pages/Company/RollCall/CurrentDay.cshtml b/ServiceHost/Areas/Client/Pages/Company/RollCall/CurrentDay.cshtml index 6fbe76c0..8cec90aa 100644 --- a/ServiceHost/Areas/Client/Pages/Company/RollCall/CurrentDay.cshtml +++ b/ServiceHost/Areas/Client/Pages/Company/RollCall/CurrentDay.cshtml @@ -46,7 +46,7 @@
-
+
@@ -60,99 +60,102 @@
تجمیع در خروج
مجموع ساعات کاری
- - @if (@Model.RollCallViewModels.PresentEmployees.Any()) - { - @foreach (var item in Model.RollCallViewModels.PresentEmployees) + +
+
+ @if (@Model.RollCallViewModels.PresentEmployees.Any()) { -
-
-
- ردیف -
-
-
- @(index++) + @foreach (var item in Model.RollCallViewModels.PresentEmployees) + { +
+
+
+ ردیف +
+
+
+ @(index++) +
-
-
-
نام پرسنل
-
- @item.EmployeeFullName -
-
- -
-
-
شماره پرسنلی:
-
@item.PersonnelCode
-
-
- -
-
-
تاخیر در ورود:
-
-
-
-
- -
- @foreach (var itemTime in item.RollCallTimesList) - { -
ساعت ورود
-
-
@(itemTime.StartDate ?? "-")
-
- } -
- -
- @foreach (var itemTime in item.RollCallTimesList) - { -
ساعت خروج
-
-
@(itemTime.EndDate ?? "-")
-
- } -
- -
-
-
تجمیع در خروج:
-
-
-
-
- -
-
-
مجموع ساعات کاری:
-
- @if (item.RollCallTimesList.Last().EndDate == null) - { - - - - - - - } - else - { - @item.TotalWorkingHours - } +
+
نام پرسنل
+
+ @item.EmployeeFullName
-
-
+
+
+
شماره پرسنلی:
+
@item.PersonnelCode
+
+
+ +
+
+
تاخیر در ورود:
+
-
+
+
+ +
+ @foreach (var itemTime in item.RollCallTimesList) + { +
ساعت ورود
+
+
@(itemTime.StartDate ?? "-")
+
+ } +
+ +
+ @foreach (var itemTime in item.RollCallTimesList) + { +
ساعت خروج
+
+
@(itemTime.EndDate ?? "-")
+
+ } +
+ +
+
+
تجمیع در خروج:
+
-
+
+
+ +
+
+
مجموع ساعات کاری:
+
+ @if (item.RollCallTimesList.Last().EndDate == null) + { + + + + + + + } + else + { + @item.TotalWorkingHours + } +
+
+
+ +
+ } } - } - else - { - - } + else + { + + } +
@@ -160,7 +163,7 @@
-
+
@@ -173,51 +176,55 @@
- @if (@Model.RollCallViewModels.AbsentEmployees.Any(x => !x.HasLeave)) - { - @foreach (var item in Model.RollCallViewModels.AbsentEmployees) +
+
+ @if (@Model.RollCallViewModels.AbsentEmployees.Any(x => !x.HasLeave)) { - if (!item.HasLeave) + @foreach (var item in Model.RollCallViewModels.AbsentEmployees) { -
-
-
- ردیف + if (!item.HasLeave) + { +
+
+
+ ردیف +
+
+
+ @(indexAbsent++) +
+
-
-
- @(indexAbsent++) + +
+
نام پرسنل
+
+ @item.EmployeeFullName +
+
+ +
+
+
شماره پرسنلی:
+
@item.PersonnelCode
- -
-
نام پرسنل
-
- @item.EmployeeFullName -
-
- -
-
-
شماره پرسنلی:
-
@item.PersonnelCode
-
-
-
+ } } } - } - else - { - - } + else + { + + } + +
-
+
@@ -231,52 +238,55 @@
- @if (@Model.RollCallViewModels.AbsentEmployees.Any(x => x.HasLeave)) - { - @foreach (var item in Model.RollCallViewModels.AbsentEmployees) +
+
+ @if (@Model.RollCallViewModels.AbsentEmployees.Any(x => x.HasLeave)) { - if (item.HasLeave) + @foreach (var item in Model.RollCallViewModels.AbsentEmployees) { -
-
-
- ردیف + if (item.HasLeave) + { +
+
+
+ ردیف +
+
+
+ @(indexLeave++) +
+
-
-
- @(indexLeave++) + +
+
نام پرسنل
+
+ @item.EmployeeFullName +
+
+ +
+
+
شماره پرسنلی:
+
@item.PersonnelCode
+
+
+ +
+
+
+
@item.Reason
- -
-
نام پرسنل
-
- @item.EmployeeFullName -
-
- -
-
-
شماره پرسنلی:
-
@item.PersonnelCode
-
-
- -
-
-
-
@item.Reason
-
-
-
+ } } } - } - else - { - - } + else + { + + } +
diff --git a/ServiceHost/Areas/Client/Pages/Company/RollCall/CurrentDay.cshtml.cs b/ServiceHost/Areas/Client/Pages/Company/RollCall/CurrentDay.cshtml.cs index f7bd4896..65fa2d3d 100644 --- a/ServiceHost/Areas/Client/Pages/Company/RollCall/CurrentDay.cshtml.cs +++ b/ServiceHost/Areas/Client/Pages/Company/RollCall/CurrentDay.cshtml.cs @@ -68,7 +68,6 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall } - public IActionResult OnGetCurrentDayAjax(string type) { var workshopHash = User.FindFirstValue("WorkshopSlug"); diff --git a/ServiceHost/Areas/Client/Pages/Company/RollCall/EmployeeUploadPicture.cshtml b/ServiceHost/Areas/Client/Pages/Company/RollCall/EmployeeUploadPicture.cshtml index 2c0be50a..dedaeffa 100644 --- a/ServiceHost/Areas/Client/Pages/Company/RollCall/EmployeeUploadPicture.cshtml +++ b/ServiceHost/Areas/Client/Pages/Company/RollCall/EmployeeUploadPicture.cshtml @@ -74,7 +74,7 @@ -

تعداد پرسنل سرویس خریداری شده: @Model.MaxPersonValid

+

تعداد پرسنل سرویس خریداری شده: @(Model.MaxPersonValid == -1 ? "نامحدود" : Model.MaxPersonValid)

diff --git a/ServiceHost/Areas/Client/Pages/Company/RollCall/EmployeeUploadPicture.cshtml.cs b/ServiceHost/Areas/Client/Pages/Company/RollCall/EmployeeUploadPicture.cshtml.cs index 109dd716..5c69be70 100644 --- a/ServiceHost/Areas/Client/Pages/Company/RollCall/EmployeeUploadPicture.cshtml.cs +++ b/ServiceHost/Areas/Client/Pages/Company/RollCall/EmployeeUploadPicture.cshtml.cs @@ -79,49 +79,53 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall public IActionResult OnGetCheckModalTakeImage() { - var mess = ""; var workshopHash = User.FindFirstValue("WorkshopSlug"); var workshopId = _passwordHasher.SlugDecrypt(workshopHash); - if (workshopId > 0) + + if (workshopId <= 0) { - var plan = _rollCallServiceApplication.GetActiveServiceByWorkshopId(workshopId); - if (plan != null) + return new JsonResult(new { - if (plan.IsActiveString == "true") - { - var maxValid = plan.MaxPersonValid; - var activedPerson = _rollCallEmployeeApplication.activedPerson(workshopId); - if (activedPerson < maxValid) - { - return new JsonResult(new - { - isSuccedded = true, - message = "موفق" - }); - } - else - { - mess = "محدودیت افزودن پرسنل"; - } - } - else - { - mess = "سرویس شما فعال نیست"; - } - } - else - { - mess = "شما سرویس خریداری شده ندارید"; - } + isSuccedded = false, + message = "کارگاه شما یافت نشده است" + }); } - else + + var plan = _rollCallServiceApplication.GetActiveServiceByWorkshopId(workshopId); + + if (plan == null) { - mess = "کارگاه شما یافت نشده است"; + return new JsonResult(new + { + isSuccedded = false, + message = "شما سرویس خریداری شده ندارید" + }); } + + if (plan.IsActiveString != "true") + { + return new JsonResult(new + { + isSuccedded = false, + message = "سرویس شما فعال نیست" + }); + } + + var maxValid = plan.MaxPersonValid; + + if (maxValid == -1 || _rollCallEmployeeApplication.activedPerson(workshopId) < maxValid) + { + return new JsonResult(new + { + isSuccedded = true, + message = "موفق" + }); + } + return new JsonResult(new { isSuccedded = false, - message = mess, + message = "محدودیت افزودن پرسنل" }); } @@ -144,13 +148,26 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall if (employeeDetails != null) employeeName = employeeDetails.EmployeeFullName; + string pic1 = ""; + string pic2 = ""; + if (hasPicture) + { + byte[] fileContent1 = System.IO.File.ReadAllBytes($"{_webHostEnvironment.ContentRootPath}\\Faces\\{workshopId}\\{employeeId}\\{1}.jpg"); + pic1 = Convert.ToBase64String(fileContent1); + byte[] fileContent2 = System.IO.File.ReadAllBytes($"{_webHostEnvironment.ContentRootPath}\\Faces\\{workshopId}\\{employeeId}\\{2}.jpg"); + pic2 = Convert.ToBase64String(fileContent2); + } + var res = new TakePictureModel() { HasPicture = hasPicture, EmployeeId = employeeId, WorkshopId = workshopId, - Name = employeeName + Name = employeeName, + Pic1 = pic1, + Pic2 = pic2, }; + return Partial("ModalTakeImages", res); } @@ -196,19 +213,14 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall HasUploadedImage = "true", }; result = _rollCallEmployeeApplication.Create(createCommand); - - - } + _rollCallEmployeeStatusApplication.Create(new CreateRollCallEmployeeStatus() + { RollCallEmployeeId = result.SendId }); + } else { - result = new OperationResult() - { - IsSuccedded = true, - Message = "عملیات با موفقیت انجام شده است" - }; + result = _rollCallEmployeeApplication.UploadedImage(employeeId, workshopId); } - _rollCallEmployeeStatusApplication.Create(new CreateRollCallEmployeeStatus() - { RollCallEmployeeId = result.SendId }); + if (result.IsSuccedded) { return new JsonResult(new @@ -232,7 +244,8 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall return new JsonResult(new { IsSuccedded = false, - }); + Message = e.Message, + }); } } diff --git a/ServiceHost/Areas/Client/Pages/Company/RollCall/Index.cshtml.cs b/ServiceHost/Areas/Client/Pages/Company/RollCall/Index.cshtml.cs index 07967bd1..43558954 100644 --- a/ServiceHost/Areas/Client/Pages/Company/RollCall/Index.cshtml.cs +++ b/ServiceHost/Areas/Client/Pages/Company/RollCall/Index.cshtml.cs @@ -130,7 +130,7 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall return new JsonResult(new { Success = result.IsSuccedded, - message = result.Message, + message = result.IsSuccedded ? "نام کاربری با مورد تاییداست" : result.Message, }); } } diff --git a/ServiceHost/Areas/Client/Pages/Company/RollCall/ModalCameraAccount.cshtml b/ServiceHost/Areas/Client/Pages/Company/RollCall/ModalCameraAccount.cshtml index cc2197a0..f9da16af 100644 --- a/ServiceHost/Areas/Client/Pages/Company/RollCall/ModalCameraAccount.cshtml +++ b/ServiceHost/Areas/Client/Pages/Company/RollCall/ModalCameraAccount.cshtml @@ -33,22 +33,25 @@
-
- -
+
+ +
- - - +
+ Loading... +
+ + + - - + +
-
-
+
+
@@ -155,4 +158,4 @@ var checkAccountAjax = `@Url.Page("./Index", "CheckAccount")`; var saveCameraAccountAjax = `@Url.Page("./Index", "SaveCameraAccount")`; - \ No newline at end of file + \ No newline at end of file diff --git a/ServiceHost/Areas/Client/Pages/Company/RollCall/ModalTakeImages.cshtml b/ServiceHost/Areas/Client/Pages/Company/RollCall/ModalTakeImages.cshtml index fdd3bccf..e7899d73 100644 --- a/ServiceHost/Areas/Client/Pages/Company/RollCall/ModalTakeImages.cshtml +++ b/ServiceHost/Areas/Client/Pages/Company/RollCall/ModalTakeImages.cshtml @@ -11,7 +11,7 @@