private void downloadDatabaseEntries() { DateTime monthEndDay = MonthFirstDay.AddMonths(1); monthEndDay = monthEndDay.AddDays(-1); List <ServiceSheetViewModel> downloadedServiceSheets = DbServiceSheet.downloadServiceSheets(MonthFirstDay, monthEndDay); if (downloadedServiceSheets == null) { return; } //Create the list of possible days for each engineer Dictionary <DateTime, List <DbEmployee> > missingDays = createPossibleEngineerDaysCalendar(); Dictionary <DateTime, List <DbEmployee> > actualDays = new Dictionary <DateTime, List <DbEmployee> >(); if (missingDays == null) { return; } //Copy the possible days to the missing. //Dictionary<DateTime, List<DbEmployee>> missingDays = new Dictionary<DateTime, List<DbEmployee>>(possibleDays); //Create actual days list and update missing list updateActualandMissingCalendars(actualDays, missingDays, downloadedServiceSheets); //Set the actual and missing calendar days on the calendar rows updateCalendarActualAndMissingDates(actualDays, missingDays); }
private void calculateRowOneStartDate() { //MonthFirstDay = DateTime.Now; int dayNumber = MonthFirstDay.Day; MonthFirstDay = MonthFirstDay.AddDays(-dayNumber + 1); int startOfMonthDay = (int)MonthFirstDay.DayOfWeek; if (startOfMonthDay == 0) { RowOneStartDate = MonthFirstDay.AddDays(-6); } else { RowOneStartDate = MonthFirstDay.AddDays(-startOfMonthDay + 1); } }