public WindowDoctorNewCalendar()
        {
            InitializeComponent();

            #region Load calendars to ComboBox
            try
            {
                ComboBoxPickCalendar.ItemsSource = ClassSqlCalendar.AlreadyCreatedCalendarsForDoctor();
                if (ComboBoxPickCalendar.Items.Count == 0)
                {
                    this.Loaded += (a, b) => NavigationService.Navigate(new WindowDoctorNewCalendarEmpty());
                }
                ComboBoxPickCalendar.SelectedIndex = ComboBoxPickCalendar.Items.Count - 1;
                LoadDateToGrid();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            #endregion

            if (CurrentMonthDataGrid.SelectedIndex == -1)
            {
                workingDay.IsEnabled = false;
            }

            PreviousMonthDataGrid.ItemsSource = ClassSqlCalendar.GetListOfWorkingDayInCurrentMonth(ClassLoggedDoctor.Doctor_Id);
        }
Exemple #2
0
        public WindowDoctorEditCalendar()
        {
            InitializeComponent();

            List <ClassTerm> ListOfTerms = ClassSqlCalendar.GetListOfWorkingDayInCurrentMonth(ClassLoggedDoctor.Doctor_Id);

            CurrentMonthDataGrid.ItemsSource   = ListOfTerms;
            CurrentMonthDataGrid.SelectedIndex = 0;
        }
Exemple #3
0
        private void ButtonAdd_Click(object sender, RoutedEventArgs e)
        {
            WindowDoctorEditCalendarAdd windowDoctorEditCalendarAdd = new WindowDoctorEditCalendarAdd();
            var dialogResult = windowDoctorEditCalendarAdd.ShowDialog();

            if (windowDoctorEditCalendarAdd.DialogResult == true)
            {
                ListOfTerms = ClassSqlCalendar.GetListOfWorkingDayInCurrentMonth(ClassLoggedDoctor.Doctor_Id);
                RefreshDataGrid();
            }
        }
Exemple #4
0
        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;
            }
        }
        private void copyPreviousMonth_Click(object sender, RoutedEventArgs e)
        {
            List <ClassTerm> previousDays = ClassSqlCalendar.GetListOfWorkingDayInCurrentMonth(ClassLoggedDoctor.Doctor_Id);

            foreach (ClassTerm previousDay in previousDays)
            {
                var date = previousDay.Date.AddDays(28);
                foreach (ClassCalendarDay day in days)
                {
                    if (day.DateInDateTime == date)
                    {
                        day.IsWorkingDay = true;
                    }
                }
            }

            RefreshDataGrid();
        }
        private List <ClassCalendarDay> ListOfAvaiableDates()
        {
            ClassCalendar           calendar         = GetCalendarForCurrentDate();
            List <ClassCalendarDay> allAvailableDays = ClassSqlCalendar.ListOfCalendarDays(calendar.CalendarId);
            List <ClassTerm>        workingDays      = ClassSqlCalendar.GetListOfWorkingDayInCurrentMonth(ClassLoggedDoctor.Doctor_Id);

            List <ClassCalendarDay> avaiableDates = new List <ClassCalendarDay>();

            foreach (ClassTerm term in workingDays)
            {
                foreach (ClassCalendarDay day in allAvailableDays)
                {
                    if (term.Date == day.DateInDateTime)
                    {
                        avaiableDates.Add(day);
                    }
                }
            }

            avaiableDates = allAvailableDays.Except(avaiableDates).ToList();

            return(avaiableDates);
        }
Exemple #7
0
 public void RefreshList()
 {
     ListOfTerms = ClassSqlCalendar.GetListOfWorkingDayInCurrentMonth(ClassLoggedDoctor.Doctor_Id);
 }