Exemplo n.º 1
0
        private void OverlappingCalendar()
        {
            ClassCalendar calendar = GetCalendarForSelectedCalendarInComboboxFromDataBase();
            List <ClassOverlappingCalendar> list = sql.OverlappingTerms(calendar.CalendarId);

            if (list.Count != 0)
            {
                //Need changes in offices
                WindowOverlapping windowOverlapping = new WindowOverlapping(list, calendar.CalendarId);
                bool update = (bool)windowOverlapping.ShowDialog();
                if (!update)
                {
                    return;
                }
                foreach (var item in list)
                {
                    if (item.NewOfficeNumber == 0)
                    {
                        continue;
                    }
                    sql.UpdateOffice(item.TermId, item.NewOfficeId);
                }
                return;
            }
            //Calendar verified
            sql.UpdateCalendarStatus(4, calendar.CalendarId);
            MessageBox.Show("Succesfully veryfied", "Succes");
            ComboBoxPickDate.ItemsSource = sql.CalendarList();
            if (ComboBoxPickDate.Items.Count == 0)
            {
                return;
            }
            ComboBoxPickDate.SelectedIndex = ComboBoxPickDate.Items.Count - 1;
            return;
        }
        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());
        }