private void mitProcess_Click(object sender, RoutedEventArgs e)
        {
            bool     blnFatalError      = false;
            DateTime datTransactionDate = DateTime.Now;
            string   strErrorMessage    = "";

            try
            {
                if (MainWindow.gintTrailerID == -1)
                {
                    blnFatalError    = true;
                    strErrorMessage += "Trailer Was Not Entered\n";
                }
                if (cboSelectEmployee.SelectedIndex < 1)
                {
                    blnFatalError    = true;
                    strErrorMessage += "Employee Was Not Selected\n";
                }
                if (cboDamageReported.SelectedIndex < 1)
                {
                    blnFatalError    = true;
                    strErrorMessage += "Damage Reported Was Not Selected\n";
                }
                if (blnFatalError == true)
                {
                    TheMessagesClass.ErrorMessage(strErrorMessage);
                    return;
                }
                if (gblnProblemReported == false)
                {
                    MainWindow.gstrInspectionProblem = "NO PROBLEMS REPORTED";
                }
                else
                {
                    InspectionTrailerProblems InspectionTrailerProblems = new InspectionTrailerProblems();
                    InspectionTrailerProblems.ShowDialog();
                }

                blnFatalError = TheDailyTrailerInspectionClass.InsertDailyTrailerInspection(MainWindow.gintTrailerID, MainWindow.gintEmployeeID, datTransactionDate, gstrInspectionStatus, MainWindow.gstrInspectionProblem);

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

                blnFatalError = TheTrailerHistoryClass.InsertTrailerHistory(MainWindow.gintTrailerID, MainWindow.gintEmployeeID, MainWindow.TheVerifyLogonDataSet.VerifyLogon[0].EmployeeID, "TRAILER SIGNED OUT");


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


                if (gstrInspectionStatus == "FAILED")
                {
                    PleaseWait pleaseWait = new PleaseWait();
                    pleaseWait.Show();

                    TheSendEmailClass.TrailerEmailMessage(txtEnterTrailerNumber.Text, MainWindow.gstrInspectionProblem);

                    pleaseWait.Close();
                }

                TheMessagesClass.InformationMessage("The Trailer Inspection Has Been Entered");

                ResetControls();
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Daily Trailer Inspection // Process Menu Item " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
Esempio n. 2
0
        private void mitImportExcel_Click(object sender, RoutedEventArgs e)
        {
            bool blnIsNotInteger = false;

            Excel.Application xlDropOrder;
            Excel.Workbook    xlDropBook;
            Excel.Worksheet   xlDropSheet;
            Excel.Range       range;

            string strInformation = "";
            int    intColumnRange = 0;
            int    intCounter;
            int    intNumberOfRecords;
            string strVehicleNumber;
            int    intVehicleID;
            int    intSecondCounter;
            int    intSecondNumberOfRecords;

            try
            {
                TheDOTAuditDataSet.dotaudit.Rows.Clear();

                Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
                dlg.FileName = "Document"; // Default file name
                // dlg.DefaultExt = ".csv"; // Default file extension
                //dlg.Filter = "Excel (.csv)|*.csv"; // Filter files by extension

                // Show open file dialog box
                Nullable <bool> result = dlg.ShowDialog();

                // Process open file dialog box results
                if (result == true)
                {
                    // Open document
                    string filename = dlg.FileName;
                }

                PleaseWait PleaseWait = new PleaseWait();
                PleaseWait.Show();

                xlDropOrder = new Excel.Application();
                xlDropBook  = xlDropOrder.Workbooks.Open(dlg.FileName, 0, true, 5, "", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);
                xlDropSheet = (Excel.Worksheet)xlDropOrder.Worksheets.get_Item(1);

                range = xlDropSheet.UsedRange;
                intNumberOfRecords = range.Rows.Count - 1;
                intColumnRange     = range.Columns.Count;

                for (intCounter = 2; intCounter <= intNumberOfRecords; intCounter++)
                {
                    strInformation = Convert.ToString((range.Cells[intCounter, 2] as Excel.Range).Value2);

                    strInformation  = strInformation.Substring(4, 4);
                    blnIsNotInteger = TheDataValidationClass.VerifyIntegerData(strInformation);
                    if (blnIsNotInteger == false)
                    {
                        DOTAuditDataSet.dotauditRow NewVehicleRow = TheDOTAuditDataSet.dotaudit.NewdotauditRow();

                        strVehicleNumber = strInformation;
                        TheFindActiveVehicleBVehicleNumberDataSet = TheVehicleMainClass.FindActiveVehicleMainByVehicleNumber(strVehicleNumber);
                        intVehicleID                = TheFindActiveVehicleBVehicleNumberDataSet.FindActiveVehicleMainByVehicleNumber[0].VehicleID;
                        NewVehicleRow.VehicleID     = intVehicleID;
                        NewVehicleRow.VehicleNumber = strVehicleNumber;
                        NewVehicleRow.VIN           = TheFindActiveVehicleBVehicleNumberDataSet.FindActiveVehicleMainByVehicleNumber[0].VINNumber;

                        TheDOTAuditDataSet.dotaudit.Rows.Add(NewVehicleRow);
                    }
                }

                ThefindActiveVehicleMainSortedDataSet = TheVehicleMainClass.FindActiveVehicleMainSorted();

                intNumberOfRecords = ThefindActiveVehicleMainSortedDataSet.FindActiveVehicleMainSorted.Rows.Count - 1;

                intSecondNumberOfRecords = TheDOTAuditDataSet.dotaudit.Rows.Count - 1;

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

                    for (intSecondCounter = 0; intSecondCounter <= intSecondNumberOfRecords; intSecondCounter++)
                    {
                        if (intVehicleID == TheDOTAuditDataSet.dotaudit[intSecondCounter].VehicleID)
                        {
                            DOTAuditDataSet.dotauditRow NewVehicleRow = TheSortedDOTAuditDataSete.dotaudit.NewdotauditRow();

                            NewVehicleRow.VehicleNumber = TheDOTAuditDataSet.dotaudit[intSecondCounter].VehicleNumber;
                            NewVehicleRow.VehicleID     = intVehicleID;
                            NewVehicleRow.VIN           = TheDOTAuditDataSet.dotaudit[intSecondCounter].VIN;

                            TheSortedDOTAuditDataSete.dotaudit.Rows.Add(NewVehicleRow);
                        }
                    }
                }

                PleaseWait.Close();
                dgrResults.ItemsSource = TheSortedDOTAuditDataSete.dotaudit;
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // DOT Audit Report // Import Excel Menu Item " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
Esempio n. 3
0
        private void mitSave_Click(object sender, RoutedEventArgs e)
        {
            //setting local variables
            string strPartNumber;
            int    intPartID;
            string strDescription;
            string strJDEPartNumber;
            double douPrice = 0;
            string strValueForValidation;
            bool   blnFatalError      = false;
            bool   blnThereIsAProblem = false;
            string strErrorMessage    = "";
            int    intRecordsReturned;
            int    intRecordCounter;
            bool   blnRecordMatch;

            PleaseWait PleaseWait = new PleaseWait();

            PleaseWait.Show();

            try
            {
                //data validation
                strPartNumber = txtPartNumber.Text;
                intPartID     = Convert.ToInt32(txtPartID.Text);
                if (strPartNumber == "")
                {
                    blnFatalError    = true;
                    strErrorMessage += "Part Number Was Not Entered\n";
                }
                strJDEPartNumber = txtJDEPartNumber.Text;
                if (strJDEPartNumber == "")
                {
                    blnFatalError    = true;
                    strErrorMessage += "JDE Part Number Was Not Entered\n";
                }
                strDescription = txtDescription.Text;
                if (strDescription == "")
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Description Was Not Entered\n";
                }
                strValueForValidation = txtPrice.Text;
                blnThereIsAProblem    = TheDataValidationClass.VerifyDoubleData(strValueForValidation);
                if (blnThereIsAProblem == true)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Price Entered in not Numeric\n";
                }
                else
                {
                    douPrice = Convert.ToDouble(strValueForValidation);
                }
                if (blnFatalError == true)
                {
                    PleaseWait.Close();
                    TheMessagesClass.ErrorMessage(strErrorMessage);
                    return;
                }

                //validation to see if the part number is used with another row
                TheFindPartByPartNumberDataSet = ThePartNumberClass.FindPartByPartNumber(strPartNumber);

                intRecordsReturned = TheFindPartByPartNumberDataSet.FindPartByPartNumber.Rows.Count;

                if (intRecordsReturned > 0)
                {
                    blnRecordMatch = false;

                    for (intRecordCounter = 0; intRecordCounter <= intRecordsReturned - 1; intRecordCounter++)
                    {
                        if (strPartNumber == TheFindPartByPartNumberDataSet.FindPartByPartNumber[intRecordCounter].PartNumber)
                        {
                            if (intPartID != TheFindPartByPartNumberDataSet.FindPartByPartNumber[intRecordCounter].PartID)
                            {
                                blnRecordMatch = true;
                            }
                        }
                    }

                    if (blnRecordMatch == true)
                    {
                        TheMessagesClass.ErrorMessage("Part Number Exists with a Different Part ID");
                        return;
                    }
                }


                if ((strJDEPartNumber != "NOT REQUIRED") && (strJDEPartNumber != "NOT PROVIDED"))
                {
                    TheFindPartByJDEPartNumberDataSet = ThePartNumberClass.FindPartByJDEPartNumber(strJDEPartNumber);

                    intRecordsReturned = TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber.Rows.Count;

                    if (intRecordsReturned > 0)
                    {
                        blnRecordMatch = false;

                        for (intRecordCounter = 0; intRecordCounter <= intRecordsReturned - 1; intRecordCounter++)
                        {
                            if (strJDEPartNumber == TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber[intRecordCounter].JDEPartNumber)
                            {
                                if (intPartID != TheFindPartByJDEPartNumberDataSet.FindPartByJDEPartNumber[intRecordCounter].PartID)
                                {
                                    blnRecordMatch = true;
                                }
                            }
                        }

                        if (blnRecordMatch == true)
                        {
                            TheMessagesClass.ErrorMessage("JDE Part Number Exists with a Different Part ID");
                            return;
                        }
                    }
                }

                //doing the loop
                blnFatalError = ThePartNumberClass.UpdatePartInformation(intPartID, strJDEPartNumber, strDescription, true, float.Parse(txtPrice.Text));

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

                TheMessagesClass.InformationMessage("The Part Has Been Updated");

                ClearControls();
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Edit Parts // Save Menu Item " + Ex.Message);

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

            PleaseWait.Close();
        }
Esempio n. 4
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();
            }
        }
        private void mitPrint_Click(object sender, RoutedEventArgs e)
        {
            int intCurrentRow = 0;
            int intCounter;
            int intColumns;
            int intNumberOfRecords;

            PleaseWait PleaseWait = new PleaseWait();

            PleaseWait.Show();

            try
            {
                PrintDialog pdCancelledReport = new PrintDialog();

                if (pdCancelledReport.ShowDialog().Value)
                {
                    FlowDocument fdCancelledLines = new FlowDocument();
                    Thickness    thickness        = new Thickness(100, 50, 50, 50);
                    fdCancelledLines.PagePadding = thickness;

                    //Set Up Table Columns
                    Table cancelledTable = new Table();
                    fdCancelledLines.Blocks.Add(cancelledTable);
                    cancelledTable.CellSpacing = 0;
                    intColumns = TheFindVehicleInYardByDateRangeDataSet.FindVehiclesInYardByDateRange.Columns.Count;

                    for (int intColumnCounter = 0; intColumnCounter < intColumns; intColumnCounter++)
                    {
                        cancelledTable.Columns.Add(new TableColumn());
                    }
                    cancelledTable.RowGroups.Add(new TableRowGroup());

                    //Title row
                    cancelledTable.RowGroups[0].Rows.Add(new TableRow());
                    TableRow newTableRow = cancelledTable.RowGroups[0].Rows[intCurrentRow];
                    newTableRow.Cells.Add(new TableCell(new Paragraph(new Run("Vehicles In Yard Report"))));
                    newTableRow.Cells[0].FontSize      = 20;
                    newTableRow.Cells[0].FontFamily    = new FontFamily("Times New Roman");
                    newTableRow.Cells[0].ColumnSpan    = intColumns;
                    newTableRow.Cells[0].TextAlignment = TextAlignment.Center;
                    newTableRow.Cells[0].Padding       = new Thickness(0, 0, 0, 20);

                    //Header Row
                    cancelledTable.RowGroups[0].Rows.Add(new TableRow());
                    intCurrentRow++;
                    newTableRow = cancelledTable.RowGroups[0].Rows[intCurrentRow];
                    newTableRow.Cells.Add(new TableCell(new Paragraph(new Run("Vehicle Number"))));
                    newTableRow.Cells.Add(new TableCell(new Paragraph(new Run("First Name"))));
                    newTableRow.Cells.Add(new TableCell(new Paragraph(new Run("Last Name"))));
                    newTableRow.Cells.Add(new TableCell(new Paragraph(new Run("Assigned Office"))));
                    newTableRow.Cells.Add(new TableCell(new Paragraph(new Run("Transaction Date"))));

                    //Format Header Row
                    for (intCounter = 0; intCounter < intColumns; intCounter++)
                    {
                        newTableRow.Cells[intCounter].FontSize        = 11;
                        newTableRow.Cells[intCounter].FontFamily      = new FontFamily("Times New Roman");
                        newTableRow.Cells[intCounter].BorderBrush     = Brushes.Black;
                        newTableRow.Cells[intCounter].TextAlignment   = TextAlignment.Center;
                        newTableRow.Cells[intCounter].BorderThickness = new Thickness();
                    }

                    intNumberOfRecords = TheFindVehicleInYardByDateRangeDataSet.FindVehiclesInYardByDateRange.Rows.Count;

                    //Data, Format Data

                    for (int intReportRowCounter = 0; intReportRowCounter < intNumberOfRecords; intReportRowCounter++)
                    {
                        cancelledTable.RowGroups[0].Rows.Add(new TableRow());
                        intCurrentRow++;
                        newTableRow = cancelledTable.RowGroups[0].Rows[intCurrentRow];
                        for (int intColumnCounter = 0; intColumnCounter < intColumns; intColumnCounter++)
                        {
                            newTableRow.Cells.Add(new TableCell(new Paragraph(new Run(TheFindVehicleInYardByDateRangeDataSet.FindVehiclesInYardByDateRange[intReportRowCounter][intColumnCounter].ToString()))));


                            newTableRow.Cells[intColumnCounter].FontSize = 12;
                            newTableRow.Cells[0].FontFamily = new FontFamily("Times New Roman");
                            newTableRow.Cells[intColumnCounter].BorderBrush     = Brushes.LightSteelBlue;
                            newTableRow.Cells[intColumnCounter].BorderThickness = new Thickness(0, 0, 0, 1);
                            newTableRow.Cells[intColumnCounter].TextAlignment   = TextAlignment.Center;
                        }
                    }

                    //Set up page and print
                    fdCancelledLines.ColumnWidth = pdCancelledReport.PrintableAreaWidth;
                    fdCancelledLines.PageHeight  = pdCancelledReport.PrintableAreaHeight;
                    fdCancelledLines.PageWidth   = pdCancelledReport.PrintableAreaWidth;
                    pdCancelledReport.PrintDocument(((IDocumentPaginatorSource)fdCancelledLines).DocumentPaginator, "Vehicle Exception Report");
                    intCurrentRow = 0;
                }
            }
            catch (Exception Ex)
            {
                TheMessagesClass.ErrorMessage(Ex.ToString());

                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Vehicles In Yard Report // Print Menu Item " + Ex.Message);
            }

            PleaseWait.Close();
        }