/// <summary> /// Populates Item list based on the selected category in the treeCategory /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void treeCategory_FocusedNodeChanged(object sender, DevExpress.XtraTreeList.FocusedNodeChangedEventArgs e) { DataRowView dr = (DataRowView)treeCategory.GetDataRecordByNode(treeCategory.Selection[0]); Items itm = new Items(); DataTable dtItem; //TODO: filter criteria; string value = dr["ID"].ToString(); string type = value.Substring(0,1); _catId = 0; int categoryId = Convert.ToInt32(value.Substring(1)); switch (type) { case "C": dtItem = itm.GetItemsByCategory(categoryId); toolStripButtonAddItems.Enabled = false; toolStripButtonEditItem.Enabled = false; _selectedCat = categoryId; break; case "S": dtItem = itm.GetItemsBySubCategory(categoryId); toolStripButtonAddItems.Enabled = true; _catId = categoryId; toolStripButtonEditItem.Enabled = false; _selectedSubCat = categoryId; break; default: dtItem = itm.GetAllItem(); toolStripButtonAddItems.Enabled = false; toolStripButtonEditItem.Enabled = false; _selectedCat = 0; break; } PopulateItemList(dtItem); }
/// <summary> /// Loads the form data /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ManageItemsLoad(object sender, EventArgs e) { PopulateCatTree(); Items itm = new Items(); DataTable dtItem = itm.GetAllItem(); PopulateItemList(dtItem); //lblState.Text = "All Items"; }