Ejemplo n.º 1
0
        public FindDailyVehicleInspectionProblemByVehicleIDAndDateRangeDataSet FindDailyVehicleInspectionProblemByVehicleIDAndDateRange(int intVehicleID, DateTime datStartDate, DateTime datEndDate)
        {
            try
            {
                aFindDailyVehicleInspectionProblemsByVehicleIDAndDateRangeDataSet      = new FindDailyVehicleInspectionProblemByVehicleIDAndDateRangeDataSet();
                aFindDailyVehicleInspectionProblemsByVehicleIDAndDateRangeTableAdapter = new FindDailyVehicleInspectionProblemByVehicleIDAndDateRangeDataSetTableAdapters.FindDailyVehicleInspectionProblemsByVehicleIDAndDateRangeTableAdapter();
                aFindDailyVehicleInspectionProblemsByVehicleIDAndDateRangeTableAdapter.Fill(aFindDailyVehicleInspectionProblemsByVehicleIDAndDateRangeDataSet.FindDailyVehicleInspectionProblemsByVehicleIDAndDateRange, intVehicleID, datStartDate, datEndDate);
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Inspections Class // Find Daily Vehicle Inspection Problems By Vehicle ID and Date Range " + Ex.Message);
            }

            return(aFindDailyVehicleInspectionProblemsByVehicleIDAndDateRangeDataSet);
        }
Ejemplo n.º 2
0
        private void mitPrint_Click(object sender, RoutedEventArgs e)
        {
            //setting local variables
            int      intCounter;
            int      intNumberOfRecords;
            int      intVehicleID;
            DateTime datTransactionDate;
            int      intSecondCounter;
            int      intSecondNumberOfRecords;
            string   strInspectStatus;
            string   strVehicleProblem;
            string   strInspectionNotes;
            int      intThirdCounter;
            int      intThirdNumberOfRecords;


            pdProblemReport = new PrintDialog();

            if (pdProblemReport.ShowDialog().Value)
            {
                PleaseWait PleaseWait = new PleaseWait();
                PleaseWait.Show();

                try
                {
                    gdatEndDate = DateTime.Now;

                    gdatEndDate = TheDateSearchClass.RemoveTime(gdatEndDate);

                    gdatStartDate = TheDateSearchClass.SubtractingDays(gdatEndDate, 200);

                    intNumberOfRecords = TheSortedDOTAuditDataSete.dotaudit.Rows.Count - 1;

                    for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++)
                    {
                        TheDOTVehicleInspectionDataSet.inspectionresults.Rows.Clear();

                        intVehicleID = TheSortedDOTAuditDataSete.dotaudit[intCounter].VehicleID;

                        TheFindDailyVehicleInspectionByVehicleIDAndDateRangeDataSet = TheInspectionsClass.FindDailyVehicleInspectionByVehicleIDAndDateRange(intVehicleID, gdatStartDate, gdatEndDate);

                        intSecondNumberOfRecords = TheFindDailyVehicleInspectionByVehicleIDAndDateRangeDataSet.FindDailyVehicleInspectionsByVehicleIDAndDateRange.Rows.Count - 1;

                        for (intSecondCounter = 0; intSecondCounter <= intSecondNumberOfRecords; intSecondCounter++)
                        {
                            strInspectStatus   = TheFindDailyVehicleInspectionByVehicleIDAndDateRangeDataSet.FindDailyVehicleInspectionsByVehicleIDAndDateRange[intSecondCounter].InspectionStatus;
                            datTransactionDate = TheFindDailyVehicleInspectionByVehicleIDAndDateRangeDataSet.FindDailyVehicleInspectionsByVehicleIDAndDateRange[intSecondCounter].InspectionDate;
                            datTransactionDate = TheDateSearchClass.RemoveTime(datTransactionDate);
                            strVehicleProblem  = "";
                            strInspectionNotes = "";

                            if (strInspectStatus == "PASSED")
                            {
                                strVehicleProblem  = "NO PROBLEM REPORTED";
                                strInspectionNotes = "NO PROBLEM REPORTED";
                            }
                            else
                            {
                                TheFindDailyVehicleInspectionProblemByVehicleIDAndDateRangeDataSet = TheInspectionsClass.FindDailyVehicleInspectionProblemByVehicleIDAndDateRange(intVehicleID, datTransactionDate, datTransactionDate.AddDays(1));

                                intThirdNumberOfRecords = TheFindDailyVehicleInspectionProblemByVehicleIDAndDateRangeDataSet.FindDailyVehicleInspectionProblemsByVehicleIDAndDateRange.Rows.Count - 1;

                                for (intThirdCounter = 0; intThirdCounter <= intThirdNumberOfRecords; intThirdCounter++)
                                {
                                    if (TheFindDailyVehicleInspectionProblemByVehicleIDAndDateRangeDataSet.FindDailyVehicleInspectionProblemsByVehicleIDAndDateRange[intThirdCounter].VehicleProblem == null)
                                    {
                                        strVehicleProblem = TheFindDailyVehicleInspectionProblemByVehicleIDAndDateRangeDataSet.FindDailyVehicleInspectionProblemsByVehicleIDAndDateRange[intThirdCounter].InspectionNotes + "\n";
                                    }
                                    else
                                    {
                                        strVehicleProblem = TheFindDailyVehicleInspectionProblemByVehicleIDAndDateRangeDataSet.FindDailyVehicleInspectionProblemsByVehicleIDAndDateRange[intThirdCounter].VehicleProblem + "\n";
                                    }

                                    strInspectionNotes = TheFindDailyVehicleInspectionProblemByVehicleIDAndDateRangeDataSet.FindDailyVehicleInspectionProblemsByVehicleIDAndDateRange[intThirdCounter].InspectionNotes + "\n";
                                }
                            }


                            DOTVehicleInspectionDataSet.inspectionresultsRow NewInspectionRow = TheDOTVehicleInspectionDataSet.inspectionresults.NewinspectionresultsRow();

                            NewInspectionRow.VehicleNumber    = TheSortedDOTAuditDataSete.dotaudit[intCounter].VehicleNumber;
                            NewInspectionRow.InspectionNotes  = strInspectionNotes;
                            NewInspectionRow.InspectionStatus = strInspectStatus;
                            NewInspectionRow.OdometerReading  = TheFindDailyVehicleInspectionByVehicleIDAndDateRangeDataSet.FindDailyVehicleInspectionsByVehicleIDAndDateRange[intSecondCounter].OdometerReading;
                            NewInspectionRow.TransactionDate  = datTransactionDate;
                            NewInspectionRow.VehicleProblem   = strVehicleProblem;

                            TheDOTVehicleInspectionDataSet.inspectionresults.Rows.Add(NewInspectionRow);
                        }

                        PrintReports();
                    }

                    dgrResults.ItemsSource = TheDOTVehicleInspectionDataSet.inspectionresults;
                }
                catch (Exception Ex)
                {
                    TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // DOT Audit Report // Process Menu Item " + Ex.Message);

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

                PleaseWait.Close();
            }
        }