private void ButtonAdd_Click(object sender, RoutedEventArgs e) { if (workingDayFrom.SelectedItem == null || workingDayTo.SelectedItem == null || AvailableDate.SelectedItem == null) { MessageBox.Show("You cannot leave any empty combobox!"); return; } ClassCalendar calendar = GetCalendarForCurrentDate(); int dayId = ClassSqlCalendar.GetDayIdForCalendarDate(calendar.CalendarId, ((ClassCalendarDay)AvailableDate.SelectedItem).DateInDateTime.Day); ClassSqlCalendar.CreateTerm((TimeSpan)workingDayFrom.SelectedItem, (TimeSpan)workingDayTo.SelectedItem, ClassSqlCalendar.GetCalendarIdForDoctor(ClassLoggedDoctor.Doctor_Id, calendar.CalendarId), dayId, ClassSQLConnections.GetOfficeIdForDoctor(ClassLoggedDoctor.Doctor_Id), ClassLoggedDoctor.Doctor_Id, ((ClassCalendarDay)AvailableDate.SelectedItem).Date); this.DialogResult = true; this.Close(); }
private void Button_AcceptCalendarClick(object sender, RoutedEventArgs e) { ClassCalendar calendar = GetCalendarForSelectedCalendarInComboboxFromDataBase(); foreach (ClassCalendarDay day in days) { if (day.IsWorkingDay == true) { int dayId = ClassSqlCalendar.GetDayIdForCalendarDate(calendar.CalendarId, day.DateInDateTime.Day); ClassSqlCalendar.CreateTerm(day.StartTime, day.EndTime, ClassSqlCalendar.GetCalendarIdForDoctor(ClassLoggedDoctor.Doctor_Id, calendar.CalendarId), dayId, ClassSQLConnections.GetOfficeIdForDoctor(ClassLoggedDoctor.Doctor_Id), ClassLoggedDoctor.Doctor_Id, day.Date); } } ClassSqlCalendar.UpdateCalendarStatus(ClassSqlCalendar.SelectStatusId(EnumStatus.AcceptedByTheDoctor), calendar.CalendarId); NavigationService.Navigate(new WindowDoctorNewCalendarEmpty()); }