private void cboSelectCategory_SelectionChanged(object sender, SelectionChangedEventArgs e) { int intSelectedIndex; string strCategory; int intCounter; int intNumberOfRecords; int intCurrentLocation; try { intSelectedIndex = cboSelectCategory.SelectedIndex - 1; if (intSelectedIndex > -1) { strCategory = TheFindSortedToolCategoryDataSet.FindSortedToolCategory[intSelectedIndex].ToolCategory; TheCurrentToolsDataSet.currenttools.Rows.Clear(); TheFindToolsByCategoryDataSet = TheToolsClass.FindToolsByCategory(strCategory); intNumberOfRecords = TheFindToolsByCategoryDataSet.FindToolsByCategory.Rows.Count - 1; for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++) { intCurrentLocation = TheFindToolsByCategoryDataSet.FindToolsByCategory[intCounter].CurrentLocation; TheFindEmployeeByEmployeeIDDataSet = TheEmployeeClass.FindEmployeeByEmployeeID(intCurrentLocation); CurrentToolsDataSet.currenttoolsRow NewToolRow = TheCurrentToolsDataSet.currenttools.NewcurrenttoolsRow(); NewToolRow.AssignedOffice = TheFindEmployeeByEmployeeIDDataSet.FindEmployeeByEmployeeID[0].FirstName; NewToolRow.Description = TheFindToolsByCategoryDataSet.FindToolsByCategory[intCounter].ToolDescription; NewToolRow.FirstName = TheFindToolsByCategoryDataSet.FindToolsByCategory[intCounter].FirstName; NewToolRow.LastName = TheFindToolsByCategoryDataSet.FindToolsByCategory[intCounter].LastName; NewToolRow.ToolID = TheFindToolsByCategoryDataSet.FindToolsByCategory[intCounter].ToolID; NewToolRow.TransactionDate = TheFindToolsByCategoryDataSet.FindToolsByCategory[intCounter].TransactionDate; TheCurrentToolsDataSet.currenttools.Rows.Add(NewToolRow); } dgrTools.ItemsSource = TheCurrentToolsDataSet.currenttools; } } catch (Exception Ex) { TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Blue Jay ERP // Current Tool Location // Combo Box Selectiong " + Ex.Message); TheMessagesClass.ErrorMessage(Ex.ToString()); } }
public FindToolsByCategoryDataSet FindToolsByCategory(string strCategory) { try { aFindToolsByCategoryDataSet = new FindToolsByCategoryDataSet(); aFindToolsByCategoryTableAdapter = new FindToolsByCategoryDataSetTableAdapters.FindToolsByCategoryTableAdapter(); aFindToolsByCategoryTableAdapter.Fill(aFindToolsByCategoryDataSet.FindToolsByCategory, strCategory); } catch (Exception Ex) { TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Tools Class // Find Tools By Category " + Ex.Message); } return(aFindToolsByCategoryDataSet); }
private void ResetForm() { int intCounter; int intNumberOfRecords; cboSelectCategory.Items.Clear(); cboSelectCategory.Items.Add("Select Category"); TheFindSortedToolCategoryDataSet = TheToolCategoryClass.FindSortedToolCategory(); intNumberOfRecords = TheFindSortedToolCategoryDataSet.FindSortedToolCategory.Rows.Count - 1; for (intCounter = 0; intCounter <= intNumberOfRecords; intCounter++) { cboSelectCategory.Items.Add(TheFindSortedToolCategoryDataSet.FindSortedToolCategory[intCounter].ToolCategory); } TheFindToolsByCategoryDataSet = TheToolsClass.FindToolsByCategory(""); dgrTools.ItemsSource = TheFindToolsByCategoryDataSet.FindToolsByCategory; cboSelectCategory.SelectedIndex = 0; }