private void workingDayFrom_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (workingDayFrom.SelectedItem != null)
            {
                lastSelectedDay.StartTime = (TimeSpan)workingDayFrom.SelectedItem;
                days.RemoveAt(CurrentMonthDataGrid.SelectedIndex);
                days.Insert(CurrentMonthDataGrid.SelectedIndex, lastSelectedDay);

                RefreshDataGrid();

                if (workingDayFrom.SelectedIndex == workingDayFrom.Items.Count - 1)
                {
                    workingDayTo.ItemsSource = ClassHelpers.GenerateListOfHours((TimeSpan)workingDayFrom.Items[workingDayFrom.SelectedIndex], lastSelectedDay.EndTime + new TimeSpan(0, 15, 0));
                }
                else
                {
                    workingDayTo.ItemsSource = ClassHelpers.GenerateListOfHours((TimeSpan)workingDayFrom.Items[workingDayFrom.SelectedIndex + 1], ListOfOriginalDays()[lastSelectedIndex].EndTime);
                }

                if ((TimeSpan)workingDayFrom.SelectedItem > lastSelectedDay.EndTime)
                {
                    workingDayTo.ItemsSource   = ClassHelpers.GenerateListOfHours((TimeSpan)workingDayFrom.Items[workingDayFrom.SelectedIndex + 1], ListOfOriginalDays()[lastSelectedIndex].EndTime);
                    workingDayTo.SelectedIndex = 0;
                }
            }
        }
Esempio n. 2
0
        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);
            }
        }
        public WindowDoctorEditCalendarAdd()
        {
            InitializeComponent();

            workingDayFrom.ItemsSource = ClassHelpers.GenerateListOfHours(new TimeSpan(7, 0, 0), new TimeSpan(20, 0, 0));
            workingDayTo.ItemsSource   = ClassHelpers.GenerateListOfHours(new TimeSpan(7, 0, 0), new TimeSpan(20, 0, 0));
            AvailableDate.ItemsSource  = ListOfAvaiableDates();
        }
        public void TestGenerateHours()
        {
            //Arange
            List <TimeSpan> expectedListofGenerateHours = new List <TimeSpan>()
            {
                new TimeSpan(7, 0, 0), new TimeSpan(7, 15, 0), new TimeSpan(7, 30, 0), new TimeSpan(7, 45, 0), new TimeSpan(8, 0, 0),
                new TimeSpan(8, 15, 0), new TimeSpan(8, 30, 0), new TimeSpan(8, 45, 0), new TimeSpan(9, 0, 0), new TimeSpan(9, 15, 0), new TimeSpan(9, 30, 0), new TimeSpan(9, 45, 0), new TimeSpan(10, 0, 0), new TimeSpan(10, 15, 0), new TimeSpan(10, 30, 0), new TimeSpan(10, 45, 0), new TimeSpan(11, 0, 0), new TimeSpan(11, 15, 0), new TimeSpan(11, 30, 0), new TimeSpan(11, 45, 0), new TimeSpan(12, 0, 0), new TimeSpan(12, 15, 0), new TimeSpan(12, 30, 0), new TimeSpan(12, 45, 0), new TimeSpan(13, 0, 0), new TimeSpan(13, 15, 0), new TimeSpan(13, 30, 0), new TimeSpan(13, 45, 0), new TimeSpan(14, 0, 0), new TimeSpan(14, 15, 0), new TimeSpan(14, 30, 0), new TimeSpan(14, 45, 0), new TimeSpan(15, 0, 0), new TimeSpan(15, 15, 0), new TimeSpan(15, 30, 0), new TimeSpan(15, 45, 0), new TimeSpan(16, 0, 0), new TimeSpan(16, 15, 0), new TimeSpan(16, 30, 0), new TimeSpan(16, 45, 0), new TimeSpan(17, 0, 0), new TimeSpan(17, 15, 0), new TimeSpan(17, 30, 0), new TimeSpan(17, 45, 0), new TimeSpan(18, 0, 0), new TimeSpan(18, 15, 0), new TimeSpan(18, 30, 0), new TimeSpan(18, 45, 0), new TimeSpan(19, 0, 0), new TimeSpan(19, 15, 0), new TimeSpan(19, 30, 0), new TimeSpan(19, 45, 0), new TimeSpan(20, 0, 0)
            };

            // Act
            List <TimeSpan> actualListofGenerateHours = ClassHelpers.GenerateListOfHours(new TimeSpan(7, 0, 0), new TimeSpan(20, 0, 0));

            // Assert
            Xunit.Assert.Equal(expectedListofGenerateHours, actualListofGenerateHours);
        }
        private void CheckBoxWorkingDay_Checked(object sender, RoutedEventArgs e)
        {
            workingDayFrom.IsEnabled = true;
            workingDayTo.IsEnabled   = true;

            ClassCalendarDay day = (ClassCalendarDay)CurrentMonthDataGrid.SelectedItem;

            RefreshLastSelectedItems(day);

            day.IsWorkingDay = true;
            // day.StartTime = ListOfOriginalDays()[lastSelectedIndex].StartTime;
            // day.EndTime = ListOfOriginalDays()[lastSelectedIndex].EndTime;
            days.RemoveAt(CurrentMonthDataGrid.SelectedIndex);
            days.Insert(CurrentMonthDataGrid.SelectedIndex, day);

            RefreshDataGrid();

            workingDayFrom.ItemsSource  = ClassHelpers.GenerateListOfHours(ListOfOriginalDays()[lastSelectedIndex].StartTime, ListOfOriginalDays()[lastSelectedIndex].EndTime - new TimeSpan(0, 15, 0));
            workingDayFrom.SelectedItem = lastSelectedDay.StartTime;
            workingDayTo.ItemsSource    = ClassHelpers.GenerateListOfHours((TimeSpan)workingDayFrom.Items[workingDayFrom.SelectedIndex + 1], ListOfOriginalDays()[lastSelectedIndex].EndTime);
            workingDayTo.SelectedIndex  = workingDayTo.Items.Count - 1;
        }
Esempio n. 6
0
        private void CheckBoxWorkingDay_Checked(object sender, RoutedEventArgs e)
        {
            if (lastSelectedTerm != null)
            {
                workingDayFrom.IsEnabled = true;
                workingDayTo.IsEnabled   = true;

                ClassTerm term = (ClassTerm)CurrentMonthDataGrid.SelectedItem;
                RefreshLastSelectedItems(term);

                lastSelectedTerm.IsWorkingDay = true;
                ListOfTerms.RemoveAt(CurrentMonthDataGrid.SelectedIndex);
                ListOfTerms.Insert(CurrentMonthDataGrid.SelectedIndex, lastSelectedTerm);

                RefreshDataGrid();

                workingDayFrom.ItemsSource  = ClassHelpers.GenerateListOfHours(new TimeSpan(7, 0, 0), new TimeSpan(19, 45, 0));
                workingDayFrom.SelectedItem = lastSelectedTerm.StartTime;
                workingDayTo.ItemsSource    = ClassHelpers.GenerateListOfHours(new TimeSpan(7, 15, 0), new TimeSpan(20, 0, 0));
                workingDayTo.SelectedItem   = lastSelectedTerm.EndTime;
            }
        }
 private void AddWorkingDayFrom_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     workingDayTo.ItemsSource = ClassHelpers.GenerateListOfHours((TimeSpan)(workingDayFrom.SelectedItem) + new TimeSpan(0, 15, 0), new TimeSpan(20, 0, 0));
 }