change CWS for kebab mahdi
This commit is contained in:
@@ -46,22 +46,24 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
|
||||
private readonly ILeftWorkRepository _leftWorkRepository;
|
||||
private readonly ILeaveRepository _leaveRepository;
|
||||
private readonly IHolidayItemRepository _holidayItemRepository;
|
||||
private readonly TestDbContext _testDbContext;
|
||||
|
||||
|
||||
public RollCallMandatoryRepository(CompanyContext context, IYearlySalaryRepository yearlySalaryRepository,
|
||||
ILeftWorkRepository leftWorkRepository, ILeaveRepository leaveRepository, IHolidayItemRepository holidayItemRepository) : base(context)
|
||||
ILeftWorkRepository leftWorkRepository, ILeaveRepository leaveRepository, IHolidayItemRepository holidayItemRepository, TestDbContext testDbContext) : base(context)
|
||||
{
|
||||
_context = context;
|
||||
_yearlySalaryRepository = yearlySalaryRepository;
|
||||
_leftWorkRepository = leftWorkRepository;
|
||||
_leaveRepository = leaveRepository;
|
||||
_holidayItemRepository = holidayItemRepository;
|
||||
_testDbContext = testDbContext;
|
||||
}
|
||||
|
||||
#region OfficialChckout
|
||||
public ComputingViewModel MandatoryCompute(long employeeId, long workshopId, DateTime contractStart,
|
||||
DateTime contractEnd,
|
||||
CreateWorkingHoursTemp command, bool holidayWorking,bool isStaticCheckout)
|
||||
CreateWorkingHoursTemp command, bool holidayWorking, bool isStaticCheckout)
|
||||
{
|
||||
#region Entities
|
||||
|
||||
@@ -1687,8 +1689,8 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
|
||||
command.SingleShift1Shanbe1,
|
||||
command.SingleShift2Shanbe1,
|
||||
command.TowShifts1Shanbe1,
|
||||
command.TowShifts2Shanbe1, currntDateGr, rest0w1,leaveSearchResult);
|
||||
if (res.Count> 0)
|
||||
command.TowShifts2Shanbe1, currntDateGr, rest0w1, leaveSearchResult);
|
||||
if (res.Count > 0)
|
||||
rollCallList.AddRange(res);
|
||||
|
||||
}
|
||||
@@ -2018,7 +2020,7 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
|
||||
LeaveType = x.LeaveType,
|
||||
PaidLeaveType = x.PaidLeaveType,
|
||||
StartLeaveGr = x.StartLeaveGr,
|
||||
EndLeaveGr = x.PaidLeaveType == "روزانه" ? new DateTime(x.EndLeaveGr.Year, x.EndLeaveGr.Month, x.EndLeaveGr.Day, 23,59,59) : x.EndLeaveGr,
|
||||
EndLeaveGr = x.PaidLeaveType == "روزانه" ? new DateTime(x.EndLeaveGr.Year, x.EndLeaveGr.Month, x.EndLeaveGr.Day, 23, 59, 59) : x.EndLeaveGr,
|
||||
}).ToList();
|
||||
}
|
||||
|
||||
@@ -2038,7 +2040,7 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
|
||||
|
||||
|
||||
|
||||
shift1StartGr = new DateTime(cuurentDate.Year, cuurentDate.Month, cuurentDate.Day, starTimeSingel1.Hour, starTimeSingel1.Minute,0);
|
||||
shift1StartGr = new DateTime(cuurentDate.Year, cuurentDate.Month, cuurentDate.Day, starTimeSingel1.Hour, starTimeSingel1.Minute, 0);
|
||||
shift1EndGr = new DateTime(cuurentDate.Year, cuurentDate.Month, cuurentDate.Day, endTimeSingel2.Hour, endTimeSingel2.Minute, 0);
|
||||
|
||||
if (shift1EndGr.TimeOfDay < shift1StartGr.TimeOfDay)
|
||||
@@ -2051,7 +2053,7 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
|
||||
shiftSpan = (shift1EndGr - shift1StartGr);
|
||||
}
|
||||
|
||||
if (!leaveSearchResult.Any(x => x.StartLeaveGr < shift1EndGr && x.EndLeaveGr > shift1StartGr && x.PaidLeaveType =="روزانه"))
|
||||
if (!leaveSearchResult.Any(x => x.StartLeaveGr < shift1EndGr && x.EndLeaveGr > shift1StartGr && x.PaidLeaveType == "روزانه"))
|
||||
{
|
||||
var hourseLeaveTypeResult = leaveSearchResult.FirstOrDefault(x =>
|
||||
x.StartLeaveGr < shift1EndGr && x.EndLeaveGr > shift1StartGr && x.PaidLeaveType == "ساعتی");
|
||||
@@ -2142,14 +2144,14 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
|
||||
|
||||
//اگر شیفت 1 وجود داشت تاریخ جاری را از شیف 1 میگیریم
|
||||
//زیرا ممکن پایان شیف 1 در روز بعد باشد
|
||||
var shift1 = result.MaxBy(x=>x.EndDate);
|
||||
var shift1 = result.MaxBy(x => x.EndDate);
|
||||
if (shift1 != null)
|
||||
if (shift1.EndDate != null)
|
||||
cuurentDate = shift1.EndDate.Value;
|
||||
|
||||
|
||||
shift2StartGr = new DateTime(cuurentDate.Year, cuurentDate.Month, cuurentDate.Day, startTimeTowSh1.Hour, startTimeTowSh1.Minute,0);
|
||||
shift2EndGr = new DateTime(cuurentDate.Year, cuurentDate.Month, cuurentDate.Day, endTimeTowSh2.Hour, endTimeTowSh2.Minute,0);
|
||||
shift2StartGr = new DateTime(cuurentDate.Year, cuurentDate.Month, cuurentDate.Day, startTimeTowSh1.Hour, startTimeTowSh1.Minute, 0);
|
||||
shift2EndGr = new DateTime(cuurentDate.Year, cuurentDate.Month, cuurentDate.Day, endTimeTowSh2.Hour, endTimeTowSh2.Minute, 0);
|
||||
|
||||
if (shift2EndGr.TimeOfDay < shift2StartGr.TimeOfDay)
|
||||
shift2EndGr = shift2EndGr.AddDays(1);
|
||||
@@ -2942,11 +2944,30 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
|
||||
|
||||
#region CustomizeSettings
|
||||
|
||||
CustomizeWorkshopEmployeeSettings customizeWorkshopEmployeeSettings = _context.CustomizeWorkshopEmployeeSettings
|
||||
CustomizeWorkshopEmployeeSettings customizeWorkshopEmployeeSettings;
|
||||
CustomizeWorkshopSettings customizeWorkshopSettings;
|
||||
|
||||
|
||||
var endFarvarding = new DateTime(2025, 4, 20);
|
||||
if (contractStart>endFarvarding)
|
||||
{
|
||||
customizeWorkshopEmployeeSettings=_context.CustomizeWorkshopEmployeeSettings
|
||||
.AsSplitQuery().AsNoTracking().FirstOrDefault(x =>
|
||||
x.WorkshopId == workshopId && x.EmployeeId == employeeId);
|
||||
CustomizeWorkshopSettings customizeWorkshopSettings =
|
||||
_context.CustomizeWorkshopSettings.AsNoTracking().FirstOrDefault(x => x.WorkshopId == workshopId);
|
||||
|
||||
customizeWorkshopSettings =_context.CustomizeWorkshopSettings.AsNoTracking().FirstOrDefault(x => x.WorkshopId == workshopId);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
customizeWorkshopEmployeeSettings = _testDbContext.CustomizeWorkshopEmployeeSettings
|
||||
.AsSplitQuery().AsNoTracking().FirstOrDefault(x =>
|
||||
x.WorkshopId == workshopId && x.EmployeeId == employeeId);
|
||||
|
||||
customizeWorkshopSettings = _testDbContext.CustomizeWorkshopSettings.AsNoTracking().FirstOrDefault(x => x.WorkshopId == workshopId);
|
||||
|
||||
}
|
||||
|
||||
//ToDo handel exception if is null
|
||||
monthySalary = customizeWorkshopEmployeeSettings?.Salary ?? 0;
|
||||
monthDays = customizeWorkshopSettings.MaxMonthDays == MaxMonthDays.ThirtyDaysForAllMonth
|
||||
@@ -3774,10 +3795,28 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
|
||||
{
|
||||
var firstDayOfMonth = $"{(contractStart.ToFarsi())[..8]}/01".ToGeorgianDateTime();
|
||||
|
||||
CustomizeWorkshopEmployeeSettings customizeWorkshopEmployeeSettings = _context.CustomizeWorkshopEmployeeSettings.AsSplitQuery().FirstOrDefault(x =>
|
||||
CustomizeWorkshopEmployeeSettings customizeWorkshopEmployeeSettings;
|
||||
CustomizeWorkshopSettings customizeWorkshopSettings;
|
||||
|
||||
var endFarvarding = new DateTime(2025, 4, 20);
|
||||
if (contractStart > endFarvarding)
|
||||
{
|
||||
customizeWorkshopEmployeeSettings = _context.CustomizeWorkshopEmployeeSettings
|
||||
.AsSplitQuery().AsNoTracking().FirstOrDefault(x =>
|
||||
x.WorkshopId == workshopId && x.EmployeeId == employeeId);
|
||||
CustomizeWorkshopSettings customizeWorkshopSettings =
|
||||
_context.CustomizeWorkshopSettings.FirstOrDefault(x => x.WorkshopId == workshopId);
|
||||
|
||||
customizeWorkshopSettings = _context.CustomizeWorkshopSettings.AsNoTracking().FirstOrDefault(x => x.WorkshopId == workshopId);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
customizeWorkshopEmployeeSettings = _testDbContext.CustomizeWorkshopEmployeeSettings
|
||||
.AsSplitQuery().AsNoTracking().FirstOrDefault(x =>
|
||||
x.WorkshopId == workshopId && x.EmployeeId == employeeId);
|
||||
|
||||
customizeWorkshopSettings = _testDbContext.CustomizeWorkshopSettings.AsNoTracking().FirstOrDefault(x => x.WorkshopId == workshopId);
|
||||
|
||||
}
|
||||
//ToDo handel exception if is null
|
||||
var monthySalary = customizeWorkshopEmployeeSettings?.Salary ?? 0;
|
||||
var monthDays = customizeWorkshopSettings.MaxMonthDays == MaxMonthDays.ThirtyDaysForAllMonth
|
||||
|
||||
@@ -8,6 +8,9 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Company.Domain.CustomizeWorkshopEmployeeSettingsAgg.Entities;
|
||||
using Company.Domain.CustomizeWorkshopSettingsAgg.Entities;
|
||||
using CompanyManagment.EFCore.Migrations;
|
||||
|
||||
namespace CompanyManagment.EFCore
|
||||
{
|
||||
@@ -15,6 +18,8 @@ namespace CompanyManagment.EFCore
|
||||
{
|
||||
public DbSet<InsuranceJobItem> InsuranceJobItems { get; set; }
|
||||
public DbSet<InsuranceJob> InsuranceJobs { get; set; }
|
||||
public DbSet<CustomizeWorkshopEmployeeSettings> CustomizeWorkshopEmployeeSettings { get; set; }
|
||||
public DbSet<CustomizeWorkshopSettings> CustomizeWorkshopSettings { get; set; }
|
||||
|
||||
public TestDbContext(DbContextOptions<TestDbContext> options) : base(options)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user