private void ResetControls()
        {
            TheImportGEOFenceDataSet.importgeofence.Rows.Clear();
            TheFindActiveVehicleMainDataSet = TheVehicleMainClass.FindActiveVehicleMain();
            TheFindWarehouseDataSet         = TheEmployeeClass.FindWarehouses();

            dgrResults.ItemsSource = TheImportGEOFenceDataSet.importgeofence;
        }
        private void ResetControls()
        {
            int    intCounter;
            int    intNumberOfRecords;
            int    intRecordsReturned;
            string strLastName;

            try
            {
                TheImportVehiclesDataSet.importvehicles.Rows.Clear();

                TheFindActiveVehicleMainDataSet = TheVehicleMainClass.FindActiveVehicleMain();

                intNumberOfRecords = TheFindActiveVehicleMainDataSet.FindActiveVehicleMain.Rows.Count - 1;

                for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                {
                    strLastName = TheFindActiveVehicleMainDataSet.FindActiveVehicleMain[intCounter].VehicleNumber;

                    TheFindAllEmployeebyLastNameDataSet = TheEmployeeClass.FindAllEmployeesByLastName(strLastName);

                    intRecordsReturned = TheFindAllEmployeebyLastNameDataSet.FindAllEmployeeByLastName.Rows.Count;

                    if (intRecordsReturned < 1)
                    {
                        ImportVehiclesDataSet.importvehiclesRow NewVehicleRow = TheImportVehiclesDataSet.importvehicles.NewimportvehiclesRow();

                        NewVehicleRow.AssignedOffice      = TheFindActiveVehicleMainDataSet.FindActiveVehicleMain[intCounter].AssignedOffice;
                        NewVehicleRow.CDLRequired         = "N/A";
                        NewVehicleRow.DOTStatus           = "N/A";
                        NewVehicleRow.DOTStatusID         = -1;
                        NewVehicleRow.EmployeeID          = -1;
                        NewVehicleRow.GPSStatusID         = -1;
                        NewVehicleRow.IMEI                = "N/A";
                        NewVehicleRow.LicensePlate        = "N/A";
                        NewVehicleRow.MedicalCardRequired = "N/A";
                        NewVehicleRow.OdometerReading     = 0;
                        NewVehicleRow.VehicleMake         = "N/A";
                        NewVehicleRow.VehicleModel        = "N/A";
                        NewVehicleRow.VehicleNumber       = strLastName;
                        NewVehicleRow.VINNumber           = "N/A";
                        NewVehicleRow.Year                = 0;
                        NewVehicleRow.TamperTag           = "N/A";

                        TheImportVehiclesDataSet.importvehicles.Rows.Add(NewVehicleRow);
                    }
                }

                dgrResutls.ItemsSource = TheImportVehiclesDataSet.importvehicles;
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Add Vehicle To Employee Table // Reset Controls " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
        public FindActiveVehicleMainDataSet FindActiveVehicleMain()
        {
            try
            {
                aFindActiveVehicleMainDataSet      = new FindActiveVehicleMainDataSet();
                aFindActiveVehicleMainTableAdpater = new FindActiveVehicleMainDataSetTableAdapters.FindActiveVehicleMainTableAdapter();
                aFindActiveVehicleMainTableAdpater.Fill(aFindActiveVehicleMainDataSet.FindActiveVehicleMain);
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Vehicle Main Class // Find Active Vehicle Main " + Ex.Message);
            }

            return(aFindActiveVehicleMainDataSet);
        }
        private void ResetControls()
        {
            int intCounter;
            int intNumberOfRecords;

            try
            {
                TheActiveVehicleDataSet.activevehicles.Rows.Clear();

                TheFindActiveVehicleMainDataSet = TheVehicleMainClass.FindActiveVehicleMain();

                intNumberOfRecords = TheFindActiveVehicleMainDataSet.FindActiveVehicleMain.Rows.Count - 1;

                for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                {
                    ActiveVehicleDataSet.activevehiclesRow NewVehicleRow = TheActiveVehicleDataSet.activevehicles.NewactivevehiclesRow();

                    NewVehicleRow.AssignedOffice = TheFindActiveVehicleMainDataSet.FindActiveVehicleMain[intCounter].AssignedOffice;
                    NewVehicleRow.DOTStatus      = TheFindActiveVehicleMainDataSet.FindActiveVehicleMain[intCounter].DOTStatus;
                    NewVehicleRow.FirstName      = TheFindActiveVehicleMainDataSet.FindActiveVehicleMain[intCounter].FirstName;
                    NewVehicleRow.IMEI           = TheFindActiveVehicleMainDataSet.FindActiveVehicleMain[intCounter].IMEI;
                    NewVehicleRow.LastName       = TheFindActiveVehicleMainDataSet.FindActiveVehicleMain[intCounter].LastName;
                    NewVehicleRow.LicensePlate   = TheFindActiveVehicleMainDataSet.FindActiveVehicleMain[intCounter].LicensePlate;
                    NewVehicleRow.VehicleMake    = TheFindActiveVehicleMainDataSet.FindActiveVehicleMain[intCounter].VehicleMake;
                    NewVehicleRow.VehicleModel   = TheFindActiveVehicleMainDataSet.FindActiveVehicleMain[intCounter].VehicleModel;
                    NewVehicleRow.VehicleNumber  = TheFindActiveVehicleMainDataSet.FindActiveVehicleMain[intCounter].VehicleNumber;
                    NewVehicleRow.VehicleYear    = TheFindActiveVehicleMainDataSet.FindActiveVehicleMain[intCounter].VehicleYear;
                    NewVehicleRow.VINNumber      = TheFindActiveVehicleMainDataSet.FindActiveVehicleMain[intCounter].VINNumber;

                    TheActiveVehicleDataSet.activevehicles.Rows.Add(NewVehicleRow);
                }

                dgrResults.ItemsSource = TheActiveVehicleDataSet.activevehicles;
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Vehicle Roster // Window Loaded " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
Exemple #5
0
        private void expProcess_Expanded_1(object sender, RoutedEventArgs e)
        {
            int      intVehicleCounter;
            int      intVehicleNumberOfRecords;
            int      intAutomileCounter;
            int      intAutomileNumberOfRecords;
            int      intVehicleID;
            string   strVehicleNumber;
            string   strAutomileVehicleNumber;
            bool     blnItemFound;
            bool     blnItemEntered;
            int      intThirdCounter;
            string   strInOrOut;
            string   strManager;
            string   strFullName;
            string   strAssignedOffice;
            DateTime datStartDate;
            DateTime datEndDate;
            int      intRecordsReturned;
            int      intManagerID;

            try
            {
                expProcess.IsExpanded = false;

                //loading the vehicle data set
                TheFindActiveVehicleMainDataSet = TheVehicleMainClass.FindActiveVehicleMain();
                TheVehicleCurrentStatusDataSet.vehiclecurrentstatus.Rows.Clear();
                TheShortedCurrentVehicleDataSet.shortenlist.Rows.Clear();

                datStartDate = DateTime.Now;
                datStartDate = TheDateSearchClass.RemoveTime(datStartDate);
                datEndDate   = TheDateSearchClass.AddingDays(datStartDate, 1);

                intVehicleNumberOfRecords  = TheFindActiveVehicleMainDataSet.FindActiveVehicleMain.Rows.Count - 1;
                intAutomileNumberOfRecords = TheAutomileImportDataSet.automileimport.Rows.Count - 1;
                gintThirdCounter           = 0;
                gintThirdNumberOfRecords   = 0;

                for (intVehicleCounter = 0; intVehicleCounter <= intVehicleNumberOfRecords; intVehicleCounter++)
                {
                    intVehicleID = TheFindActiveVehicleMainDataSet.FindActiveVehicleMain[intVehicleCounter].VehicleID;

                    if (intVehicleID != 9076)
                    {
                        strVehicleNumber = TheFindActiveVehicleMainDataSet.FindActiveVehicleMain[intVehicleCounter].VehicleNumber;

                        strAssignedOffice = TheFindActiveVehicleMainDataSet.FindActiveVehicleMain[intVehicleCounter].AssignedOffice;

                        TheFindCurrentAssignedVehicleMainByVehicleIDDataSet = TheVehicleAssignmentClass.FindCurrentAssignedVehicleMainByVehicleID(intVehicleID);

                        strFullName  = TheFindCurrentAssignedVehicleMainByVehicleIDDataSet.FindCurrentAssignedVehicleMainByVehicleID[0].FirstName + " ";
                        strFullName += TheFindCurrentAssignedVehicleMainByVehicleIDDataSet.FindCurrentAssignedVehicleMainByVehicleID[0].LastName;
                        intManagerID = TheFindCurrentAssignedVehicleMainByVehicleIDDataSet.FindCurrentAssignedVehicleMainByVehicleID[0].ManagerID;

                        TheFindEnmployeeByEmployeeIDDataSet = TheEmployeeClass.FindEmployeeByEmployeeID(intManagerID);

                        strManager  = TheFindEnmployeeByEmployeeIDDataSet.FindEmployeeByEmployeeID[0].FirstName + " ";
                        strManager += TheFindEnmployeeByEmployeeIDDataSet.FindEmployeeByEmployeeID[0].LastName;
                        strInOrOut  = "UNKNOWN";

                        if (TheFindCurrentAssignedVehicleMainByVehicleIDDataSet.FindCurrentAssignedVehicleMainByVehicleID[0].LastName == "WAREHOUSE")
                        {
                            strManager = "FLEET MANAGER";
                        }

                        TheFindVehicleInShopByVehicleIDDataSet = TheVehiclesInShopClass.FindVehicleMainInShopByVehicleID(intVehicleID);

                        TheFindVehicleInYardByVehicleIDAndDateRangeDataSet = TheVehicleInYardClass.FindVehiclesInYardByVehicleIDAndDateRange(intVehicleID, datStartDate, datEndDate);

                        intRecordsReturned = TheFindVehicleInYardByVehicleIDAndDateRangeDataSet.FindVehiclesInYardByVehicleIDAndDateRange.Rows.Count;

                        if (intRecordsReturned > 0)
                        {
                            strInOrOut = "IN YARD";
                        }

                        blnItemEntered = false;

                        for (intAutomileCounter = 0; intAutomileCounter <= intAutomileNumberOfRecords; intAutomileCounter++)
                        {
                            strAutomileVehicleNumber = TheAutomileImportDataSet.automileimport[intAutomileCounter].VehicleNumber;

                            blnItemFound = strAutomileVehicleNumber.Contains(strVehicleNumber);

                            if (blnItemFound == true)
                            {
                                strInOrOut = TheAutomileImportDataSet.automileimport[intAutomileCounter].IsInside;

                                if (strInOrOut == "YES")
                                {
                                    strInOrOut = "IN YARD";
                                }
                                else if (strInOrOut == "NO")
                                {
                                    strInOrOut = "OUT";
                                }

                                if (gintThirdCounter > 0)
                                {
                                    for (intThirdCounter = 0; gintThirdCounter <= gintThirdNumberOfRecords; intThirdCounter++)
                                    {
                                        if (strVehicleNumber == TheVehicleCurrentStatusDataSet.vehiclecurrentstatus[intThirdCounter].VehicleNumber)
                                        {
                                            if (strInOrOut == "YES")
                                            {
                                                TheVehicleCurrentStatusDataSet.vehiclecurrentstatus[intThirdCounter].InOrOut = "IN YARD";
                                            }
                                            else if (strInOrOut == "NO")
                                            {
                                                TheVehicleCurrentStatusDataSet.vehiclecurrentstatus[intThirdCounter].InOrOut = strInOrOut;
                                            }

                                            blnItemEntered = true;
                                        }
                                    }
                                }
                            }
                        }


                        intRecordsReturned = TheFindVehicleInShopByVehicleIDDataSet.FindVehicleMainInShopByVehicleID.Rows.Count;

                        if (intRecordsReturned > 0)
                        {
                            strInOrOut = "IN SHOP";
                        }

                        if (blnItemEntered == false)
                        {
                            VehicleCurrentStatusDataSet.vehiclecurrentstatusRow NewVehicleRow = TheVehicleCurrentStatusDataSet.vehiclecurrentstatus.NewvehiclecurrentstatusRow();

                            NewVehicleRow.AssignedOffice = strAssignedOffice;
                            NewVehicleRow.Manager        = strManager;
                            NewVehicleRow.Driver         = strFullName;
                            NewVehicleRow.InOrOut        = strInOrOut;
                            NewVehicleRow.VehicleNumber  = strVehicleNumber;

                            TheVehicleCurrentStatusDataSet.vehiclecurrentstatus.Rows.Add(NewVehicleRow);

                            ShortedCurrentVehicleDataSet.shortenlistRow SecondVehicleRow = TheShortedCurrentVehicleDataSet.shortenlist.NewshortenlistRow();

                            SecondVehicleRow.Driver        = strFullName;
                            SecondVehicleRow.VehicleNumber = strVehicleNumber;
                            SecondVehicleRow.InOrOut       = strInOrOut;

                            TheShortedCurrentVehicleDataSet.shortenlist.Rows.Add(SecondVehicleRow);
                        }
                    }
                }

                TheMessagesClass.InformationMessage("Processing the Report Is Completed");

                dgrResults.ItemsSource = TheVehicleCurrentStatusDataSet.vehiclecurrentstatus;
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Four Thirty Report // Main Window // Process Expander " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
        private bool RunVehicleExceptionReport(DateTime datStartDate)
        {
            bool     blnFatalError = false;
            int      intCounter;
            int      intNumberOfRecords;
            int      intVehicleID;
            int      intRecordsReturned;
            DateTime datEndDate;
            string   strFirstNamed = "";
            string   strLastName   = "";

            try
            {
                TheVehicleExceptionDataSet.vehicleexception.Rows.Clear();

                datEndDate = TheDateSearchClass.AddingDays(datStartDate, 1);

                TheFindActiveVehicleMainDataSet = TheVehicleMainClass.FindActiveVehicleMain();

                intNumberOfRecords = TheFindActiveVehicleMainDataSet.FindActiveVehicleMain.Rows.Count - 1;

                for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                {
                    intVehicleID = TheFindActiveVehicleMainDataSet.FindActiveVehicleMain[intCounter].VehicleID;

                    TheFindDailyVehicleInspectionByVehicleIDAndDateRangeDataSet = TheInspectionClass.FindDailyVehicleInspectionByVehicleIDAndDateRange(intVehicleID, datStartDate, datEndDate);

                    intRecordsReturned = TheFindDailyVehicleInspectionByVehicleIDAndDateRangeDataSet.FindDailyVehicleInspectionsByVehicleIDAndDateRange.Rows.Count;

                    if (intRecordsReturned == 0)
                    {
                        TheFindVehicleInYardByVehicleIDAndDateRangeDataSet = TheVehicleInYardClass.FindVehiclesInYardByVehicleIDAndDateRange(intVehicleID, datStartDate, datEndDate);

                        intRecordsReturned = TheFindVehicleInYardByVehicleIDAndDateRangeDataSet.FindVehiclesInYardByVehicleIDAndDateRange.Rows.Count;

                        if (intRecordsReturned == 0)
                        {
                            TheFindVehicleInShopByVehicleIDDataSet = TheVehicleInShopClass.FindVehiclesInShopByVehicleID(intVehicleID);

                            intRecordsReturned = TheFindVehicleInShopByVehicleIDDataSet.FindVehiclesInShopByVehicleID.Rows.Count;

                            if (intRecordsReturned == 0)
                            {
                                TheFindcurrentAssignedVehicleMainByVehicleIDDataSet = TheVehicleAssignmentClass.FindCurrentAssignedVehicleMainByVehicleID(intVehicleID);

                                intRecordsReturned = TheFindcurrentAssignedVehicleMainByVehicleIDDataSet.FindCurrentAssignedVehicleMainByVehicleID.Rows.Count;

                                if (intRecordsReturned == 0)
                                {
                                    strLastName   = "NOT ASSIGNED";
                                    strFirstNamed = "NOT ASSIGNED";
                                }
                                else
                                {
                                    strLastName   = TheFindcurrentAssignedVehicleMainByVehicleIDDataSet.FindCurrentAssignedVehicleMainByVehicleID[0].LastName;
                                    strFirstNamed = TheFindcurrentAssignedVehicleMainByVehicleIDDataSet.FindCurrentAssignedVehicleMainByVehicleID[0].FirstName;
                                }

                                VehicleExceptionDataSet.vehicleexceptionRow NewVehicleRow = TheVehicleExceptionDataSet.vehicleexception.NewvehicleexceptionRow();

                                NewVehicleRow.AssignedOffice = TheFindActiveVehicleMainDataSet.FindActiveVehicleMain[intCounter].AssignedOffice;
                                NewVehicleRow.FirstName      = strFirstNamed;
                                NewVehicleRow.LastName       = strLastName;
                                NewVehicleRow.VehicleID      = intVehicleID;
                                NewVehicleRow.VehicleNumber  = TheFindActiveVehicleMainDataSet.FindActiveVehicleMain[intCounter].VehicleNumber;

                                TheVehicleExceptionDataSet.vehicleexception.Rows.Add(NewVehicleRow);
                            }
                        }
                    }
                }
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Automate Vehicle Reports // Run Vehicle Exception Report " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());

                blnFatalError = true;
            }

            return(blnFatalError);
        }
        private void cboSelectLocation_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            int    intSelectedIndex;
            string strAssignedOffice;
            int    intCounter;
            int    intNumberOfRecords;

            try
            {
                intSelectedIndex = cboSelectLocation.SelectedIndex - 2;
                TheActiveVehicleDataSet.activevehicles.Rows.Clear();

                if (intSelectedIndex == -1)
                {
                    TheFindActiveVehicleMainDataSet = TheVehicleMainClass.FindActiveVehicleMain();

                    intNumberOfRecords = TheFindActiveVehicleMainDataSet.FindActiveVehicleMain.Rows.Count - 1;

                    if (intNumberOfRecords > -1)
                    {
                        for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                        {
                            ActiveVehicleDataSet.activevehiclesRow NewVehicleRow = TheActiveVehicleDataSet.activevehicles.NewactivevehiclesRow();

                            NewVehicleRow.AssignedOffice = TheFindActiveVehicleMainDataSet.FindActiveVehicleMain[intCounter].AssignedOffice;
                            NewVehicleRow.FirstName      = TheFindActiveVehicleMainDataSet.FindActiveVehicleMain[intCounter].FirstName;
                            NewVehicleRow.LastName       = TheFindActiveVehicleMainDataSet.FindActiveVehicleMain[intCounter].LastName;
                            NewVehicleRow.LicensePlate   = TheFindActiveVehicleMainDataSet.FindActiveVehicleMain[intCounter].LicensePlate;
                            NewVehicleRow.VehicleID      = TheFindActiveVehicleMainDataSet.FindActiveVehicleMain[intCounter].VehicleID;
                            NewVehicleRow.VehicleMake    = TheFindActiveVehicleMainDataSet.FindActiveVehicleMain[intCounter].VehicleMake;
                            NewVehicleRow.VehicleModel   = TheFindActiveVehicleMainDataSet.FindActiveVehicleMain[intCounter].VehicleModel;
                            NewVehicleRow.VehicleNumber  = TheFindActiveVehicleMainDataSet.FindActiveVehicleMain[intCounter].VehicleNumber;
                            NewVehicleRow.VehicleYear    = TheFindActiveVehicleMainDataSet.FindActiveVehicleMain[intCounter].VehicleYear;
                            NewVehicleRow.VINNumber      = TheFindActiveVehicleMainDataSet.FindActiveVehicleMain[intCounter].VINNumber;

                            TheActiveVehicleDataSet.activevehicles.Rows.Add(NewVehicleRow);
                        }
                    }
                }
                else if (intSelectedIndex > -1)
                {
                    strAssignedOffice = TheFindWarehouseDataSet.FindWarehouses[intSelectedIndex].FirstName;

                    TheFindActiveVehicleMainByLocationDataSet = TheVehicleMainClass.FindActiveVehicleMainByLocation(strAssignedOffice);

                    intNumberOfRecords = TheFindActiveVehicleMainByLocationDataSet.FindActiveVehicleMainByLocation.Rows.Count - 1;

                    if (intNumberOfRecords > -1)
                    {
                        for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                        {
                            ActiveVehicleDataSet.activevehiclesRow NewVehicleRow = TheActiveVehicleDataSet.activevehicles.NewactivevehiclesRow();

                            NewVehicleRow.AssignedOffice = strAssignedOffice;
                            NewVehicleRow.FirstName      = TheFindActiveVehicleMainByLocationDataSet.FindActiveVehicleMainByLocation[intCounter].FirstName;
                            NewVehicleRow.LastName       = TheFindActiveVehicleMainByLocationDataSet.FindActiveVehicleMainByLocation[intCounter].LastName;
                            NewVehicleRow.LicensePlate   = TheFindActiveVehicleMainByLocationDataSet.FindActiveVehicleMainByLocation[intCounter].LicensePlate;
                            NewVehicleRow.VehicleID      = TheFindActiveVehicleMainByLocationDataSet.FindActiveVehicleMainByLocation[intCounter].VehicleID;
                            NewVehicleRow.VehicleMake    = TheFindActiveVehicleMainByLocationDataSet.FindActiveVehicleMainByLocation[intCounter].VehicleMake;
                            NewVehicleRow.VehicleModel   = TheFindActiveVehicleMainByLocationDataSet.FindActiveVehicleMainByLocation[intCounter].VehicleModel;
                            NewVehicleRow.VehicleNumber  = TheFindActiveVehicleMainByLocationDataSet.FindActiveVehicleMainByLocation[intCounter].VehicleNumber;
                            NewVehicleRow.VehicleYear    = TheFindActiveVehicleMainByLocationDataSet.FindActiveVehicleMainByLocation[intCounter].VehicleYear;
                            NewVehicleRow.VINNumber      = TheFindActiveVehicleMainByLocationDataSet.FindActiveVehicleMainByLocation[intCounter].VINNumber;

                            TheActiveVehicleDataSet.activevehicles.Rows.Add(NewVehicleRow);
                        }
                    }
                }

                dgrVehicleRoster.ItemsSource = TheActiveVehicleDataSet.activevehicles;
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "New Blue Jay ERP // Vehicle Roster // Combo Box Selection " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
Exemple #8
0
        private void mitGenerateReport_Click(object sender, RoutedEventArgs e)
        {
            int      intCounter;
            int      intNumberOfRecords;
            int      intVehicleID;
            int      intRecordsReturned;
            DateTime datStartDate = DateTime.Now;
            DateTime datEndDate;
            string   strFirstNamed = "";
            string   strLastName   = "";

            try
            {
                TheVehicleExceptionDataSet.vehicleexception.Rows.Clear();

                datStartDate = TheDateSearchClass.RemoveTime(datStartDate);

                datEndDate = TheDateSearchClass.AddingDays(datStartDate, 1);

                TheFindActiveVehicleMainDataSet = TheVehicleMainClass.FindActiveVehicleMain();

                intNumberOfRecords = TheFindActiveVehicleMainDataSet.FindActiveVehicleMain.Rows.Count - 1;

                for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                {
                    intVehicleID = TheFindActiveVehicleMainDataSet.FindActiveVehicleMain[intCounter].VehicleID;

                    TheFindDailyVehicleInspectionByVehicleIDAndDateRangeDataSete = TheInspectionClass.FindDailyVehicleInspectionByVehicleIDAndDateRange(intVehicleID, datStartDate, datEndDate);

                    intRecordsReturned = TheFindDailyVehicleInspectionByVehicleIDAndDateRangeDataSete.FindDailyVehicleInspectionsByVehicleIDAndDateRange.Rows.Count;

                    if (intRecordsReturned == 0)
                    {
                        TheFindVehicleInYardByVehicleIDAndDateRangeDataSet = TheVehicleInYardClass.FindVehiclesInYardByVehicleIDAndDateRange(intVehicleID, datStartDate, datEndDate);

                        intRecordsReturned = TheFindVehicleInYardByVehicleIDAndDateRangeDataSet.FindVehiclesInYardByVehicleIDAndDateRange.Rows.Count;

                        if (intRecordsReturned == 0)
                        {
                            TheFindVehicleMainInShopByVehicleIDDataSet = TheVehicleInShopClass.FindVehicleMainInShopByVehicleID(intVehicleID);

                            intRecordsReturned = TheFindVehicleMainInShopByVehicleIDDataSet.FindVehicleMainInShopByVehicleID.Rows.Count;

                            if (intRecordsReturned == 0)
                            {
                                TheFindcurrentAssignedVehicleMainByVehicleIDDataSet = TheVehicleAssignmentClass.FindCurrentAssignedVehicleMainByVehicleID(intVehicleID);

                                intRecordsReturned = TheFindcurrentAssignedVehicleMainByVehicleIDDataSet.FindCurrentAssignedVehicleMainByVehicleID.Rows.Count;

                                if (intRecordsReturned == 0)
                                {
                                    strLastName   = "NOT ASSIGNED";
                                    strFirstNamed = "NOT ASSIGNED";
                                }
                                else
                                {
                                    strLastName   = TheFindcurrentAssignedVehicleMainByVehicleIDDataSet.FindCurrentAssignedVehicleMainByVehicleID[0].LastName;
                                    strFirstNamed = TheFindcurrentAssignedVehicleMainByVehicleIDDataSet.FindCurrentAssignedVehicleMainByVehicleID[0].FirstName;
                                }

                                VehicleExceptionDataSet.vehicleexceptionRow NewVehicleRow = TheVehicleExceptionDataSet.vehicleexception.NewvehicleexceptionRow();

                                NewVehicleRow.AssignedOffice = TheFindActiveVehicleMainDataSet.FindActiveVehicleMain[intCounter].AssignedOffice;
                                NewVehicleRow.FirstName      = strFirstNamed;
                                NewVehicleRow.LastName       = strLastName;
                                NewVehicleRow.VehicleID      = intVehicleID;
                                NewVehicleRow.VehicleNumber  = TheFindActiveVehicleMainDataSet.FindActiveVehicleMain[intCounter].VehicleNumber;

                                TheVehicleExceptionDataSet.vehicleexception.Rows.Add(NewVehicleRow);
                            }
                        }
                    }
                }

                dgrResults.ItemsSource = TheVehicleExceptionDataSet.vehicleexception;
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Vehicle Exception Report // Generate The Report Menu Item " + Ex.Message);

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