ConvertStatic ADD 12-24
This commit is contained in:
@@ -18,7 +18,7 @@ public interface IRollCallMandatoryRepository : IRepository<long, RollCall>
|
||||
|
||||
List<RotatingShiftViewModel> RotatingShiftCheck(List<GroupedRollCalls> rollCallList);
|
||||
|
||||
List<RollCallViewModel> ConvertStaticHouresToRollCall(CreateWorkingHoursTemp command, bool workshopHolidyWorking);
|
||||
List<RollCallViewModel> ConvertStaticHourseToRollCall(CreateWorkingHoursTemp command, bool workshopHolidyWorking);
|
||||
CustomizeCheckoutMandatoryViewModel CustomizeCheckoutMandatoryCompute(long employeeId, long workshopId, DateTime contractStart, DateTime contractEnd);
|
||||
|
||||
List<LateToWorkEarlyExistSpannig> LateToWorkEarlyExit(List<GroupedRollCalls> groupedRollCall,
|
||||
|
||||
@@ -114,7 +114,7 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
|
||||
command.EmployeeId = employeeId;
|
||||
command.ContractStartGr = contractStart;
|
||||
command.ContractEndGr = contractEnd;
|
||||
rollCallResult = ConvertStaticHouresToRollCall(command, holidayWorking);
|
||||
rollCallResult = ConvertStaticHourseToRollCall(command, holidayWorking);
|
||||
groupedRollCall = rollCallResult.GroupBy(x => x.ShiftDate.Date).Select(x => new GroupedRollCalls()
|
||||
{
|
||||
CreationDate = x.Key,
|
||||
@@ -1237,7 +1237,7 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
|
||||
}
|
||||
|
||||
|
||||
public List<RollCallViewModel> ConvertStaticHouresToRollCall(CreateWorkingHoursTemp command, bool workshopHolidyWorking)
|
||||
public List<RollCallViewModel> ConvertStaticHourseToRollCall(CreateWorkingHoursTemp command, bool workshopHolidyWorking)
|
||||
{
|
||||
var rollCallList = new List<RollCallViewModel>();
|
||||
#region Entities
|
||||
@@ -1255,6 +1255,20 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
|
||||
var d1 = new PersianDateTime(syear, smonth, sday);
|
||||
var d2 = new PersianDateTime(eyear, emonth, eday);
|
||||
|
||||
//بدست آوردن مرخصی
|
||||
LeaveSearchModel leaveSearch = new LeaveSearchModel()
|
||||
{
|
||||
EmployeeId = command.EmployeeId,
|
||||
WorkshopId = command.WorkshopId,
|
||||
|
||||
StartLeaveGr = command.ContractStartGr,
|
||||
EndLeaveGr = command.ContractEndGr,
|
||||
IsAccepted = true,
|
||||
};
|
||||
var leaveSearchResult = _leaveRepository.search(leaveSearch);
|
||||
//بدس آوردن تعطیلات رسمی
|
||||
var holidayList = _holidayItemRepository.GetHolidayItem(sdate.Substring(0, 4));
|
||||
bool isHoliday = false;
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -1430,23 +1444,64 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region 12-24
|
||||
|
||||
if (command.ShiftWork == "5") //12-24
|
||||
{
|
||||
var start = Convert.ToDateTime(command.StartComplex);
|
||||
var end = Convert.ToDateTime(command.EndComplex);
|
||||
|
||||
var startDateAndTime = new PersianDateTime(syear, smonth, sday, start.Hour, start.Minute);
|
||||
var startContract = new PersianDateTime(syear, smonth, sday, start.Hour, start.Minute);
|
||||
var endContract = new PersianDateTime(eyear, emonth, eday, 23, 59);
|
||||
for (var da = startDateAndTime; da <= endContract; da = da.AddHours(36))
|
||||
{
|
||||
|
||||
if (end.TimeOfDay < start.TimeOfDay)
|
||||
end = end.AddDays(1);
|
||||
var currentDateFa = $"{da}";
|
||||
|
||||
string startComplex = start.ToString("HH:mm");
|
||||
string endComplex = end.ToString("HH:mm");
|
||||
DateTime currntDateGr = currentDateFa.ToGeorgianDateTime();
|
||||
if (da == startContract)
|
||||
{
|
||||
var res = FindStaticShiftsStatus(
|
||||
startComplex,
|
||||
endComplex,
|
||||
null,
|
||||
null, currntDateGr, TimeSpan.Zero, leaveSearchResult);
|
||||
if (res.Count > 0)
|
||||
rollCallList.AddRange(res);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
var res = FindStaticShiftsStatus(
|
||||
startComplex,
|
||||
endComplex,
|
||||
null,
|
||||
null, currntDateGr, TimeSpan.Zero, leaveSearchResult);
|
||||
if (res.Count > 0)
|
||||
rollCallList.AddRange(res);
|
||||
}
|
||||
|
||||
var endCal = end - start;
|
||||
var nextStart = start.AddHours(36);
|
||||
end = nextStart.Add(endCal);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
//بدست آوردن مرخصی
|
||||
LeaveSearchModel leaveSearch = new LeaveSearchModel()
|
||||
{
|
||||
EmployeeId = command.EmployeeId,
|
||||
WorkshopId = command.WorkshopId,
|
||||
|
||||
StartLeaveGr = command.ContractStartGr,
|
||||
EndLeaveGr = command.ContractEndGr,
|
||||
IsAccepted = true,
|
||||
};
|
||||
var leaveSearchResult = _leaveRepository.search(leaveSearch);
|
||||
//بدس آوردن تعطیلات رسمی
|
||||
var holidayList = _holidayItemRepository.GetHolidayItem(sdate.Substring(0, 4));
|
||||
bool isHoliday = false;
|
||||
|
||||
#region ShiftWork4Compute
|
||||
|
||||
@@ -1465,10 +1520,10 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
|
||||
var w6 = 0;
|
||||
var currentDateFa = $"{da}";
|
||||
DateTime currntDateGr = currentDateFa.ToGeorgianDateTime();
|
||||
//if (!workshopHolidyWorking)
|
||||
//{
|
||||
// isHoliday = holidayList.Any(x => x == currentDateFa);
|
||||
//}
|
||||
if (!workshopHolidyWorking)
|
||||
{
|
||||
isHoliday = holidayList.Any(x => x == currentDateFa);
|
||||
}
|
||||
switch (FirstDayOfMonth.DayOfWeek)
|
||||
{
|
||||
case "شنبه":
|
||||
|
||||
Reference in New Issue
Block a user