public FindVehicleMainProblemReadyForInvoicingDataSet FindVehicleMainProblemReadyForInvoicing(int intVehicleID)
        {
            try
            {
                aFindVehicleMainProblemReadyForInvoicingDataSet      = new FindVehicleMainProblemReadyForInvoicingDataSet();
                aFindVehicleMainProblemREadyForInvoicingTableAdapter = new FindVehicleMainProblemReadyForInvoicingDataSetTableAdapters.FindVehicleMainProblemReadyForInvoicingTableAdapter();
                aFindVehicleMainProblemREadyForInvoicingTableAdapter.Fill(aFindVehicleMainProblemReadyForInvoicingDataSet.FindVehicleMainProblemReadyForInvoicing, intVehicleID);
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Vehicle Problem Class // Find Vehicle Main Problem Ready For Invoicing " + Ex.Message);
            }

            return(aFindVehicleMainProblemReadyForInvoicingDataSet);
        }
        private void TxtVehicleNumber_TextChanged(object sender, TextChangedEventArgs e)
        {
            string strVehicleNumber;
            int    intLength;
            bool   blnItemFound = false;
            int    intCounter;
            int    intNumberOfRecords;
            int    intRecordsReturned;

            try
            {
                strVehicleNumber = txtVehicleNumber.Text;
                intLength        = strVehicleNumber.Length;

                if (intLength == 4)
                {
                    blnItemFound = FindVehicle(strVehicleNumber);
                }
                else if (intLength == 6)
                {
                    blnItemFound = FindVehicle(strVehicleNumber);
                    if (blnItemFound == false)
                    {
                        TheMessagesClass.InformationMessage("Vehicle Number Not Found");
                        return;
                    }
                }

                if (blnItemFound == true)
                {
                    TheFindVehicleMainInShopByVehicleIDDataSet = TheVehiclesInShopClass.FindVehicleMainInShopByVehicleID(MainWindow.gintVehicleID);

                    intRecordsReturned = TheFindVehicleMainInShopByVehicleIDDataSet.FindVehicleMainInShopByVehicleID.Rows.Count;

                    if (intRecordsReturned > 0)
                    {
                        TheMessagesClass.ErrorMessage("THE VEHICLE IS STILL IN THE SHOP");
                        ResetControls();
                        return;
                    }

                    TheOpenVehicleProblemsDataSet.openvehicleproblem.Rows.Clear();

                    TheFindVehicleMainProblemReadyForInvoicingDataSet = TheVehicleProblemClass.FindVehicleMainProblemReadyForInvoicing(MainWindow.gintVehicleID);

                    intNumberOfRecords = TheFindVehicleMainProblemReadyForInvoicingDataSet.FindVehicleMainProblemReadyForInvoicing.Rows.Count - 1;

                    if (intNumberOfRecords > -1)
                    {
                        for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                        {
                            OpenVehicleProblemsDataSet.openvehicleproblemRow NewProblemRow = TheOpenVehicleProblemsDataSet.openvehicleproblem.NewopenvehicleproblemRow();

                            NewProblemRow.Problem     = TheFindVehicleMainProblemReadyForInvoicingDataSet.FindVehicleMainProblemReadyForInvoicing[intCounter].Problem;
                            NewProblemRow.ProblemDate = TheFindVehicleMainProblemReadyForInvoicingDataSet.FindVehicleMainProblemReadyForInvoicing[intCounter].TransactionDAte;
                            NewProblemRow.ProblemID   = TheFindVehicleMainProblemReadyForInvoicingDataSet.FindVehicleMainProblemReadyForInvoicing[intCounter].ProblemID;
                            NewProblemRow.Status      = TheFindVehicleMainProblemReadyForInvoicingDataSet.FindVehicleMainProblemReadyForInvoicing[intCounter].ProblemStatus;
                            NewProblemRow.Vendor      = TheFindVehicleMainProblemReadyForInvoicingDataSet.FindVehicleMainProblemReadyForInvoicing[intCounter].VendorName;
                            NewProblemRow.Selected    = false;

                            TheOpenVehicleProblemsDataSet.openvehicleproblem.Rows.Add(NewProblemRow);
                        }
                    }

                    dgrResults.ItemsSource      = TheOpenVehicleProblemsDataSet.openvehicleproblem;
                    cboVendor.IsEnabled         = true;
                    cboAttachInvoice.IsEnabled  = true;
                    mitProcessInvoice.IsEnabled = true;
                }
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Invoice Vehicle Problems // Vehicle Number Text Box " + Ex.Message);

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