Ejemplo n.º 1
0
 private void btnSubmit_Click(object sender, RoutedEventArgs e)
 {
     if (dtpStart.SelectedDate == null)
     {
         MessageBox.Show("Please select the start date!", "START DATE MISSING", MessageBoxButton.OK, MessageBoxImage.Exclamation);
         popFilter.IsOpen = true;
     }
     else if (dtpEnd.SelectedDate == null)
     {
         MessageBox.Show("Please select the end date!", "START DATE MISSING", MessageBoxButton.OK, MessageBoxImage.Exclamation);
         popFilter.IsOpen = true;
     }
     else if (dtpEnd.SelectedDate < dtpStart.SelectedDate)
     {
         MessageBox.Show("The start date cannot be greater than the end date!", "INVALID FILTER", MessageBoxButton.OK, MessageBoxImage.Exclamation);
     }
     else if (cmbInstructor.SelectedValue == null && chkAll.IsChecked == false)
     {
         MessageBox.Show("Please select the instructor!", "INSTRUCTOR MISSING", MessageBoxButton.OK, MessageBoxImage.Exclamation);
     }
     else
     {
         var mainWindow = Application.Current.Windows.Cast <Window>().FirstOrDefault(window => window is MainWindow) as MainWindow;
         FuelUsageReporting nwFuelUsageRprt = new FuelUsageReporting();
         mainWindow.grdMain.Children.Clear();
         nwFuelUsageRprt.instructorID = Globals.instructorID;
         nwFuelUsageRprt.start        = Convert.ToDateTime(dtpStart.SelectedDate).Month;
         nwFuelUsageRprt.end          = Convert.ToDateTime(dtpEnd.SelectedDate).Month;
         nwFuelUsageRprt.year         = Convert.ToDateTime(dtpEnd.SelectedDate).Year;
         nwFuelUsageRprt.Isfiltered   = true;
         mainWindow.grdMain.Children.Add(nwFuelUsageRprt);
     }
 }
        private void btnReporting_Click(object sender, RoutedEventArgs e)
        {
            FuelUsageReporting nwReport = new FuelUsageReporting();

            this.grdMain.Children.Clear();
            this.grdMain.Children.Add(nwReport);
        }
Ejemplo n.º 3
0
        private void btnClearFilter_Click(object sender, RoutedEventArgs e)
        {
            var mainWindow = Application.Current.Windows.Cast <Window>().FirstOrDefault(window => window is MainWindow) as MainWindow;
            FuelUsageReporting nwFuelUsageRprt = new FuelUsageReporting();

            mainWindow.grdMain.Children.Clear();
            nwFuelUsageRprt.instructorID = Globals.instructorID;
            nwFuelUsageRprt.Isfiltered   = false;
            mainWindow.grdMain.Children.Add(nwFuelUsageRprt);
        }