1578 lines
80 KiB
C#
1578 lines
80 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using _0_Framework.Application;
|
|
using AccountMangement.Infrastructure.EFCore;
|
|
using Company.Domain.ReportAgg;
|
|
using CompanyManagment.App.Contracts.LeftWork;
|
|
using CompanyManagment.App.Contracts.Report;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using PersianTools.Core;
|
|
|
|
namespace CompanyManagment.EFCore.Repository;
|
|
|
|
public class ReportRepository : IReportRepository
|
|
{
|
|
private readonly CompanyContext _context;
|
|
private readonly AccountContext _accountContext;
|
|
|
|
public ReportRepository(CompanyContext context, AccountContext accountContext)
|
|
{
|
|
_context = context;
|
|
_accountContext = accountContext;
|
|
}
|
|
|
|
public AllReport GetAllActiveWorkshops(string year, string month)
|
|
{
|
|
var watch = System.Diagnostics.Stopwatch.StartNew();
|
|
string nowFa = "";
|
|
if (!string.IsNullOrWhiteSpace(year) && !string.IsNullOrWhiteSpace(month))
|
|
{
|
|
nowFa = $"{year}/{month}/01";
|
|
}
|
|
else
|
|
{
|
|
nowFa = $"{(DateTime.Now.ToFarsi()).Substring(0, 8)}01";
|
|
}
|
|
|
|
var currentEndOfMonth = nowFa.FindeEndOfMonth();
|
|
|
|
var currentMonthStart = nowFa.ToGeorgianDateTime();
|
|
var currentMonthEnd = currentEndOfMonth.ToGeorgianDateTime();
|
|
int currentYear = Convert.ToInt32(nowFa.Substring(0, 4));
|
|
var currentMonth = Convert.ToInt32(nowFa.Substring(5, 2));
|
|
var nextMonthStartFa = new PersianDateTime(currentYear, currentMonth, 1).AddMonths(1);
|
|
var nextMonthStart = ($"{nextMonthStartFa}").ToGeorgianDateTime();
|
|
var nextMonthEnd = (($"{nextMonthStartFa}").FindeEndOfMonth()).ToGeorgianDateTime();
|
|
//var instititionContracts = _context.InstitutionContractSet.Where(x => x.IsActiveString == "true").Select(x=>x.ContractingPartyId).ToList();
|
|
var blockContractingPartyIds = _context.PersonalContractingParties.Where(x => x.IsBlock == "false" && x.IsActiveString == "true").Select(x => x.id).ToList();
|
|
//blockContractingPartyIds = blockContractingPartyIds.Where(x => instititionContracts.Contains(x)).ToList();
|
|
var workshops = _context.Workshops.Where(x => x.IsActiveString == "true")
|
|
.Include(x => x.WorkshopEmployers)
|
|
.Include(x => x.LeftWorks)
|
|
.Select(x => new ActiveWorkshops
|
|
{
|
|
Id = x.id,
|
|
ContractLeftWorkCount = 0,
|
|
CheckoutLeftWorkCount = 0,
|
|
ContractingPartId = x.WorkshopEmployers.Select(e => e.Employer.ContractingPartyId).FirstOrDefault(),
|
|
AccountIdList = _context.WorkshopAccounts.Where(m => m.WorkshopId == x.id && m.ContractAndCheckout == "true" && m.IsActiveSting == "true").Select(a => a.AccountId).ToList(),
|
|
#region Contracts
|
|
|
|
//contractLeft This Mont
|
|
|
|
ContractLeftIds = x.LeftWorks.Select(l => new LeftWorkViewModel()
|
|
{
|
|
EmployeeId = l.EmployeeId,
|
|
StartWorkDateGr = l.StartWorkDate,
|
|
LeftWorkDateGr = l.LeftWorkDate.AddDays(-1),
|
|
|
|
}).Where(l =>
|
|
(l.StartWorkDateGr <= nextMonthStart && l.LeftWorkDateGr > nextMonthStart) ||
|
|
(l.StartWorkDateGr <= nextMonthEnd && l.LeftWorkDateGr >= nextMonthEnd) ||
|
|
(l.StartWorkDateGr >= nextMonthStart && l.StartWorkDateGr <= nextMonthEnd) ||
|
|
(l.LeftWorkDateGr >= nextMonthStart && l.LeftWorkDateGr <= nextMonthEnd)).Select(l => l.EmployeeId).ToList(),
|
|
#endregion
|
|
|
|
#region Checkouts
|
|
|
|
//CheckoutLeft befor This Month
|
|
|
|
CheckoutLeftIds = x.LeftWorks.Select(l => new LeftWorkViewModel()
|
|
{
|
|
EmployeeId = l.EmployeeId,
|
|
StartWorkDateGr = l.StartWorkDate,
|
|
LeftWorkDateGr = l.LeftWorkDate.AddDays(-1),
|
|
|
|
}).Where(l => (l.StartWorkDateGr <= currentMonthStart && l.LeftWorkDateGr > currentMonthStart) ||
|
|
(l.StartWorkDateGr <= currentMonthEnd && l.LeftWorkDateGr >= currentMonthEnd) ||
|
|
(l.StartWorkDateGr >= currentMonthStart && l.StartWorkDateGr <= currentMonthEnd) ||
|
|
(l.LeftWorkDateGr >= currentMonthStart && l.LeftWorkDateGr <= currentMonthEnd)).Select(l => l.EmployeeId).ToList(),
|
|
|
|
#endregion
|
|
|
|
|
|
}).Where(e => blockContractingPartyIds.Contains(e.ContractingPartId) && e.AccountIdList.Count > 0).AsSplitQuery();
|
|
|
|
var workshopsList = workshops.Select(x => new ActiveWorkshops
|
|
{
|
|
Id = x.Id,
|
|
|
|
|
|
AccountIdList = x.AccountIdList,
|
|
|
|
#region Contracts
|
|
|
|
//contractLeft This Month
|
|
ContractLeftIds = _context.InstitutionContractSet.Any(c => c.ContractingPartyId == x.ContractingPartId && c.ContractStartGr <= nextMonthStart && c.ContractEndGr >= nextMonthEnd) ? x.ContractLeftIds : new List<long>(),
|
|
|
|
#endregion
|
|
|
|
#region Checkouts
|
|
|
|
////CheckoutLeft befor This Month
|
|
CheckoutLeftIds = _context.InstitutionContractSet.Any(c => c.ContractingPartyId == x.ContractingPartId && c.ContractStartGr <= currentMonthStart && c.ContractEndGr >= currentMonthEnd) ? x.CheckoutLeftIds : new List<long>(),
|
|
|
|
#endregion
|
|
}).AsSplitQuery();
|
|
//var wCount = workshops.Count();
|
|
//var partyId = workshops.Select(x => x.ContractingPartId).ToList();
|
|
|
|
Console.WriteLine("Ripo query 1 >>>>>: " + watch.Elapsed);
|
|
var res = workshopsList.AsEnumerable();
|
|
watch.Restart();
|
|
var result = res.Select(x => new ActiveWorkshops
|
|
{
|
|
Id = x.Id,
|
|
ContractLeftWorkCount = x.ContractLeftIds.Count,
|
|
CheckoutLeftWorkCount = x.CheckoutLeftIds.Count,
|
|
|
|
|
|
AccountIdList = x.AccountIdList,
|
|
CheckoutDoneCount = x.CheckoutLeftIds.Count > 0
|
|
? _context.CheckoutSet.Where(ch => ch.WorkshopId == x.Id)
|
|
.Where(ch => x.CheckoutLeftIds.Contains(ch.EmployeeId))
|
|
.Count(ch =>
|
|
ch.ContractStart >= currentMonthStart && ch.ContractStart < currentMonthEnd &&
|
|
ch.IsActiveString == "true")
|
|
: 0,
|
|
CheckoutSignDoneCount = x.CheckoutLeftIds.Count > 0
|
|
? _context.CheckoutSet.Where(ch => ch.WorkshopId == x.Id)
|
|
.Where(ch => x.CheckoutLeftIds.Contains(ch.EmployeeId))
|
|
.Count(ch =>
|
|
ch.ContractStart >= currentMonthStart && ch.ContractStart < currentMonthEnd &&
|
|
ch.IsActiveString == "true" && ch.Signature == "1")
|
|
: 0,
|
|
|
|
ContrctDoneCount = x.ContractLeftIds.Count > 0
|
|
? _context.Contracts.Where(ct => ct.WorkshopIds == x.Id && ct.IsActiveString == "true")
|
|
.Where(ct => x.ContractLeftIds.Contains(ct.EmployeeId))
|
|
.Count(l => (l.ContarctStart <= nextMonthStart && l.ContractEnd >= nextMonthStart) ||
|
|
(l.ContarctStart <= nextMonthEnd && l.ContractEnd >= nextMonthEnd) ||
|
|
(l.ContarctStart >= nextMonthStart && l.ContarctStart <= nextMonthEnd) ||
|
|
(l.ContractEnd >= nextMonthStart && l.ContractEnd <= nextMonthEnd))
|
|
: 0,
|
|
ContrctSignDoneCount = x.ContractLeftIds.Count > 0
|
|
? _context.Contracts
|
|
.Where(ct => ct.WorkshopIds == x.Id && ct.IsActiveString == "true" && ct.Signature == "1")
|
|
.Where(ct => x.ContractLeftIds.Contains(ct.EmployeeId))
|
|
.Count(l => (l.ContarctStart <= nextMonthStart && l.ContractEnd >= nextMonthStart) ||
|
|
(l.ContarctStart <= nextMonthEnd && l.ContractEnd >= nextMonthEnd) ||
|
|
(l.ContarctStart >= nextMonthStart && l.ContarctStart <= nextMonthEnd) ||
|
|
(l.ContractEnd >= nextMonthStart && l.ContractEnd <= nextMonthEnd))
|
|
: 0,
|
|
|
|
}).AsEnumerable();
|
|
|
|
Console.WriteLine("Ripo query 2 >>>>>: " + watch.Elapsed);
|
|
var contractAccountResult = result.Select(x => new ActiveWorkshops()
|
|
{
|
|
Id = x.Id,
|
|
//AccountId = _accountContext.Accounts.Any(e => x.AccountIdList.Contains(e.id) && e.RoleId == 5)
|
|
// ? _accountContext.Accounts.Where(e => x.AccountIdList.Contains(e.id)).FirstOrDefault(e => e.RoleId == 5)!.id : 0,
|
|
//AccountFullname = _accountContext.Accounts.Any(e => x.AccountIdList.Contains(e.id) && e.RoleId == 5)
|
|
// ? _accountContext.Accounts.Where(e => x.AccountIdList.Contains(e.id)).FirstOrDefault(e => e.RoleId == 5)!.Fullname : "",
|
|
AccountId = _accountContext.AccountLeftWorks.Any(e=> x.AccountIdList.Contains(e.AccountId) && e.StartWorkGr <= currentMonthStart && e.LeftWorkGr >= currentMonthEnd) ?
|
|
_accountContext.AccountLeftWorks.FirstOrDefault(e => x.AccountIdList.Contains(e.AccountId) && e.StartWorkGr <= currentMonthStart && e.LeftWorkGr >= currentMonthEnd)!.AccountId : 0,
|
|
|
|
ContractLeftWorkCount = x.ContractLeftWorkCount,
|
|
ContrctDoneCount = x.ContrctDoneCount,
|
|
ContrctSignDoneCount = x.ContrctSignDoneCount,
|
|
|
|
IsActiveString = x.IsActiveString,
|
|
WorkshopFullName = x.WorkshopFullName,
|
|
|
|
}).Where(x => x.AccountId != 0 && x.ContractLeftWorkCount > 0).ToList();
|
|
var checkoutAccountResult = result.Select(x => new ActiveWorkshops()
|
|
{
|
|
Id = x.Id,
|
|
//AccountId = _accountContext.Accounts.Any(e => x.AccountIdList.Contains(e.id) && e.RoleId == 5)
|
|
// ? _accountContext.Accounts.Where(e => x.AccountIdList.Contains(e.id)).FirstOrDefault(e => e.RoleId == 5)!.id : 0,
|
|
//AccountFullname = _accountContext.Accounts.Any(e => x.AccountIdList.Contains(e.id) && e.RoleId == 5)
|
|
// ? _accountContext.Accounts.Where(e => x.AccountIdList.Contains(e.id)).FirstOrDefault(e => e.RoleId == 5)!.Fullname : "",
|
|
AccountId = _accountContext.AccountLeftWorks.Any(e => x.AccountIdList.Contains(e.AccountId) && e.StartWorkGr <= nextMonthStart && e.LeftWorkGr >= nextMonthEnd) ?
|
|
_accountContext.AccountLeftWorks.FirstOrDefault(e => x.AccountIdList.Contains(e.AccountId) && e.StartWorkGr <= nextMonthStart && e.LeftWorkGr >= nextMonthEnd)!.AccountId : 0,
|
|
|
|
|
|
CheckoutLeftWorkCount = x.CheckoutLeftWorkCount,
|
|
CheckoutDoneCount = x.CheckoutDoneCount,
|
|
CheckoutSignDoneCount = x.CheckoutSignDoneCount,
|
|
|
|
IsActiveString = x.IsActiveString,
|
|
WorkshopFullName = x.WorkshopFullName,
|
|
|
|
}).Where(x => x.AccountId != 0 && x.CheckoutLeftWorkCount > 0).ToList();
|
|
watch.Restart();
|
|
//قرارداد هایی که باید اسجاد می شد
|
|
var contractToBe = contractAccountResult.Sum(x => x.ContractLeftWorkCount);
|
|
|
|
//قراردادهای ایجاد شده
|
|
var createdContracts = contractAccountResult.Sum(x => x.ContrctDoneCount);
|
|
// قراداد های امضاء شده
|
|
var signedContracts = contractAccountResult.Sum(x => x.ContrctSignDoneCount);
|
|
|
|
|
|
// تصفیه هایی که باید ایجاد می شد
|
|
var checkoutToBe = checkoutAccountResult.Sum(x => x.CheckoutLeftWorkCount);
|
|
|
|
// تصفیه های ایجاد شده
|
|
var createdCheckouts = checkoutAccountResult.Sum(x => x.CheckoutDoneCount);
|
|
//تصفیه های امضاء شده
|
|
var signedChckouts = checkoutAccountResult.Sum(x => x.CheckoutSignDoneCount);
|
|
|
|
|
|
var contractGroupResult = contractAccountResult.GroupBy(x => x.AccountId).Select(x => new AccountResults()
|
|
{
|
|
AccountId = x.Key,
|
|
AccountFullName = _accountContext.Accounts.FirstOrDefault(a=>a.id == x.Key)!.Fullname,
|
|
|
|
ContractDonePercent = (x.Sum(c => c.ContrctDoneCount) * 100) / (x.Sum(c => c.ContractLeftWorkCount)),
|
|
ContractSignPercent = x.Sum(c => c.ContrctDoneCount) > 0 ? (x.Sum(c => c.ContrctSignDoneCount) * 100) / (x.Sum(c => c.ContrctDoneCount)) : 0,
|
|
|
|
|
|
}).ToList();
|
|
var checkoutGroupResult = checkoutAccountResult.GroupBy(x => x.AccountId).Select(x => new AccountResults()
|
|
{
|
|
AccountId = x.Key,
|
|
AccountFullName = _accountContext.Accounts.FirstOrDefault(a => a.id == x.Key)!.Fullname,
|
|
|
|
CheckoutDonePercent = (x.Sum(c => c.CheckoutDoneCount) * 100) / x.Sum(c => c.CheckoutLeftWorkCount),
|
|
CheckoutSignPercent = x.Sum(c => c.CheckoutDoneCount) > 0 ? (x.Sum(c => c.CheckoutSignDoneCount) * 100) / (x.Sum(c => c.CheckoutDoneCount)) : 0,
|
|
|
|
}).ToList();
|
|
#region ComputePercentage
|
|
|
|
//قرارداد
|
|
var contractPercent = (createdContracts * 100) / contractToBe;
|
|
//امضاء قراداد
|
|
var contractSignaturePercent = createdContracts > 0 ? (signedContracts * 100) / createdContracts : 0;
|
|
// تصفیه
|
|
var checkoutPercent = (createdCheckouts * 100) / checkoutToBe;
|
|
// امضاء تصفیه حساب
|
|
var checkoutSignaturePercent = createdCheckouts > 0 ? (signedChckouts * 100) / createdCheckouts : 0;
|
|
var finalResult = new AllReport()
|
|
{
|
|
//همه
|
|
AllPercent = (contractPercent + contractSignaturePercent + checkoutPercent + checkoutSignaturePercent) / 4,
|
|
//قرارداد
|
|
ContractPercent = contractPercent,
|
|
//امضاء قراداد
|
|
ContractSignaturePercent = contractSignaturePercent,
|
|
// تصفیه
|
|
CheckoutPercent = checkoutPercent,
|
|
// امضاء تصفیه حساب
|
|
CheckoutSignaturePercent = checkoutSignaturePercent,
|
|
|
|
Year = $"{currentYear}",
|
|
Month = nowFa.Substring(5, 2),
|
|
ContractAccountResults = contractGroupResult,
|
|
CheckoutAccountResults = checkoutGroupResult,
|
|
|
|
AllContract = contractToBe,
|
|
ContractNotDone = contractToBe - createdContracts,
|
|
ContrcatDone = createdContracts,
|
|
ContractSignNotDone = createdContracts - signedContracts,
|
|
ContractSignDone = signedContracts,
|
|
|
|
|
|
AllCheckout = checkoutToBe,
|
|
CheckoutNotDone = checkoutToBe - createdCheckouts,
|
|
CheckoutDone = createdCheckouts,
|
|
CheckoutSignDone = signedChckouts,
|
|
CheckoutSignNotDone = createdCheckouts - signedChckouts,
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
#endregion
|
|
Console.WriteLine("App 1 >>>>>: " + watch.Elapsed);
|
|
|
|
return finalResult;
|
|
|
|
}
|
|
|
|
public WorkshopResult GetWorkshopContractDone(string year, string month, long accountId)
|
|
{
|
|
var watch = System.Diagnostics.Stopwatch.StartNew();
|
|
string nowFa = "";
|
|
if (!string.IsNullOrWhiteSpace(year) && !string.IsNullOrWhiteSpace(month))
|
|
{
|
|
nowFa = $"{year}/{month}/01";
|
|
}
|
|
else
|
|
{
|
|
nowFa = $"{(DateTime.Now.ToFarsi()).Substring(0, 8)}01";
|
|
}
|
|
|
|
var currentEndOfMonth = nowFa.FindeEndOfMonth();
|
|
|
|
var currentMonthStart = nowFa.ToGeorgianDateTime();
|
|
var currentMonthEnd = currentEndOfMonth.ToGeorgianDateTime();
|
|
int currentYear = Convert.ToInt32(nowFa.Substring(0, 4));
|
|
var currentMonth = Convert.ToInt32(nowFa.Substring(5, 2));
|
|
var nextMonthStartFa = new PersianDateTime(currentYear, currentMonth, 1).AddMonths(1);
|
|
var nextMonthStart = ($"{nextMonthStartFa}").ToGeorgianDateTime();
|
|
var nextMonthEnd = (($"{nextMonthStartFa}").FindeEndOfMonth()).ToGeorgianDateTime();
|
|
|
|
|
|
//var instititionContracts = _context.InstitutionContractSet.Where(x => x.IsActiveString == "true").Select(x => x.ContractingPartyId).ToList();
|
|
var blockContractingPartyIds = _context.PersonalContractingParties.Where(x => x.IsBlock == "false" && x.IsActiveString == "true").Select(x => x.id).ToList();
|
|
//blockContractingPartyIds = blockContractingPartyIds.Where(x => instititionContracts.Contains(x)).ToList();
|
|
var workshops = _context.Workshops.Where(x => x.IsActiveString == "true")
|
|
.Include(x => x.WorkshopEmployers)
|
|
.Include(x => x.LeftWorks)
|
|
.Select(x => new ActiveWorkshops
|
|
{
|
|
Id = x.id,
|
|
IsActiveString = x.IsActiveString,
|
|
WorkshopFullName = x.WorkshopFullName,
|
|
ArchiveCode = x.ArchiveCode,
|
|
ContractingPartId = x.WorkshopEmployers.Select(e => e.Employer.ContractingPartyId).FirstOrDefault(),
|
|
AccountIdList = _context.WorkshopAccounts.Where(m => m.WorkshopId == x.id).Select(a => a.AccountId)
|
|
.ToList(),
|
|
|
|
|
|
#region Contracts
|
|
|
|
//contractLeft This Mont
|
|
|
|
ContractLeftIds = x.LeftWorks.Select(l => new LeftWorkViewModel()
|
|
{
|
|
EmployeeId = l.EmployeeId,
|
|
StartWorkDateGr = l.StartWorkDate,
|
|
LeftWorkDateGr = l.LeftWorkDate.AddDays(-1),
|
|
|
|
}).Where(l =>
|
|
(l.StartWorkDateGr <= nextMonthStart && l.LeftWorkDateGr > nextMonthStart) ||
|
|
(l.StartWorkDateGr <= nextMonthEnd && l.LeftWorkDateGr >= nextMonthEnd) ||
|
|
(l.StartWorkDateGr >= nextMonthStart && l.StartWorkDateGr <= nextMonthEnd) ||
|
|
(l.LeftWorkDateGr >= nextMonthStart && l.LeftWorkDateGr <= nextMonthEnd)).Select(l => l.EmployeeId).ToList(),
|
|
#endregion
|
|
|
|
|
|
|
|
}).Where(e => blockContractingPartyIds.Contains(e.ContractingPartId))
|
|
.Where(a => a.AccountIdList.Contains(accountId)).AsSplitQuery();
|
|
|
|
var workshopsList = workshops.Select(x => new ActiveWorkshops
|
|
{
|
|
Id = x.Id,
|
|
WorkshopFullName = x.WorkshopFullName,
|
|
ArchiveCode = x.ArchiveCode,
|
|
ContractingPartId = x.ContractingPartId,
|
|
AccountIdList = x.AccountIdList,
|
|
#region Contracts
|
|
|
|
//contractLeft This Month
|
|
ContractLeftIds = _context.InstitutionContractSet.Any(c => c.ContractingPartyId == x.ContractingPartId && c.ContractStartGr <= nextMonthStart && c.ContractEndGr >= nextMonthEnd) ? x.ContractLeftIds : new List<long>(),
|
|
|
|
#endregion
|
|
|
|
|
|
}).ToList();
|
|
|
|
var result = workshopsList.Select(x => new ActiveWorkshops
|
|
{
|
|
Id = x.Id,
|
|
ContractLeftWorkCount = x.ContractLeftIds.Count,
|
|
WorkshopFullName = x.WorkshopFullName,
|
|
ArchiveCode = x.ArchiveCode,
|
|
ContrctDoneCount = x.ContractLeftIds.Count > 0 ? _context.Contracts.Where(ct => ct.WorkshopIds == x.Id && ct.IsActiveString == "true").Where(ct => x.ContractLeftIds.Contains(ct.EmployeeId))
|
|
.Count(l => (l.ContarctStart <= nextMonthStart && l.ContractEnd >= nextMonthStart) ||
|
|
(l.ContarctStart <= nextMonthEnd && l.ContractEnd >= nextMonthEnd) ||
|
|
(l.ContarctStart >= nextMonthStart && l.ContarctStart <= nextMonthEnd) ||
|
|
(l.ContractEnd >= nextMonthStart && l.ContractEnd <= nextMonthEnd)) : 0,
|
|
|
|
|
|
}).Where(x=>x.ContractLeftWorkCount > 0).ToList();
|
|
var workshopList = result.Select(x => new workshopSearch()
|
|
{
|
|
Id = x.Id,
|
|
WorkshopFullName = x.WorkshopFullName,
|
|
ArchiveCode = x.ArchiveCode,
|
|
ContractDonePercent = ((x.ContrctDoneCount * 100) / x.ContractLeftWorkCount),
|
|
|
|
}).OrderBy(x => x.ContractDonePercent).ToList();
|
|
|
|
var badWorkshop = workshopList.FirstOrDefault();
|
|
var badWorkshopLeftWorks = _context.LeftWorkList.Where(l => l.WorkshopId == badWorkshop.Id).Select(l => new LeftWorkViewModel()
|
|
{
|
|
Id = l.id,
|
|
EmployeeId = l.EmployeeId,
|
|
EmployeeFullName = l.EmployeeFullName,
|
|
StartWorkDateGr = l.StartWorkDate,
|
|
LeftWorkDateGr = l.LeftWorkDate.AddDays(-1),
|
|
|
|
}).Where(l =>
|
|
(l.StartWorkDateGr <= nextMonthStart && l.LeftWorkDateGr > nextMonthStart) ||
|
|
(l.StartWorkDateGr <= nextMonthEnd && l.LeftWorkDateGr >= nextMonthEnd) ||
|
|
(l.StartWorkDateGr >= nextMonthStart && l.StartWorkDateGr <= nextMonthEnd) ||
|
|
(l.LeftWorkDateGr >= nextMonthStart && l.LeftWorkDateGr <= nextMonthEnd)).ToList();
|
|
var badWorkshopContracts = _context.Contracts.Where(ct => ct.WorkshopIds == badWorkshop.Id && ct.IsActiveString == "true")
|
|
.Where(l => (l.ContarctStart <= nextMonthStart && l.ContractEnd >= nextMonthStart) ||
|
|
(l.ContarctStart <= nextMonthEnd && l.ContractEnd >= nextMonthEnd) ||
|
|
(l.ContarctStart >= nextMonthStart && l.ContarctStart <= nextMonthEnd) ||
|
|
(l.ContractEnd >= nextMonthStart && l.ContractEnd <= nextMonthEnd)).Select(x => x.EmployeeId).ToList();
|
|
var notDoneEmployes = badWorkshopLeftWorks.Select(l => new EmployeeNotDone()
|
|
{
|
|
Id = l.EmployeeId,
|
|
EmployeeFullName = l.EmployeeFullName,
|
|
|
|
}).Where(l => !badWorkshopContracts.Contains(l.Id)).ToList();
|
|
|
|
var finalResult = new WorkshopResult()
|
|
{
|
|
WorkshopSearches = workshopList,
|
|
EmployeeNotDones = notDoneEmployes,
|
|
};
|
|
Console.WriteLine("ajax >>>>>: " + watch.Elapsed);
|
|
return finalResult;
|
|
}
|
|
|
|
public WorkshopResult GetWorkshopContractSignDone(string year, string month, long accountId)
|
|
{
|
|
var watch = System.Diagnostics.Stopwatch.StartNew();
|
|
string nowFa = "";
|
|
if (!string.IsNullOrWhiteSpace(year) && !string.IsNullOrWhiteSpace(month))
|
|
{
|
|
nowFa = $"{year}/{month}/01";
|
|
}
|
|
else
|
|
{
|
|
nowFa = $"{(DateTime.Now.ToFarsi()).Substring(0, 8)}01";
|
|
}
|
|
|
|
var currentEndOfMonth = nowFa.FindeEndOfMonth();
|
|
|
|
var currentMonthStart = nowFa.ToGeorgianDateTime();
|
|
var currentMonthEnd = currentEndOfMonth.ToGeorgianDateTime();
|
|
int currentYear = Convert.ToInt32(nowFa.Substring(0, 4));
|
|
var currentMonth = Convert.ToInt32(nowFa.Substring(5, 2));
|
|
var nextMonthStartFa = new PersianDateTime(currentYear, currentMonth, 1).AddMonths(1);
|
|
var nextMonthStart = ($"{nextMonthStartFa}").ToGeorgianDateTime();
|
|
var nextMonthEnd = (($"{nextMonthStartFa}").FindeEndOfMonth()).ToGeorgianDateTime();
|
|
|
|
|
|
//var instititionContracts = _context.InstitutionContractSet.Where(x => x.IsActiveString == "true").Select(x => x.ContractingPartyId).ToList();
|
|
var blockContractingPartyIds = _context.PersonalContractingParties.Where(x => x.IsBlock == "false" && x.IsActiveString == "true").Select(x => x.id).ToList();
|
|
//blockContractingPartyIds = blockContractingPartyIds.Where(x => instititionContracts.Contains(x)).ToList();
|
|
var workshops = _context.Workshops.Where(x => x.IsActiveString == "true")
|
|
.Include(x => x.WorkshopEmployers)
|
|
.Include(x => x.LeftWorks)
|
|
.Select(x => new ActiveWorkshops
|
|
{
|
|
Id = x.id,
|
|
IsActiveString = x.IsActiveString,
|
|
WorkshopFullName = x.WorkshopFullName,
|
|
ArchiveCode = x.ArchiveCode,
|
|
ContractingPartId = x.WorkshopEmployers.Select(e => e.Employer.ContractingPartyId).FirstOrDefault(),
|
|
AccountIdList = _context.WorkshopAccounts.Where(m => m.WorkshopId == x.id).Select(a => a.AccountId).ToList(),
|
|
#region Contracts
|
|
|
|
//contractLeft This Mont
|
|
|
|
ContractLeftIds = x.LeftWorks.Select(l => new LeftWorkViewModel()
|
|
{
|
|
EmployeeId = l.EmployeeId,
|
|
StartWorkDateGr = l.StartWorkDate,
|
|
LeftWorkDateGr = l.LeftWorkDate.AddDays(-1),
|
|
|
|
}).Where(l =>
|
|
(l.StartWorkDateGr <= nextMonthStart && l.LeftWorkDateGr > nextMonthStart) ||
|
|
(l.StartWorkDateGr <= nextMonthEnd && l.LeftWorkDateGr >= nextMonthEnd) ||
|
|
(l.StartWorkDateGr >= nextMonthStart && l.StartWorkDateGr <= nextMonthEnd) ||
|
|
(l.LeftWorkDateGr >= nextMonthStart && l.LeftWorkDateGr <= nextMonthEnd)).Select(l => l.EmployeeId).ToList(),
|
|
#endregion
|
|
|
|
|
|
}).Where(e => blockContractingPartyIds.Contains(e.ContractingPartId))
|
|
.Where(a => a.AccountIdList.Contains(accountId)).AsSplitQuery();
|
|
var workshopsList = workshops.Select(x => new ActiveWorkshops
|
|
{
|
|
Id = x.Id,
|
|
WorkshopFullName = x.WorkshopFullName,
|
|
ArchiveCode = x.ArchiveCode,
|
|
ContractingPartId = x.ContractingPartId,
|
|
AccountIdList = x.AccountIdList,
|
|
#region Contracts
|
|
|
|
//contractLeft This Month
|
|
ContractLeftIds = _context.InstitutionContractSet.Any(c => c.ContractingPartyId == x.ContractingPartId && c.ContractStartGr <= nextMonthStart && c.ContractEndGr >= nextMonthEnd) ? x.ContractLeftIds : new List<long>(),
|
|
|
|
#endregion
|
|
|
|
|
|
}).ToList();
|
|
|
|
var result = workshopsList.Select(x => new ActiveWorkshops
|
|
{
|
|
Id = x.Id,
|
|
ContractLeftWorkCount = x.ContractLeftIds.Count,
|
|
WorkshopFullName = x.WorkshopFullName,
|
|
ArchiveCode = x.ArchiveCode,
|
|
ContrctDoneCount = x.ContractLeftIds.Count > 0 ? _context.Contracts.Where(ch => ch.WorkshopIds == x.Id && ch.IsActiveString == "true").Where(ch => x.ContractLeftIds.Contains(ch.EmployeeId))
|
|
.Count(l => (l.ContarctStart <= nextMonthStart && l.ContractEnd >= nextMonthStart) ||
|
|
(l.ContarctStart <= nextMonthEnd && l.ContractEnd >= nextMonthEnd) ||
|
|
(l.ContarctStart >= nextMonthStart && l.ContarctStart <= nextMonthEnd) ||
|
|
(l.ContractEnd >= nextMonthStart && l.ContractEnd <= nextMonthEnd)) : 0,
|
|
ContrctSignDoneCount = x.ContractLeftIds.Count > 0 ?_context.Contracts.Where(ct => ct.WorkshopIds == x.Id && ct.IsActiveString == "true" && ct.Signature == "1").Where(ct => x.ContractLeftIds.Contains(ct.EmployeeId))
|
|
.Count(l => (l.ContarctStart <= nextMonthStart && l.ContractEnd >= nextMonthStart) ||
|
|
(l.ContarctStart <= nextMonthEnd && l.ContractEnd >= nextMonthEnd) ||
|
|
(l.ContarctStart >= nextMonthStart && l.ContarctStart <= nextMonthEnd) ||
|
|
(l.ContractEnd >= nextMonthStart && l.ContractEnd <= nextMonthEnd)) : 0,
|
|
|
|
|
|
}).Where(x => x.ContrctDoneCount > 0).ToList();
|
|
var workshopList = result.Select(x => new workshopSearch()
|
|
{
|
|
Id = x.Id,
|
|
WorkshopFullName = x.WorkshopFullName,
|
|
ArchiveCode = x.ArchiveCode,
|
|
|
|
ContractSignPercent = ((x.ContrctSignDoneCount * 100) / x.ContrctDoneCount),
|
|
|
|
}).OrderBy(x => x.ContractSignPercent).ToList();
|
|
|
|
var badWorkshop = workshopList.FirstOrDefault();
|
|
var badWorkshopLeftWorks = _context.LeftWorkList.Where(l => l.WorkshopId == badWorkshop.Id).Select(l => new LeftWorkViewModel()
|
|
{
|
|
Id = l.id,
|
|
EmployeeId = l.EmployeeId,
|
|
EmployeeFullName = l.EmployeeFullName,
|
|
StartWorkDateGr = l.StartWorkDate,
|
|
LeftWorkDateGr = l.LeftWorkDate,
|
|
|
|
}).Where(l =>
|
|
(l.StartWorkDateGr <= nextMonthStart && l.LeftWorkDateGr > nextMonthStart) ||
|
|
(l.StartWorkDateGr <= nextMonthEnd && l.LeftWorkDateGr >= nextMonthEnd) ||
|
|
(l.StartWorkDateGr >= nextMonthStart && l.StartWorkDateGr <= nextMonthEnd) ||
|
|
(l.LeftWorkDateGr >= nextMonthStart && l.LeftWorkDateGr <= nextMonthEnd)).ToList();
|
|
var badWorkshopContracts = _context.Contracts.Where(ct => ct.WorkshopIds == badWorkshop.Id && ct.IsActiveString == "true" && ct.Signature == "1")
|
|
.Where(l => (l.ContarctStart <= nextMonthStart && l.ContractEnd >= nextMonthStart) ||
|
|
(l.ContarctStart <= nextMonthEnd && l.ContractEnd >= nextMonthEnd) ||
|
|
(l.ContarctStart >= nextMonthStart && l.ContarctStart <= nextMonthEnd) ||
|
|
(l.ContractEnd >= nextMonthStart && l.ContractEnd <= nextMonthEnd)).Select(x => x.EmployeeId).ToList();
|
|
var notDoneEmployes = badWorkshopLeftWorks.Select(l => new EmployeeNotDone()
|
|
{
|
|
Id = l.EmployeeId,
|
|
EmployeeFullName = l.EmployeeFullName,
|
|
|
|
}).Where(l => !badWorkshopContracts.Contains(l.Id)).ToList();
|
|
|
|
var finalResult = new WorkshopResult()
|
|
{
|
|
WorkshopSearches = workshopList,
|
|
EmployeeNotDones = notDoneEmployes,
|
|
};
|
|
Console.WriteLine("ajax >>>>>: " + watch.Elapsed);
|
|
return finalResult;
|
|
}
|
|
|
|
public WorkshopResult GetWorkshopCheckoutDone(string year, string month, long accountId)
|
|
{
|
|
var watch = System.Diagnostics.Stopwatch.StartNew();
|
|
string nowFa = "";
|
|
if (!string.IsNullOrWhiteSpace(year) && !string.IsNullOrWhiteSpace(month))
|
|
{
|
|
nowFa = $"{year}/{month}/01";
|
|
}
|
|
else
|
|
{
|
|
nowFa = $"{(DateTime.Now.ToFarsi()).Substring(0, 8)}01";
|
|
}
|
|
|
|
var currentEndOfMonth = nowFa.FindeEndOfMonth();
|
|
|
|
var currentMonthStart = nowFa.ToGeorgianDateTime();
|
|
var currentMonthEnd = currentEndOfMonth.ToGeorgianDateTime();
|
|
int currentYear = Convert.ToInt32(nowFa.Substring(0, 4));
|
|
var currentMonth = Convert.ToInt32(nowFa.Substring(5, 2));
|
|
var nextMonthStartFa = new PersianDateTime(currentYear, currentMonth, 1).AddMonths(1);
|
|
var nextMonthStart = ($"{nextMonthStartFa}").ToGeorgianDateTime();
|
|
var nextMonthEnd = (($"{nextMonthStartFa}").FindeEndOfMonth()).ToGeorgianDateTime();
|
|
|
|
|
|
//var instititionContracts = _context.InstitutionContractSet.Where(x => x.IsActiveString == "true").Select(x => x.ContractingPartyId).ToList();
|
|
var blockContractingPartyIds = _context.PersonalContractingParties.Where(x => x.IsBlock == "false" && x.IsActiveString == "true").Select(x => x.id).ToList();
|
|
//blockContractingPartyIds = blockContractingPartyIds.Where(x => instititionContracts.Contains(x)).ToList();
|
|
var workshops = _context.Workshops.Where(x => x.IsActiveString == "true")
|
|
.Include(x => x.WorkshopEmployers)
|
|
.Include(x => x.LeftWorks)
|
|
.Select(x => new ActiveWorkshops
|
|
{
|
|
Id = x.id,
|
|
IsActiveString = x.IsActiveString,
|
|
WorkshopFullName = x.WorkshopFullName,
|
|
ArchiveCode = x.ArchiveCode,
|
|
ContractingPartId = x.WorkshopEmployers.Select(e => e.Employer.ContractingPartyId).FirstOrDefault(),
|
|
AccountIdList = _context.WorkshopAccounts.Where(m => m.WorkshopId == x.id).Select(a => a.AccountId).ToList(),
|
|
|
|
|
|
#region Checkouts
|
|
|
|
//CheckoutLeft befor This Month
|
|
CheckoutLeftIds = x.LeftWorks.Select(l => new LeftWorkViewModel()
|
|
{
|
|
EmployeeId = l.EmployeeId,
|
|
StartWorkDateGr = l.StartWorkDate,
|
|
LeftWorkDateGr = l.LeftWorkDate.AddDays(-1),
|
|
|
|
}).Where(l =>
|
|
(l.StartWorkDateGr <= currentMonthStart && l.LeftWorkDateGr > currentMonthStart) ||
|
|
(l.StartWorkDateGr <= currentMonthEnd && l.LeftWorkDateGr >= currentMonthEnd) ||
|
|
(l.StartWorkDateGr >= currentMonthStart && l.StartWorkDateGr <= currentMonthEnd) ||
|
|
(l.LeftWorkDateGr >= currentMonthStart && l.LeftWorkDateGr <= currentMonthEnd)).Select(l => l.EmployeeId).ToList(),
|
|
|
|
#endregion
|
|
|
|
}).Where(e => blockContractingPartyIds.Contains(e.ContractingPartId))
|
|
.Where(a => a.AccountIdList.Contains(accountId)).AsSplitQuery();
|
|
var workshopsList = workshops.Select(x => new ActiveWorkshops
|
|
{
|
|
Id = x.Id,
|
|
IsActiveString = x.IsActiveString,
|
|
WorkshopFullName = x.WorkshopFullName,
|
|
ArchiveCode = x.ArchiveCode,
|
|
ContractingPartId = x.ContractingPartId,
|
|
AccountIdList = x.AccountIdList,
|
|
|
|
|
|
#region Checkouts
|
|
|
|
////CheckoutLeft befor This Month
|
|
CheckoutLeftIds = _context.InstitutionContractSet.Any(c => c.ContractingPartyId == x.ContractingPartId && c.ContractStartGr <= currentMonthStart && c.ContractEndGr >= currentMonthEnd) ? x.CheckoutLeftIds : new List<long>(),
|
|
|
|
|
|
#endregion
|
|
}).ToList();
|
|
|
|
var result = workshopsList.Select(x => new ActiveWorkshops
|
|
{
|
|
Id = x.Id,
|
|
CheckoutLeftWorkCount = x.CheckoutLeftIds.Count,
|
|
WorkshopFullName = x.WorkshopFullName,
|
|
ArchiveCode = x.ArchiveCode,
|
|
CheckoutDoneCount = x.CheckoutLeftIds.Count > 0 ? _context.CheckoutSet.Where(ch => ch.WorkshopId == x.Id).Where(ct => x.CheckoutLeftIds.Contains(ct.EmployeeId))
|
|
.Count(ch =>
|
|
ch.ContractStart >= currentMonthStart && ch.ContractStart < currentMonthEnd &&
|
|
ch.IsActiveString == "true") : 0,
|
|
|
|
|
|
}).Where(x => x.CheckoutLeftWorkCount > 0).ToList();
|
|
var workshopList = result.Select(x => new workshopSearch()
|
|
{
|
|
Id = x.Id,
|
|
WorkshopFullName = x.WorkshopFullName,
|
|
ArchiveCode = x.ArchiveCode,
|
|
CheckoutDonePercent = ((x.CheckoutDoneCount * 100) / x.CheckoutLeftWorkCount),
|
|
|
|
}).OrderBy(x => x.CheckoutDonePercent).ToList();
|
|
|
|
var badWorkshop = workshopList.FirstOrDefault();
|
|
var badWorkshopLeftWorks = _context.LeftWorkList.Where(l => l.WorkshopId == badWorkshop.Id).Select(l => new LeftWorkViewModel()
|
|
{
|
|
Id = l.id,
|
|
EmployeeId = l.EmployeeId,
|
|
EmployeeFullName = l.EmployeeFullName,
|
|
StartWorkDateGr = l.StartWorkDate,
|
|
LeftWorkDateGr = l.LeftWorkDate.AddDays(-1),
|
|
|
|
}).Where(l => (l.StartWorkDateGr <= currentMonthStart && l.LeftWorkDateGr > currentMonthStart) ||
|
|
(l.StartWorkDateGr <= currentMonthEnd && l.LeftWorkDateGr >= currentMonthEnd) ||
|
|
(l.StartWorkDateGr >= currentMonthStart && l.StartWorkDateGr <= currentMonthEnd) ||
|
|
(l.LeftWorkDateGr >= currentMonthStart && l.LeftWorkDateGr <= currentMonthEnd)).ToList();
|
|
var badWorkshopCheckouts = _context.CheckoutSet.Where(ch => ch.WorkshopId == badWorkshop.Id)
|
|
.Where(ch =>
|
|
ch.ContractStart >= currentMonthStart && ch.ContractStart < currentMonthEnd &&
|
|
ch.IsActiveString == "true").Select(x => x.EmployeeId).ToList();
|
|
var notDoneEmployes = badWorkshopLeftWorks.Select(l => new EmployeeNotDone()
|
|
{
|
|
Id = l.EmployeeId,
|
|
EmployeeFullName = l.EmployeeFullName,
|
|
|
|
}).Where(l => !badWorkshopCheckouts.Contains(l.Id)).ToList();
|
|
|
|
var finalResult = new WorkshopResult()
|
|
{
|
|
WorkshopSearches = workshopList,
|
|
EmployeeNotDones = notDoneEmployes,
|
|
};
|
|
Console.WriteLine("ajax >>>>>: " + watch.Elapsed);
|
|
return finalResult;
|
|
}
|
|
|
|
public WorkshopResult GetWorkshopCheckoutSignDone(string year, string month, long accountId)
|
|
{
|
|
var watch = System.Diagnostics.Stopwatch.StartNew();
|
|
string nowFa = "";
|
|
if (!string.IsNullOrWhiteSpace(year) && !string.IsNullOrWhiteSpace(month))
|
|
{
|
|
nowFa = $"{year}/{month}/01";
|
|
}
|
|
else
|
|
{
|
|
nowFa = $"{(DateTime.Now.ToFarsi()).Substring(0, 8)}01";
|
|
}
|
|
|
|
var currentEndOfMonth = nowFa.FindeEndOfMonth();
|
|
|
|
var currentMonthStart = nowFa.ToGeorgianDateTime();
|
|
var currentMonthEnd = currentEndOfMonth.ToGeorgianDateTime();
|
|
int currentYear = Convert.ToInt32(nowFa.Substring(0, 4));
|
|
var currentMonth = Convert.ToInt32(nowFa.Substring(5, 2));
|
|
var nextMonthStartFa = new PersianDateTime(currentYear, currentMonth, 1).AddMonths(1);
|
|
var nextMonthStart = ($"{nextMonthStartFa}").ToGeorgianDateTime();
|
|
var nextMonthEnd = (($"{nextMonthStartFa}").FindeEndOfMonth()).ToGeorgianDateTime();
|
|
|
|
|
|
//var instititionContracts = _context.InstitutionContractSet.Where(x => x.IsActiveString == "true").Select(x => x.ContractingPartyId).ToList();
|
|
var blockContractingPartyIds = _context.PersonalContractingParties.Where(x => x.IsBlock == "false" && x.IsActiveString == "true").Select(x => x.id).ToList();
|
|
//blockContractingPartyIds = blockContractingPartyIds.Where(x => instititionContracts.Contains(x)).ToList();
|
|
var workshops = _context.Workshops.Where(x => x.IsActiveString == "true")
|
|
.Include(x => x.WorkshopEmployers)
|
|
.Include(x => x.LeftWorks)
|
|
.Select(x => new ActiveWorkshops
|
|
{
|
|
Id = x.id,
|
|
IsActiveString = x.IsActiveString,
|
|
WorkshopFullName = x.WorkshopFullName,
|
|
ArchiveCode = x.ArchiveCode,
|
|
ContractingPartId = x.WorkshopEmployers.Select(e => e.Employer.ContractingPartyId).FirstOrDefault(),
|
|
AccountIdList = _context.WorkshopAccounts.Where(m => m.WorkshopId == x.id).Select(a => a.AccountId).ToList(),
|
|
|
|
|
|
#region Checkouts
|
|
|
|
//CheckoutLeft befor This Month
|
|
CheckoutLeftIds = x.LeftWorks.Select(l => new LeftWorkViewModel()
|
|
{
|
|
EmployeeId = l.EmployeeId,
|
|
StartWorkDateGr = l.StartWorkDate,
|
|
LeftWorkDateGr = l.LeftWorkDate.AddDays(-1),
|
|
|
|
}).Where(l =>
|
|
(l.StartWorkDateGr <= currentMonthStart && l.LeftWorkDateGr > currentMonthStart) ||
|
|
(l.StartWorkDateGr <= currentMonthEnd && l.LeftWorkDateGr >= currentMonthEnd) ||
|
|
(l.StartWorkDateGr >= currentMonthStart && l.StartWorkDateGr <= currentMonthEnd) ||
|
|
(l.LeftWorkDateGr >= currentMonthStart && l.LeftWorkDateGr <= currentMonthEnd)).Select(l => l.EmployeeId).ToList(),
|
|
|
|
#endregion
|
|
|
|
}).Where(e => blockContractingPartyIds.Contains(e.ContractingPartId))
|
|
.Where(a => a.AccountIdList.Contains(accountId)).AsSplitQuery();
|
|
var workshopsList = workshops.Select(x => new ActiveWorkshops
|
|
{
|
|
Id = x.Id,
|
|
IsActiveString = x.IsActiveString,
|
|
WorkshopFullName = x.WorkshopFullName,
|
|
ArchiveCode = x.ArchiveCode,
|
|
ContractingPartId = x.ContractingPartId,
|
|
AccountIdList = x.AccountIdList,
|
|
|
|
|
|
#region Checkouts
|
|
|
|
////CheckoutLeft befor This Month
|
|
CheckoutLeftIds = _context.InstitutionContractSet.Any(c => c.ContractingPartyId == x.ContractingPartId && c.ContractStartGr <= currentMonthStart && c.ContractEndGr >= currentMonthEnd) ? x.CheckoutLeftIds : new List<long>(),
|
|
|
|
|
|
#endregion
|
|
}).ToList();
|
|
|
|
var result = workshopsList.Select(x => new ActiveWorkshops
|
|
{
|
|
Id = x.Id,
|
|
CheckoutLeftWorkCount = x.CheckoutLeftIds.Count,
|
|
WorkshopFullName = x.WorkshopFullName,
|
|
ArchiveCode = x.ArchiveCode,
|
|
CheckoutDoneCount = x.CheckoutLeftIds.Count > 0 ? _context.CheckoutSet.Where(ch => ch.WorkshopId == x.Id).Where(ct => x.CheckoutLeftIds.Contains(ct.EmployeeId))
|
|
.Count(ch =>
|
|
ch.ContractStart >= currentMonthStart && ch.ContractStart < currentMonthEnd &&
|
|
ch.IsActiveString == "true") : 0,
|
|
CheckoutSignDoneCount = x.CheckoutLeftIds.Count > 0 ? _context.CheckoutSet.Where(ch => ch.WorkshopId == x.Id && ch.Signature == "1").Where(ct => x.CheckoutLeftIds.Contains(ct.EmployeeId))
|
|
.Count(ch =>
|
|
ch.ContractStart >= currentMonthStart && ch.ContractStart < currentMonthEnd &&
|
|
ch.IsActiveString == "true") : 0,
|
|
|
|
|
|
}).Where(x => x.CheckoutDoneCount > 0).ToList();
|
|
var workshopList = result.Select(x => new workshopSearch()
|
|
{
|
|
Id = x.Id,
|
|
WorkshopFullName = x.WorkshopFullName,
|
|
ArchiveCode = x.ArchiveCode,
|
|
CheckoutSignPercent = ((x.CheckoutSignDoneCount * 100) / x.CheckoutDoneCount),
|
|
|
|
}).OrderBy(x => x.CheckoutSignPercent).ToList();
|
|
|
|
var badWorkshop = workshopList.FirstOrDefault();
|
|
var badWorkshopLeftWorks = _context.LeftWorkList.Where(l => l.WorkshopId == badWorkshop.Id).Select(l => new LeftWorkViewModel()
|
|
{
|
|
Id = l.id,
|
|
EmployeeId = l.EmployeeId,
|
|
EmployeeFullName = l.EmployeeFullName,
|
|
StartWorkDateGr = l.StartWorkDate,
|
|
LeftWorkDateGr = l.LeftWorkDate.AddDays(-1),
|
|
|
|
}).Where(l => (l.StartWorkDateGr <= currentMonthStart && l.LeftWorkDateGr > currentMonthStart) ||
|
|
(l.StartWorkDateGr <= currentMonthEnd && l.LeftWorkDateGr >= currentMonthEnd) ||
|
|
(l.StartWorkDateGr >= currentMonthStart && l.StartWorkDateGr <= currentMonthEnd) ||
|
|
(l.LeftWorkDateGr >= currentMonthStart && l.LeftWorkDateGr <= currentMonthEnd)).ToList();
|
|
var badWorkshopCheckouts = _context.CheckoutSet.Where(ch => ch.WorkshopId == badWorkshop.Id)
|
|
.Where(ch =>
|
|
ch.ContractStart >= currentMonthStart && ch.ContractStart < currentMonthEnd && ch.Signature == "1" &&
|
|
ch.IsActiveString == "true").Select(x => x.EmployeeId).ToList();
|
|
var notDoneEmployes = badWorkshopLeftWorks.Select(l => new EmployeeNotDone()
|
|
{
|
|
Id = l.EmployeeId,
|
|
EmployeeFullName = l.EmployeeFullName,
|
|
|
|
}).Where(l => !badWorkshopCheckouts.Contains(l.Id)).ToList();
|
|
|
|
var finalResult = new WorkshopResult()
|
|
{
|
|
WorkshopSearches = workshopList,
|
|
EmployeeNotDones = notDoneEmployes,
|
|
};
|
|
Console.WriteLine("ajax >>>>>: " + watch.Elapsed);
|
|
return finalResult;
|
|
}
|
|
|
|
public List<EmployeeNotDone> GetEmployeeContract(string year, string month, long workshopId)
|
|
{
|
|
string nowFa = "";
|
|
if (!string.IsNullOrWhiteSpace(year) && !string.IsNullOrWhiteSpace(month))
|
|
{
|
|
nowFa = $"{year}/{month}/01";
|
|
}
|
|
else
|
|
{
|
|
nowFa = $"{(DateTime.Now.ToFarsi()).Substring(0, 8)}01";
|
|
}
|
|
|
|
var currentEndOfMonth = nowFa.FindeEndOfMonth();
|
|
|
|
var currentMonthStart = nowFa.ToGeorgianDateTime();
|
|
var currentMonthEnd = currentEndOfMonth.ToGeorgianDateTime();
|
|
int currentYear = Convert.ToInt32(nowFa.Substring(0, 4));
|
|
var currentMonth = Convert.ToInt32(nowFa.Substring(5, 2));
|
|
var nextMonthStartFa = new PersianDateTime(currentYear, currentMonth, 1).AddMonths(1);
|
|
var nextMonthStart = ($"{nextMonthStartFa}").ToGeorgianDateTime();
|
|
var nextMonthEnd = (($"{nextMonthStartFa}").FindeEndOfMonth()).ToGeorgianDateTime();
|
|
|
|
// پرسنلی که باید انجام میشد
|
|
var workshopLeftWorks = _context.LeftWorkList.Where(l => l.WorkshopId == workshopId).Select(l => new LeftWorkViewModel()
|
|
{
|
|
Id = l.id,
|
|
EmployeeId = l.EmployeeId,
|
|
EmployeeFullName = l.EmployeeFullName,
|
|
StartWorkDateGr = l.StartWorkDate,
|
|
LeftWorkDateGr = l.LeftWorkDate.AddDays(-1),
|
|
|
|
}).Where(l =>
|
|
(l.StartWorkDateGr <= nextMonthStart && l.LeftWorkDateGr > nextMonthStart) ||
|
|
(l.StartWorkDateGr <= nextMonthEnd && l.LeftWorkDateGr >= nextMonthEnd) ||
|
|
(l.StartWorkDateGr >= nextMonthStart && l.StartWorkDateGr <= nextMonthEnd) ||
|
|
(l.LeftWorkDateGr >= nextMonthStart && l.LeftWorkDateGr <= nextMonthEnd)).ToList();
|
|
//پرسنلی که کارشان انجام شده
|
|
var workshopContracts = _context.Contracts.Where(ct => ct.WorkshopIds == workshopId && ct.IsActiveString == "true")
|
|
.Where(l => (l.ContarctStart <= nextMonthStart && l.ContractEnd >= nextMonthStart) ||
|
|
(l.ContarctStart <= nextMonthEnd && l.ContractEnd >= nextMonthEnd) ||
|
|
(l.ContarctStart >= nextMonthStart && l.ContarctStart <= nextMonthEnd) ||
|
|
(l.ContractEnd >= nextMonthStart && l.ContractEnd <= nextMonthEnd)).Select(x => x.EmployeeId).ToList();
|
|
return workshopLeftWorks.Select(l => new EmployeeNotDone()
|
|
{
|
|
Id = l.EmployeeId,
|
|
EmployeeFullName = l.EmployeeFullName,
|
|
}).Where(x => !workshopContracts.Contains(x.Id)).ToList();
|
|
}
|
|
|
|
public List<EmployeeNotDone> GetEmployeeContractSign(string year, string month, long workshopId)
|
|
{
|
|
string nowFa = "";
|
|
if (!string.IsNullOrWhiteSpace(year) && !string.IsNullOrWhiteSpace(month))
|
|
{
|
|
nowFa = $"{year}/{month}/01";
|
|
}
|
|
else
|
|
{
|
|
nowFa = $"{(DateTime.Now.ToFarsi()).Substring(0, 8)}01";
|
|
}
|
|
|
|
var currentEndOfMonth = nowFa.FindeEndOfMonth();
|
|
|
|
var currentMonthStart = nowFa.ToGeorgianDateTime();
|
|
var currentMonthEnd = currentEndOfMonth.ToGeorgianDateTime();
|
|
int currentYear = Convert.ToInt32(nowFa.Substring(0, 4));
|
|
var currentMonth = Convert.ToInt32(nowFa.Substring(5, 2));
|
|
var nextMonthStartFa = new PersianDateTime(currentYear, currentMonth, 1).AddMonths(1);
|
|
var nextMonthStart = ($"{nextMonthStartFa}").ToGeorgianDateTime();
|
|
var nextMonthEnd = (($"{nextMonthStartFa}").FindeEndOfMonth()).ToGeorgianDateTime();
|
|
|
|
var badWorkshopLeftWorks = _context.LeftWorkList.Where(l => l.WorkshopId == workshopId).Select(l => new LeftWorkViewModel()
|
|
{
|
|
Id = l.id,
|
|
EmployeeId = l.EmployeeId,
|
|
EmployeeFullName = l.EmployeeFullName,
|
|
StartWorkDateGr = l.StartWorkDate,
|
|
LeftWorkDateGr = l.LeftWorkDate.AddDays(-1),
|
|
|
|
}).Where(l =>
|
|
(l.StartWorkDateGr <= nextMonthStart && l.LeftWorkDateGr > nextMonthStart) ||
|
|
(l.StartWorkDateGr <= nextMonthEnd && l.LeftWorkDateGr >= nextMonthEnd) ||
|
|
(l.StartWorkDateGr >= nextMonthStart && l.StartWorkDateGr <= nextMonthEnd) ||
|
|
(l.LeftWorkDateGr >= nextMonthStart && l.LeftWorkDateGr <= nextMonthEnd)).ToList();
|
|
var badWorkshopContracts = _context.Contracts.Where(ct => ct.WorkshopIds == workshopId && ct.IsActiveString == "true" && ct.Signature == "1")
|
|
.Where(l => (l.ContarctStart <= nextMonthStart && l.ContractEnd >= nextMonthStart) ||
|
|
(l.ContarctStart <= nextMonthEnd && l.ContractEnd >= nextMonthEnd) ||
|
|
(l.ContarctStart >= nextMonthStart && l.ContarctStart <= nextMonthEnd) ||
|
|
(l.ContractEnd >= nextMonthStart && l.ContractEnd <= nextMonthEnd)).Select(x => x.EmployeeId).ToList();
|
|
return badWorkshopLeftWorks.Select(l => new EmployeeNotDone()
|
|
{
|
|
Id = l.EmployeeId,
|
|
EmployeeFullName = l.EmployeeFullName,
|
|
|
|
}).Where(l => !badWorkshopContracts.Contains(l.Id)).ToList();
|
|
}
|
|
|
|
public List<EmployeeNotDone> GetEmployeeCheckout(string year, string month, long workshopId)
|
|
{
|
|
string nowFa = "";
|
|
if (!string.IsNullOrWhiteSpace(year) && !string.IsNullOrWhiteSpace(month))
|
|
{
|
|
nowFa = $"{year}/{month}/01";
|
|
}
|
|
else
|
|
{
|
|
nowFa = $"{(DateTime.Now.ToFarsi()).Substring(0, 8)}01";
|
|
}
|
|
|
|
var currentEndOfMonth = nowFa.FindeEndOfMonth();
|
|
|
|
var currentMonthStart = nowFa.ToGeorgianDateTime();
|
|
var currentMonthEnd = currentEndOfMonth.ToGeorgianDateTime();
|
|
int currentYear = Convert.ToInt32(nowFa.Substring(0, 4));
|
|
var currentMonth = Convert.ToInt32(nowFa.Substring(5, 2));
|
|
var nextMonthStartFa = new PersianDateTime(currentYear, currentMonth, 1).AddMonths(1);
|
|
var nextMonthStart = ($"{nextMonthStartFa}").ToGeorgianDateTime();
|
|
var nextMonthEnd = (($"{nextMonthStartFa}").FindeEndOfMonth()).ToGeorgianDateTime();
|
|
|
|
var badWorkshopLeftWorks = _context.LeftWorkList.Where(l => l.WorkshopId == workshopId).Select(l => new LeftWorkViewModel()
|
|
{
|
|
Id = l.id,
|
|
EmployeeId = l.EmployeeId,
|
|
EmployeeFullName = l.EmployeeFullName,
|
|
StartWorkDateGr = l.StartWorkDate,
|
|
LeftWorkDateGr = l.LeftWorkDate.AddDays(-1),
|
|
|
|
}).Where(l => (l.StartWorkDateGr <= currentMonthStart && l.LeftWorkDateGr > currentMonthStart) ||
|
|
(l.StartWorkDateGr <= currentMonthEnd && l.LeftWorkDateGr >= currentMonthEnd) ||
|
|
(l.StartWorkDateGr >= currentMonthStart && l.StartWorkDateGr <= currentMonthEnd) ||
|
|
(l.LeftWorkDateGr >= currentMonthStart && l.LeftWorkDateGr <= currentMonthEnd)).ToList();
|
|
var badWorkshopCheckouts = _context.CheckoutSet.Where(ch => ch.WorkshopId == workshopId)
|
|
.Where(ch =>
|
|
ch.ContractStart >= currentMonthStart && ch.ContractStart < currentMonthEnd &&
|
|
ch.IsActiveString == "true").Select(x => x.EmployeeId).ToList();
|
|
return badWorkshopLeftWorks.Select(l => new EmployeeNotDone()
|
|
{
|
|
Id = l.EmployeeId,
|
|
EmployeeFullName = l.EmployeeFullName,
|
|
}).Where(l => !badWorkshopCheckouts.Contains(l.Id)).ToList();
|
|
|
|
}
|
|
|
|
public List<EmployeeNotDone> GetEmployeeCheckoutSign(string year, string month, long workshopId)
|
|
{
|
|
string nowFa = "";
|
|
if (!string.IsNullOrWhiteSpace(year) && !string.IsNullOrWhiteSpace(month))
|
|
{
|
|
nowFa = $"{year}/{month}/01";
|
|
}
|
|
else
|
|
{
|
|
nowFa = $"{(DateTime.Now.ToFarsi()).Substring(0, 8)}01";
|
|
}
|
|
|
|
var currentEndOfMonth = nowFa.FindeEndOfMonth();
|
|
|
|
var currentMonthStart = nowFa.ToGeorgianDateTime();
|
|
var currentMonthEnd = currentEndOfMonth.ToGeorgianDateTime();
|
|
int currentYear = Convert.ToInt32(nowFa.Substring(0, 4));
|
|
var currentMonth = Convert.ToInt32(nowFa.Substring(5, 2));
|
|
var nextMonthStartFa = new PersianDateTime(currentYear, currentMonth, 1).AddMonths(1);
|
|
var nextMonthStart = ($"{nextMonthStartFa}").ToGeorgianDateTime();
|
|
var nextMonthEnd = (($"{nextMonthStartFa}").FindeEndOfMonth()).ToGeorgianDateTime();
|
|
|
|
var badWorkshopLeftWorks = _context.LeftWorkList.Where(l => l.WorkshopId == workshopId).Select(l => new LeftWorkViewModel()
|
|
{
|
|
Id = l.id,
|
|
EmployeeId = l.EmployeeId,
|
|
EmployeeFullName = l.EmployeeFullName,
|
|
StartWorkDateGr = l.StartWorkDate,
|
|
LeftWorkDateGr = l.LeftWorkDate.AddDays(-1),
|
|
|
|
}).Where(l => (l.StartWorkDateGr <= currentMonthStart && l.LeftWorkDateGr > currentMonthStart) ||
|
|
(l.StartWorkDateGr <= currentMonthEnd && l.LeftWorkDateGr >= currentMonthEnd) ||
|
|
(l.StartWorkDateGr >= currentMonthStart && l.StartWorkDateGr <= currentMonthEnd) ||
|
|
(l.LeftWorkDateGr >= currentMonthStart && l.LeftWorkDateGr <= currentMonthEnd)).ToList();
|
|
var badWorkshopCheckouts = _context.CheckoutSet.Where(ch => ch.WorkshopId == workshopId)
|
|
.Where(ch =>
|
|
ch.ContractStart >= currentMonthStart && ch.ContractStart < currentMonthEnd && ch.Signature == "1" &&
|
|
ch.IsActiveString == "true").Select(x => x.EmployeeId).ToList();
|
|
return badWorkshopLeftWorks.Select(l => new EmployeeNotDone()
|
|
{
|
|
Id = l.EmployeeId,
|
|
EmployeeFullName = l.EmployeeFullName,
|
|
}).Where(l => !badWorkshopCheckouts.Contains(l.Id)).ToList();
|
|
|
|
}
|
|
|
|
#region PrintAll
|
|
public PrintAllContractCheckout GetPrintAllContractDone(string year, string month, long accountId)
|
|
{
|
|
var watch = System.Diagnostics.Stopwatch.StartNew();
|
|
string nowFa = "";
|
|
if (!string.IsNullOrWhiteSpace(year) && !string.IsNullOrWhiteSpace(month))
|
|
{
|
|
nowFa = $"{year}/{month}/01";
|
|
}
|
|
else
|
|
{
|
|
nowFa = $"{(DateTime.Now.ToFarsi()).Substring(0, 8)}01";
|
|
}
|
|
|
|
var currentEndOfMonth = nowFa.FindeEndOfMonth();
|
|
|
|
var currentMonthStart = nowFa.ToGeorgianDateTime();
|
|
var currentMonthEnd = currentEndOfMonth.ToGeorgianDateTime();
|
|
int currentYear = Convert.ToInt32(nowFa.Substring(0, 4));
|
|
var currentMonth = Convert.ToInt32(nowFa.Substring(5, 2));
|
|
var nextMonthStartFa = new PersianDateTime(currentYear, currentMonth, 1).AddMonths(1);
|
|
var nextMonthStart = ($"{nextMonthStartFa}").ToGeorgianDateTime();
|
|
var nextMonthEnd = (($"{nextMonthStartFa}").FindeEndOfMonth()).ToGeorgianDateTime();
|
|
|
|
|
|
//var instititionContracts = _context.InstitutionContractSet.Where(x => x.IsActiveString == "true").Select(x => x.ContractingPartyId).ToList();
|
|
var blockContractingPartyIds = _context.PersonalContractingParties.Where(x => x.IsBlock == "false" && x.IsActiveString == "true").Select(x => x.id).ToList();
|
|
//blockContractingPartyIds = blockContractingPartyIds.Where(x => instititionContracts.Contains(x)).ToList();
|
|
|
|
var workshops = _context.Workshops.Where(x => x.IsActiveString == "true")
|
|
.Include(x => x.WorkshopEmployers)
|
|
.Include(x => x.LeftWorks)
|
|
.Select(x => new ActiveWorkshops
|
|
{
|
|
Id = x.id,
|
|
IsActiveString = x.IsActiveString,
|
|
WorkshopFullName = x.WorkshopFullName,
|
|
ArchiveCode = x.ArchiveCode,
|
|
ContractingPartId = x.WorkshopEmployers.Select(e => e.Employer.ContractingPartyId).FirstOrDefault(),
|
|
AccountIdList = _context.WorkshopAccounts.Where(m => m.WorkshopId == x.id).Select(a => a.AccountId).ToList(),
|
|
|
|
#region Contracts
|
|
|
|
//contractLeft This Mont
|
|
|
|
ContractLeftIds = x.LeftWorks.Select(l => new LeftWorkViewModel()
|
|
{
|
|
EmployeeId = l.EmployeeId,
|
|
StartWorkDateGr = l.StartWorkDate,
|
|
LeftWorkDateGr = l.LeftWorkDate.AddDays(-1),
|
|
|
|
}).Where(l =>
|
|
(l.StartWorkDateGr <= nextMonthStart && l.LeftWorkDateGr > nextMonthStart) ||
|
|
(l.StartWorkDateGr <= nextMonthEnd && l.LeftWorkDateGr >= nextMonthEnd) ||
|
|
(l.StartWorkDateGr >= nextMonthStart && l.StartWorkDateGr <= nextMonthEnd) ||
|
|
(l.LeftWorkDateGr >= nextMonthStart && l.LeftWorkDateGr <= nextMonthEnd)).Select(l => l.EmployeeId).ToList(),
|
|
#endregion
|
|
}).Where(e => blockContractingPartyIds.Contains(e.ContractingPartId))
|
|
.Where(a => a.AccountIdList.Contains(accountId)).AsSplitQuery();
|
|
var workshopsList = workshops.Select(x => new ActiveWorkshops
|
|
{
|
|
Id = x.Id,
|
|
IsActiveString = x.IsActiveString,
|
|
WorkshopFullName = x.WorkshopFullName,
|
|
ArchiveCode = x.ArchiveCode,
|
|
ContractingPartId = x.ContractingPartId,
|
|
AccountIdList = x.AccountIdList,
|
|
#region Contracts
|
|
|
|
//contractLeft This Month
|
|
ContractLeftIds = _context.InstitutionContractSet.Any(c => c.ContractingPartyId == x.ContractingPartId && c.ContractStartGr <= nextMonthStart && c.ContractEndGr >= nextMonthEnd) ? x.ContractLeftIds : new List<long>(),
|
|
|
|
#endregion
|
|
|
|
|
|
}).ToList();
|
|
var result = workshopsList.Select(x => new ActiveWorkshops
|
|
{
|
|
Id = x.Id,
|
|
ContractLeftWorkCount = x.ContractLeftIds.Count,
|
|
WorkshopFullName = x.WorkshopFullName,
|
|
ArchiveCode = x.ArchiveCode,
|
|
ContrctDoneCount = x.ContractLeftIds.Count > 0 ? _context.Contracts.Where(ct => ct.WorkshopIds == x.Id && ct.IsActiveString == "true").Where(ct => x.ContractLeftIds.Contains(ct.EmployeeId))
|
|
.Count(l => (l.ContarctStart <= nextMonthStart && l.ContractEnd >= nextMonthStart) ||
|
|
(l.ContarctStart <= nextMonthEnd && l.ContractEnd >= nextMonthEnd) ||
|
|
(l.ContarctStart >= nextMonthStart && l.ContarctStart <= nextMonthEnd) ||
|
|
(l.ContractEnd >= nextMonthStart && l.ContractEnd <= nextMonthEnd)) : 0,
|
|
}).Where(x => x.ContractLeftWorkCount > 0).ToList();
|
|
|
|
var workshopList = result.Where(x=>((x.ContrctDoneCount * 100) / x.ContractLeftWorkCount) < 100)
|
|
.Select(x => new workshopSearch()
|
|
{
|
|
Id = x.Id,
|
|
WorkshopFullName = x.WorkshopFullName,
|
|
ArchiveCode = x.ArchiveCode,
|
|
ContractDonePercent = ((x.ContrctDoneCount * 100) / x.ContractLeftWorkCount),
|
|
EmployeeNotDones = _context.LeftWorkList.Where(l => l.WorkshopId == x.Id).Select(l => new LeftWorkViewModel()
|
|
{
|
|
Id = l.id,
|
|
EmployeeId = l.EmployeeId,
|
|
EmployeeFullName = l.EmployeeFullName,
|
|
StartWorkDateGr = l.StartWorkDate,
|
|
LeftWorkDateGr = l.LeftWorkDate.AddDays(-1),
|
|
}).Where(l =>
|
|
(l.StartWorkDateGr <= nextMonthStart && l.LeftWorkDateGr > nextMonthStart) ||
|
|
(l.StartWorkDateGr <= nextMonthEnd && l.LeftWorkDateGr >= nextMonthEnd) ||
|
|
(l.StartWorkDateGr >= nextMonthStart && l.StartWorkDateGr <= nextMonthEnd) ||
|
|
(l.LeftWorkDateGr >= nextMonthStart && l.LeftWorkDateGr <= nextMonthEnd))
|
|
.Where(l => !_context.Contracts.Where(ct => ct.WorkshopIds == x.Id && ct.IsActiveString == "true")
|
|
.Any(c => c.EmployeeId == l.EmployeeId &&
|
|
((c.ContarctStart <= nextMonthStart && c.ContractEnd >= nextMonthStart) ||
|
|
(c.ContarctStart <= nextMonthEnd && c.ContractEnd >= nextMonthEnd) ||
|
|
(c.ContarctStart >= nextMonthStart && c.ContarctStart <= nextMonthEnd) ||
|
|
(c.ContractEnd >= nextMonthStart && c.ContractEnd <= nextMonthEnd))))
|
|
.Select(l => new EmployeeNotDone
|
|
{
|
|
Id = l.EmployeeId,
|
|
EmployeeFullName = l.EmployeeFullName,
|
|
}).ToList()
|
|
}).OrderBy(x => x.ContractDonePercent).ToList();
|
|
|
|
var finalResult = new PrintAllContractCheckout()
|
|
{
|
|
AccountId = accountId,
|
|
AccountFullName = _accountContext.Accounts.FirstOrDefault(x => x.id == accountId)?.Fullname,
|
|
Year = $"{nextMonthStartFa.Year}",
|
|
Month = nextMonthStartFa.Month.ToFarsiMonthByIntNumber(),
|
|
ReportType = "تنظیم قرارداد",
|
|
WorkshopSearches = workshopList,
|
|
};
|
|
|
|
Console.WriteLine("ajax >>>>>: " + watch.Elapsed);
|
|
return finalResult;
|
|
}
|
|
|
|
public PrintAllContractCheckout GetPrintAllContractSignDone(string year, string month, long accountId)
|
|
{
|
|
var watch = System.Diagnostics.Stopwatch.StartNew();
|
|
string nowFa = "";
|
|
if (!string.IsNullOrWhiteSpace(year) && !string.IsNullOrWhiteSpace(month))
|
|
{
|
|
nowFa = $"{year}/{month}/01";
|
|
}
|
|
else
|
|
{
|
|
nowFa = $"{(DateTime.Now.ToFarsi()).Substring(0, 8)}01";
|
|
}
|
|
|
|
var currentEndOfMonth = nowFa.FindeEndOfMonth();
|
|
|
|
var currentMonthStart = nowFa.ToGeorgianDateTime();
|
|
var currentMonthEnd = currentEndOfMonth.ToGeorgianDateTime();
|
|
int currentYear = Convert.ToInt32(nowFa.Substring(0, 4));
|
|
var currentMonth = Convert.ToInt32(nowFa.Substring(5, 2));
|
|
var nextMonthStartFa = new PersianDateTime(currentYear, currentMonth, 1).AddMonths(1);
|
|
var nextMonthStart = ($"{nextMonthStartFa}").ToGeorgianDateTime();
|
|
var nextMonthEnd = (($"{nextMonthStartFa}").FindeEndOfMonth()).ToGeorgianDateTime();
|
|
|
|
|
|
//var instititionContracts = _context.InstitutionContractSet.Where(x => x.IsActiveString == "true").Select(x => x.ContractingPartyId).ToList();
|
|
var blockContractingPartyIds = _context.PersonalContractingParties.Where(x => x.IsBlock == "false" && x.IsActiveString == "true").Select(x => x.id).ToList();
|
|
//blockContractingPartyIds = blockContractingPartyIds.Where(x => instititionContracts.Contains(x)).ToList();
|
|
|
|
var workshops = _context.Workshops.Where(x => x.IsActiveString == "true")
|
|
.Include(x => x.WorkshopEmployers)
|
|
.Include(x => x.LeftWorks)
|
|
.Select(x => new ActiveWorkshops
|
|
{
|
|
Id = x.id,
|
|
IsActiveString = x.IsActiveString,
|
|
WorkshopFullName = x.WorkshopFullName,
|
|
ArchiveCode = x.ArchiveCode,
|
|
ContractingPartId = x.WorkshopEmployers.Select(e => e.Employer.ContractingPartyId).FirstOrDefault(),
|
|
AccountIdList = _context.WorkshopAccounts.Where(m => m.WorkshopId == x.id).Select(a => a.AccountId).ToList(),
|
|
#region Contracts
|
|
|
|
//contractLeft This Mont
|
|
|
|
ContractLeftIds = x.LeftWorks.Select(l => new LeftWorkViewModel()
|
|
{
|
|
EmployeeId = l.EmployeeId,
|
|
StartWorkDateGr = l.StartWorkDate,
|
|
LeftWorkDateGr = l.LeftWorkDate.AddDays(-1),
|
|
|
|
}).Where(l =>
|
|
(l.StartWorkDateGr <= nextMonthStart && l.LeftWorkDateGr > nextMonthStart) ||
|
|
(l.StartWorkDateGr <= nextMonthEnd && l.LeftWorkDateGr >= nextMonthEnd) ||
|
|
(l.StartWorkDateGr >= nextMonthStart && l.StartWorkDateGr <= nextMonthEnd) ||
|
|
(l.LeftWorkDateGr >= nextMonthStart && l.LeftWorkDateGr <= nextMonthEnd)).Select(l => l.EmployeeId).ToList(),
|
|
#endregion
|
|
|
|
}).Where(e => blockContractingPartyIds.Contains(e.ContractingPartId))
|
|
.Where(a => a.AccountIdList.Contains(accountId)).AsSplitQuery();
|
|
var workshopsList = workshops.Select(x => new ActiveWorkshops
|
|
{
|
|
Id = x.Id,
|
|
IsActiveString = x.IsActiveString,
|
|
WorkshopFullName = x.WorkshopFullName,
|
|
ArchiveCode = x.ArchiveCode,
|
|
ContractingPartId = x.ContractingPartId,
|
|
AccountIdList = x.AccountIdList,
|
|
#region Contracts
|
|
|
|
//contractLeft This Month
|
|
ContractLeftIds = _context.InstitutionContractSet.Any(c => c.ContractingPartyId == x.ContractingPartId && c.ContractStartGr <= nextMonthStart && c.ContractEndGr >= nextMonthEnd) ? x.ContractLeftIds : new List<long>(),
|
|
|
|
#endregion
|
|
|
|
|
|
}).ToList();
|
|
var result = workshopsList.Select(x => new ActiveWorkshops
|
|
{
|
|
Id = x.Id,
|
|
ContractLeftWorkCount = x.ContractLeftIds.Count,
|
|
WorkshopFullName = x.WorkshopFullName,
|
|
ArchiveCode = x.ArchiveCode,
|
|
ContrctDoneCount = x.ContractLeftIds.Count > 0 ? _context.Contracts.Where(ch => ch.WorkshopIds == x.Id && ch.IsActiveString == "true").Where(ch => x.ContractLeftIds.Contains(ch.EmployeeId))
|
|
.Count(l => (l.ContarctStart <= nextMonthStart && l.ContractEnd >= nextMonthStart) ||
|
|
(l.ContarctStart <= nextMonthEnd && l.ContractEnd >= nextMonthEnd) ||
|
|
(l.ContarctStart >= nextMonthStart && l.ContarctStart <= nextMonthEnd) ||
|
|
(l.ContractEnd >= nextMonthStart && l.ContractEnd <= nextMonthEnd)) : 0,
|
|
ContrctSignDoneCount = x.ContractLeftIds.Count > 0 ? _context.Contracts.Where(ct => ct.WorkshopIds == x.Id && ct.IsActiveString == "true" && ct.Signature == "1").Where(ct => x.ContractLeftIds.Contains(ct.EmployeeId))
|
|
.Count(l => (l.ContarctStart <= nextMonthStart && l.ContractEnd >= nextMonthStart) ||
|
|
(l.ContarctStart <= nextMonthEnd && l.ContractEnd >= nextMonthEnd) ||
|
|
(l.ContarctStart >= nextMonthStart && l.ContarctStart <= nextMonthEnd) ||
|
|
(l.ContractEnd >= nextMonthStart && l.ContractEnd <= nextMonthEnd)) : 0,
|
|
}).Where(x => x.ContrctDoneCount > 0).ToList();
|
|
|
|
var workshopList = result.Where(x => ((x.ContrctSignDoneCount * 100) / x.ContrctDoneCount) < 100)
|
|
.Select(x => new workshopSearch()
|
|
{
|
|
Id = x.Id,
|
|
WorkshopFullName = x.WorkshopFullName,
|
|
ArchiveCode = x.ArchiveCode,
|
|
ContractSignPercent = ((x.ContrctSignDoneCount * 100) / x.ContrctDoneCount),
|
|
EmployeeNotDones = _context.LeftWorkList.Where(l => l.WorkshopId == x.Id).Select(l => new LeftWorkViewModel()
|
|
{
|
|
Id = l.id,
|
|
EmployeeId = l.EmployeeId,
|
|
EmployeeFullName = l.EmployeeFullName,
|
|
StartWorkDateGr = l.StartWorkDate,
|
|
LeftWorkDateGr = l.LeftWorkDate.AddDays(-1),
|
|
}).Where(l =>
|
|
(l.StartWorkDateGr <= nextMonthStart && l.LeftWorkDateGr > nextMonthStart) ||
|
|
(l.StartWorkDateGr <= nextMonthEnd && l.LeftWorkDateGr >= nextMonthEnd) ||
|
|
(l.StartWorkDateGr >= nextMonthStart && l.StartWorkDateGr <= nextMonthEnd) ||
|
|
(l.LeftWorkDateGr >= nextMonthStart && l.LeftWorkDateGr <= nextMonthEnd))
|
|
.Where(l => !_context.Contracts.Where(ct => ct.WorkshopIds == x.Id && ct.IsActiveString == "true" && ct.Signature == "1")
|
|
.Any(c => c.EmployeeId == l.EmployeeId &&
|
|
((c.ContarctStart <= nextMonthStart && c.ContractEnd >= nextMonthStart) ||
|
|
(c.ContarctStart <= nextMonthEnd && c.ContractEnd >= nextMonthEnd) ||
|
|
(c.ContarctStart >= nextMonthStart && c.ContarctStart <= nextMonthEnd) ||
|
|
(c.ContractEnd >= nextMonthStart && c.ContractEnd <= nextMonthEnd))))
|
|
.Select(l => new EmployeeNotDone()
|
|
{
|
|
Id = l.EmployeeId,
|
|
EmployeeFullName = l.EmployeeFullName,
|
|
}).ToList()
|
|
}).OrderBy(x => x.ContractSignPercent).ToList();
|
|
|
|
|
|
|
|
|
|
var finalResult = new PrintAllContractCheckout()
|
|
{
|
|
AccountId = accountId,
|
|
AccountFullName = _accountContext.Accounts.FirstOrDefault(x => x.id == accountId)?.Fullname,
|
|
Year = $"{nextMonthStartFa.Year}",
|
|
Month = nextMonthStartFa.Month.ToFarsiMonthByIntNumber(),
|
|
ReportType = "امضاء قرارداد",
|
|
WorkshopSearches = workshopList,
|
|
};
|
|
Console.WriteLine("ajax >>>>>: " + watch.Elapsed);
|
|
return finalResult;
|
|
}
|
|
|
|
public PrintAllContractCheckout GetPrintAllCheckoutDone(string year, string month, long accountId)
|
|
{
|
|
var watch = System.Diagnostics.Stopwatch.StartNew();
|
|
string nowFa = "";
|
|
if (!string.IsNullOrWhiteSpace(year) && !string.IsNullOrWhiteSpace(month))
|
|
{
|
|
nowFa = $"{year}/{month}/01";
|
|
}
|
|
else
|
|
{
|
|
nowFa = $"{(DateTime.Now.ToFarsi()).Substring(0, 8)}01";
|
|
}
|
|
|
|
var currentEndOfMonth = nowFa.FindeEndOfMonth();
|
|
|
|
var currentMonthStart = nowFa.ToGeorgianDateTime();
|
|
var currentMonthEnd = currentEndOfMonth.ToGeorgianDateTime();
|
|
int currentYear = Convert.ToInt32(nowFa.Substring(0, 4));
|
|
var currentMonth = Convert.ToInt32(nowFa.Substring(5, 2));
|
|
var nextMonthStartFa = new PersianDateTime(currentYear, currentMonth, 1).AddMonths(1);
|
|
var nextMonthStart = ($"{nextMonthStartFa}").ToGeorgianDateTime();
|
|
var nextMonthEnd = (($"{nextMonthStartFa}").FindeEndOfMonth()).ToGeorgianDateTime();
|
|
|
|
|
|
//var instititionContracts = _context.InstitutionContractSet.Where(x => x.IsActiveString == "true").Select(x => x.ContractingPartyId).ToList();
|
|
var blockContractingPartyIds = _context.PersonalContractingParties.Where(x => x.IsBlock == "false" && x.IsActiveString == "true").Select(x => x.id).ToList();
|
|
//blockContractingPartyIds = blockContractingPartyIds.Where(x => instititionContracts.Contains(x)).ToList();
|
|
var workshops = _context.Workshops.Where(x => x.IsActiveString == "true")
|
|
.Include(x => x.WorkshopEmployers)
|
|
.Include(x => x.LeftWorks)
|
|
.Select(x => new ActiveWorkshops
|
|
{
|
|
Id = x.id,
|
|
IsActiveString = x.IsActiveString,
|
|
WorkshopFullName = x.WorkshopFullName,
|
|
ArchiveCode = x.ArchiveCode,
|
|
ContractingPartId = x.WorkshopEmployers.Select(e => e.Employer.ContractingPartyId).FirstOrDefault(),
|
|
AccountIdList = _context.WorkshopAccounts.Where(m => m.WorkshopId == x.id).Select(a => a.AccountId).ToList(),
|
|
|
|
|
|
#region Checkouts
|
|
|
|
//CheckoutLeft befor This Month
|
|
CheckoutLeftIds = x.LeftWorks.Select(l => new LeftWorkViewModel()
|
|
{
|
|
EmployeeId = l.EmployeeId,
|
|
StartWorkDateGr = l.StartWorkDate,
|
|
LeftWorkDateGr = l.LeftWorkDate.AddDays(-1),
|
|
|
|
}).Where(l =>
|
|
(l.StartWorkDateGr <= currentMonthStart && l.LeftWorkDateGr > currentMonthStart) ||
|
|
(l.StartWorkDateGr <= currentMonthEnd && l.LeftWorkDateGr >= currentMonthEnd) ||
|
|
(l.StartWorkDateGr >= currentMonthStart && l.StartWorkDateGr <= currentMonthEnd) ||
|
|
(l.LeftWorkDateGr >= currentMonthStart && l.LeftWorkDateGr <= currentMonthEnd)).Select(l => l.EmployeeId).ToList(),
|
|
|
|
#endregion
|
|
|
|
}).Where(e => blockContractingPartyIds.Contains(e.ContractingPartId))
|
|
.Where(a => a.AccountIdList.Contains(accountId)).AsSplitQuery();
|
|
var workshopsList = workshops.Select(x => new ActiveWorkshops
|
|
{
|
|
Id = x.Id,
|
|
IsActiveString = x.IsActiveString,
|
|
WorkshopFullName = x.WorkshopFullName,
|
|
ArchiveCode = x.ArchiveCode,
|
|
ContractingPartId = x.ContractingPartId,
|
|
AccountIdList = x.AccountIdList,
|
|
|
|
|
|
#region Checkouts
|
|
|
|
////CheckoutLeft befor This Month
|
|
CheckoutLeftIds = _context.InstitutionContractSet.Any(c => c.ContractingPartyId == x.ContractingPartId && c.ContractStartGr <= currentMonthStart && c.ContractEndGr >= currentMonthEnd) ? x.CheckoutLeftIds : new List<long>(),
|
|
|
|
|
|
#endregion
|
|
}).ToList();
|
|
var result = workshopsList.Select(x => new ActiveWorkshops
|
|
{
|
|
Id = x.Id,
|
|
CheckoutLeftWorkCount = x.CheckoutLeftIds.Count,
|
|
WorkshopFullName = x.WorkshopFullName,
|
|
ArchiveCode = x.ArchiveCode,
|
|
CheckoutDoneCount = x.CheckoutLeftIds.Count > 0 ? _context.CheckoutSet.Where(ch => ch.WorkshopId == x.Id).Where(ct => x.CheckoutLeftIds.Contains(ct.EmployeeId))
|
|
.Count(ch =>
|
|
ch.ContractStart >= currentMonthStart && ch.ContractStart < currentMonthEnd &&
|
|
ch.IsActiveString == "true") : 0,
|
|
}).Where(x => x.CheckoutLeftWorkCount > 0).ToList();
|
|
|
|
var workshopList = result.Where(x => ((x.CheckoutDoneCount * 100) / x.CheckoutLeftWorkCount) < 100)
|
|
.Select(x => new workshopSearch()
|
|
{
|
|
Id = x.Id,
|
|
WorkshopFullName = x.WorkshopFullName,
|
|
ArchiveCode = x.ArchiveCode,
|
|
CheckoutDonePercent = ((x.CheckoutDoneCount * 100) / x.CheckoutLeftWorkCount),
|
|
EmployeeNotDones = _context.LeftWorkList.Where(l => l.WorkshopId == x.Id).Select(l => new LeftWorkViewModel()
|
|
{
|
|
Id = l.id,
|
|
EmployeeId = l.EmployeeId,
|
|
EmployeeFullName = l.EmployeeFullName,
|
|
StartWorkDateGr = l.StartWorkDate,
|
|
LeftWorkDateGr = l.LeftWorkDate.AddDays(-1),
|
|
}).Where(l => (l.StartWorkDateGr <= currentMonthStart && l.LeftWorkDateGr > currentMonthStart) ||
|
|
(l.StartWorkDateGr <= currentMonthEnd && l.LeftWorkDateGr >= currentMonthEnd) ||
|
|
(l.StartWorkDateGr >= currentMonthStart && l.StartWorkDateGr <= currentMonthEnd) ||
|
|
(l.LeftWorkDateGr >= currentMonthStart && l.LeftWorkDateGr <= currentMonthEnd))
|
|
.Where(l => !_context.CheckoutSet
|
|
.Where(ch => ch.WorkshopId == x.Id && ch.ContractStart >= currentMonthStart && ch.ContractStart < currentMonthEnd && ch.IsActiveString == "true")
|
|
.Any(ch => ch.EmployeeId == l.EmployeeId))
|
|
.Select(l => new EmployeeNotDone
|
|
{
|
|
Id = l.EmployeeId,
|
|
EmployeeFullName = l.EmployeeFullName,
|
|
}).ToList()
|
|
}).OrderBy(x => x.CheckoutDonePercent).ToList();
|
|
|
|
var finalResult = new PrintAllContractCheckout()
|
|
{
|
|
AccountId = accountId,
|
|
AccountFullName = _accountContext.Accounts.FirstOrDefault(x => x.id == accountId)?.Fullname,
|
|
Year = year,
|
|
Month = month.ToFarsiMonthByNumber(),
|
|
ReportType = "تنظیم تصفیه حساب",
|
|
WorkshopSearches = workshopList,
|
|
};
|
|
Console.WriteLine("ajax >>>>>: " + watch.Elapsed);
|
|
return finalResult;
|
|
}
|
|
|
|
public PrintAllContractCheckout GetPrintAllCheckoutSignDone(string year, string month, long accountId)
|
|
{
|
|
var watch = System.Diagnostics.Stopwatch.StartNew();
|
|
string nowFa = "";
|
|
if (!string.IsNullOrWhiteSpace(year) && !string.IsNullOrWhiteSpace(month))
|
|
{
|
|
nowFa = $"{year}/{month}/01";
|
|
}
|
|
else
|
|
{
|
|
nowFa = $"{(DateTime.Now.ToFarsi()).Substring(0, 8)}01";
|
|
}
|
|
|
|
var currentEndOfMonth = nowFa.FindeEndOfMonth();
|
|
|
|
var currentMonthStart = nowFa.ToGeorgianDateTime();
|
|
var currentMonthEnd = currentEndOfMonth.ToGeorgianDateTime();
|
|
int currentYear = Convert.ToInt32(nowFa.Substring(0, 4));
|
|
var currentMonth = Convert.ToInt32(nowFa.Substring(5, 2));
|
|
var nextMonthStartFa = new PersianDateTime(currentYear, currentMonth, 1).AddMonths(1);
|
|
var nextMonthStart = ($"{nextMonthStartFa}").ToGeorgianDateTime();
|
|
var nextMonthEnd = (($"{nextMonthStartFa}").FindeEndOfMonth()).ToGeorgianDateTime();
|
|
|
|
|
|
//var instititionContracts = _context.InstitutionContractSet.Where(x => x.IsActiveString == "true").Select(x => x.ContractingPartyId).ToList();
|
|
var blockContractingPartyIds = _context.PersonalContractingParties.Where(x => x.IsBlock == "false" && x.IsActiveString == "true").Select(x => x.id).ToList();
|
|
//blockContractingPartyIds = blockContractingPartyIds.Where(x => instititionContracts.Contains(x)).ToList();
|
|
|
|
var workshops = _context.Workshops.Where(x => x.IsActiveString == "true")
|
|
.Include(x => x.WorkshopEmployers)
|
|
.Include(x => x.LeftWorks)
|
|
.Select(x => new ActiveWorkshops
|
|
{
|
|
Id = x.id,
|
|
IsActiveString = x.IsActiveString,
|
|
WorkshopFullName = x.WorkshopFullName,
|
|
ArchiveCode = x.ArchiveCode,
|
|
ContractingPartId = x.WorkshopEmployers.Select(e => e.Employer.ContractingPartyId).FirstOrDefault(),
|
|
AccountIdList = _context.WorkshopAccounts.Where(m => m.WorkshopId == x.id).Select(a => a.AccountId).ToList(),
|
|
|
|
#region Checkouts
|
|
|
|
//CheckoutLeft befor This Month
|
|
CheckoutLeftIds = x.LeftWorks.Select(l => new LeftWorkViewModel()
|
|
{
|
|
EmployeeId = l.EmployeeId,
|
|
StartWorkDateGr = l.StartWorkDate,
|
|
LeftWorkDateGr = l.LeftWorkDate.AddDays(-1),
|
|
|
|
}).Where(l =>
|
|
(l.StartWorkDateGr <= currentMonthStart && l.LeftWorkDateGr > currentMonthStart) ||
|
|
(l.StartWorkDateGr <= currentMonthEnd && l.LeftWorkDateGr >= currentMonthEnd) ||
|
|
(l.StartWorkDateGr >= currentMonthStart && l.StartWorkDateGr <= currentMonthEnd) ||
|
|
(l.LeftWorkDateGr >= currentMonthStart && l.LeftWorkDateGr <= currentMonthEnd)).Select(l => l.EmployeeId).ToList(),
|
|
|
|
#endregion
|
|
|
|
}).Where(e => blockContractingPartyIds.Contains(e.ContractingPartId))
|
|
.Where(a => a.AccountIdList.Contains(accountId)).AsSplitQuery();
|
|
var workshopsList = workshops.Select(x => new ActiveWorkshops
|
|
{
|
|
Id = x.Id,
|
|
IsActiveString = x.IsActiveString,
|
|
WorkshopFullName = x.WorkshopFullName,
|
|
ArchiveCode = x.ArchiveCode,
|
|
ContractingPartId = x.ContractingPartId,
|
|
AccountIdList = x.AccountIdList,
|
|
|
|
|
|
#region Checkouts
|
|
|
|
////CheckoutLeft befor This Month
|
|
CheckoutLeftIds = _context.InstitutionContractSet.Any(c => c.ContractingPartyId == x.ContractingPartId && c.ContractStartGr <= currentMonthStart && c.ContractEndGr >= currentMonthEnd) ? x.CheckoutLeftIds : new List<long>(),
|
|
|
|
|
|
#endregion
|
|
}).ToList();
|
|
var result = workshopsList.Select(x => new ActiveWorkshops
|
|
{
|
|
Id = x.Id,
|
|
CheckoutLeftWorkCount = x.CheckoutLeftIds.Count,
|
|
|
|
WorkshopFullName = x.WorkshopFullName,
|
|
ArchiveCode = x.ArchiveCode,
|
|
CheckoutDoneCount = x.CheckoutLeftIds.Count > 0 ? _context.CheckoutSet.Where(ch => ch.WorkshopId == x.Id).Where(ct => x.CheckoutLeftIds.Contains(ct.EmployeeId))
|
|
.Count(ch =>
|
|
ch.ContractStart >= currentMonthStart && ch.ContractStart < currentMonthEnd &&
|
|
ch.IsActiveString == "true") : 0,
|
|
CheckoutSignDoneCount = x.CheckoutLeftIds.Count > 0 ? _context.CheckoutSet.Where(ch => ch.WorkshopId == x.Id && ch.Signature == "1").Where(ct => x.CheckoutLeftIds.Contains(ct.EmployeeId))
|
|
.Count(ch =>
|
|
ch.ContractStart >= currentMonthStart && ch.ContractStart < currentMonthEnd &&
|
|
ch.IsActiveString == "true") : 0,
|
|
|
|
}).Where(x => x.CheckoutDoneCount > 0).ToList();
|
|
|
|
var workshopList = result.Where(x => ((x.CheckoutSignDoneCount * 100) / x.CheckoutDoneCount) < 100)
|
|
.Select(x => new workshopSearch()
|
|
{
|
|
Id = x.Id,
|
|
WorkshopFullName = x.WorkshopFullName,
|
|
ArchiveCode = x.ArchiveCode,
|
|
CheckoutSignPercent = ((x.CheckoutSignDoneCount * 100) / x.CheckoutDoneCount),
|
|
EmployeeNotDones = _context.LeftWorkList.Where(l => l.WorkshopId == x.Id).Select(l => new LeftWorkViewModel()
|
|
{
|
|
Id = l.id,
|
|
EmployeeId = l.EmployeeId,
|
|
EmployeeFullName = l.EmployeeFullName,
|
|
StartWorkDateGr = l.StartWorkDate,
|
|
LeftWorkDateGr = l.LeftWorkDate.AddDays(-1),
|
|
}).Where(l => (l.StartWorkDateGr <= currentMonthStart && l.LeftWorkDateGr > currentMonthStart) ||
|
|
(l.StartWorkDateGr <= currentMonthEnd && l.LeftWorkDateGr >= currentMonthEnd) ||
|
|
(l.StartWorkDateGr >= currentMonthStart && l.StartWorkDateGr <= currentMonthEnd) ||
|
|
(l.LeftWorkDateGr >= currentMonthStart && l.LeftWorkDateGr <= currentMonthEnd))
|
|
.Where(l => !_context.CheckoutSet.Where(ch => ch.WorkshopId == x.Id &&
|
|
ch.ContractStart >= currentMonthStart && ch.ContractStart < currentMonthEnd && ch.Signature == "1" &&
|
|
ch.IsActiveString == "true")
|
|
.Any(ch => ch.EmployeeId == l.EmployeeId))
|
|
.Select(l => new EmployeeNotDone
|
|
{
|
|
Id = l.EmployeeId,
|
|
EmployeeFullName = l.EmployeeFullName,
|
|
}).ToList()
|
|
}).OrderBy(x => x.CheckoutSignPercent).ToList();
|
|
|
|
var finalResult = new PrintAllContractCheckout()
|
|
{
|
|
AccountId = accountId,
|
|
AccountFullName = _accountContext.Accounts.FirstOrDefault(x => x.id == accountId)?.Fullname,
|
|
Year = year,
|
|
Month = month.ToFarsiMonthByNumber(),
|
|
ReportType = "امضاء تصفیه حساب",
|
|
WorkshopSearches = workshopList,
|
|
};
|
|
Console.WriteLine("ajax >>>>>: " + watch.Elapsed);
|
|
return finalResult;
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
|