-
@section Script {
-
-
-
-@* *@
-
-
-
-
-
-
-
-
-
-
+
+
+ @* *@
+
+
+
+
+
+
+
+
+
+
-
+
-
+
- }
-
+
+ function signatureAll() {
+ $('.sweet-alert').removeClass("successSwall");
+ $('.sweet-alert').removeClass("errorSwall");
+ var workshopId = Number($("#SearchModel_WorkshopIds").val());
+ var year = $("#SearchModel_Year").val();
+ var month = $("#SearchModel_Month").val();
+ var employeeSearch = $("#empSearch").val();
-}
+ //if (employeeSearch != '' && workshopId != "0") {
+ // در صورتیکه پرسنل و کارگاه سرچ شد، نیاز به انتخاب سال و ماه نباشد
+ // swal({
+ // title: "لطفا در قسمت جستجوی قرارداد آیتمهای کارگاه، سال و ماه را انتخاب نموده و روی کلید جستجو کلیک کنید ",
+ // text: "",
+ // type: "warning",
+ // showCancelButton: true,
+ // confirmButtonColor: "#DD6B55",
+ // //confirmButtonText: "بستن",
+ // cancelButtonText: "بستن",
+ // closeOnConfirm: false,
+ // customClass: "errorSwall"
+ // });
+ // }
+ // else{
+ if (year.trim() == "" && month.trim() == "" && workshopId == "0") {
+ swal({
+ title: "لطفا در قسمت جستجوی قرارداد آیتمهای کارگاه، سال و ماه را انتخاب نموده و روی کلید جستجو کلیک کنید ",
+ text: "",
+ type: "warning",
+ showCancelButton: true,
+ confirmButtonColor: "#DD6B55",
+ //confirmButtonText: "بستن",
+ cancelButtonText: "بستن",
+ closeOnConfirm: false,
+ customClass: "errorSwall"
+ });
+ //$.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', " ابتدا آیتمهای کارگاه و سال , ماه را انتخاب کنید ");
+ } else if (year.trim() == "" && month.trim() == "" && workshopId != "0") {
+ swal({
+ title: "لطفا در قسمت جستجوی قرارداد آیتمهای سال و ماه را انتخاب نموده و روی کلید جستجو کلیک کنید ",
+ text: "",
+ type: "warning",
+ showCancelButton: true,
+ confirmButtonColor: "#DD6B55",
+ //confirmButtonText: "بستن",
+ cancelButtonText: "بستن",
+ closeOnConfirm: false,
+ customClass: "errorSwall"
+ });
+ //$.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', " ابتدا آیتمهای سال و ماه را انتخاب کنید ");
+ } else if (year.trim() != "" && month.trim() == "" && workshopId == "0") {
+ swal({
+ title: "لطفا در قسمت جستجوی قرارداد آیتمهای کارگاه و ماه را انتخاب نموده و روی کلید جستجو کلیک کنید ",
+ text: "",
+ type: "warning",
+ showCancelButton: true,
+ confirmButtonColor: "#DD6B55",
+ //confirmButtonText: "بستن",
+ cancelButtonText: "بستن",
+ closeOnConfirm: false,
+ customClass: "errorSwall"
+ });
+ //$.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', " ابتدا آیتمهای کارگاه و ماه را انتخاب کنید ");
+ } else if (year.trim() == "" && month.trim() != "" && workshopId == "0") {
+ //$.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', " ابتدا آیتمهای کارگاه و سال را انتخاب کنید ");
+ swal({
+ title: "لطفا در قسمت جستجوی قرارداد آیتمهای کارگاه و سال را انتخاب نموده و روی کلید جستجو کلیک کنید ",
+ text: "",
+ type: "warning",
+ showCancelButton: true,
+ confirmButtonColor: "#DD6B55",
+ //confirmButtonText: "بستن",
+ cancelButtonText: "بستن",
+ closeOnConfirm: false,
+ customClass: "errorSwall"
+ });
+ } else if (year.trim() != "" && month.trim() == "" && workshopId != "0") {
+ swal({
+ title: "لطفا در قسمت جستجوی قرارداد آیتم ماه را انتخاب نموده و روی کلید جستجو کلیک کنید ",
+ text: "",
+ type: "warning",
+ showCancelButton: true,
+ confirmButtonColor: "#DD6B55",
+ //confirmButtonText: "بستن",
+ cancelButtonText: "بستن",
+ closeOnConfirm: false,
+ customClass: "errorSwall"
+ });
+ //$.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', " ابتدا آیتم ماه را انتخاب کنید ");
+ } else if (year.trim() != "" && month.trim() != "" && workshopId == "0") {
+ swal({
+ title: "لطفا در قسمت جستجوی قرارداد آیتم کارگاه را انتخاب نموده و روی کلید جستجو کلیک کنید ", //"ابتدا آیتم کارگاه را انتخاب کنید ",
+ text: "",
+ type: "warning",
+ showCancelButton: true,
+ confirmButtonColor: "#DD6B55",
+ //confirmButtonText: "بستن",
+ cancelButtonText: "بستن",
+ closeOnConfirm: false,
+ customClass: "errorSwall"
+ });
+ // $.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', " ابتدا آیتم کارگاه را انتخاب کنید ");
+ } else if (year.trim() == "" && month.trim() != "" && workshopId != "0") {
+ //$.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', " ابتدا آیتم سال را انتخاب کنید ");
+ swal({
+ title: "لطفا در قسمت جستجوی قرارداد آیتم سال را انتخاب نموده و روی کلید جستجو کلیک کنید ",
+ text: "",
+ type: "warning",
+ showCancelButton: true,
+ confirmButtonColor: "#DD6B55",
+ //confirmButtonText: "بستن",
+ cancelButtonText: "بستن",
+ closeOnConfirm: false,
+ customClass: "errorSwall"
+ });
+ } else {
+ let ids = [];
+ $("input[name=foo]:checked").each(function() {
+ const id = $(this).val();
+ ids.push(id);
+ });
+ if (ids.length == 0) {
+ //$.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', " هیچ قراردادی انتخاب نشده است ");
+ swal({
+ title: "هیچ قراردادی انتخاب نشده است ",
+ text: "لطفا از تیک های سمت راست جدول، قراردادهای مورد نظر را انتخاب کنید.",
+ type: "warning",
+ showCancelButton: true,
+ confirmButtonColor: "#DD6B55",
+ //confirmButtonText: "بستن",
+ cancelButtonText: "بستن",
+ closeOnConfirm: false,
+ customClass: "errorSwall"
+ });
+ } else if (document.getElementById("sercheSignCheck").value == "false") {
+ swal({
+ title: "لطفا روی کلید جستجو کلیک کنید ",
+ text: "",
+ type: "warning",
+ showCancelButton: true,
+ confirmButtonColor: "#DD6B55",
+ //confirmButtonText: "بستن",
+ cancelButtonText: "بستن",
+ closeOnConfirm: false,
+ customClass: "errorSwall"
+ });
+ } else {
+ swal({
+ title: "آیا امضای قراردادهای انتخاب شده اطمینان دارید؟",
+ text: "",
+ type: "warning",
+ showCancelButton: true,
+ confirmButtonColor: "#DD6B55",
+ confirmButtonText: "بله",
+ cancelButtonText: "خیر",
+ closeOnConfirm: false,
+ closeOnCancel: true
+ },
+ function(isConfirm) {
+ if (isConfirm) {
+ $(".alarm").removeClass('alarm');
+ $.ajax({
+ async: false,
+ dataType: 'json',
+ type: 'POST',
+ url: '@Url.Page("/Company/Contracts/Index", "SignatureAll")',
+ headers: { "RequestVerificationToken": $('@Html.AntiForgeryToken()').val() },
+ data: { "ids": ids, "workshopId": workshopId },
+ success: function(response) {
+ console.log(response);
+ if (response.isSuccedded) {
+ swal({
+ title: "امضای قراردادهای انتخاب شده با موفقیت انجام شد ",
+ text: "",
+ type: "success",
+ showCancelButton: true,
+ confirmButtonColor: "#DD6B55",
+ confirmButtonText: "بستن",
+ cancelButtonText: "خیر",
+ closeOnConfirm: true,
+ customClass: "successSwall"
+ },
+ function(isConfirm) {
+ if (isConfirm) {
+ for (let index = 0; index < ids.length; index++) {
+ $(`#td_${ids[index]}`).html(`
`);
+ }
+ $('.myLinkSign').click(function(event) {
+ signAjax(event, this);
+ });
+ }
+ });
+ }
+ //$.Notification.notify('success', 'top center', 'پیام سیستم ', " امضای قراردادهای انتخاب شده با موفقیت انجام شد.");
+ else
+ //$.Notification.notify('error', 'top center', 'پیام سیستم ', " امضای قراردادهای انتخاب شده با خطا مواجه شد.");
+ {
+ swal({
+ title: "امضای قراردادهای انتخاب شده با خطا مواجه شد ",
+ text: "",
+ type: "warning",
+ showCancelButton: true,
+ confirmButtonColor: "#DD6B55",
+ //confirmButtonText: "بستن",
+ cancelButtonText: "بستن",
+ closeOnConfirm: false,
+ customClass: "errorSwall"
+ });
+ }
+ },
+ failure: function(response) {
+ //console.log(5, response);
+ }
+ });
+ }
+ });
+ }
+ }
+ // }
+ }
+ function deleteAllSignature() {
+ $('.sweet-alert').removeClass("successSwall");
+ $('.sweet-alert').removeClass("errorSwall");
+ var workshopId = Number($("#SearchModel_WorkshopIds").val());
+ var year = $("#SearchModel_Year").val();
+ var month = $("#SearchModel_Month").val();
+ if (year.trim() == "" && month.trim() == "" && workshopId == "0") {
+ swal({
+ title: "لطفا در قسمت جستجوی قرارداد آیتمهای کارگاه، سال و ماه را انتخاب نموده و روی کلید جستجو کلیک کنید ",
+ text: "",
+ type: "warning",
+ showCancelButton: true,
+ confirmButtonColor: "#DD6B55",
+ //confirmButtonText: "بستن",
+ cancelButtonText: "بستن",
+ closeOnConfirm: false,
+ customClass: "errorSwall"
+ });
+ //$.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', " ابتدا آیتمهای کارگاه و سال , ماه را انتخاب کنید ");
+ } else if (year.trim() == "" && month.trim() == "" && workshopId != "0") {
+ swal({
+ title: "لطفا در قسمت جستجوی قرارداد آیتمهای سال و ماه را انتخاب نموده و روی کلید جستجو کلیک کنید ",
+ text: "",
+ type: "warning",
+ showCancelButton: true,
+ confirmButtonColor: "#DD6B55",
+ //confirmButtonText: "بستن",
+ cancelButtonText: "بستن",
+ closeOnConfirm: false,
+ customClass: "errorSwall"
+ });
+ //$.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', " ابتدا آیتمهای سال و ماه را انتخاب کنید ");
+ } else if (year.trim() != "" && month.trim() == "" && workshopId == "0") {
+ swal({
+ title: "لطفا در قسمت جستجوی قرارداد آیتمهای کارگاه و ماه را انتخاب نموده و روی کلید جستجو کلیک کنید ",
+ text: "",
+ type: "warning",
+ showCancelButton: true,
+ confirmButtonColor: "#DD6B55",
+ //confirmButtonText: "بستن",
+ cancelButtonText: "بستن",
+ closeOnConfirm: false,
+ customClass: "errorSwall"
+ });
+ //$.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', " ابتدا آیتمهای کارگاه و ماه را انتخاب کنید ");
+ } else if (year.trim() == "" && month.trim() != "" && workshopId == "0") {
+ //$.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', " ابتدا آیتمهای کارگاه و سال را انتخاب کنید ");
+ swal({
+ title: "لطفا در قسمت جستجوی قرارداد آیتمهای کارگاه و سال را انتخاب نموده و روی کلید جستجو کلیک کنید ",
+ text: "",
+ type: "warning",
+ showCancelButton: true,
+ confirmButtonColor: "#DD6B55",
+ //confirmButtonText: "بستن",
+ cancelButtonText: "بستن",
+ closeOnConfirm: false,
+ customClass: "errorSwall"
+ });
+ } else if (year.trim() != "" && month.trim() == "" && workshopId != "0") {
+ swal({
+ title: "لطفا در قسمت جستجوی قرارداد آیتم ماه را انتخاب نموده و روی کلید جستجو کلیک کنید ",
+ text: "",
+ type: "warning",
+ showCancelButton: true,
+ confirmButtonColor: "#DD6B55",
+ //confirmButtonText: "بستن",
+ cancelButtonText: "بستن",
+ closeOnConfirm: false,
+ customClass: "errorSwall"
+ });
+ //$.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', " ابتدا آیتم ماه را انتخاب کنید ");
+ } else if (year.trim() != "" && month.trim() != "" && workshopId == "0") {
+ swal({
+ title: "لطفا در قسمت جستجوی قرارداد آیتم کارگاه را انتخاب نموده و روی کلید جستجو کلیک کنید ", //"ابتدا آیتم کارگاه را انتخاب کنید ",
+ text: "",
+ type: "warning",
+ showCancelButton: true,
+ confirmButtonColor: "#DD6B55",
+ //confirmButtonText: "بستن",
+ cancelButtonText: "بستن",
+ closeOnConfirm: false,
+ customClass: "errorSwall"
+ });
+ // $.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', " ابتدا آیتم کارگاه را انتخاب کنید ");
+ } else if (year.trim() == "" && month.trim() != "" && workshopId != "0") {
+ //$.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', " ابتدا آیتم سال را انتخاب کنید ");
+ swal({
+ title: "لطفا در قسمت جستجوی قرارداد آیتم سال را انتخاب نموده و روی کلید جستجو کلیک کنید ",
+ text: "",
+ type: "warning",
+ showCancelButton: true,
+ confirmButtonColor: "#DD6B55",
+ //confirmButtonText: "بستن",
+ cancelButtonText: "بستن",
+ closeOnConfirm: false,
+ customClass: "errorSwall"
+ });
+ } else {
+ let ids = [];
+ $("input[name=foo]:checked").each(function() {
+ const id = $(this).val();
+ ids.push(id);
+ });
+ if (ids.length == 0) {
+ swal({
+ title: "هیچ قراردادی انتخاب نشده است ",
+ text: "لطفا از تیک های سمت راست جدول، قراردادهای مورد نظر را انتخاب کنید.",
+ type: "warning",
+ showCancelButton: true,
+ confirmButtonColor: "#DD6B55",
+ //confirmButtonText: "بستن",
+ cancelButtonText: "بستن",
+ closeOnConfirm: false,
+ customClass: "errorSwall"
+ });
+ //$.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', " هیچ قراردادی انتخاب نشده است ");
+ } else if (document.getElementById("sercheSignCheck").value == "false") {
+ swal({
+ title: "لطفا روی کلید جستجو کلیک کنید ",
+ text: "",
+ type: "warning",
+ showCancelButton: true,
+ confirmButtonColor: "#DD6B55",
+ //confirmButtonText: "بستن",
+ cancelButtonText: "بستن",
+ closeOnConfirm: false,
+ customClass: "errorSwall"
+ });
+ } else {
+ swal({
+ title: "آیا از حذف امضای قراردادهای انتخاب شده اطمینان دارید؟",
+ text: "",
+ type: "warning",
+ showCancelButton: true,
+ confirmButtonColor: "#DD6B55",
+ confirmButtonText: "بله",
+ cancelButtonText: "خیر",
+ closeOnConfirm: false,
+ closeOnCancel: true
+ },
+ function(isConfirm) {
+ if (isConfirm) {
+ $(".alarm").removeClass('alarm');
+ $.ajax({
+ async: false,
+ dataType: 'json',
+ type: 'POST',
+ url: '@Url.Page("/Company/Contracts/Index", "DeleteAllSignature")',
+ headers: { "RequestVerificationToken": $('@Html.AntiForgeryToken()').val() },
+ data: { "ids": ids, "workshopId": workshopId },
+ success: function(response) {
+ if (response.isSuccedded) {
+ //$.Notification.notify('success', 'top center', 'پیام سیستم ', "حذف امضای قراردادهای انتخاب شده با موفقیت انجام شد.");
+ swal({
+ title: "حذف امضای قراردادهای انتخاب شده با موفقیت انجام شد ",
+ text: "",
+ type: "success",
+ showCancelButton: true,
+ confirmButtonColor: "#DD6B55",
+ confirmButtonText: "بستن",
+ //cancelButtonText: "خیر",
+ closeOnConfirm: true,
+ customClass: "successSwall"
+ },
+ function(isConfirm) {
+ if (isConfirm) {
+ for (let index = 0; index < ids.length; index++) {
+ $(`#td_${ids[index]}`).html(`
`);
+ }
+ $('.myLinkSign').click(function(event) {
+ signAjax(event, this);
+ });
+ }
+ });
+ } else {
+ swal({
+ title: "حذف امضای قراردادهای انتخاب شده با خطا مواجه شد",
+ text: "",
+ type: "warning",
+ showCancelButton: true,
+ confirmButtonColor: "#DD6B55",
+ //confirmButtonText: "بستن",
+ cancelButtonText: "بستن",
+ closeOnConfirm: false,
+ customClass: "errorSwall"
+ });
+ }
+
+ },
+ failure: function(response) {
+ //console.log(5, response);
+ }
+ });
+ }
+ });
+ }
+ }
+ }
+
+ $("#empSearch").keypress(function(event) {
+ if (event.keyCode === 13) {
+ if ($("#SearchModel_EmployeeId").val() == "0")
+ $("#SearchModel_EmployeeName").val($("#empSearch").val());
+ $("#btnSearch").click();
+ }
+ });
+
+ //------------End new Change---------------
+
+
+
+}
\ No newline at end of file
diff --git a/ServiceHost/Areas/Admin/Pages/Company/Contracts/Index.cshtml.cs b/ServiceHost/Areas/Admin/Pages/Company/Contracts/Index.cshtml.cs
index 6cfb70a1..732f5499 100644
--- a/ServiceHost/Areas/Admin/Pages/Company/Contracts/Index.cshtml.cs
+++ b/ServiceHost/Areas/Admin/Pages/Company/Contracts/Index.cshtml.cs
@@ -1,17 +1,8 @@
-using System;
-using System.Collections.Generic;
-using System.Diagnostics.CodeAnalysis;
-using System.Linq;
-using System.Threading.Tasks;
-using System.Runtime.InteropServices;
-using System.Runtime.Versioning;
-using System.Text;
+using System.Diagnostics.CodeAnalysis;
+using System.Globalization;
using _0_Framework.Application;
using Company.Domain.CheckoutAgg;
-using Company.Domain.ContarctingPartyAgg;
using Company.Domain.ContractAgg;
-using Company.Domain.empolyerAgg;
-using Company.Domain.WorkshopAgg;
using CompanyManagment.App.Contracts.Contract;
using CompanyManagment.App.Contracts.Employee;
using CompanyManagment.App.Contracts.Employer;
@@ -23,1003 +14,871 @@ using CompanyManagment.App.Contracts.WorkingHours;
using CompanyManagment.App.Contracts.WorkingHoursItems;
using CompanyManagment.App.Contracts.Workshop;
using CompanyManagment.App.Contracts.YearlySalary;
-using CompanyManagment.EFCore;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Mvc.Razor;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.AspNetCore.Mvc.Rendering;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Metadata.Internal;
-using Microsoft.Extensions.Logging;
-using Newtonsoft.Json;
-using PersianTools.Core;
-using CompanyManagment.EFCore.Migrations;
-using System.Globalization;
-using static Microsoft.EntityFrameworkCore.DbLoggerCategory.Database;
-namespace ServiceHost.Areas.Admin.Pages.Company.Contracts
+namespace ServiceHost.Areas.Admin.Pages.Company.Contracts;
+
+[Authorize]
+public class IndexModel : PageModel
{
- [Authorize]
- public class IndexModel : PageModel
- {
-
- public string Message { get; set; }
-
- public ContractSearchModel SearchModel;
-
- public List
Contracts;
- public List Contracts2;
- public List EmployeeList;
- public List EmployerList;
- public List WorkshopList;
- public List ComputingView;
- public string WorkshopSearch = "false";
- public string SignCheck = "false";
- public string DeleteCheck = "false";
- public bool falseCheck { get; set; }
-
-
- public List JobList;
- public List WorkshopEmployer;
- public List PersonnelList;
- public string employeeFullName;
-
- public SelectList Workshops;
- public SelectList WorkshopsCode;
- public SelectList Employees;
- public SelectList Employers;
- public SelectList Jobs;
- public List YearlyList;
- private readonly IContractApplication _contractApplication;
- private readonly IWorkshopApplication _workshopApplication;
- private readonly IEmployeeApplication _employeeApplication;
- private readonly IEmployerApplication _employerApplication;
- private readonly IYearlySalaryApplication _yearlySalaryApplication;
- private readonly IJobApplication _jobApplication;
- private readonly IContractRepository _contractRepository;
- private readonly IWorkingHoursApplication _workingHoursApplication;
- private readonly IWorkingHoursItemsApplication _workingHoursItemsApplication;
- private readonly IAuthHelper _authHelper;
- private readonly ILeftWorkApplication _leftWorkApplication;
- private readonly ILeaveApplication _leaveApplication;
- private readonly ICheckoutRepository _checkoutRepository;
- private readonly IPersonalContractingPartyApp _personalContractingPartyApp;
-
- public IndexModel(IContractApplication contractApplication, IWorkshopApplication workshopApplication,
- IEmployeeApplication employeeApplication,
- IEmployerApplication employerApplication,
- IYearlySalaryApplication yearlySalaryApplication,
- IJobApplication jobApplication, IContractRepository contractRepository,
- IWorkingHoursApplication workingHoursApplication,
- IWorkingHoursItemsApplication workingHoursItemsApplication,
- IAuthHelper authHelper, ILeftWorkApplication leftWorkApplication, ILeaveApplication leaveApplication, ICheckoutRepository checkoutRepository, IPersonalContractingPartyApp personalContractingPartyApp)
- {
- _contractApplication = contractApplication;
- _workshopApplication = workshopApplication;
- _employeeApplication = employeeApplication;
- _employerApplication = employerApplication;
- _yearlySalaryApplication = yearlySalaryApplication;
- _jobApplication = jobApplication;
- _contractRepository = contractRepository;
- _workingHoursApplication = workingHoursApplication;
- _workingHoursItemsApplication = workingHoursItemsApplication;
- _authHelper = authHelper;
- _leftWorkApplication = leftWorkApplication;
- _leaveApplication = leaveApplication;
- _checkoutRepository = checkoutRepository;
- _personalContractingPartyApp = personalContractingPartyApp;
- }
-
-
- [SuppressMessage("ReSharper.DPA", "DPA0009: High execution time of DB command", MessageId = "time: 619ms")]
- public void OnGet(ContractSearchModel searchModel)
- {
-
- //EmployerList = _employerApplication.GetEmployers();
- //EmployeeList = _employeeApplication.GetEmployee();
- //WorkshopList = _workshopApplication.GetWorkshop();
- Jobs =
- new SelectList(_jobApplication.GetJob(), "Id", "JobName");
-
- Workshops =
- new SelectList(_workshopApplication.GetWorkshopAccount(), "Id", "WorkshopFullName");
-
- WorkshopsCode =
- new SelectList(_workshopApplication.GetWorkshopAccount(), "Id", "ArchiveCode");
-
- //Employees =
- // new SelectList(_employeeApplication.GetEmployee(), "Id", "EmployeeFullName");
-
- Employers =
- new SelectList(_employerApplication.GetEmployers(), "Id", "FullName");
- YearlyList =
- _yearlySalaryApplication.GetYears();
-
- Contracts = _contractApplication.SearchForMainContract(searchModel);
- if (Contracts != null)
- {
- if (searchModel.WorkshopIds != 0 || searchModel.EmployeeId != 0)
- {
- WorkshopSearch = "true";
- }
- if (searchModel.WorkshopIds != 0 && !string.IsNullOrEmpty(searchModel.Year))
- {
- DeleteCheck = "true";
- }
- if (searchModel.WorkshopIds != 0 && !string.IsNullOrEmpty(searchModel.Year) && !string.IsNullOrEmpty(searchModel.Month))
- {
- SignCheck = "true";
- }
-
-
- }
- if (searchModel.EmployeeId > 0)
- {
- employeeFullName = Contracts.Select(x => x.EmployeeName).FirstOrDefault();
- }
- else
- {
- employeeFullName = searchModel.EmployeeName;
- }
-
- }
-
-
-
- public async Task OnGetPersonelMainList(string searchEmployee)
- {
-
- PersonnelList = await _employeeApplication.GetEmployeeToList();
- var person = PersonnelList.Where(x => x.EmployeeFullName.Contains(searchEmployee)).Take(200).ToList();
- person = person.OrderBy(x => x.EmployeeFullName.Length).ToList();
-
-
-
- return new JsonResult(new
- {
- IsSuccedded = true,
- mylist = person,
-
-
- });
- }
-
-
-
- // مرخصی
- #region PaidLeaveSickLeav
-
- #region SickLeave
-
- public IActionResult OnGetCreateSickLeave(long employeeId, long workshopId, long hd)
- {
- var workshopName = _workshopApplication.GetDetails(workshopId);
- var employeeName = _employeeApplication.GetDetails(employeeId);
- var search = new LeaveSearchModel()
- {
- EmployeeId = employeeId,
- WorkshopId = workshopId,
- LeaveType = "استعلاجی",
-
- };
- var serachResult = _leaveApplication.search(search);
-
- var command = new CreateLeave()
- {
- EmployeeId = employeeId,
- WorkshopId = workshopId,
- LeaveSearch = serachResult,
- WorkshopName = workshopName.WorkshopFullName,
- EmployeeFullName = employeeName.EmployeeFullName,
-
- };
- return Partial("./SickLeave", command);
- }
- public IActionResult OnPostCreateSickLeave(CreateLeave command)
- {
-
- command.LeaveType = "استعلاجی";
-
- var result = _leaveApplication.Create(command);
- var res = result.IsSuccedded;
- return new JsonResult(new
- {
- IsSuccedded = res,
- message = result.Message,
- EmployeeId = command.EmployeeId,
- WorkshopId = command.WorkshopId
- });
- }
-
- public IActionResult OnPostRemoveSickLeave(long id, long EmployeeId, long WorkshopId)
- {
- var result = _leaveApplication.RemoveLeave(id);
- var res = result.IsSuccedded;
- return new JsonResult(new
- {
- IsSuccedded = res,
- message = result.Message,
- employeeId = EmployeeId,
- workshopId = WorkshopId,
- hd = 1
- });
-
- }
- public IActionResult OnGetEditSickLeave(long id)
- {
-
- var res = _leaveApplication.GetDetails(id);
-
-
- return Partial("EditSick", res);
- }
-
- public IActionResult OnPostEditSickLeave(EditLeave command)
- {
- if (ModelState.IsValid)
- {
-
- }
-
- command.LeaveType = "استعلاجی";
- var result = _leaveApplication.Edit(command);
-
- var res = result.IsSuccedded;
- return new JsonResult(new
- {
- IsSuccedded = res,
- message = result.Message,
- employeeId = command.EmployeeId,
- workshopId = command.WorkshopId,
- hd = 1
- });
-
-
-
- }
-
- #endregion
-
- #region PaidLeave
-
- public IActionResult OnGetCreatePaidLeave(long employeeId, long workshopId, long hd)
- {
- var workshopName = _workshopApplication.GetDetails(workshopId);
- var employeeName = _employeeApplication.GetDetails(employeeId);
- var search = new LeaveSearchModel()
- {
- EmployeeId = employeeId,
- WorkshopId = workshopId,
- LeaveType = "استحقاقی",
- };
- var serachResult = _leaveApplication.search(search);
-
- var command = new CreateLeave()
- {
- EmployeeId = employeeId,
- WorkshopId = workshopId,
- LeaveSearch = serachResult,
- WorkshopName = workshopName.WorkshopFullName,
- EmployeeFullName = employeeName.EmployeeFullName,
- };
- return Partial("./PaidLeave", command);
- }
- public IActionResult OnPostCreatePaidLeave(CreateLeave command)
- {
- command.LeaveType = "استحقاقی";
-
- var result = _leaveApplication.Create(command);
- var res = result.IsSuccedded;
- return new JsonResult(new
- {
- IsSuccedded = res,
- message = result.Message,
- EmployeeId = command.EmployeeId,
- WorkshopId = command.WorkshopId
- });
- }
-
- public IActionResult OnGetCheckIfValidToEdit(long id)
- {
- var check = _leaveApplication.CheckIfValidToEdit(id);
- if (check)
- {
- return new JsonResult(new
- {
- validToEdit = true
- });
- }
- else
- {
- return new JsonResult(new
- {
- validToEdit = false
- });
- }
-
- }
- public IActionResult OnGetEditPaidLeave(long id)
- {
- var res = _leaveApplication.GetDetails(id);
- return Partial("EditPaidLeave", res);
- }
-
- public IActionResult OnPostEditPaidLeave(EditLeave command)
- {
- if (ModelState.IsValid)
- {
-
- }
-
- command.LeaveType = "استحقاقی";
- var result = _leaveApplication.Edit(command);
-
- var res = result.IsSuccedded;
- return new JsonResult(new
- {
- IsSuccedded = res,
- message = result.Message,
- employeeId = command.EmployeeId,
- workshopId = command.WorkshopId,
- hd = 1
- });
- }
-
- public IActionResult OnGetComputeLeavHourse(string startHours, string endHourse)
- {
- var start = Convert.ToDateTime(startHours);
- var end = Convert.ToDateTime(endHourse);
- if (start > end || start == end)
- {
- end = end.AddDays(1);
- }
-
- var hoursesSpan = (end - start);
- var hours = (int)hoursesSpan.TotalHours;
- var minuts = hoursesSpan.TotalMinutes % 60;
-
-
- if (hours > 0 && minuts > 0)
- {
-
- return new JsonResult(new
- {
-
- res = hours + " " + "ساعت و" + " " + minuts + " " + "دقیقه",
- });
- }
- else if (hours > 0 && minuts == 0)
- {
- return new JsonResult(new
- {
-
- res = hours + " " + "ساعت ",
- });
- }
- else if (hours == 0 && minuts > 0)
- {
- return new JsonResult(new
- {
- res = minuts + " " + "دقیقه",
- });
- }
-
- return new JsonResult(new
- {
- totalHours = $"{hours}",
-
-
-
- });
- }
- public IActionResult OnGetComputeLeavdays(string startDay, string endDay)
- {
- if (!string.IsNullOrWhiteSpace(startDay) && !string.IsNullOrWhiteSpace(endDay))
- {
- var start = startDay.ToGeorgianDateTime();
- var end = endDay.ToGeorgianDateTime();
- if (end >= start)
- {
- var daysSpan = (end - start).TotalDays + 1;
- return new JsonResult(new
- {
- res = $"{(int)daysSpan} روز",
- });
- }
- else
- {
- return new JsonResult(new
- {
- res = "تاریخ پایان از تاریخ شروع کوچکتر است",
- });
- }
-
- }
-
- return new JsonResult(new
- {
- res = "",
- });
- }
- public IActionResult OnPostRemovePaidLeave(long id, long EmployeeId, long WorkshopId)
- {
- var result = _leaveApplication.RemoveLeave(id);
- var res = result.IsSuccedded;
- return new JsonResult(new
- {
- IsSuccedded = res,
- message = result.Message,
- employeeId = EmployeeId,
- workshopId = WorkshopId,
- hd = 1
- });
-
- }
-
- #endregion
-
-
- #endregion
- //ترک کار
- #region LeftWorks
-
- public IActionResult OnPostRemoveLeftWork(long id, long EmployeeId, string employeeName)
- {
- var result = _leftWorkApplication.RemoveLeftWork(id);
- var res = result.IsSuccedded;
- return new JsonResult(new
- {
- IsSuccedded = res,
- message = result.Message,
- employeeId = EmployeeId,
- employeeName = employeeName,
- hd = 1
- });
-
- }
- public IActionResult OnGetCreateLeftWork(long employeeId, string employeeName)
- {
- var search = new LeftWorkSearchModel()
- {
- EmployeeId = employeeId,
-
- };
- var serachResult = _leftWorkApplication.search(search);
- var workShops = _workshopApplication.GetWorkshop();
- var command = new CreateLeftWork()
- {
- EmployeeId = employeeId,
- EmployeeFullName = employeeName,
- LeftWorkSearch = serachResult,
- Workshops = workShops
-
- };
- return Partial("./LeftWork", command);
- }
-
- public IActionResult OnPostCreateLetWork(CreateLeftWork command)
- {
-
- //var workshopName = _workshopApplication.GetDetails(command.WorkshopId);
- //var start = _leftWorkApplication.StartWork(command.EmployeeId, command.WorkshopId, command.LeftWorkDate);
- command.LeftWorkDate = "1500/01/01";
- //command.WorkshopName = workshopName.WorkshopFullName;
-
- var result = _leftWorkApplication.Create(command);
- var res = result.IsSuccedded;
- return new JsonResult(new
- {
- IsSuccedded = res,
- message = result.Message,
- EmployeeId = command.EmployeeId,
- employeeName = command.EmployeeFullName
- });
- }
- public IActionResult OnGetEditLeftWork(long id)
- {
-
- var res = _leftWorkApplication.GetDetails(id);
-
-
- return Partial("EditLeftWork", res);
- }
-
- public IActionResult OnPostEditLeftWork(EditLeftWork command)
- {
- if (ModelState.IsValid)
- {
-
- }
-
-
- var result = _leftWorkApplication.Edit(command);
-
- var res = result.IsSuccedded;
- return new JsonResult(new
- {
- IsSuccedded = res,
- message = result.Message,
- employeeId = command.EmployeeId,
- employeeName = command.EmployeeFullName,
- hd = 1
- });
-
-
-
- }
- public IActionResult OnGetEnterLeftWork(long id, string employeeName)
- {
-
- var res = _leftWorkApplication.GetDetails(id);
- res.LeftWorkDate = "";
- res.EmployeeFullName = employeeName;
-
- return Partial("EnterLeftWorkDate", res);
- }
- public IActionResult OnPostEnterLeftWork(EditLeftWork command)
- {
- if (ModelState.IsValid)
- {
-
- }
-
-
- var result = _leftWorkApplication.Edit(command);
-
- var res = result.IsSuccedded;
- return new JsonResult(new
- {
- IsSuccedded = res,
- message = result.Message,
- employeeId = command.EmployeeId,
- workshopId = command.WorkshopId,
- hd = 1
- });
-
-
-
- }
-
- #endregion
-
- public IActionResult OnPostCheckPsCode(long id, long workshopId, string code)
- {
- var psCode = Convert.ToInt64(code);
- var cheker = _contractRepository.Exists(x => x.PersonnelCode == psCode && x.WorkshopIds == workshopId && x.EmployeeId != id && x.IsActiveString == "true");
- if (cheker)
- {
- return new JsonResult(new
- {
- IsSuccedded = true,
- psCodeExist = true,
-
-
- });
- }
- else
- {
- return new JsonResult(new
- {
- IsSuccedded = true,
- psCodeExist = false,
-
-
- });
- }
-
- }
- public IActionResult OnPostLoadPersonel(long id, long workshopId)
- {
- string leftWorkStartdate = "";
- var result = _employeeApplication.GetDetails(id);
- var serachModel = new LeftWorkSearchModel()
- {
- EmployeeId = id,
- WorkshopId = workshopId,
-
- };
- var leftWoekSerchResult = _leftWorkApplication.search(serachModel);
- if (leftWoekSerchResult.Count > 0)
- {
- //var leftWorkLast = leftWoekSerchResult.OrderByDescending(x => x.StartWorkDateGr).FirstOrDefault();
- //if (leftWorkLast.LeftWorkDate == "1500/01/01")
- //{
- // leftWorkStartdate = leftWoekSerchResult.Select(x => x.StartWorkDate).FirstOrDefault();
- //}
-
- leftWorkStartdate = leftWoekSerchResult.OrderBy(x => x.StartWorkDateGr).FirstOrDefault()?.StartWorkDate;
-
- }
-
- //var psCode = _contractRepository.FindPersonnelCode(workshopId, id);
- //var contractExistBythisPsCode = _contractRepository.Exists(x => x.PersonnelCode == psCode && x.WorkshopIds == workshopId && x.EmployeeId == id && x.IsActiveString =="true");
- //var chekoutExistByThisPerson = _checkoutRepository.Exists(x => x.EmployeeId == id && x.WorkshopId == workshopId);
- //var exsitContractAndCheckout = false;
- //if(contractExistBythisPsCode || chekoutExistByThisPerson)
- //{
- // exsitContractAndCheckout = true;
- //}
- return new JsonResult(new
- {
- IsSuccedded = true,
- FatherName = result.FatherName,
- NationalCode = result.NationalCode,
- IdNumber = result.IdNumber,
- DateOfBirth = result.DateOfBirth,
- State = result.State,
- City = result.City,
- Address = result.Address,
- LeftWorkStartDate = leftWorkStartdate,
- //personnelCode = psCode,
- //contractExist = exsitContractAndCheckout
-
-
- });
- }
-
- public IActionResult OnPostLoadWorkshops(long id)
- {
- var result = _workshopApplication.GetWorkshopInfo(id);
- return new JsonResult(new
- {
- IsSuccedded = true,
- InsurancCode = result.InsuranceCode,
- archiveCode = result.ArchiveCode,
- state = result.State,
- city = result.City,
- address = result.Address,
- adres = result.State + "-" + result.City + "-" + result.Address,
- empList = result.EmpList,
- employeeList = result.EmployeeList,
-
-
- });
- }
-
- // پرینت تکی
- #region PrintOne
-
- public IActionResult OnGetDetails(long id)
- {
-
- var res = _contractApplication.GetDetails(id);
- var weeklyDouble = 0.0;
- var weekly = res.WorkingHoursWeekly;
- if (!string.IsNullOrWhiteSpace(weekly) &&
- weekly != "24 - 12" && weekly != "24 - 24" && weekly != "36 - 12" && weekly != "48 - 24")
- {
- if (weekly.Contains("/"))
- {
- weeklyDouble = double.Parse(weekly);
- var minute = (int)((weeklyDouble % 1) * 60);
- var hour = (int)(weeklyDouble);
- res.WorkingHoursWeekly = hour + " " + "ساعت و" + " " + minute + " " + "دقیقه";
- }
- else if (weekly.Contains("."))
- {
- weeklyDouble = double.Parse(weekly, CultureInfo.InvariantCulture);
- var minute = (int)((weeklyDouble % 1) * 60);
- var hour = (int)(weeklyDouble);
- res.WorkingHoursWeekly = hour + " " + "ساعت و" + " " + minute + " " + "دقیقه";
- }
- else
- {
- res.WorkingHoursWeekly = res.WorkingHoursWeekly + " " + "ساعت";
- }
-
-
- }
-
-
- //res.WorkshopEmployerList = _contractRepository.GetWorkshopEmployer();
- //res.Employers = _employerApplication.GetEmployers();
- //res.Employees = _employeeApplication.GetEmployee();
- //res.Workshops = _workshopApplication.GetWorkshop();
- return Partial("Details", res);
- }
-
- #endregion
- // پرینت گروهی
- #region PrintAll
-
- public IActionResult OnGetPrintAllB(List ids)
- {
- var result = _contractApplication.PrintAll(ids);
- var finalresult = result.OrderByDescending(x => x.ContractEndGr).ToList();
- var res = new GroupPrintViewModel
- {
- ContractList = finalresult
-
- };
- //var res = _contractApplication.PrintAll(ids);
-
- return Partial("PrintAllTest", res);
- }
- #endregion
-
- public IActionResult OnGetDeActive(long id)
- {
-
-
- var result = _contractApplication.DeActive(id);
-
- if (result.IsSuccedded)
- return RedirectToPage("./Index");
- Message = result.Message;
- return RedirectToPage("./Index");
- }
-
- public IActionResult OnGetIsActive(long id)
- {
-
-
- var result = _contractApplication.Active(id);
- if (result.IsSuccedded)
- return RedirectToPage("./Index");
- Message = result.Message;
- return RedirectToPage("./Index");
- }
-
- //public IActionResult OnGetSign(long id)
- //{
-
-
- // var result = _contractApplication.Sign(id);
- // return RedirectToPage("./Index");
-
-
- //}
- //public IActionResult OnGetUnSign(long id)
- //{
-
-
- // var result = _contractApplication.UnSign(id);
- // return RedirectToPage("./Index");
-
- //}
- public IActionResult OnGetSign(string Id)
- {
-
- var id = Convert.ToInt64(Id);
- var result = _contractApplication.Sign(id);
- if (result.IsSuccedded)
- {
- return new JsonResult(new
- {
- IsSuccedded = true,
-
- });
- }
- else
- {
- return new JsonResult(new
- {
- IsSuccedded = false,
-
- });
- }
- }
- public IActionResult OnGetUnSign(string Id)
- {
- var permissions = _authHelper.GetPermissions();
- var checkHasPermission = permissions.Any(n => n.Equals(20122));
- if (checkHasPermission)
- {
- var id = Convert.ToInt64(Id);
- var result = _contractApplication.UnSign(id);
- if (result.IsSuccedded)
- {
- return new JsonResult(new
- {
- IsSuccedded = true,
-
- });
- }
- else
- {
- return new JsonResult(new
- {
- IsSuccedded = false,
-
- });
- }
- }
- else
- {
- return new JsonResult(new
- {
- IsSuccedded = false,
-
- });
- }
-
- }
- public IActionResult OnGetGroupDeActive(List ids)
- {
-
- foreach (var item in ids)
- {
- var result = _contractApplication.DeActive(item);
- }
- return RedirectToPage("./Index");
-
- }
-
-
- public IActionResult OnGetGroupReActive(List ids)
- {
-
- foreach (var item in ids)
- {
- var result = _contractApplication.Active(item);
- }
-
-
- //if (result.IsSuccedded)
- // return RedirectToPage("./Index");
-
- return RedirectToPage("./Index");
- }
-
-
- public IActionResult OnGetGroupSign(List ids)
- {
-
- foreach (var item in ids)
- {
- var result = _contractApplication.Sign(item);
- }
- return RedirectToPage("./Index");
-
- }
- public IActionResult OnGetGroupUnSign(List ids)
- {
-
- foreach (var item in ids)
- {
- var result = _contractApplication.UnSign(item);
- }
- return RedirectToPage("./Index");
-
- }
- #region NewChangeByHeydari
-
- public IActionResult OnPostDeleteAllContarcts(List ids, long workshopId)
- {
- var op = new OperationResult();
- var workshop = _workshopApplication.GetDetails(workshopId);
- var empId = workshop.EmployerIdList.FirstOrDefault();
- var isBlock = _personalContractingPartyApp.IsBlockByEmployerId(empId);
- if (isBlock == "true")
- {
- return new JsonResult(new
- {
- successDelete = false,
- });
-
- }
- else
- {
- var checkoutList = _contractApplication.CheckHasCheckout(ids);
- List hasSignatureIds = new List();
- if (checkoutList == null || (checkoutList != null && checkoutList.Count == 0))//تصفیه حساب نداشته باشد
- {
- hasSignatureIds = _contractApplication.CheckHasSignature(ids);
- if (hasSignatureIds == null || (hasSignatureIds != null && hasSignatureIds.Count == 0))//امضا نداشته باشد
- {
- op = _contractApplication.DeleteAllContarcts(ids);
- }
- }
-
- return new JsonResult(new
- {
- hasCheckout = (checkoutList != null && checkoutList.Count() > 0) ? true : false,
- checkoutList = checkoutList,
- hasSignature = (hasSignatureIds != null && hasSignatureIds.Count() > 0) ? true : false,
- signatureList = hasSignatureIds,
- successDelete = op.IsSuccedded,
-
- });
- }
-
- }
-
- public IActionResult OnPostDeleteContarcts(long id)
- {
- var ids = new List();
- ids.Add(id);
- var op = new OperationResult();
- var checkoutList = _contractApplication.CheckHasCheckout(ids);
- List hasSignatureIds = new List();
- if (checkoutList == null || (checkoutList != null && checkoutList.Count == 0)) //تصفیه حساب نداشته باشد
- {
- hasSignatureIds = _contractApplication.CheckHasSignature(ids);
- if (hasSignatureIds == null ||
- (hasSignatureIds != null && hasSignatureIds.Count == 0)) //امضا نداشته باشد
- {
- op = _contractApplication.DeleteContarcts(id);
- }
- }
-
- return new JsonResult(new
- {
- hasCheckout = (checkoutList != null && checkoutList.Count() > 0) ? true : false,
- checkoutList = checkoutList,
- hasSignature = (hasSignatureIds != null && hasSignatureIds.Count() > 0) ? true : false,
- signatureList = hasSignatureIds,
- successDelete = op.IsSuccedded,
-
- });
-
-
- }
-
- public IActionResult OnPostSignatureAll(List ids, long workshopId)
- {
-
-
- var result = new OperationResult();
- var workshop = _workshopApplication.GetDetails(workshopId);
- var empId = workshop.EmployerIdList.FirstOrDefault();
- var isBlock = _personalContractingPartyApp.IsBlockByEmployerId(empId);
- if (isBlock == "true")
- {
- return new JsonResult(new
- {
- isSuccedded = false,
- });
- }
- else
- {
- foreach (var item in ids)
- {
- result = _contractApplication.Sign(item);
- if (!result.IsSuccedded)
- break;
- }
- return new JsonResult(result);
- }
-
-
-
- }
- public IActionResult OnPostDeleteAllSignature(List ids, long workshopId)
- {
- var permissions = _authHelper.GetPermissions();
- var checkHasPermission = permissions.Any(n => n.Equals(20122));
-
- var result = new OperationResult();
- var workshop = _workshopApplication.GetDetails(workshopId);
- var empId = workshop.EmployerIdList.FirstOrDefault();
- var isBlock = _personalContractingPartyApp.IsBlockByEmployerId(empId);
- if (isBlock == "true" || !checkHasPermission)
- {
- return new JsonResult(new
- {
- isSuccedded = false,
- });
- }
- else
- {
- foreach (var item in ids)
- {
- result = _contractApplication.UnSign(item);
- if (!result.IsSuccedded)
- break;
- }
- return new JsonResult(result);
- }
- }
-
-
- #endregion
- }
-
- public class Person
- {
- public string FirstName { get; set; }
- public string LastName { get; set; }
- public int Age { get; set; }
- }
+ private readonly IAuthHelper _authHelper;
+ private readonly ICheckoutRepository _checkoutRepository;
+ private readonly IContractApplication _contractApplication;
+ private readonly IContractRepository _contractRepository;
+ private readonly IEmployeeApplication _employeeApplication;
+ private readonly IEmployerApplication _employerApplication;
+ private readonly IJobApplication _jobApplication;
+ private readonly ILeaveApplication _leaveApplication;
+ private readonly ILeftWorkApplication _leftWorkApplication;
+ private readonly IPersonalContractingPartyApp _personalContractingPartyApp;
+ private readonly IWorkingHoursApplication _workingHoursApplication;
+ private readonly IWorkingHoursItemsApplication _workingHoursItemsApplication;
+ private readonly IWorkshopApplication _workshopApplication;
+ private readonly IYearlySalaryApplication _yearlySalaryApplication;
+ public List ComputingView;
+
+ public List Contracts;
+ public List Contracts2;
+ public string DeleteCheck = "false";
+ public string employeeFullName;
+ public List EmployeeList;
+ public SelectList Employees;
+ public List EmployerList;
+ public SelectList Employers;
+
+
+ public List JobList;
+ public SelectList Jobs;
+ public List PersonnelList;
+
+ public ContractSearchModel SearchModel;
+ public string SignCheck = "false";
+ public List WorkshopEmployer;
+ public List WorkshopList;
+
+ public SelectList Workshops;
+ public SelectList WorkshopsCode;
+ public string WorkshopSearch = "false";
+ public List YearlyList;
+
+ public IndexModel(IContractApplication contractApplication, IWorkshopApplication workshopApplication,
+ IEmployeeApplication employeeApplication,
+ IEmployerApplication employerApplication,
+ IYearlySalaryApplication yearlySalaryApplication,
+ IJobApplication jobApplication, IContractRepository contractRepository,
+ IWorkingHoursApplication workingHoursApplication,
+ IWorkingHoursItemsApplication workingHoursItemsApplication,
+ IAuthHelper authHelper, ILeftWorkApplication leftWorkApplication, ILeaveApplication leaveApplication,
+ ICheckoutRepository checkoutRepository, IPersonalContractingPartyApp personalContractingPartyApp)
+ {
+ _contractApplication = contractApplication;
+ _workshopApplication = workshopApplication;
+ _employeeApplication = employeeApplication;
+ _employerApplication = employerApplication;
+ _yearlySalaryApplication = yearlySalaryApplication;
+ _jobApplication = jobApplication;
+ _contractRepository = contractRepository;
+ _workingHoursApplication = workingHoursApplication;
+ _workingHoursItemsApplication = workingHoursItemsApplication;
+ _authHelper = authHelper;
+ _leftWorkApplication = leftWorkApplication;
+ _leaveApplication = leaveApplication;
+ _checkoutRepository = checkoutRepository;
+ _personalContractingPartyApp = personalContractingPartyApp;
+ }
+
+ public string Message { get; set; }
+ public bool falseCheck { get; set; }
+
+
+ [SuppressMessage("ReSharper.DPA", "DPA0009: High execution time of DB command", MessageId = "time: 619ms")]
+ public void OnGet(ContractSearchModel searchModel)
+ {
+ //EmployerList = _employerApplication.GetEmployers();
+ //EmployeeList = _employeeApplication.GetEmployee();
+ //WorkshopList = _workshopApplication.GetWorkshop();
+ Jobs =
+ new SelectList(_jobApplication.GetJob(), "Id", "JobName");
+
+ Workshops =
+ new SelectList(_workshopApplication.GetWorkshopAccount(), "Id", "WorkshopFullName");
+
+ WorkshopsCode =
+ new SelectList(_workshopApplication.GetWorkshopAccount(), "Id", "ArchiveCode");
+
+ //Employees =
+ // new SelectList(_employeeApplication.GetEmployee(), "Id", "EmployeeFullName");
+
+ Employers =
+ new SelectList(_employerApplication.GetEmployers(), "Id", "FullName");
+ YearlyList =
+ _yearlySalaryApplication.GetYears();
+
+ Contracts = _contractApplication.SearchForMainContract(searchModel);
+ if (Contracts != null)
+ {
+ if (searchModel.WorkshopIds != 0 || searchModel.EmployeeId != 0) WorkshopSearch = "true";
+ if (searchModel.WorkshopIds != 0 && !string.IsNullOrEmpty(searchModel.Year)) DeleteCheck = "true";
+ if (searchModel.WorkshopIds != 0 && !string.IsNullOrEmpty(searchModel.Year) &&
+ !string.IsNullOrEmpty(searchModel.Month)) SignCheck = "true";
+ }
+
+ if (searchModel.EmployeeId > 0)
+ employeeFullName = Contracts.Select(x => x.EmployeeName).FirstOrDefault();
+ else
+ employeeFullName = searchModel.EmployeeName;
+ }
+
+
+ public async Task OnGetPersonelMainList(string searchEmployee)
+ {
+ PersonnelList = await _employeeApplication.GetEmployeeToList();
+ var person = PersonnelList.Where(x => x.EmployeeFullName.Contains(searchEmployee)).Take(200).ToList();
+ person = person.OrderBy(x => x.EmployeeFullName.Length).ToList();
+
+
+ return new JsonResult(new
+ {
+ IsSuccedded = true,
+ mylist = person
+ });
+ }
+
+ public IActionResult OnPostCheckPsCode(long id, long workshopId, string code)
+ {
+ var psCode = Convert.ToInt64(code);
+ var cheker = _contractRepository.Exists(x =>
+ x.PersonnelCode == psCode && x.WorkshopIds == workshopId && x.EmployeeId != id &&
+ x.IsActiveString == "true");
+ if (cheker)
+ return new JsonResult(new
+ {
+ IsSuccedded = true,
+ psCodeExist = true
+ });
+ return new JsonResult(new
+ {
+ IsSuccedded = true,
+ psCodeExist = false
+ });
+ }
+
+ public IActionResult OnPostLoadPersonel(long id, long workshopId)
+ {
+ var leftWorkStartdate = "";
+ var result = _employeeApplication.GetDetails(id);
+ var serachModel = new LeftWorkSearchModel
+ {
+ EmployeeId = id,
+ WorkshopId = workshopId
+ };
+ var leftWoekSerchResult = _leftWorkApplication.search(serachModel);
+ if (leftWoekSerchResult.Count > 0)
+ //var leftWorkLast = leftWoekSerchResult.OrderByDescending(x => x.StartWorkDateGr).FirstOrDefault();
+ //if (leftWorkLast.LeftWorkDate == "1500/01/01")
+ //{
+ // leftWorkStartdate = leftWoekSerchResult.Select(x => x.StartWorkDate).FirstOrDefault();
+ //}
+ leftWorkStartdate = leftWoekSerchResult.OrderBy(x => x.StartWorkDateGr).FirstOrDefault()?.StartWorkDate;
+
+ //var psCode = _contractRepository.FindPersonnelCode(workshopId, id);
+ //var contractExistBythisPsCode = _contractRepository.Exists(x => x.PersonnelCode == psCode && x.WorkshopIds == workshopId && x.EmployeeId == id && x.IsActiveString =="true");
+ //var chekoutExistByThisPerson = _checkoutRepository.Exists(x => x.EmployeeId == id && x.WorkshopId == workshopId);
+ //var exsitContractAndCheckout = false;
+ //if(contractExistBythisPsCode || chekoutExistByThisPerson)
+ //{
+ // exsitContractAndCheckout = true;
+ //}
+ return new JsonResult(new
+ {
+ IsSuccedded = true,
+ result.FatherName,
+ result.NationalCode,
+ result.IdNumber,
+ result.DateOfBirth,
+ result.State,
+ result.City,
+ result.Address,
+ LeftWorkStartDate = leftWorkStartdate
+ //personnelCode = psCode,
+ //contractExist = exsitContractAndCheckout
+ });
+ }
+
+ public IActionResult OnPostLoadWorkshops(long id)
+ {
+ var result = _workshopApplication.GetWorkshopInfo(id);
+ return new JsonResult(new
+ {
+ IsSuccedded = true,
+ InsurancCode = result.InsuranceCode,
+ archiveCode = result.ArchiveCode,
+ state = result.State,
+ city = result.City,
+ address = result.Address,
+ adres = result.State + "-" + result.City + "-" + result.Address,
+ empList = result.EmpList,
+ employeeList = result.EmployeeList
+ });
+ }
+
+ // پرینت تکی
+
+ #region PrintOne
+
+ public IActionResult OnGetDetails(long id)
+ {
+ var res = _contractApplication.GetDetails(id);
+ var weeklyDouble = 0.0;
+ var weekly = res.WorkingHoursWeekly;
+ if (!string.IsNullOrWhiteSpace(weekly) &&
+ weekly != "24 - 12" && weekly != "24 - 24" && weekly != "36 - 12" && weekly != "48 - 24")
+ {
+ if (weekly.Contains("/"))
+ {
+ weeklyDouble = double.Parse(weekly);
+ var minute = (int)(weeklyDouble % 1 * 60);
+ var hour = (int)weeklyDouble;
+ res.WorkingHoursWeekly = hour + " " + "ساعت و" + " " + minute + " " + "دقیقه";
+ }
+ else if (weekly.Contains("."))
+ {
+ weeklyDouble = double.Parse(weekly, CultureInfo.InvariantCulture);
+ var minute = (int)(weeklyDouble % 1 * 60);
+ var hour = (int)weeklyDouble;
+ res.WorkingHoursWeekly = hour + " " + "ساعت و" + " " + minute + " " + "دقیقه";
+ }
+ else
+ {
+ res.WorkingHoursWeekly = res.WorkingHoursWeekly + " " + "ساعت";
+ }
+ }
+
+
+ //res.WorkshopEmployerList = _contractRepository.GetWorkshopEmployer();
+ //res.Employers = _employerApplication.GetEmployers();
+ //res.Employees = _employeeApplication.GetEmployee();
+ //res.Workshops = _workshopApplication.GetWorkshop();
+ return Partial("Details", res);
+ }
+
+ #endregion
+
+ // پرینت گروهی
+
+ #region PrintAll
+
+ public IActionResult OnGetPrintAllB(List ids)
+ {
+ var result = _contractApplication.PrintAll(ids);
+ var finalresult = result.OrderByDescending(x => x.ContractEndGr).ToList();
+ var res = new GroupPrintViewModel
+ {
+ ContractList = finalresult
+ };
+ //var res = _contractApplication.PrintAll(ids);
+
+ return Partial("PrintAllTest", res);
+ }
+
+ #endregion
+
+ public IActionResult OnGetDeActive(long id)
+ {
+ var result = _contractApplication.DeActive(id);
+
+ if (result.IsSuccedded)
+ return RedirectToPage("./Index");
+ Message = result.Message;
+ return RedirectToPage("./Index");
+ }
+
+ public IActionResult OnGetIsActive(long id)
+ {
+ var result = _contractApplication.Active(id);
+ if (result.IsSuccedded)
+ return RedirectToPage("./Index");
+ Message = result.Message;
+ return RedirectToPage("./Index");
+ }
+
+ //public IActionResult OnGetSign(long id)
+ //{
+
+
+ // var result = _contractApplication.Sign(id);
+ // return RedirectToPage("./Index");
+
+
+ //}
+ //public IActionResult OnGetUnSign(long id)
+ //{
+
+
+ // var result = _contractApplication.UnSign(id);
+ // return RedirectToPage("./Index");
+
+ //}
+ public IActionResult OnGetSign(string Id)
+ {
+ var id = Convert.ToInt64(Id);
+ var result = _contractApplication.Sign(id);
+ if (result.IsSuccedded)
+ return new JsonResult(new
+ {
+ IsSuccedded = true
+ });
+ return new JsonResult(new
+ {
+ IsSuccedded = false
+ });
+ }
+
+ public IActionResult OnGetUnSign(string Id)
+ {
+ var permissions = _authHelper.GetPermissions();
+ var checkHasPermission = permissions.Any(n => n.Equals(20122));
+ if (checkHasPermission)
+ {
+ var id = Convert.ToInt64(Id);
+ var result = _contractApplication.UnSign(id);
+ if (result.IsSuccedded)
+ return new JsonResult(new
+ {
+ IsSuccedded = true
+ });
+ return new JsonResult(new
+ {
+ IsSuccedded = false
+ });
+ }
+
+ return new JsonResult(new
+ {
+ IsSuccedded = false
+ });
+ }
+
+ public IActionResult OnGetGroupDeActive(List ids)
+ {
+ foreach (var item in ids)
+ {
+ var result = _contractApplication.DeActive(item);
+ }
+
+ return RedirectToPage("./Index");
+ }
+
+
+ public IActionResult OnGetGroupReActive(List ids)
+ {
+ foreach (var item in ids)
+ {
+ var result = _contractApplication.Active(item);
+ }
+
+
+ //if (result.IsSuccedded)
+ // return RedirectToPage("./Index");
+
+ return RedirectToPage("./Index");
+ }
+
+
+ public IActionResult OnGetGroupSign(List ids)
+ {
+ foreach (var item in ids)
+ {
+ var result = _contractApplication.Sign(item);
+ }
+
+ return RedirectToPage("./Index");
+ }
+
+ public IActionResult OnGetGroupUnSign(List ids)
+ {
+ foreach (var item in ids)
+ {
+ var result = _contractApplication.UnSign(item);
+ }
+
+ return RedirectToPage("./Index");
+ }
+
+
+ // مرخصی
+
+ #region PaidLeaveSickLeav
+
+ #region SickLeave
+
+ public IActionResult OnGetCreateSickLeave(long employeeId, long workshopId, long hd)
+ {
+ var workshopName = _workshopApplication.GetDetails(workshopId);
+ var employeeName = _employeeApplication.GetDetails(employeeId);
+ var search = new LeaveSearchModel
+ {
+ EmployeeId = employeeId,
+ WorkshopId = workshopId,
+ LeaveType = "استعلاجی"
+ };
+ var serachResult = _leaveApplication.search(search);
+
+ var command = new CreateLeave
+ {
+ EmployeeId = employeeId,
+ WorkshopId = workshopId,
+ LeaveSearch = serachResult,
+ WorkshopName = workshopName.WorkshopFullName,
+ EmployeeFullName = employeeName.EmployeeFullName
+ };
+ return Partial("./SickLeave", command);
+ }
+
+ public IActionResult OnPostCreateSickLeave(CreateLeave command)
+ {
+ command.LeaveType = "استعلاجی";
+
+ var result = _leaveApplication.Create(command);
+ var res = result.IsSuccedded;
+ return new JsonResult(new
+ {
+ IsSuccedded = res,
+ message = result.Message,
+ command.EmployeeId,
+ command.WorkshopId
+ });
+ }
+
+ public IActionResult OnPostRemoveSickLeave(long id, long EmployeeId, long WorkshopId)
+ {
+ var result = _leaveApplication.RemoveLeave(id);
+ var res = result.IsSuccedded;
+ return new JsonResult(new
+ {
+ IsSuccedded = res,
+ message = result.Message,
+ employeeId = EmployeeId,
+ workshopId = WorkshopId,
+ hd = 1
+ });
+ }
+
+ public IActionResult OnGetEditSickLeave(long id)
+ {
+ var res = _leaveApplication.GetDetails(id);
+
+
+ return Partial("EditSick", res);
+ }
+
+ public IActionResult OnPostEditSickLeave(EditLeave command)
+ {
+ if (ModelState.IsValid)
+ {
+ }
+
+ command.LeaveType = "استعلاجی";
+ var result = _leaveApplication.Edit(command);
+
+ var res = result.IsSuccedded;
+ return new JsonResult(new
+ {
+ IsSuccedded = res,
+ message = result.Message,
+ employeeId = command.EmployeeId,
+ workshopId = command.WorkshopId,
+ hd = 1
+ });
+ }
+
+ #endregion
+
+ #region PaidLeave
+
+ public IActionResult OnGetCreatePaidLeave(long employeeId, long workshopId, long hd)
+ {
+ var workshopName = _workshopApplication.GetDetails(workshopId);
+ var employeeName = _employeeApplication.GetDetails(employeeId);
+ var search = new LeaveSearchModel
+ {
+ EmployeeId = employeeId,
+ WorkshopId = workshopId,
+ LeaveType = "استحقاقی"
+ };
+ var serachResult = _leaveApplication.search(search);
+
+ var command = new CreateLeave
+ {
+ EmployeeId = employeeId,
+ WorkshopId = workshopId,
+ LeaveSearch = serachResult,
+ WorkshopName = workshopName.WorkshopFullName,
+ EmployeeFullName = employeeName.EmployeeFullName
+ };
+ return Partial("./PaidLeave", command);
+ }
+
+ public IActionResult OnPostCreatePaidLeave(CreateLeave command)
+ {
+ command.LeaveType = "استحقاقی";
+
+ var result = _leaveApplication.Create(command);
+ var res = result.IsSuccedded;
+ return new JsonResult(new
+ {
+ IsSuccedded = res,
+ message = result.Message,
+ command.EmployeeId,
+ command.WorkshopId
+ });
+ }
+
+ public IActionResult OnGetCheckIfValidToEdit(long id)
+ {
+ var check = _leaveApplication.CheckIfValidToEdit(id);
+ if (check)
+ return new JsonResult(new
+ {
+ validToEdit = true
+ });
+ return new JsonResult(new
+ {
+ validToEdit = false
+ });
+ }
+
+ public IActionResult OnGetEditPaidLeave(long id)
+ {
+ var res = _leaveApplication.GetDetails(id);
+ return Partial("EditPaidLeave", res);
+ }
+
+ public IActionResult OnPostEditPaidLeave(EditLeave command)
+ {
+ if (ModelState.IsValid)
+ {
+ }
+
+ command.LeaveType = "استحقاقی";
+ var result = _leaveApplication.Edit(command);
+
+ var res = result.IsSuccedded;
+ return new JsonResult(new
+ {
+ IsSuccedded = res,
+ message = result.Message,
+ employeeId = command.EmployeeId,
+ workshopId = command.WorkshopId,
+ hd = 1
+ });
+ }
+
+ public IActionResult OnGetComputeLeavHourse(string startHours, string endHourse)
+ {
+ var start = Convert.ToDateTime(startHours);
+ var end = Convert.ToDateTime(endHourse);
+ if (start > end || start == end) end = end.AddDays(1);
+
+ var hoursesSpan = end - start;
+ var hours = (int)hoursesSpan.TotalHours;
+ var minuts = hoursesSpan.TotalMinutes % 60;
+
+
+ if (hours > 0 && minuts > 0)
+ return new JsonResult(new
+ {
+ res = hours + " " + "ساعت و" + " " + minuts + " " + "دقیقه"
+ });
+ if (hours > 0 && minuts == 0)
+ return new JsonResult(new
+ {
+ res = hours + " " + "ساعت "
+ });
+ if (hours == 0 && minuts > 0)
+ return new JsonResult(new
+ {
+ res = minuts + " " + "دقیقه"
+ });
+
+ return new JsonResult(new
+ {
+ totalHours = $"{hours}"
+ });
+ }
+
+ public IActionResult OnGetComputeLeavdays(string startDay, string endDay)
+ {
+ if (!string.IsNullOrWhiteSpace(startDay) && !string.IsNullOrWhiteSpace(endDay))
+ {
+ var start = startDay.ToGeorgianDateTime();
+ var end = endDay.ToGeorgianDateTime();
+ if (end >= start)
+ {
+ var daysSpan = (end - start).TotalDays + 1;
+ return new JsonResult(new
+ {
+ res = $"{(int)daysSpan} روز"
+ });
+ }
+
+ return new JsonResult(new
+ {
+ res = "تاریخ پایان از تاریخ شروع کوچکتر است"
+ });
+ }
+
+ return new JsonResult(new
+ {
+ res = ""
+ });
+ }
+
+ public IActionResult OnPostRemovePaidLeave(long id, long EmployeeId, long WorkshopId)
+ {
+ var result = _leaveApplication.RemoveLeave(id);
+ var res = result.IsSuccedded;
+ return new JsonResult(new
+ {
+ IsSuccedded = res,
+ message = result.Message,
+ employeeId = EmployeeId,
+ workshopId = WorkshopId,
+ hd = 1
+ });
+ }
+
+ #endregion
+
+ #endregion
+
+ //ترک کار
+
+ #region LeftWorks
+
+ public IActionResult OnPostRemoveLeftWork(long id, long EmployeeId, string employeeName)
+ {
+ var result = _leftWorkApplication.RemoveLeftWork(id);
+ var res = result.IsSuccedded;
+ return new JsonResult(new
+ {
+ IsSuccedded = res,
+ message = result.Message,
+ employeeId = EmployeeId,
+ employeeName,
+ hd = 1
+ });
+ }
+
+ public IActionResult OnGetCreateLeftWork(long employeeId, string employeeName)
+ {
+ var search = new LeftWorkSearchModel
+ {
+ EmployeeId = employeeId
+ };
+ var serachResult = _leftWorkApplication.search(search);
+ var workShops = _workshopApplication.GetWorkshop();
+ var command = new CreateLeftWork
+ {
+ EmployeeId = employeeId,
+ EmployeeFullName = employeeName,
+ LeftWorkSearch = serachResult,
+ Workshops = workShops
+ };
+ return Partial("./LeftWork", command);
+ }
+
+ public IActionResult OnPostCreateLetWork(CreateLeftWork command)
+ {
+ //var workshopName = _workshopApplication.GetDetails(command.WorkshopId);
+ //var start = _leftWorkApplication.StartWork(command.EmployeeId, command.WorkshopId, command.LeftWorkDate);
+ command.LeftWorkDate = "1500/01/01";
+ //command.WorkshopName = workshopName.WorkshopFullName;
+
+ var result = _leftWorkApplication.Create(command);
+ var res = result.IsSuccedded;
+ return new JsonResult(new
+ {
+ IsSuccedded = res,
+ message = result.Message,
+ command.EmployeeId,
+ employeeName = command.EmployeeFullName
+ });
+ }
+
+ public IActionResult OnGetEditLeftWork(long id)
+ {
+ var res = _leftWorkApplication.GetDetails(id);
+
+
+ return Partial("EditLeftWork", res);
+ }
+
+ public IActionResult OnPostEditLeftWork(EditLeftWork command)
+ {
+ if (ModelState.IsValid)
+ {
+ }
+
+
+ var result = _leftWorkApplication.Edit(command);
+
+ var res = result.IsSuccedded;
+ return new JsonResult(new
+ {
+ IsSuccedded = res,
+ message = result.Message,
+ employeeId = command.EmployeeId,
+ employeeName = command.EmployeeFullName,
+ hd = 1
+ });
+ }
+
+ public IActionResult OnGetEnterLeftWork(long id, string employeeName)
+ {
+ var res = _leftWorkApplication.GetDetails(id);
+ res.LeftWorkDate = "";
+ res.EmployeeFullName = employeeName;
+
+ return Partial("EnterLeftWorkDate", res);
+ }
+
+ public IActionResult OnPostEnterLeftWork(EditLeftWork command)
+ {
+ if (ModelState.IsValid)
+ {
+ }
+
+
+ var result = _leftWorkApplication.Edit(command);
+
+ var res = result.IsSuccedded;
+ return new JsonResult(new
+ {
+ IsSuccedded = res,
+ message = result.Message,
+ employeeId = command.EmployeeId,
+ workshopId = command.WorkshopId,
+ hd = 1
+ });
+ }
+
+ #endregion
+
+ #region NewChangeByHeydari
+
+ public IActionResult OnPostDeleteAllContarcts(List ids, long workshopId)
+ {
+ var op = new OperationResult();
+ var workshop = _workshopApplication.GetDetails(workshopId);
+ var empId = workshop.EmployerIdList.FirstOrDefault();
+ var isBlock = _personalContractingPartyApp.IsBlockByEmployerId(empId);
+ if (isBlock == "true")
+ return new JsonResult(new
+ {
+ successDelete = false
+ });
+
+ var checkoutList = _contractApplication.CheckHasCheckout(ids);
+ var hasSignatureIds = new List();
+ if (checkoutList == null || (checkoutList != null && checkoutList.Count == 0)) //تصفیه حساب نداشته باشد
+ {
+ hasSignatureIds = _contractApplication.CheckHasSignature(ids);
+ if (hasSignatureIds == null || (hasSignatureIds != null && hasSignatureIds.Count == 0)) //امضا نداشته باشد
+ op = _contractApplication.DeleteAllContarcts(ids);
+ }
+
+ return new JsonResult(new
+ {
+ hasCheckout = checkoutList != null && checkoutList.Count() > 0 ? true : false,
+ checkoutList,
+ hasSignature = hasSignatureIds != null && hasSignatureIds.Count() > 0 ? true : false,
+ signatureList = hasSignatureIds,
+ successDelete = op.IsSuccedded
+ });
+ }
+
+ public IActionResult OnPostDeleteContarcts(long id)
+ {
+ var ids = new List();
+ ids.Add(id);
+ var op = new OperationResult();
+ var checkoutList = _contractApplication.CheckHasCheckout(ids);
+ var hasSignatureIds = new List();
+ if (checkoutList == null || (checkoutList != null && checkoutList.Count == 0)) //تصفیه حساب نداشته باشد
+ {
+ hasSignatureIds = _contractApplication.CheckHasSignature(ids);
+ if (hasSignatureIds == null ||
+ (hasSignatureIds != null && hasSignatureIds.Count == 0)) //امضا نداشته باشد
+ op = _contractApplication.DeleteContarcts(id);
+ }
+
+ return new JsonResult(new
+ {
+ hasCheckout = checkoutList != null && checkoutList.Count() > 0 ? true : false,
+ checkoutList,
+ hasSignature = hasSignatureIds != null && hasSignatureIds.Count() > 0 ? true : false,
+ signatureList = hasSignatureIds,
+ successDelete = op.IsSuccedded
+ });
+ }
+
+ public IActionResult OnPostSignatureAll(List ids, long workshopId)
+ {
+ var result = new OperationResult();
+ var workshop = _workshopApplication.GetDetails(workshopId);
+ var empId = workshop.EmployerIdList.FirstOrDefault();
+ var isBlock = _personalContractingPartyApp.IsBlockByEmployerId(empId);
+ if (isBlock == "true")
+ return new JsonResult(new
+ {
+ isSuccedded = false
+ });
+
+ foreach (var item in ids)
+ {
+ result = _contractApplication.Sign(item);
+ if (!result.IsSuccedded)
+ break;
+ }
+
+ return new JsonResult(result);
+ }
+
+ public IActionResult OnPostDeleteAllSignature(List ids, long workshopId)
+ {
+ var permissions = _authHelper.GetPermissions();
+ var checkHasPermission = permissions.Any(n => n.Equals(20122));
+
+ var result = new OperationResult();
+ var workshop = _workshopApplication.GetDetails(workshopId);
+ var empId = workshop.EmployerIdList.FirstOrDefault();
+ var isBlock = _personalContractingPartyApp.IsBlockByEmployerId(empId);
+ if (isBlock == "true" || !checkHasPermission)
+ return new JsonResult(new
+ {
+ isSuccedded = false
+ });
+
+ foreach (var item in ids)
+ {
+ result = _contractApplication.UnSign(item);
+ if (!result.IsSuccedded)
+ break;
+ }
+
+ return new JsonResult(result);
+ }
+
+ #endregion
}
+
+public class Person
+{
+ public string FirstName { get; set; }
+ public string LastName { get; set; }
+ public int Age { get; set; }
+}
\ No newline at end of file
diff --git a/ServiceHost/Areas/Admin/Pages/Company/Contracts/LeftWork.cshtml b/ServiceHost/Areas/Admin/Pages/Company/Contracts/LeftWork.cshtml
index d9a39453..fe5e0ebf 100644
--- a/ServiceHost/Areas/Admin/Pages/Company/Contracts/LeftWork.cshtml
+++ b/ServiceHost/Areas/Admin/Pages/Company/Contracts/LeftWork.cshtml
@@ -1,12 +1,11 @@
@model CompanyManagment.App.Contracts.LeftWork.CreateLeftWork
@{
-
- int i = 1;
+ var i = 1;
}
@{
-
-
+
}