private void btnFueling_Click(object sender, RoutedEventArgs e)
        {
            Fueling nwFueling = new Fueling();

            this.grdMain.Children.Clear();
            this.grdMain.Children.Add(nwFueling);
        }
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            if (cmbCarReg.SelectedValue == null)
            {
                MessageBox.Show("Car Registration Missing", "DATA MISSING", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
            else if (dtpDate.SelectedDate == null)
            {
                MessageBox.Show("Date Missing", "DATA MISSING", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
            else if (txtFuelAmount.Text == null)
            {
                MessageBox.Show("Fuel Amount Missing", "DATA MISSING", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
            else if (Convert.ToDecimal(txtFuelAmount.Text) <= 0)
            {
                MessageBox.Show("Please Enter The Correct Fuel Amount", "DATA INCORRECT", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
            else if (cmbInstructor.SelectedValue == null)
            {
                MessageBox.Show("Instructor Missing", "DATA MISSING", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
            else if (txtAmount.Text == null)
            {
                MessageBox.Show("Amount Paid Missing", "DATA MISSING", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
            else if (Convert.ToDecimal(ExtractNumber(txtAmount.Text)) <= 0)
            {
                MessageBox.Show("Please Enter The Correct Amount Paid", "DATA INCORRECT", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
            else if (txtInvoice.Text == string.Empty)
            {
                MessageBox.Show("Invoice Number Missing", "DATA MISSING", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
            else if (txtMilage.Value == null)
            {
                MessageBox.Show("Milage Missing", "DATA MISSING", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
            else if (!DbAccess.GetCheckMilage(Convert.ToDecimal(txtMilage.Text), Convert.ToByte(cmbCarReg.SelectedValue)))
            {
                MessageBox.Show("Milage Cannot be less than the previous milage", "DATA MISSING", MessageBoxButton.OK, MessageBoxImage.Warning);
            }

            else
            {
                VehicleFueling nwVehicleFueling = new VehicleFueling()
                {
                    Date          = Convert.ToDateTime(dtpDate.SelectedDate),
                    FuelAmount    = Convert.ToDecimal(txtFuelAmount.Text),
                    InstructorID  = Convert.ToInt32(cmbInstructor.SelectedValue),
                    InvoiceNumber = txtInvoice.Text,
                    Milage        = Convert.ToDecimal(txtMilage.Text),
                    Notes         = txtNotes.Text,
                    Price         = Convert.ToDecimal(ExtractNumber(txtAmount.Text)) * (decimal)0.01,
                    UserID        = Globals.LogInID,
                    VehicleID     = Convert.ToByte(cmbCarReg.SelectedValue)
                };

                DbInsert.InsertFuelingData(nwVehicleFueling);
                LoadDataGrid();
                MessageBox.Show("Fueling Data Added", "DATA ADDED", MessageBoxButton.OK, MessageBoxImage.Information);
                var     mainWindow = Application.Current.Windows.Cast <Window>().FirstOrDefault(window => window is MainWindow) as MainWindow;
                Fueling nwFueling  = new Fueling();
                mainWindow.grdMain.Children.Clear();
                mainWindow.grdMain.Children.Add(nwFueling);
            }
        }