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

            try
            {
                if (cboSelectVendor.SelectedIndex < 1)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Vendor was not Selected\n";
                }
                strProblemReported = txtProblemReported.Text;
                if (strProblemReported.Length < 20)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Problem Reported is not Long Enough\n";
                }
                if (blnFatalError == true)
                {
                    TheMessagesClass.ErrorMessage(strErrorMessage);
                    return;
                }

                intEmployeeID = MainWindow.TheVerifyLogonDataSet.VerifyLogon[0].EmployeeID;

                blnFatalError = TheTrailerProblemClass.InsertTrailerProblem(MainWindow.gintTrailerID, datTransactionDate, intEmployeeID, strProblemReported, MainWindow.gintVendorID);

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

                TheFindTrailerProblemByDateMatchDataSet = TheTrailerProblemClass.FindTrailerProblemByDateMatch(datTransactionDate);

                MainWindow.gintProblemID = TheFindTrailerProblemByDateMatchDataSet.FindTrailerProblemByDateMatch[0].ProblemID;

                blnFatalError = TheTrailerProblemUpdateClass.InsertTrailerProblemUpdate(MainWindow.gintProblemID, intEmployeeID, strProblemReported);

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

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

                btnAddDocuments.IsEnabled = true;
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Created Trailer Problem // Process Button " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }
        public FindTrailerProblemByDateMatchDataSet FindTrailerProblemByDateMatch(DateTime datTransactionDate)
        {
            try
            {
                aFindTrailerProblemByDateMatchDataSet      = new FindTrailerProblemByDateMatchDataSet();
                aFindTrailerProblemByDateMatchTableAdapter = new FindTrailerProblemByDateMatchDataSetTableAdapters.FindTrailerProblemByDateMatchTableAdapter();
                aFindTrailerProblemByDateMatchTableAdapter.Fill(aFindTrailerProblemByDateMatchDataSet.FindTrailerProblemByDateMatch, datTransactionDate);
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Trailer Problem Class // Find Trailer Problem By Date Match " + Ex.Message);
            }

            return(aFindTrailerProblemByDateMatchDataSet);
        }
        private void expProcess_Expanded(object sender, RoutedEventArgs e)
        {
            //setting local variables
            bool     blnFatalError      = false;
            DateTime datTransactionDate = DateTime.Now;
            string   strTrailerProblem;
            string   strErrorMessage = "";
            int      intTrailerProblemLength;

            try
            {
                if (cboNewProblem.SelectedIndex == 0)
                {
                    blnFatalError    = true;
                    strErrorMessage += "New Problem Was Not Selected\n";
                }
                strTrailerProblem       = txtEnterProblem.Text;
                intTrailerProblemLength = strTrailerProblem.Length;
                if (intTrailerProblemLength < 10)
                {
                    blnFatalError    = true;
                    strErrorMessage += "The Problem Entered Is Not Long Enough\n";
                }
                if (blnFatalError == true)
                {
                    TheMessagesClass.ErrorMessage(strErrorMessage);
                    return;
                }

                if (cboNewProblem.SelectedIndex == 1)
                {
                    blnFatalError = TheTrailerProblemClass.InsertTrailerProblem(MainWindow.gintTrailerID, datTransactionDate, MainWindow.gintWarehouseEmployeeID, strTrailerProblem, 1001);

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

                    TheFindTrailerProblemByDateMatchDataSet = TheTrailerProblemClass.FindTrailerProblemByDateMatch(datTransactionDate);

                    MainWindow.gintProblemID = TheFindTrailerProblemByDateMatchDataSet.FindTrailerProblemByDateMatch[0].ProblemID;
                }

                if (MainWindow.gintProblemID == -1)
                {
                    TheMessagesClass.ErrorMessage("A Problem was not Selected");
                    return;
                }

                blnFatalError = TheTrailerProblemUpdateClass.InsertTrailerProblemUpdate(MainWindow.gintProblemID, MainWindow.gintWarehouseEmployeeID, strTrailerProblem);

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

                TheMessagesClass.InformationMessage("Problem Was Entered");

                MainWindow.gstrInspectionProblem += strTrailerProblem + "\n";

                MainWindow.gintProblemID = 0;
                txtEnterProblem.Text     = "";

                TheFindOpenTrailerProblemsByTrailerIDDataSet = TheTrailerProblemClass.FindOpenTrailerProblemsByTrailerID(MainWindow.gintTrailerID);

                dgrCurrentProblems.ItemsSource = TheFindOpenTrailerProblemsByTrailerIDDataSet.FindOpenTrailerProblemByTrailerID;

                cboNewProblem.IsEnabled     = true;
                cboNewProblem.SelectedIndex = 0;
                Close();
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay Communications // Inspection Trailer Problem // Process Menu Item " + Ex.Message);

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