public FindVehicleProblemByDateMatchDataSet FindVehicleProblemByDateMatch(DateTime datTransactionDate)
        {
            try
            {
                aFindVehicleProblemByDateMatchDataSet      = new FindVehicleProblemByDateMatchDataSet();
                aFindVehicleProblemByDateMatchTableAdapter = new FindVehicleProblemByDateMatchDataSetTableAdapters.FindVehicleProblemByDateMatchTableAdapter();
                aFindVehicleProblemByDateMatchTableAdapter.Fill(aFindVehicleProblemByDateMatchDataSet.FindVehicleProblemByDateMatch, datTransactionDate);
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Vehicle Problem Class // Find Vehicle Problem By Date Match " + Ex.Message);
            }

            return(aFindVehicleProblemByDateMatchDataSet);
        }
        private void mitProcessProblem_Click(object sender, RoutedEventArgs e)
        {
            string   strVehicleProblem  = "";
            string   strVehicleNotes    = "";
            bool     blnFatalError      = false;
            DateTime datTransactionDate = DateTime.Now;
            string   strErrorMessage    = "";

            try
            {
                strVehicleProblem = txtProblem.Text;
                if (strVehicleProblem == "")
                {
                    blnFatalError    = true;
                    strErrorMessage += "Vehice Problem was Not Entered\n";
                }
                strVehicleNotes = txtAddedNotes.Text;
                if (strVehicleNotes == "")
                {
                    blnFatalError    = true;
                    strErrorMessage += "Problem Notes were not Entered\n";
                }
                if (gblnInShop == true)
                {
                    if (cboSelectVendor.SelectedIndex < 1)
                    {
                        blnFatalError    = true;
                        strErrorMessage += "Vendor was not Selected\n";
                    }
                }

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

                blnFatalError = TheVehicleProblemClass.InsertVehicleProblem(MainWindow.gintVehicleID, datTransactionDate, strVehicleProblem);

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

                TheFindVehicleProblemByDateMatchDataSet = TheVehicleProblemClass.FindVehicleProblemByDateMatch(datTransactionDate);

                MainWindow.gintProblemID = TheFindVehicleProblemByDateMatchDataSet.FindVehicleProblemByDateMatch[0].ProblemID;

                blnFatalError = TheVehicleProblemClass.InsertVehicleProblemUpdate(MainWindow.gintProblemID, MainWindow.TheVerifyLogonDataSet.VerifyLogon[0].EmployeeID, strVehicleNotes, datTransactionDate);

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

                if (gblnInShop == true)
                {
                    blnFatalError = TheVehiclesInShopClass.InsertVehicleInShop(MainWindow.gintVehicleID, datTransactionDate, MainWindow.gintVendorID, strVehicleProblem, MainWindow.gintProblemID);

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

                TheMessagesClass.InformationMessage("The Problem Has Been reported");

                MessageBoxResult result = MessageBox.Show("Do You Want To Print A Copy of the problem", "Please Choose", MessageBoxButton.YesNo, MessageBoxImage.Question);

                if (result == MessageBoxResult.Yes)
                {
                    TheVehicleProblemPrintClass.PrintVehicleProblemInfo();
                }

                ResetControls();
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // New Vehicle Problem // Process Problem Menu Item " + Ex.Message);
            }
        }
        private void mitSave_Click(object sender, RoutedEventArgs e)
        {
            //this will save the transaction
            string   strInspectionNotes;
            bool     blnFatalError      = false;
            string   strErrorMessage    = "";
            DateTime datTransactionDate = DateTime.Now;
            //int intLength;
            string strManagerNotes;
            string strFleetNotes;
            bool   blnThereIsaProblem = false;

            try
            {
                MainWindow.gstrVehicleProblem = txtInspectionNotes.Text;
                blnThereIsaProblem            = CharacterCheck(MainWindow.gstrVehicleProblem);
                if (blnThereIsaProblem == true)
                {
                    blnFatalError    = true;
                    strErrorMessage += "There Is a Recurring Character that is displaying, Invalid Entry\n";
                }
                strManagerNotes = txtManagerNotes.Text;
                if (strManagerNotes.Length < 20)
                {
                    blnFatalError    = true;
                    strErrorMessage += "Manager Notes Entry is not Long Enough\n";
                }
                strFleetNotes = txtFleetNotes.Text;
                if (strFleetNotes.Length < 20)
                {
                    blnFatalError    = true;
                    strErrorMessage += "Fleet Notes Entry is not Long Enough\n";
                }
                if (cboSelectEmployee.SelectedIndex < 1)
                {
                    blnFatalError    = true;
                    strErrorMessage += "Fleet Employee Was Not Selected\n";
                }
                if (cboSelectManager.SelectedIndex < 1)
                {
                    blnFatalError    = true;
                    strErrorMessage += "Manager Was Not Selected\n";
                }
                if (gintMultipleSelectedIndex == 0)
                {
                    blnFatalError    = true;
                    strErrorMessage += "Multiple Orders Was Not Selected\n";
                }
                if (gblnNewWorkOrder == true)
                {
                    if (MainWindow.gstrVehicleProblem == "")
                    {
                        blnFatalError    = true;
                        strErrorMessage += "Vehicle Problem Was Not Entered\n";
                    }
                }

                strInspectionNotes = txtInspectionNotes.Text;
                if (strInspectionNotes == "")
                {
                    blnFatalError    = true;
                    strErrorMessage += "Inspection Notes Were Not Entered\n";
                }
                else
                {
                    blnThereIsaProblem = CharacterCheck(strInspectionNotes);
                    if (blnThereIsaProblem == true)
                    {
                        blnFatalError    = true;
                        strErrorMessage += "There is a recurring character in the Inspection Notes\n";
                    }
                }

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

                strManagerNotes = "MANAGER NOTES: " + strManagerNotes;
                strFleetNotes   = "FLEET NOTES: " + strFleetNotes;

                if (gblnNewWorkOrder == true)
                {
                    //iserting into table
                    blnFatalError = TheVehicleProblemClass.InsertVehicleProblem(MainWindow.gintVehicleID, datTransactionDate, MainWindow.gstrVehicleProblem);

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

                    TheFindVehicleProblemByDateMatchDataSet = TheVehicleProblemClass.FindVehicleProblemByDateMatch(datTransactionDate);

                    gintProblemID = TheFindVehicleProblemByDateMatchDataSet.FindVehicleProblemByDateMatch[0].ProblemID;

                    blnFatalError = TheVehicleProblemClass.InsertVehicleProblemUpdate(gintProblemID, MainWindow.TheVerifyLogonDataSet.VerifyLogon[0].EmployeeID, strManagerNotes, datTransactionDate);

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

                    blnFatalError = TheVehicleProblemClass.InsertVehicleProblemUpdate(gintProblemID, MainWindow.TheVerifyLogonDataSet.VerifyLogon[0].EmployeeID, strFleetNotes, datTransactionDate);

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

                blnFatalError = TheInspectionClass.InsertVehicleInspectionProblem(MainWindow.gintVehicleID, MainWindow.gintInspectionID, MainWindow.gstrInspectionType, MainWindow.gstrVehicleProblem, MainWindow.gintOdometerReading, MainWindow.gblnServicable, strInspectionNotes, gintManagerID, gintFleetEmployeeID, strManagerNotes, strFleetNotes, gintProblemID);

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

                TheMessagesClass.InformationMessage("Vehicle Has Been Updated");

                if (gblnMultipleOrders == true)
                {
                    txtInspectionNotes.Text           = "";
                    txtManagerNotes.Text              = "";
                    txtFleetNotes.Text                = "";
                    cboMultipleProblems.SelectedIndex = 0;
                    SetReadOnlyControls(false);
                }
                else if (gblnMultipleOrders == false)
                {
                    Close();
                }
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Vehicle Inspection Problem // Save Menu Item " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
        private void mitProccess_Click(object sender, RoutedEventArgs e)
        {
            //setting local variables
            DateTime datOilChangeDate   = DateTime.Now;
            int      intOdometerReading = 0;
            float    fltInvoiceTotal    = 0;
            string   strValueForValidation;
            string   strErrorMessage    = "";
            bool     blnFatalError      = false;
            bool     blnThereIsAProblem = false;
            DateTime datTransactionDate = DateTime.Now;

            try
            {
                strValueForValidation = txtOilChangeDate.Text;
                blnThereIsAProblem    = TheDataValidationClass.VerifyDateData(strValueForValidation);
                if (blnThereIsAProblem == true)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Odometer Date is not a Date\n";
                }
                else
                {
                    datOilChangeDate = Convert.ToDateTime(strValueForValidation);
                }
                strValueForValidation = txtOilChangeOdometer.Text;
                blnThereIsAProblem    = TheDataValidationClass.VerifyIntegerData(strValueForValidation);
                if (blnThereIsAProblem == true)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Odometer Reading is not an Integer\n";
                }
                else
                {
                    intOdometerReading = Convert.ToInt32(strValueForValidation);

                    if (gintOldOdometerReading + 3000 >= intOdometerReading)
                    {
                        blnFatalError    = true;
                        strErrorMessage += "Odometer Reading is less than 3000 Miles Since Last Oil Change\n";
                    }
                }

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

                if (MainWindow.gblnWorkOrderSelected == false)
                {
                    blnFatalError = TheVehicleProblemClass.InsertVehicleProblem(MainWindow.gintVehicleID, datTransactionDate, "PREVENTIVE MAINTENANCE");

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

                    TheFindVehicleProblemByDateMatchDataSet = TheVehicleProblemClass.FindVehicleProblemByDateMatch(datTransactionDate);

                    MainWindow.gintProblemID = TheFindVehicleProblemByDateMatchDataSet.FindVehicleProblemByDateMatch[0].ProblemID;
                }

                blnFatalError = TheVehicleProblemClass.InsertVehicleProblemUpdate(MainWindow.gintProblemID, MainWindow.TheVerifyLogonDataSet.VerifyLogon[0].EmployeeID, "PREVENTIVIE MAINTENANCE PERFORMED", datTransactionDate);

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

                blnFatalError = TheVehicleMainClass.UpdateMainOilChangeInformation(MainWindow.gintVehicleID, intOdometerReading, datOilChangeDate);

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

                if (gblnOilChangeComplete == true)
                {
                    blnFatalError = TheVehicleProblemClass.ChangeVehicleProblemStatus(MainWindow.gintProblemID, "AWAITING INVOICE");

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

                    blnFatalError = TheVehicleProblemClass.UpdateVehiclePRoblemCost(MainWindow.gintProblemID, fltInvoiceTotal);

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

                TheMessagesClass.InformationMessage("The Record Has Been Saved");

                MessageBoxResult result = MessageBox.Show("Do You Want To Print A Copy of the problem", "Please Choose", MessageBoxButton.YesNo, MessageBoxImage.Question);

                if (result == MessageBoxResult.Yes)
                {
                    TheVehicleProblemPrintClass.PrintVehicleProblemInfo();
                }

                ResetControls();
                SetControlsReadOnly(true);
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Preventive Maintenance // Process Menu Item " + Ex.Message);

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