public FindDailyVehicleMainInspectionByDateMatchDataSet FindDailyVehicleMainInspectionByDateMatch(DateTime datTransactionDate) { try { aFindDailyVehicleMainInspectionByDateMatchDataSet = new FindDailyVehicleMainInspectionByDateMatchDataSet(); aFindDailyVehicleMainInspectionByDateMatchTableAdapter = new FindDailyVehicleMainInspectionByDateMatchDataSetTableAdapters.FindDailyVehicleMainInspectionByDateMatchTableAdapter(); aFindDailyVehicleMainInspectionByDateMatchTableAdapter.Fill(aFindDailyVehicleMainInspectionByDateMatchDataSet.FindDailyVehicleMainInspectionByDateMatch, datTransactionDate); } catch (Exception Ex) { TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Inspections Class // Find Daily Vehicle Main Inspection By Date Match " + Ex.Message); } return(aFindDailyVehicleMainInspectionByDateMatchDataSet); }
private void mitProcess_Click(object sender, RoutedEventArgs e) { //this will process the information string strValueForValidation; bool blnFatalError = false; bool blnThereIsAProblem = false; string strErrorMessage = ""; int intRecordsReturned; try { //data validation MainWindow.gstrVehicleNumber = txtEnterVehicleNumber.Text; TheFindActiveVehicleMainByVehicleNumberDataSet = TheVehicleMainClass.FindActiveVehicleMainByVehicleNumber(MainWindow.gstrVehicleNumber); intRecordsReturned = TheFindActiveVehicleMainByVehicleNumberDataSet.FindActiveVehicleMainByVehicleNumber.Rows.Count; if (intRecordsReturned == 0) { blnFatalError = true; strErrorMessage += "Vehicle Number Not Found\n"; } else { MainWindow.gintVehicleID = TheFindActiveVehicleMainByVehicleNumberDataSet.FindActiveVehicleMainByVehicleNumber[0].VehicleID; TheFindCurrentAssignedVehicleMainByVehicleIDDataSet = TheVehicleAssignmentClass.FindCurrentAssignedVehicleMainByVehicleID(MainWindow.gintVehicleID); if (TheFindCurrentAssignedVehicleMainByVehicleIDDataSet.FindCurrentAssignedVehicleMainByVehicleID[0].LastName == "WAREHOUSE") { blnFatalError = true; strErrorMessage += "Vehicle is Assigned to a Warehouse and\nMust Be Assigned to a Technician\n"; } } strValueForValidation = cboEmployee.SelectedItem.ToString(); if (strValueForValidation == "Select Employee") { blnFatalError = true; strErrorMessage += "The Employee Was Not Selected\n"; } strValueForValidation = txtOdometerReading.Text; blnThereIsAProblem = TheDataValidationClass.VerifyIntegerData(strValueForValidation); if (blnThereIsAProblem == true) { blnFatalError = true; strErrorMessage += "The Odometer Reading is not an Integer\n"; } else { MainWindow.gintOdometerReading = Convert.ToInt32(strValueForValidation); } if (cboGPSInstalled.SelectedIndex < 1) { blnFatalError = true; strErrorMessage += "The GPS Installed was not Selected\n"; } if (blnFatalError == true) { TheMessagesClass.ErrorMessage(strErrorMessage); return; } MainWindow.gdatTransactionDate = DateTime.Now; blnFatalError = TheInspectionsClass.InsertDailyVehicleInspection(MainWindow.gintVehicleID, MainWindow.gdatTransactionDate, MainWindow.gintEmployeeID, MainWindow.gstrInspectionStatus, MainWindow.gintOdometerReading); if (blnFatalError == true) { throw new Exception(); } blnFatalError = TheVehicleHistoryClass.InsertVehicleHistory(MainWindow.gintVehicleID, MainWindow.gintEmployeeID, MainWindow.TheVerifyLogonDataSet.VerifyLogon[0].EmployeeID); if (blnFatalError == true) { throw new Exception(); } blnFatalError = TheVehicleMainClass.UpdateVehicleMainEmployeeID(MainWindow.gintVehicleID, MainWindow.gintEmployeeID); if (blnFatalError == true) { TheMessagesClass.ErrorMessage("There Was a Problem, Contact ID"); return; } TheFindDailyVehicleMainInspectionByDateMatchDataSet = TheInspectionsClass.FindDailyVehicleMainInspectionByDateMatch(MainWindow.gdatTransactionDate); MainWindow.gintInspectionID = TheFindDailyVehicleMainInspectionByDateMatchDataSet.FindDailyVehicleMainInspectionByDateMatch[0].TransactionID; blnFatalError = TheInspectGPSClass.InsertInspectGPS(MainWindow.gintInspectionID, MainWindow.gstrInspectionType, gblnGPSInstalled); if (blnFatalError == true) { throw new Exception(); } TheVehicleStatusClass.UpdateVehicleStatus(MainWindow.gintVehicleID, gstrVehicleStatus, DateTime.Now); if (rdoPassedServiceRequired.IsChecked == true) { VehicleInspectionProblem VehicleInspectionProblem = new VehicleInspectionProblem(); VehicleInspectionProblem.ShowDialog(); } txtEnterVehicleNumber.Text = ""; cboEmployee.Items.Clear(); txtEnterLastName.Text = ""; txtOdometerReading.Text = ""; rdoPassed.IsChecked = false; rdoPassedServiceRequired.IsChecked = false; cboBodyDamageReported.SelectedIndex = 0; cboGPSInstalled.SelectedIndex = 0; } catch (Exception Ex) { TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Vehicle Data Entry // Daily Vehicle Inspection // Process Button " + Ex.Message); TheMessagesClass.ErrorMessage(Ex.ToString()); } }