private void CrossMonthSandwichDeductionForPreviousMonth()
var LeaveImmediateBeforeHoliday = from Main in dcCrossMonthAttendance
join Previous in dcCrossMonthAttendance on 1 equals 1
join Next in dcCrossMonthAttendance on 1 equals 1
( (Main.Key) - 1 == Previous.Key && Previous.Value.dayValue.IsConsiderAsHolidayForSandwich() )
( (Main.Key) + 1 == Next.Key && Next.Value.dayValue.IsConsiderAsHolidayForSandwich() )
(Main.Value.dayValue.IsLeave() || Main.Value.dayValue.IsAbsent())
!Main.Value.dayValue.IsConsiderAsHolidayForSandwich()
Main.Key.IsEqualOrGreaterThanJoinDate(this.StartDateOfReportMonth, this.Employee.joinDate, Main.Value.IsPreviousMonth ? ExtensionMethod.EnumReportMonth.PreviousMonth : ExtensionMethod.EnumReportMonth.CurrentMont)
select new { key = Main.Key, Value = Main.Value, NexKey = Next.Key, NexVal = Next.Value, PreKey = Previous.Key, PreVal = Previous.Value
var LeaveImmediateBeforeHolidayWithIndex = LeaveImmediateBeforeHoliday.Select((val, i) => new { Index = i, key = val.key, Value = val.Value, NexKey = val.key, NexVal = val.Value, PreKey = val.key, PreVal = val.Value });
from Pre in LeaveImmediateBeforeHolidayWithIndex
join Nex in LeaveImmediateBeforeHolidayWithIndex on Pre.Index + 1 equals Nex.Index
select new { PriviousDayIndex = Pre.Index, PriviousDayKey = Pre.key, PriviousDayValue = Pre.Value, NextDayIndex = Nex.Index, NextDayKey = Nex.key, NextDayIValue = Nex.Value };
foreach (var day in LeaveDayPair)
var calculatedsandwich = dcCrossMonthAttendance.Count(x => x.Key > day.PriviousDayKey && x.Key < day.NextDayKey && x.Value.dayValue.IsConsiderAsHolidayForSandwich() && !dcCrossMonthAttendance.Any(y => (!y.Value.dayValue.IsConsiderAsHolidayForSandwich()) && y.Key > day.PriviousDayKey && y.Key < day.NextDayKey)
&& ( (day.PriviousDayValue.IsPreviousMonth == true && day.NextDayIValue.IsPreviousMonth == false) || (day.PriviousDayValue.IsPreviousMonth == false && day.NextDayIValue.IsPreviousMonth == true)));
if (calculatedsandwich > 0)
sandwichCount = sandwichCount + calculatedsandwich;
this.SDL = this.SDL + sandwichCount;