public TimeSlotRow(TimeSlotCell s1, TimeSlotCell s2, TimeSlotCell s3, TimeSlotCell s4) { tsC1 = s1; tsC2 = s2; tsC3 = s3; tsC4 = s4; }
/// <summary> /// Show the time slots in the DataGrid /// </summary> /// <param name="date"></param> public void ShowTimeSlotInDataGrid(DateTime date) { _log.Notice("Inside ShowTimeSlotInDataGrid"); TimeSlotRowInDataGrid.Clear(); //CurrentDateSelected = date; DayQuota dailyQuota = monthlyQuota[date]; Dictionary <string, float> tsQuotas = dailyQuota.TimeSlotQuota; List <TimeSlotCell[]> listTimeSlots = new List <TimeSlotCell[]>(); TimeSlotCell[] listTimeSlot = new TimeSlotCell[4]; int i = 0; foreach (KeyValuePair <string, float> tsQuota in tsQuotas.OrderBy(key => key.Key)) { string quotaColor; if (tsQuota.Value <= RedQuotaCutoff) { quotaColor = "Red"; } else if (tsQuota.Value >= GreenQuotaCutoff) { quotaColor = "Green"; } else { quotaColor = "Yellow"; } TimeSlotCell cell = new TimeSlotCell(tsQuota.Key, quotaColor); listTimeSlot[i] = cell; if (i == 3) { listTimeSlots.Add(listTimeSlot); listTimeSlot = new TimeSlotCell[4]; i = 0; } else { i++; } } if (listTimeSlot.Length > 0) { listTimeSlots.Add(listTimeSlot); } foreach (TimeSlotCell[] superList in listTimeSlots) { TimeSlotRow timeSlotRow = new TimeSlotRow(superList[0], superList[1], superList[2], superList[3]); if (superList[0] != null) { TimeSlotRowInDataGrid.Add(timeSlotRow); } } }
/// <summary> /// Show the time slots in the DataGrid /// </summary> /// <param name="date"></param> public void ShowTimeSlotInDataGrid(DateTime date) { _log.Notice("Inside ShowTimeSlotInDataGrid"); TimeSlotRowInDataGrid.Clear(); //CurrentDateSelected = date; DayQuota dailyQuota = monthlyQuota[date]; Dictionary<string, float> tsQuotas = dailyQuota.TimeSlotQuota; List<TimeSlotCell[]> listTimeSlots = new List<TimeSlotCell[]>(); TimeSlotCell[] listTimeSlot = new TimeSlotCell[4]; int i = 0; foreach (KeyValuePair<string, float> tsQuota in tsQuotas.OrderBy(key => key.Key)) { string quotaColor; if (tsQuota.Value <= RedQuotaCutoff) { quotaColor = "Red"; } else if (tsQuota.Value >= GreenQuotaCutoff) { quotaColor = "Green"; } else { quotaColor = "Yellow"; } TimeSlotCell cell = new TimeSlotCell(tsQuota.Key, quotaColor); listTimeSlot[i] = cell; if (i == 3) { listTimeSlots.Add(listTimeSlot); listTimeSlot = new TimeSlotCell[4]; i = 0; } else { i++; } } if (listTimeSlot.Length > 0) { listTimeSlots.Add(listTimeSlot); } foreach (TimeSlotCell[] superList in listTimeSlots) { TimeSlotRow timeSlotRow = new TimeSlotRow(superList[0], superList[1], superList[2], superList[3]); if (superList[0] != null) { TimeSlotRowInDataGrid.Add(timeSlotRow); } } }