private void mitRemoveEmployees_Click(object sender, RoutedEventArgs e) { int intCounter; int intNumberOfRecords; int intWarehouseID; string strHomeOffice; int intVehicleID; bool blnFatalError; int intTransactionID; try { intNumberOfRecords = TheFindVehicleMainDeactiveEmployeesDataSet.FindVehicleMainByDeactiveEmployees.Rows.Count - 1; for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++) { intVehicleID = TheFindVehicleMainDeactiveEmployeesDataSet.FindVehicleMainByDeactiveEmployees[intCounter].VehicleID; strHomeOffice = TheFindVehicleMainDeactiveEmployeesDataSet.FindVehicleMainByDeactiveEmployees[intCounter].AssignedOffice; intWarehouseID = FindWarehouseID(strHomeOffice); TheFindCurrentAssignedVehicleMainByVehicleIDDataSet = TheVehicleAssignmentClass.FindCurrentAssignedVehicleMainByVehicleID(intVehicleID); intTransactionID = TheFindCurrentAssignedVehicleMainByVehicleIDDataSet.FindCurrentAssignedVehicleMainByVehicleID[0].TransactionID; blnFatalError = TheVehicleMainClass.UpdateVehicleMainEmployeeID(intVehicleID, intWarehouseID); if (blnFatalError == true) { throw new Exception(); } blnFatalError = TheVehicleAssignmentClass.UpdateCurrentVehicleAssignment(intTransactionID, false); if (blnFatalError == true) { throw new Exception(); } blnFatalError = TheVehicleAssignmentClass.InsertVehicleAssignment(intVehicleID, intWarehouseID); if (blnFatalError == true) { throw new Exception(); } } TheMessagesClass.InformationMessage("Employees Have Been Removed from Vehicles"); TheFindVehicleMainDeactiveEmployeesDataSet = TheVehicleMainClass.FindVehicleMainByDeactiveEmployees(); dgrResults.ItemsSource = TheFindVehicleMainDeactiveEmployeesDataSet.FindVehicleMainByDeactiveEmployees; } catch (Exception Ex) { TheEventLogclass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Remove Employees From Vehicles // Remove Employess " + Ex.Message); TheMessagesClass.ErrorMessage(Ex.ToString()); } }
private void Window_Loaded(object sender, RoutedEventArgs e) { //this will load the grid TheFindVehicleMainDeactiveEmployeesDataSet = TheVehicleMainClass.FindVehicleMainByDeactiveEmployees(); dgrResults.ItemsSource = TheFindVehicleMainDeactiveEmployeesDataSet.FindVehicleMainByDeactiveEmployees; MainWindow.TheFindWarehousesDataSet = TheEmployeeClass.FindWarehouses(); }
public FindVehicleMainByDeactiveEmployeesDataSet FindVehicleMainByDeactiveEmployees() { try { aFindVehicleMainByDeactiveEmployeesDataSet = new FindVehicleMainByDeactiveEmployeesDataSet(); aFindVehicleMainbyDeactiveEmployeesTableAdapter = new FindVehicleMainByDeactiveEmployeesDataSetTableAdapters.FindVehicleMainByDeactiveEmployeesTableAdapter(); aFindVehicleMainbyDeactiveEmployeesTableAdapter.Fill(aFindVehicleMainByDeactiveEmployeesDataSet.FindVehicleMainByDeactiveEmployees); } catch (Exception Ex) { TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Vehicle Main Class // Find Vehicle Main By Deactive Employees " + Ex.Message); } return(aFindVehicleMainByDeactiveEmployeesDataSet); }