private void mitProcess_Click(object sender, RoutedEventArgs e)
        {
            //this will process the information
            string strValueForValidation;
            bool   blnFatalError      = false;
            bool   blnThereIsAProblem = false;
            string strErrorMessage    = "";
            string strVehicleNumber;
            int    intRecordsReturned;

            try
            {
                strVehicleNumber = txtEnterBJCNumber.Text;
                TheFindVehicleMainByVehicleNumberDataSet = TheVehicleMainClass.FindActiveVehicleMainByVehicleNumber(strVehicleNumber);
                intRecordsReturned = TheFindVehicleMainByVehicleNumberDataSet.FindActiveVehicleMainByVehicleNumber.Rows.Count;
                if (intRecordsReturned == 0)
                {
                    blnFatalError    = true;
                    strErrorMessage += "Vehicle Number Entered Was Not Found\n";
                }
                else
                {
                    MainWindow.gintVehicleID = TheFindVehicleMainByVehicleNumberDataSet.FindActiveVehicleMainByVehicleNumber[0].VehicleID;
                }
                strValueForValidation = cboEmployee.SelectedItem.ToString();
                if (strValueForValidation == "Select Employee")
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Employee Was Not Selected\n";
                }
                if (rdoFailed.IsChecked == false)
                {
                    if (rdoPassed.IsChecked == false)
                    {
                        if (rdoPassedServiceRequired.IsChecked == false)
                        {
                            blnFatalError    = true;
                            strErrorMessage += "Passed, Passed Service Required, or Failure Was Not Checked\n";
                        }
                    }
                }
                strValueForValidation = txtOdometerReading.Text;
                blnThereIsAProblem    = TheDataValidationClass.VerifyIntegerData(strValueForValidation);
                if (blnThereIsAProblem == true)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Odometer Reading is not an Integer\n";
                }
                else
                {
                    MainWindow.gintOdometerReading = Convert.ToInt32(strValueForValidation);
                }
                if (cboVehicleCleanliness.SelectedIndex == 0)
                {
                    blnFatalError    = true;
                    strErrorMessage += "Cleanliness Was Not Selected\n";
                }

                if (blnFatalError == true)
                {
                    TheMessagesClass.ErrorMessage(strErrorMessage);
                    return;
                }


                MainWindow.gdatTransactionDate = DateTime.Now;

                blnFatalError = TheWeeklyInspectionClass.InsertWeeklyVehicleInspection(MainWindow.gintVehicleID, MainWindow.gdatTransactionDate, MainWindow.gintEmployeeID, MainWindow.gstrInspectionStatus, MainWindow.gintOdometerReading);

                if (blnFatalError == true)
                {
                    TheMessagesClass.ErrorMessage("There Was a Problem, Contact ID");
                    return;
                }

                TheFindWeeklyVehicleInspectionIDDataSet = TheWeeklyInspectionClass.FindWeelyVehicleInspectionID(MainWindow.gintVehicleID, MainWindow.gintEmployeeID, MainWindow.gintOdometerReading, MainWindow.gdatTransactionDate);

                MainWindow.gintInspectionID = TheFindWeeklyVehicleInspectionIDDataSet.FindWeeklyVehicleInspectionID[0].TransactionID;

                blnFatalError = TheWeeklyVehicleCleanlinessClass.InsertWeeklyVehicleCleanliness(MainWindow.gintInspectionID, MainWindow.gintVehicleID, gblnVehicleCleanliness, MainWindow.gstrCleanlinessNotes);

                if (blnFatalError == true)
                {
                    throw new Exception();
                }

                if ((rdoFailed.IsChecked == true) || (rdoPassedServiceRequired.IsChecked == true))
                {
                    VehicleInspectionProblem VehicleInspectionProblem = new VehicleInspectionProblem();
                    VehicleInspectionProblem.ShowDialog();
                }
                else if (rdoPassed.IsChecked == true)
                {
                    TheFindOpenVehicleProblemsbyVehicleIDDataSet = TheVehicleProblemClass.FindOpenVehicleProblemsbyVehicleID(MainWindow.gintVehicleID);

                    intRecordsReturned = TheFindOpenVehicleProblemsbyVehicleIDDataSet.FindOpenVehicleProblemsByVehicleID.Rows.Count;

                    if (intRecordsReturned > 0)
                    {
                        TheMessagesClass.ErrorMessage("There Are Open Problems with this Vehicle and\nYou Are Reporting No Problems, Please Correct");
                        return;
                    }
                }

                if (rdoFailed.IsChecked == true)
                {
                    PleaseWait PleaseWait = new PleaseWait();
                    PleaseWait.Show();

                    TheVehicleStatusClass.UpdateVehicleStatus(MainWindow.gintVehicleID, "DOWN", DateTime.Now);

                    TheSendEmailClass.EmailMessage(MainWindow.gstrVehicleNumber, MainWindow.gstrVehicleProblem);

                    PleaseWait.Close();
                }

                BulkToolsAssignedToVehicle BulkToolsAssignedToVehicle = new BulkToolsAssignedToVehicle();
                BulkToolsAssignedToVehicle.ShowDialog();

                txtEnterBJCNumber.Text = "";
                cboEmployee.Items.Clear();
                txtEnterLastName.Text               = "";
                txtOdometerReading.Text             = "";
                rdoFailed.IsChecked                 = false;
                rdoPassed.IsChecked                 = false;
                rdoPassedServiceRequired.IsChecked  = false;
                cboBodyDamageReported.SelectedIndex = 0;
                cboVehicleCleanliness.SelectedIndex = 0;
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Manager Weekly Audit Data Entry // Process Menu Item " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
        private void mitProcess_Click(object sender, RoutedEventArgs e)
        {
            //this will process the information
            string strValueForValidation;
            bool   blnFatalError      = false;
            bool   blnThereIsAProblem = false;
            string strErrorMessage    = "";
            int    intRecordsReturned;

            try
            {
                //data validation
                MainWindow.gstrVehicleNumber = txtEnterVehicleNumber.Text;
                TheFindActiveVehicleMainByVehicleNumberDataSet = TheVehicleMainClass.FindActiveVehicleMainByVehicleNumber(MainWindow.gstrVehicleNumber);
                intRecordsReturned = TheFindActiveVehicleMainByVehicleNumberDataSet.FindActiveVehicleMainByVehicleNumber.Rows.Count;
                if (intRecordsReturned == 0)
                {
                    blnFatalError    = true;
                    strErrorMessage += "Vehicle Number Not Found\n";
                }
                else
                {
                    MainWindow.gintVehicleID = TheFindActiveVehicleMainByVehicleNumberDataSet.FindActiveVehicleMainByVehicleNumber[0].VehicleID;

                    TheFindCurrentAssignedVehicleMainByVehicleIDDataSet = TheVehicleAssignmentClass.FindCurrentAssignedVehicleMainByVehicleID(MainWindow.gintVehicleID);

                    if (TheFindCurrentAssignedVehicleMainByVehicleIDDataSet.FindCurrentAssignedVehicleMainByVehicleID[0].LastName == "WAREHOUSE")
                    {
                        blnFatalError    = true;
                        strErrorMessage += "Vehicle is Assigned to a Warehouse and\nMust Be Assigned to a Technician\n";
                    }
                }

                strValueForValidation = cboEmployee.SelectedItem.ToString();
                if (strValueForValidation == "Select Employee")
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Employee Was Not Selected\n";
                }

                strValueForValidation = txtOdometerReading.Text;
                blnThereIsAProblem    = TheDataValidationClass.VerifyIntegerData(strValueForValidation);
                if (blnThereIsAProblem == true)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Odometer Reading is not an Integer\n";
                }
                else
                {
                    MainWindow.gintOdometerReading = Convert.ToInt32(strValueForValidation);
                }
                if (cboGPSInstalled.SelectedIndex < 1)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The GPS Installed was not Selected\n";
                }
                if (blnFatalError == true)
                {
                    TheMessagesClass.ErrorMessage(strErrorMessage);
                    return;
                }

                MainWindow.gdatTransactionDate = DateTime.Now;

                blnFatalError = TheInspectionsClass.InsertDailyVehicleInspection(MainWindow.gintVehicleID, MainWindow.gdatTransactionDate, MainWindow.gintEmployeeID, MainWindow.gstrInspectionStatus, MainWindow.gintOdometerReading);

                if (blnFatalError == true)
                {
                    throw new Exception();
                }

                blnFatalError = TheVehicleHistoryClass.InsertVehicleHistory(MainWindow.gintVehicleID, MainWindow.gintEmployeeID, MainWindow.TheVerifyLogonDataSet.VerifyLogon[0].EmployeeID);

                if (blnFatalError == true)
                {
                    throw new Exception();
                }

                blnFatalError = TheVehicleMainClass.UpdateVehicleMainEmployeeID(MainWindow.gintVehicleID, MainWindow.gintEmployeeID);

                if (blnFatalError == true)
                {
                    TheMessagesClass.ErrorMessage("There Was a Problem, Contact ID");
                    return;
                }


                TheFindDailyVehicleMainInspectionByDateMatchDataSet = TheInspectionsClass.FindDailyVehicleMainInspectionByDateMatch(MainWindow.gdatTransactionDate);

                MainWindow.gintInspectionID = TheFindDailyVehicleMainInspectionByDateMatchDataSet.FindDailyVehicleMainInspectionByDateMatch[0].TransactionID;

                blnFatalError = TheInspectGPSClass.InsertInspectGPS(MainWindow.gintInspectionID, MainWindow.gstrInspectionType, gblnGPSInstalled);

                if (blnFatalError == true)
                {
                    throw new Exception();
                }

                TheVehicleStatusClass.UpdateVehicleStatus(MainWindow.gintVehicleID, gstrVehicleStatus, DateTime.Now);

                if (rdoPassedServiceRequired.IsChecked == true)
                {
                    VehicleInspectionProblem VehicleInspectionProblem = new VehicleInspectionProblem();
                    VehicleInspectionProblem.ShowDialog();
                }

                txtEnterVehicleNumber.Text = "";
                cboEmployee.Items.Clear();
                txtEnterLastName.Text               = "";
                txtOdometerReading.Text             = "";
                rdoPassed.IsChecked                 = false;
                rdoPassedServiceRequired.IsChecked  = false;
                cboBodyDamageReported.SelectedIndex = 0;
                cboGPSInstalled.SelectedIndex       = 0;
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Vehicle Data Entry // Daily Vehicle Inspection // Process Button " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }