public SchedulePage() { InitializeComponent(); _vm = new SchedulePageViewModel(); this.DataContext = _vm; gridSchedule.ItemsSource = _vm.ScheduleDetails; gridSchedule.MouseDoubleClick += GridSchedule_MouseDoubleClick; gridSchedule.PreviewKeyDown += GridSchedule_PreviewKeyDown; // dch rkl 11/01/2016 Enter to select ticket // dch rkl 11/22/2016 select full text on focus filterStartDate.GotFocus += textbox_GotFocus; filterEndDate.GotFocus += textbox_GotFocus; filterStartDate.Focusable = true; Keyboard.Focus(filterStartDate); //bk 01/24/2017 if previous filter set - application only if (App.Current.Properties["filterStartDate"] != null) { _vm.DefaultStartDate = (DateTime)App.Current.Properties["filterStartDate"]; filterStartDate.SelectedDate = (DateTime)App.Current.Properties["filterStartDate"]; } if (App.Current.Properties["filterEndDate"] != null) { _vm.DefaultEndDate = (DateTime)App.Current.Properties["filterEndDate"]; filterEndDate.SelectedDate = (DateTime)App.Current.Properties["filterEndDate"]; } if (App.Current.Properties["filterStartDate"] != null && App.Current.Properties["filterEndDate"] != null) { _vm.filterScheduledAppointments((DateTime)filterStartDate.SelectedDate, (DateTime)filterEndDate.SelectedDate); } }
private void ButtonFilter_Clicked(object sender, EventArgs e) { App_Settings appSettings = App.Database.GetApplicationSettings(); DateTime lowerLimit = (DateTime.Now.AddDays(Convert.ToDouble(appSettings.ScheduleDaysBefore) * (-1))).Date; DateTime upperLimit = (DateTime.Now.AddDays(Convert.ToDouble(appSettings.ScheduleDaysAfter))).Date; if (lowerLimit > filterStartDate.Date || upperLimit < filterEndDate.Date) { DisplayAlert("Update Settings", "These dates exceed your application settings. Please modify your range in there to import more data.", "OK"); } _vm.filterScheduledAppointments(filterStartDate.Date, filterEndDate.Date); }
private void buttonFilter_Click(object sender, RoutedEventArgs e) { // dch rkl 10/27/2016 Validate the dates that are input BEGIN DateTime dtStart; DateTime dtEnd; if (DateTime.TryParse(filterStartDate.SelectedDate.ToString(), out dtStart) == false) { MessageBox.Show("Invalid Start Date", "Invalid Date", MessageBoxButton.OK); } else if (DateTime.TryParse(filterEndDate.SelectedDate.ToString(), out dtEnd) == false) { MessageBox.Show("Invalid End Date", "Invalid Date", MessageBoxButton.OK); } else { // dch rkl 10/27/2016 Validate the dates that are input END App_Settings appSettings = App.Database.GetApplicationSettings(); DateTime lowerLimit = (DateTime.Now.AddDays(Convert.ToDouble(appSettings.ScheduleDaysBefore) * (-1))).Date; DateTime upperLimit = (DateTime.Now.AddDays(Convert.ToDouble(appSettings.ScheduleDaysAfter))).Date; App.Current.Properties["filterStartDate"] = filterStartDate.SelectedDate; App.Current.Properties["filterEndDate"] = filterEndDate.SelectedDate; // dch rkl 12/01/2016 if dates are outside of acceptable range, change them. BEGIN //if (lowerLimit > filterStartDate.SelectedDate || upperLimit < filterEndDate.SelectedDate) //{ // MessageBox.Show("These dates exceed your application settings. Please modify your range in there to import more data.", "Update Settings", MessageBoxButton.OK); //} if (lowerLimit > filterStartDate.SelectedDate) { filterStartDate.Text = lowerLimit.ToShortDateString(); } if (upperLimit < filterEndDate.SelectedDate) { filterEndDate.Text = upperLimit.ToShortDateString(); } // dch rkl 12/01/2016 if dates are outside of acceptable range, change them. END _vm.filterScheduledAppointments((DateTime)filterStartDate.SelectedDate, (DateTime)filterEndDate.SelectedDate); } // dch rkl 10/27/2016 Validate the dates that are input }