insurance speedup
This commit is contained in:
@@ -30,30 +30,62 @@ public class EmployeeInsurancListData : EntityBase
|
||||
IncludeStatus = includeStatus;
|
||||
BaseYears = baseYears;
|
||||
MarriedAllowance = marriedAllowance;
|
||||
DailyWagePlusBaseYears = dailyWage + baseYears;
|
||||
}
|
||||
|
||||
public long InsuranceListId { get; private set; }
|
||||
public long EmployeeId { get; private set; }
|
||||
//روزهای کارکرد پرسنل
|
||||
|
||||
/// <summary>
|
||||
/// تعداد روز های کارکرد پرسنل
|
||||
/// DSW_DD
|
||||
/// </summary>
|
||||
public int WorkingDays { get; private set; }
|
||||
// دستمزد روزانه
|
||||
|
||||
/// <summary>
|
||||
/// دستمزد روزانه پرسنل double
|
||||
/// DSW_ROOZ
|
||||
/// </summary>
|
||||
public double DailyWage { get; private set; }
|
||||
//دستمزد ماهانه
|
||||
|
||||
/// <summary>
|
||||
/// دستمزد ماهانه پرسنل double
|
||||
/// DSW_MAH
|
||||
/// </summary>
|
||||
public double MonthlySalary{ get; private set; }
|
||||
|
||||
//مزایای ماهانه
|
||||
|
||||
/// <summary>
|
||||
/// مزایای ماهانه
|
||||
/// DSW_MAZ
|
||||
/// </summary>
|
||||
public double MonthlyBenefits { get; private set; }
|
||||
//دستمزد و مزایای ماهانه مشمول
|
||||
|
||||
/// <summary>
|
||||
/// جمع دستمزد و مزایای ماهانه مشمول
|
||||
/// DSW_MASH
|
||||
/// </summary>
|
||||
public double MonthlyBenefitsIncluded { get; private set; }
|
||||
// مزایای مشمول مستمر
|
||||
public double BenefitsIncludedContinuous { get; private set; }
|
||||
//مزایای مشمول غیر مستمر
|
||||
public double BenefitsIncludedNonContinuous { get; private set; }
|
||||
//سهم بیمه حق کارگر
|
||||
|
||||
/// <summary>
|
||||
/// حق بیمه سهم بیمه شده
|
||||
/// DSW_BIME
|
||||
/// </summary>
|
||||
public double InsuranceShare { get; private set; }
|
||||
// تاریخ شروع به کار
|
||||
|
||||
/// <summary>
|
||||
/// تایخ شروع بکار میلادی
|
||||
/// DSW_SDATE
|
||||
/// </summary>
|
||||
public DateTime StartWorkDate { get; private set; }
|
||||
//تاریخ ترک کار
|
||||
|
||||
/// <summary>
|
||||
/// تاریخ ترک کار میلادی
|
||||
/// DSW_EDATE
|
||||
/// </summary>
|
||||
public DateTime? LeftWorkDate { get; private set; }
|
||||
// آی دی شغل
|
||||
public long JobId { get; private set; }
|
||||
@@ -66,6 +98,12 @@ public class EmployeeInsurancListData : EntityBase
|
||||
/// </summary>
|
||||
public double BaseYears { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// جمع پایه سنوات و دستمزد روزانه
|
||||
/// DSW_INC
|
||||
/// </summary>
|
||||
public double DailyWagePlusBaseYears { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// حق تاهل
|
||||
/// DSW_SPOUSE
|
||||
@@ -92,7 +130,9 @@ public class EmployeeInsurancListData : EntityBase
|
||||
IncludeStatus= includeStatus;
|
||||
BaseYears = baseYears;
|
||||
MarriedAllowance = marriedAllowance;
|
||||
DailyWagePlusBaseYears = dailyWage + baseYears;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -27,6 +27,15 @@ public interface IInsuranceListRepository:IRepository<long, InsuranceList>
|
||||
|
||||
InsuranceListViewModel GetInsuranceListByWorkshopIdAndYear(long workshopId, string year);
|
||||
|
||||
#region farokhi
|
||||
/// <summary>
|
||||
/// جستجوی لیست بیمه بهینه شده
|
||||
/// </summary>
|
||||
/// <param name="searchModel"></param>
|
||||
/// <returns></returns>
|
||||
public List<InsuranceListViewModel> OptimizedSearch(InsuranceListSearchModel searchModel);
|
||||
|
||||
#endregion
|
||||
|
||||
#region client
|
||||
List<InsuranceListViewModel> SearchForClient(InsuranceListSearchModel searchModel);
|
||||
|
||||
@@ -35,6 +35,7 @@ public class InsuranceList : EntityBase
|
||||
SumOfBaseYears = sumOfBaseYears;
|
||||
SumOfMarriedAllowance = sumOfMarriedAllowance;
|
||||
ConfirmSentlist = confirmSentlist;
|
||||
SumOfDailyWagePlusBaseYears = sumOfDailyWage + sumOfBaseYears;
|
||||
|
||||
}
|
||||
//آی دی کارگاه
|
||||
@@ -138,6 +139,12 @@ public class InsuranceList : EntityBase
|
||||
/// </summary>
|
||||
public double SumOfBaseYears { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// جمع پایه سنوات و دستمزد روزانه کارکنان
|
||||
/// DSW_INC
|
||||
/// </summary>
|
||||
public double SumOfDailyWagePlusBaseYears { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// مجموع حق تاهل کارکنان
|
||||
/// DSK_SPOUSE
|
||||
@@ -164,6 +171,7 @@ public class InsuranceList : EntityBase
|
||||
SumOfBaseYears = sumOfBaseYears;
|
||||
SumOfMarriedAllowance = sumOfMarriedAllowance;
|
||||
ConfirmSentlist = confirmSentlist;
|
||||
SumOfDailyWagePlusBaseYears = sumOfDailyWage + sumOfBaseYears;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -75,6 +75,12 @@ public class CreateEmployeeInsurancListData
|
||||
/// </summary>
|
||||
public double BaseYears { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// جمع پایه سنوات و دستمزد روزانه
|
||||
/// DSW_INC
|
||||
/// </summary>
|
||||
public double DailyWagePlusBaseYears { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// حق تاهل
|
||||
/// DSW_SPOUSE
|
||||
|
||||
@@ -35,4 +35,22 @@ public class EmployeeInsurancListDataSearchModel
|
||||
public DateTime LeftWorkDate { get; set; }
|
||||
// آی دی شغل
|
||||
public long JobId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// پایه سنواتی
|
||||
/// DSW_INC
|
||||
/// </summary>
|
||||
public double BaseYears { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// جمع پایه سنوات و دستمزد روزانه
|
||||
/// DSW_INC
|
||||
/// </summary>
|
||||
public double DailyWagePlusBaseYears { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// حق تاهل
|
||||
/// DSW_SPOUSE
|
||||
/// </summary>
|
||||
public double MarriedAllowance { get; set; }
|
||||
}
|
||||
@@ -103,6 +103,12 @@ public class EmployeeInsurancListDataViewModel
|
||||
/// </summary>
|
||||
public double BaseYears { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// جمع پایه سنوات و دستمزد روزانه
|
||||
/// DSW_INC
|
||||
/// </summary>
|
||||
public double DailyWagePlusBaseYears { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// حق تاهل
|
||||
/// DSW_SPOUSE
|
||||
|
||||
@@ -137,6 +137,12 @@ public class CreateInsuranceList
|
||||
/// </summary>
|
||||
public double SumOfBaseYears { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// جمع پایه سنوات و دستمزد روزانه کارکنان
|
||||
/// DSW_INC
|
||||
/// </summary>
|
||||
public double SumOfDailyWagePlusBaseYears { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// مجموع حق تاهل کارکنان
|
||||
/// DSK_SPOUSE
|
||||
|
||||
@@ -218,4 +218,22 @@ public class EmployeeDetailsForInsuranceListViewModel
|
||||
public bool HasConfilictLeftWork { get; set; }
|
||||
public double YearlySalaryItem { get; set; }
|
||||
public bool HasConfilictJobs { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// مجموع پایه سنواتی کارکنان
|
||||
/// DSK_INC
|
||||
/// </summary>
|
||||
public double SumOfBaseYears { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// جمع پایه سنوات و دستمزد روزانه کارکنان
|
||||
/// DSW_INC
|
||||
/// </summary>
|
||||
public double SumOfDailyWagePlusBaseYears { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// مجموع حق تاهل کارکنان
|
||||
/// DSK_SPOUSE
|
||||
/// </summary>
|
||||
public double SumOfMarriedAllowance { get; set; }
|
||||
}
|
||||
@@ -20,6 +20,7 @@ public class InsuranceWorkshopInfoViewModel
|
||||
/// DSK_ID
|
||||
/// </summary>
|
||||
public string InsuranceCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// ردیف پیمان
|
||||
/// </summary>
|
||||
|
||||
@@ -337,28 +337,29 @@ public class InsuranceListApplication: IInsuranceListApplication
|
||||
|
||||
public List<InsuranceListViewModel> Search(InsuranceListSearchModel searchModel)
|
||||
{
|
||||
var result = _insuranceListRepositpry.Search(searchModel);
|
||||
result = result.Select(x => new InsuranceListViewModel()
|
||||
{
|
||||
Id = x.Id,
|
||||
Year = x.Year,
|
||||
Month = x.Month.GetMonthByNumber(),
|
||||
MonthNumber = x.MonthNumber,
|
||||
WorkShopCode = x.WorkShopCode,
|
||||
WorkShopName = x.WorkShopName,
|
||||
WorkShopId = x.WorkShopId,
|
||||
TypeOfInsuranceSend = x.TypeOfInsuranceSend,
|
||||
FixedSalary = x.FixedSalary,
|
||||
StrFixedSalary = x.StrFixedSalary,
|
||||
EmployerName = x.EmployerName,
|
||||
Branch = x.Branch,
|
||||
City = x.City,
|
||||
ConfirmSentlist = x.ConfirmSentlist,
|
||||
EmployerId = x.EmployerId,
|
||||
IsBlockCantracingParty = _contractingPartyApp.IsBlockByEmployerId(x.EmployerId),
|
||||
return _insuranceListRepositpry.OptimizedSearch(searchModel);
|
||||
//var result = _insuranceListRepositpry.Search(searchModel);
|
||||
//result = result.Select(x => new InsuranceListViewModel()
|
||||
//{
|
||||
// Id = x.Id,
|
||||
// Year = x.Year,
|
||||
// Month = x.Month.GetMonthByNumber(),
|
||||
// MonthNumber = x.MonthNumber,
|
||||
// WorkShopCode = x.WorkShopCode,
|
||||
// WorkShopName = x.WorkShopName,
|
||||
// WorkShopId = x.WorkShopId,
|
||||
// TypeOfInsuranceSend = x.TypeOfInsuranceSend,
|
||||
// FixedSalary = x.FixedSalary,
|
||||
// StrFixedSalary = x.StrFixedSalary,
|
||||
// EmployerName = x.EmployerName,
|
||||
// Branch = x.Branch,
|
||||
// City = x.City,
|
||||
// ConfirmSentlist = x.ConfirmSentlist,
|
||||
// EmployerId = x.EmployerId,
|
||||
// IsBlockCantracingParty = _contractingPartyApp.IsBlockByEmployerId(x.EmployerId),
|
||||
|
||||
}).ToList();
|
||||
return result;
|
||||
//}).ToList();
|
||||
//return result;
|
||||
}
|
||||
|
||||
// محاسبه جدول پرسنل در - DSKWOR 1 create
|
||||
|
||||
8401
CompanyManagment.EFCore/Migrations/20250116224550_AddBaseYearsToInsurance.Designer.cs
generated
Normal file
8401
CompanyManagment.EFCore/Migrations/20250116224550_AddBaseYearsToInsurance.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,84 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CompanyManagment.EFCore.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddBaseYearsToInsurance : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<double>(
|
||||
name: "SumOfBaseYears",
|
||||
table: "InsuranceLists",
|
||||
type: "float",
|
||||
nullable: false,
|
||||
defaultValue: 0.0);
|
||||
|
||||
migrationBuilder.AddColumn<double>(
|
||||
name: "SumOfDailyWagePlusBaseYears",
|
||||
table: "InsuranceLists",
|
||||
type: "float",
|
||||
nullable: false,
|
||||
defaultValue: 0.0);
|
||||
|
||||
migrationBuilder.AddColumn<double>(
|
||||
name: "SumOfMarriedAllowance",
|
||||
table: "InsuranceLists",
|
||||
type: "float",
|
||||
nullable: false,
|
||||
defaultValue: 0.0);
|
||||
|
||||
migrationBuilder.AddColumn<double>(
|
||||
name: "BaseYears",
|
||||
table: "EmployeeInsurancListData",
|
||||
type: "float",
|
||||
nullable: false,
|
||||
defaultValue: 0.0);
|
||||
|
||||
migrationBuilder.AddColumn<double>(
|
||||
name: "DailyWagePlusBaseYears",
|
||||
table: "EmployeeInsurancListData",
|
||||
type: "float",
|
||||
nullable: false,
|
||||
defaultValue: 0.0);
|
||||
|
||||
migrationBuilder.AddColumn<double>(
|
||||
name: "MarriedAllowance",
|
||||
table: "EmployeeInsurancListData",
|
||||
type: "float",
|
||||
nullable: false,
|
||||
defaultValue: 0.0);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "SumOfBaseYears",
|
||||
table: "InsuranceLists");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "SumOfDailyWagePlusBaseYears",
|
||||
table: "InsuranceLists");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "SumOfMarriedAllowance",
|
||||
table: "InsuranceLists");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "BaseYears",
|
||||
table: "EmployeeInsurancListData");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "DailyWagePlusBaseYears",
|
||||
table: "EmployeeInsurancListData");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "MarriedAllowance",
|
||||
table: "EmployeeInsurancListData");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1587,6 +1587,9 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("id"));
|
||||
|
||||
b.Property<double>("BaseYears")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<double>("BenefitsIncludedContinuous")
|
||||
.HasColumnType("float");
|
||||
|
||||
@@ -1599,6 +1602,9 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
b.Property<double>("DailyWage")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<double>("DailyWagePlusBaseYears")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<long>("EmployeeId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
@@ -1617,6 +1623,9 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
b.Property<DateTime?>("LeftWorkDate")
|
||||
.HasColumnType("datetime2(7)");
|
||||
|
||||
b.Property<double>("MarriedAllowance")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<double>("MonthlyBenefits")
|
||||
.HasColumnType("float");
|
||||
|
||||
@@ -2868,15 +2877,24 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
b.Property<DateTime>("StartDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<double>("SumOfBaseYears")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<double>("SumOfBenefitsIncluded")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<double>("SumOfDailyWage")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<double>("SumOfDailyWagePlusBaseYears")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<int>("SumOfEmployees")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<double>("SumOfMarriedAllowance")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<double>("SumOfSalaries")
|
||||
.HasColumnType("float");
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.InfraStructure;
|
||||
@@ -13,6 +14,7 @@ using CompanyManagment.App.Contracts.InsuranceList;
|
||||
using CompanyManagment.App.Contracts.InsuranceWorkshopInfo;
|
||||
using CompanyManagment.App.Contracts.PersonalContractingParty;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Identity.Client;
|
||||
|
||||
|
||||
namespace CompanyManagment.EFCore.Repository;
|
||||
@@ -312,8 +314,145 @@ public class InsuranceListRepository : RepositoryBase<long, InsuranceList>, IIns
|
||||
return editInsuranceList;
|
||||
}
|
||||
|
||||
public List<InsuranceListViewModel> OptimizedSearch(InsuranceListSearchModel searchModel)
|
||||
{
|
||||
var cornometr = new Stopwatch();
|
||||
cornometr.Start();
|
||||
var acountId = _authHelper.CurrentAccountId();
|
||||
var workshopIds = _context.WorkshopAccounts.Where(x => x.AccountId == acountId).Select(x => x.WorkshopId);
|
||||
|
||||
#region sample
|
||||
|
||||
//var query = _context.InsuranceListSet
|
||||
// .Where(x => workshopIds.Contains(x.WorkshopId))
|
||||
// .Join(_context.Workshops.Include(x => x.InsuranceWorkshopInfo),
|
||||
// insurance => insurance.WorkshopId,
|
||||
// workshop => workshop.id,
|
||||
// (insurance, workshop) => new { insurance, workshop })
|
||||
// .Join(_context.WorkshopEmployers,
|
||||
// result => result.workshop.id,
|
||||
// employer => employer.WorkshopId,
|
||||
// (result, employer) => new InsuranceListViewModel
|
||||
// {
|
||||
// Id = result.insurance.id,
|
||||
// Year = result.insurance.Year,
|
||||
// MonthNumber = result.insurance.Month,
|
||||
// Month = result.insurance.Month.GetMonthByNumber(),
|
||||
// WorkShopId = result.insurance.WorkshopId,
|
||||
// WorkShopCode = result.workshop.InsuranceWorkshopInfo != null ? result.workshop.InsuranceWorkshopInfo.InsuranceCode : result.workshop.InsuranceCode,
|
||||
// WorkShopName = result.workshop.InsuranceWorkshopInfo != null ? result.workshop.InsuranceWorkshopInfo.WorkshopName : result.workshop.WorkshopFullName,
|
||||
// TypeOfInsuranceSend = result.workshop.TypeOfInsuranceSend == "NormalList" ? "عادی" :
|
||||
// result.workshop.TypeOfInsuranceSend == "Govermentlist" ? "کمک دولت" :
|
||||
// result.workshop.TypeOfInsuranceSend == "Familylist" ? "خانوادگی" : "",
|
||||
// FixedSalary = result.workshop.FixedSalary,
|
||||
// StrFixedSalary = result.workshop.FixedSalary ? "دارد" : "ندارد",
|
||||
// EmployerName = result.workshop.InsuranceWorkshopInfo != null ? result.workshop.InsuranceWorkshopInfo.EmployerName : result.workshop.WorkshopFullName,
|
||||
// Branch = "",
|
||||
// City = "",
|
||||
// ConfirmSentlist = result.insurance.ConfirmSentlist,
|
||||
// IsBlockCantracingParty = "",
|
||||
// EmployerId = employer.EmployerId,
|
||||
|
||||
// });
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
var query = _context.InsuranceListSet
|
||||
.Where(x => workshopIds.Contains(x.WorkshopId))
|
||||
.Join(_context.Workshops.Include(x => x.InsuranceWorkshopInfo),
|
||||
insurance => insurance.WorkshopId,
|
||||
workshop => workshop.id,
|
||||
(insurance, workshop) => new { insurance, workshop })
|
||||
.Join(_context.WorkshopEmployers,
|
||||
result => result.workshop.id,
|
||||
employer => employer.WorkshopId,
|
||||
(result, employer) => new { result.insurance, result.workshop, employer })
|
||||
.Select(result => new InsuranceListViewModel
|
||||
{
|
||||
Id = result.insurance.id,
|
||||
Year = result.insurance.Year,
|
||||
Month = result.insurance.Month,
|
||||
MonthNumber = result.insurance.Month,
|
||||
WorkShopId = result.insurance.WorkshopId,
|
||||
WorkShopCode = result.workshop.InsuranceWorkshopInfo != null ? result.workshop.InsuranceWorkshopInfo.InsuranceCode : result.workshop.InsuranceCode,
|
||||
WorkShopName = result.workshop.InsuranceWorkshopInfo != null ? result.workshop.InsuranceWorkshopInfo.WorkshopName : result.workshop.WorkshopFullName,
|
||||
TypeOfInsuranceSend = result.workshop.TypeOfInsuranceSend == "NormalList" ? "عادی" :
|
||||
result.workshop.TypeOfInsuranceSend == "Govermentlist" ? "کمک دولت" :
|
||||
result.workshop.TypeOfInsuranceSend == "Familylist" ? "خانوادگی" : "",
|
||||
FixedSalary = result.workshop.FixedSalary,
|
||||
StrFixedSalary = result.workshop.FixedSalary ? "دارد" : "ندارد",
|
||||
EmployerName = result.workshop.InsuranceWorkshopInfo != null ? result.workshop.InsuranceWorkshopInfo.EmployerName : result.workshop.WorkshopFullName,
|
||||
Branch = "",
|
||||
City = "",
|
||||
ConfirmSentlist = result.insurance.ConfirmSentlist,
|
||||
IsBlockCantracingParty = _context.PersonalContractingParties
|
||||
.Where(p => p.Employers.Any(e => e.id == result.employer.EmployerId))
|
||||
.Select(p => p.IsBlock)
|
||||
.FirstOrDefault(),
|
||||
EmployerId = result.employer.EmployerId
|
||||
});
|
||||
|
||||
|
||||
if (!string.IsNullOrEmpty(searchModel.Year) && searchModel.Year != "0" && !string.IsNullOrEmpty(searchModel.Month) && searchModel.Month != "0")
|
||||
query = query.Where(x => x.Year == searchModel.Year && x.Month == searchModel.Month).OrderByDescending(x => x.Id);
|
||||
else
|
||||
{
|
||||
if (!string.IsNullOrEmpty(searchModel.Month) && searchModel.Month != "0")
|
||||
query = query.Where(x => x.Month == searchModel.Month).OrderByDescending(x => x.WorkShopName).ThenByDescending(x => x.EmployerName).ThenByDescending(x => x.Year);
|
||||
|
||||
if (!string.IsNullOrEmpty(searchModel.Year) && searchModel.Year != "0")
|
||||
query = query.Where(x => x.Year == searchModel.Year).OrderByDescending(x => x.EmployerName).ThenByDescending(x => x.WorkShopName).ThenByDescending(x => x.Month);
|
||||
|
||||
}
|
||||
if (!string.IsNullOrEmpty(searchModel.WorkShopCode))
|
||||
query = query.Where(x => x.WorkShopCode == searchModel.WorkShopCode).OrderByDescending(x => x.Year).OrderByDescending(x => x.Month).ThenByDescending(x => x.EmployerName);
|
||||
|
||||
if (!string.IsNullOrEmpty(searchModel.WorkShopName))
|
||||
query = query.Where(x => x.WorkShopName.Contains(searchModel.WorkShopName)).OrderByDescending(x => x.EmployerName).ThenByDescending(x => x.Year).OrderByDescending(x => x.Month);
|
||||
|
||||
|
||||
if (searchModel.WorkshopId > 0)
|
||||
{
|
||||
var workshopName = query.FirstOrDefault(u => u.WorkShopId == searchModel.WorkshopId)?.WorkShopName;
|
||||
|
||||
query = query.Where(x => x.WorkShopName.Contains(workshopName)).OrderByDescending(x => x.EmployerName).ThenByDescending(x => x.Year).OrderByDescending(x => x.Month);
|
||||
}
|
||||
|
||||
if (searchModel.EmployerId > 0)
|
||||
{
|
||||
var employerName = query.FirstOrDefault(u => u.EmployerId == searchModel.EmployerId)?.EmployerName;
|
||||
query = query.Where(x => x.EmployerName.Contains(employerName)).OrderByDescending(x => x.EmployerName).ThenByDescending(x => x.Year).OrderByDescending(x => x.Month);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(searchModel.EmployerName))
|
||||
query = query.Where(x => x.EmployerName.Contains(searchModel.EmployerName)).OrderByDescending(x => x.EmployerName).ThenByDescending(x => x.Year).OrderByDescending(x => x.Month);
|
||||
|
||||
|
||||
if (searchModel.FixedSalary != null)
|
||||
query = query.Where(x => x.FixedSalary == searchModel.FixedSalary);
|
||||
|
||||
if (!string.IsNullOrEmpty(searchModel.TypeOfInsuranceSend) && searchModel.TypeOfInsuranceSend != "0")
|
||||
query = query.Where(x => x.TypeOfInsuranceSend == searchModel.TypeOfInsuranceSend);
|
||||
|
||||
if (!string.IsNullOrEmpty(searchModel.City) && searchModel.City != "0")
|
||||
query = query.Where(x => x.City == searchModel.City);
|
||||
|
||||
if (!string.IsNullOrEmpty(searchModel.Branch))
|
||||
query = query.Where(x => x.Branch.Contains(searchModel.Branch));
|
||||
|
||||
|
||||
//var testquery = query.Where(x => x.Year == searchModel.Year).AsEnumerable();
|
||||
|
||||
|
||||
Console.WriteLine("Optimized Search Time : " + cornometr.Elapsed);
|
||||
cornometr.Stop();
|
||||
return query.ToList();
|
||||
}
|
||||
public List<InsuranceListViewModel> Search(InsuranceListSearchModel searchModel)
|
||||
{
|
||||
var cornometr = new Stopwatch();
|
||||
cornometr.Start();
|
||||
var acountID = _authHelper.CurrentAccountId();
|
||||
var workshopIds = _context.WorkshopAccounts.Where(x => x.AccountId == acountID).Select(x => x.WorkshopId).ToList();
|
||||
List<InsuranceListViewModel> list = new List<InsuranceListViewModel>();
|
||||
@@ -416,7 +555,8 @@ public class InsuranceListRepository : RepositoryBase<long, InsuranceList>, IIns
|
||||
|
||||
if (!string.IsNullOrEmpty(searchModel.Branch))
|
||||
list = list.Where(x => x.Branch.Contains(searchModel.Branch)).ToList();
|
||||
|
||||
Console.WriteLine("Old Search Time : " + cornometr.Elapsed);
|
||||
cornometr.Stop();
|
||||
return list; //.OrderByDescending(x => x.Id).ToList();
|
||||
}
|
||||
|
||||
|
||||
@@ -165,7 +165,7 @@
|
||||
<input type="hidden" asp-for="searchModel.EmployerName" />
|
||||
<input type="search" id="empSearchEmployer" value="@Model.EmployerFullName" class="form-control inpt @{
|
||||
if(!string.IsNullOrWhiteSpace(@Model.EmployerFullName)){
|
||||
@selctedOption
|
||||
@selctedOption
|
||||
}
|
||||
}" autocomplete="off" placeholder=" نام کارفرما " style="width: 100%;position: relative">
|
||||
<div id="empEmployer" class="selectDiv" style="display: none;">
|
||||
@@ -180,7 +180,7 @@
|
||||
<input type="hidden" asp-for="searchModel.WorkShopName" />
|
||||
<input type="search" id="empSearchWorkshop" value="@Model.WorkshopFullName" class="form-control @{
|
||||
if(!string.IsNullOrWhiteSpace(@Model.WorkshopFullName)){
|
||||
@selctedOption
|
||||
@selctedOption
|
||||
}
|
||||
}" autocomplete="off" placeholder=" نام کارگاه /شماره بایگانی " style="width: 100%; position: relative">
|
||||
<div id="empWorkshop" class="selectDiv" style="display: none;">
|
||||
@@ -298,6 +298,8 @@ $('.btn-search1').on('click', function () {
|
||||
|
||||
function removeSearch()
|
||||
{
|
||||
var month = '@Model.BeforCurrentMonth_';
|
||||
console.log(month);
|
||||
$("#waiting").show();
|
||||
var myTable = $("#datatable");
|
||||
myTable.remove();
|
||||
@@ -306,8 +308,8 @@ $('.btn-search1').on('click', function () {
|
||||
$("#searchModel_WorkShopName").val('');
|
||||
$("#searchModel_EmployerName").val('');
|
||||
$(".form-control").val('');
|
||||
$("#searchModel_Year").val(0);
|
||||
$("#searchModel_Month").val(0);
|
||||
$("#searchModel_Year").val(@Model.CurrentYear_);
|
||||
$("#searchModel_Month").val(month);
|
||||
$("#searchModel_TypeOfInsuranceSend").val(0);
|
||||
$("#searchModel_City").val(0);
|
||||
$("#searchModel_FixedSalary").val('لیست مقطوع');
|
||||
|
||||
@@ -68,7 +68,11 @@ public class IndexModel : PageModel
|
||||
CurrentYear_ = persianBeforeDate.Substring(0, 4);
|
||||
YearlyList = _yearlySalaryApplication.GetYears();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// لیستهای بیمه صفحه اصلی
|
||||
/// </summary>
|
||||
/// <param name="searchModel"></param>
|
||||
/// <returns></returns>
|
||||
public IActionResult OnGetSearch(InsuranceListSearchModel searchModel)
|
||||
{
|
||||
var searchResult = _insuranceListApplication.Search(searchModel);
|
||||
@@ -84,7 +88,10 @@ public class IndexModel : PageModel
|
||||
|
||||
return Partial("./MainSearch", result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// دکمه ایجاد لیست بیمه
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public IActionResult OnGetCreate()
|
||||
{
|
||||
var date = DateTime.Now.ToFarsi();
|
||||
@@ -213,6 +220,13 @@ public class IndexModel : PageModel
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// حذف لیست بیمه
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="pathDSKKAR00"></param>
|
||||
/// <param name="pathDSKWOR00"></param>
|
||||
/// <returns></returns>
|
||||
public IActionResult OnPostRemoveInsuranceList(long id, string pathDSKKAR00, string pathDSKWOR00)
|
||||
{
|
||||
var result = _insuranceListApplication.Remove(id);
|
||||
@@ -933,7 +947,11 @@ public class IndexModel : PageModel
|
||||
}
|
||||
|
||||
#region New by heydari
|
||||
|
||||
/// <summary>
|
||||
/// جستجوی کارگاه در صفحه اصلی بیمه
|
||||
/// </summary>
|
||||
/// <param name="searchText"></param>
|
||||
/// <returns></returns>
|
||||
public IActionResult OnGetWorkshopName(string searchText)
|
||||
{
|
||||
var result = _workshopApplication.GetWorkshopByTextSearch(searchText);
|
||||
|
||||
Reference in New Issue
Block a user