private void workingDayFrom_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (workingDayFrom.SelectedItem != null) { lastSelectedTerm.StartTime = (TimeSpan)workingDayFrom.SelectedItem; ListOfTerms.RemoveAt(CurrentMonthDataGrid.SelectedIndex); ListOfTerms.Insert(CurrentMonthDataGrid.SelectedIndex, lastSelectedTerm); RefreshDataGrid(); if (workingDayFrom.SelectedIndex == workingDayFrom.Items.Count - 1) { workingDayTo.ItemsSource = ClassHelpers.GenerateListOfHours((TimeSpan)workingDayFrom.Items[workingDayFrom.SelectedIndex], ListOfOriginalDays()[lastSelectedIndex].EndTime); } else { workingDayTo.ItemsSource = ClassHelpers.GenerateListOfHours((TimeSpan)workingDayFrom.Items[workingDayFrom.SelectedIndex + 1], ListOfOriginalDays()[lastSelectedIndex].EndTime); } if ((TimeSpan)workingDayFrom.SelectedItem > lastSelectedTerm.EndTime) { workingDayTo.ItemsSource = ClassHelpers.GenerateListOfHours((TimeSpan)workingDayFrom.Items[workingDayFrom.SelectedIndex + 1], ListOfOriginalDays()[lastSelectedIndex].EndTime); workingDayTo.SelectedIndex = 0; } ClassSqlCalendar.UpdateTerm(lastSelectedTerm.TermId, lastSelectedTerm.StartTime, lastSelectedTerm.EndTime); } }
private void workingDayTo_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (workingDayTo.SelectedItem != null) { lastSelectedTerm.EndTime = (TimeSpan)workingDayTo.SelectedItem; ListOfTerms.RemoveAt(CurrentMonthDataGrid.SelectedIndex); ListOfTerms.Insert(CurrentMonthDataGrid.SelectedIndex, lastSelectedTerm); RefreshDataGrid(); } ClassSqlCalendar.UpdateTerm(lastSelectedTerm.TermId, lastSelectedTerm.StartTime, lastSelectedTerm.EndTime); }
private void availableDates_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (availableDates.SelectedItem != null) { ClassTerm term = (ClassTerm)CurrentMonthDataGrid.SelectedItem; RefreshLastSelectedItems(term); ClassSqlCalendar.UpdateTerm(((ClassCalendarDay)availableDates.SelectedItem).CalendarDayId, ((ClassCalendarDay)availableDates.SelectedItem).Date, lastSelectedTerm.TermId); CurrentMonthDataGrid.ItemsSource = ClassSqlCalendar.GetListOfWorkingDayInCurrentMonth(ClassLoggedDoctor.Doctor_Id); CurrentMonthDataGrid.SelectedIndex = lastSelectedIndex; checkBoxChangeDay.IsChecked = false; } }