public void GetAllWeek() { var max = ScheduleItemList.Select(m => m.EndWeek).OrderByDescending(m => m).FirstOrDefault(); AllWeek = max; var list = new ObservableCollection <int>(); for (int i = 1; i <= max; i++) { list.Add(i); } Weeks = list; }
private static ScheduleItemList ConvertReaderDataToScheduleItemList(SqlDataReader reader) { ScheduleItemList schedules = null; if (reader.HasRows) { schedules = new ScheduleItemList(); while (reader.Read()) { schedules.Add(new ScheduleItem(reader.GetValueOrDefault<int>("ID"), reader.GetValueOrDefault<int>("ProjectID"), reader.GetValueOrDefault<int>("EmployeeID"), reader.GetValueOrDefault<int>("WeekID"), reader.GetValueOrDefault<decimal>("Hours"))); } } return schedules; }