public FindTrailerByEmployeeIDDataSet FindTrailerByEmployeeID(int intEmployeeID) { try { aFindTrailerByEmployeeIDDataSet = new FindTrailerByEmployeeIDDataSet(); aFindTrailerByEmployeeIDTableAdapter = new FindTrailerByEmployeeIDDataSetTableAdapters.FindTrailerByEmployeeIDTableAdapter(); aFindTrailerByEmployeeIDTableAdapter.Fill(aFindTrailerByEmployeeIDDataSet.FindTrailerByEmployeeID, intEmployeeID); } catch (Exception Ex) { TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Trailers Class // Find Trailer By Employee ID " + Ex.Message); } return(aFindTrailerByEmployeeIDDataSet); }
private void cboSelectEmployee_SelectionChanged(object sender, SelectionChangedEventArgs e) { int intSelectedIndex; int intRecordsReturned; intSelectedIndex = cboSelectEmployee.SelectedIndex - 1; if (intSelectedIndex > -1) { mitProcess.IsEnabled = false; MainWindow.gintEmployeeID = TheComboEmployeeDataSet.employees[intSelectedIndex].EmployeeID; if (TheComboEmployeeDataSet.employees[intSelectedIndex].LastName != "WAREHOUSE") { TheFindTrailerByEmployeeIDDataSet = TheTrailersClass.FindTrailerByEmployeeID(MainWindow.gintEmployeeID); intRecordsReturned = TheFindTrailerByEmployeeIDDataSet.FindTrailerByEmployeeID.Rows.Count; if (intRecordsReturned > 0) { TheMessagesClass.ErrorMessage("Employee Is Assigned to Trailer Number " + TheFindTrailerByEmployeeIDDataSet.FindTrailerByEmployeeID[0].TrailerNumber); return; } else { gblnAvailable = false; gstrHistoryNotes = "EMPLOYEE ASSIGNED TO TRAILER"; } } else { gblnAvailable = true; gstrHistoryNotes = "TRAILER RETURNED TO WAREHOUSE"; } mitProcess.IsEnabled = true; } }
private bool ProcessTrailerInspection() { bool blnFatalError = false; DateTime datTransactionDate = DateTime.Now; string strErrorMessage = ""; int intRecordsReturned; int intWarehouseID; int intTrailerID; string strHomeOffice; try { if (MainWindow.gintTrailerID == -1) { blnFatalError = true; strErrorMessage += "Trailer Was Not Entered\n"; } if (cboTrailerSelectEmployee.SelectedIndex < 1) { blnFatalError = true; strErrorMessage += "Employee Was Not Selected\n"; } if (cboTrailerDamageReported.SelectedIndex < 1) { blnFatalError = true; strErrorMessage += "Damage Reported Was Not Selected\n"; } if (blnFatalError == true) { TheMessagesClass.ErrorMessage(strErrorMessage); return(blnFatalError); } TheFindTrailerByEmployeeIDDataSet = TheTrailersClass.FindTrailerByEmployeeID(gintEmployeeID); intRecordsReturned = TheFindTrailerByEmployeeIDDataSet.FindTrailerByEmployeeID.Rows.Count; if (intRecordsReturned > 0) { if (gintTrailerID != TheFindTrailerByEmployeeIDDataSet.FindTrailerByEmployeeID[0].TrailerID) { TheFindEmployeeByEmployeeIDDataSet = TheEmployeeClass.FindEmployeeByEmployeeID(gintEmployeeID); if (TheFindEmployeeByEmployeeIDDataSet.FindEmployeeByEmployeeID[0].LastName != "WAREHOUSE") { const string message = "The Employee Is Already Assigned to a Trailer\nDo You Want To Sign Them Out"; const string caption = "Are You Sure"; MessageBoxResult result = MessageBox.Show(message, caption, MessageBoxButton.YesNo, MessageBoxImage.Question); if (result == MessageBoxResult.Yes) { intTrailerID = TheFindTrailerByEmployeeIDDataSet.FindTrailerByEmployeeID[0].TrailerID; strHomeOffice = TheFindEmployeeByEmployeeIDDataSet.FindEmployeeByEmployeeID[0].HomeOffice; intWarehouseID = FindWarehouseID(strHomeOffice); blnFatalError = TheTrailersClass.UpdateTrailerEmployeeAndAvailability(intTrailerID, intWarehouseID, true); if (blnFatalError == true) { throw new Exception(); } } } } } if (gstrInspectionStatus == "PASSED") { MainWindow.gstrInspectionProblem = "NO PROBLEMS REPORTED"; } else { TrailerInspectionProblems TrailerInspectionProblems = new TrailerInspectionProblems(); TrailerInspectionProblems.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, gintWarehouseEmployeeID, "TRAILER SIGNED OUT"); if (blnFatalError == true) { throw new Exception(); } blnFatalError = TheTrailersClass.UpdateTrailerEmployeeAndAvailability(MainWindow.gintTrailerID, gintEmployeeID, true); if (blnFatalError == true) { throw new Exception(); } TheMessagesClass.InformationMessage("The Trailer Inspection Has Been Entered"); ResetControls(); } catch (Exception Ex) { TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Daily Vehicle Data Entry // Daily Trailer Inspection // Process Menu Item " + Ex.Message); TheMessagesClass.ErrorMessage(Ex.ToString()); blnFatalError = true; } return(blnFatalError); }