public FindVehicleAssignedByEmployeeIDDataSet FindVehicleAssignedByEmployeeID(int intEmployeeID) { try { aFindVehicleAssignedByEmployeeIDDataSet = new FindVehicleAssignedByEmployeeIDDataSet(); aFindVehicleAssignedByEmployeeIDTableAdapter = new FindVehicleAssignedByEmployeeIDDataSetTableAdapters.FindVehicleAssignedByEmployeeIDTableAdapter(); aFindVehicleAssignedByEmployeeIDTableAdapter.Fill(aFindVehicleAssignedByEmployeeIDDataSet.FindVehicleAssignedByEmployeeID, intEmployeeID); } catch (Exception Ex) { TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Vehicle Main Class // Find Vehicle Assigned By Employee ID " + Ex.Message); } return(aFindVehicleAssignedByEmployeeIDDataSet); }
private void cboSelectEmployee_SelectionChanged(object sender, SelectionChangedEventArgs e) { int intSelectedIndex; int intCounter; int intNumberOfRecords; int intSecondNumberOfRecords; int intSecondCounter; int intBJCNumber; int intToolCounter; int intToolNumberOfRecords; try { intSelectedIndex = cboSelectEmployee.SelectedIndex - 1; if (intSelectedIndex > -1) { TheEmployeeToolsDataSet.employeetools.Rows.Clear(); TheVehicleToolsDataSet.vehicletools.Rows.Clear(); MainWindow.gintEmployeeID = TheFindEmployeeByLastNameDataSet.FindEmployeeByLastName[intSelectedIndex].EmployeeID; MainWindow.gstrFirstName = TheFindEmployeeByLastNameDataSet.FindEmployeeByLastName[intSelectedIndex].FirstName; MainWindow.gstrLastName = TheFindEmployeeByLastNameDataSet.FindEmployeeByLastName[intSelectedIndex].LastName; TheFindToolsByEmployeeIDDataSet = TheToolsClass.FindToolsByEmployeeID(MainWindow.gintEmployeeID); intNumberOfRecords = TheFindToolsByEmployeeIDDataSet.FindToolsByEmployeeID.Rows.Count - 1; for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++) { EmployeeToolsDataSet.employeetoolsRow NewToolRow = TheEmployeeToolsDataSet.employeetools.NewemployeetoolsRow(); NewToolRow.ToolCategory = TheFindToolsByEmployeeIDDataSet.FindToolsByEmployeeID[intCounter].ToolCategory; NewToolRow.ToolDescription = TheFindToolsByEmployeeIDDataSet.FindToolsByEmployeeID[intCounter].ToolDescription; NewToolRow.ToolNotes = TheFindToolsByEmployeeIDDataSet.FindToolsByEmployeeID[intCounter].ToolNotes; NewToolRow.ToolID = TheFindToolsByEmployeeIDDataSet.FindToolsByEmployeeID[intCounter].ToolID; NewToolRow.TransactionDate = TheFindToolsByEmployeeIDDataSet.FindToolsByEmployeeID[intCounter].TransactionDate; TheEmployeeToolsDataSet.employeetools.Rows.Add(NewToolRow); } dgrTools.ItemsSource = TheEmployeeToolsDataSet.employeetools; //checking for a vehicle TheFindVehicleAssigedByEmployeeIDDataSet = TheVehicleMainClass.FindVehicleAssignedByEmployeeID(MainWindow.gintEmployeeID); intNumberOfRecords = TheFindVehicleAssigedByEmployeeIDDataSet.FindVehicleAssignedByEmployeeID.Rows.Count - 1; if (intNumberOfRecords == 0) { txtVehicleAssignment.Text = Convert.ToString(TheFindVehicleAssigedByEmployeeIDDataSet.FindVehicleAssignedByEmployeeID[0].BJCNumber); } else if (intNumberOfRecords > 0) { txtVehicleAssignment.Text = "Multiple"; } else { txtVehicleAssignment.Text = "None"; } if (intNumberOfRecords > -1) { for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++) { intBJCNumber = TheFindVehicleAssigedByEmployeeIDDataSet.FindVehicleAssignedByEmployeeID[intCounter].BJCNumber; TheFindEmployeeByLastNameDataSet = TheEmployeeClass.FindEmployeesByLastNameKeyWord(Convert.ToString(intBJCNumber)); intSecondNumberOfRecords = TheFindEmployeeByLastNameDataSet.FindEmployeeByLastName.Rows.Count - 1; for (intSecondCounter = 0; intSecondCounter <= intSecondNumberOfRecords; intSecondCounter++) { gintVehicleEmployeeID = TheFindEmployeeByLastNameDataSet.FindEmployeeByLastName[intSecondCounter].EmployeeID; TheFindToolsByEmployeeIDDataSet = TheToolsClass.FindToolsByEmployeeID(gintVehicleEmployeeID); intToolNumberOfRecords = TheFindToolsByEmployeeIDDataSet.FindToolsByEmployeeID.Rows.Count - 1; if (intToolNumberOfRecords > -1) { for (intToolCounter = 0; intToolCounter <= intToolNumberOfRecords; intToolCounter++) { VehicleToolsDataSet.vehicletoolsRow NewToolRow = TheVehicleToolsDataSet.vehicletools.NewvehicletoolsRow(); NewToolRow.BJCNumber = intBJCNumber; NewToolRow.ToolCategory = TheFindToolsByEmployeeIDDataSet.FindToolsByEmployeeID[intToolCounter].ToolCategory; NewToolRow.ToolDescription = TheFindToolsByEmployeeIDDataSet.FindToolsByEmployeeID[intToolCounter].ToolDescription; NewToolRow.ToolID = TheFindToolsByEmployeeIDDataSet.FindToolsByEmployeeID[intToolCounter].ToolID; NewToolRow.ToolNotes = TheFindToolsByEmployeeIDDataSet.FindToolsByEmployeeID[intToolCounter].ToolNotes; TheVehicleToolsDataSet.vehicletools.Rows.Add(NewToolRow); } } } } } dgrVehicleTools.ItemsSource = TheVehicleToolsDataSet.vehicletools; } } catch (Exception Ex) { TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Terminate Employee // Combo box Change Event " + Ex.Message); TheMessagesClass.ErrorMessage(Ex.ToString()); } }