private void PopulateProductCategories() { ProductCategory cat = new ProductCategory(); ProductCategoryCollection catCol = new ProductCategoryCollection(); m_Loading = true; try { catCol = cat.GetAllProductCategoryCollection(); ProductCategory AllCat = new ProductCategory(); cat.ProductCategoryID = 0; cat.Name = "All"; cat.ModifiedDate = DateTime.Now; catCol.Insert(0, cat); ddlCategory.DataSource = catCol; ddlCategory.DisplayMember = "Name"; ddlCategory.ValueMember = "ProductCategoryID"; // m_Loading = false; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void PopulateProductCategories() { Cursor.Current = Cursors.WaitCursor; ProductCategory selectNew = new ProductCategory(); ProductCategoryCollection col = new ProductCategoryCollection(); ProductCategory pc = new ProductCategory(); try { selectNew.Name = "[Select One]"; selectNew.ProductCategoryID = 0; col = pc.GetAllProductCategoryCollection(); col.Insert(0, selectNew); cmbProductCategories.DataSource = col; cmbProductCategories.DisplayMember = "Name"; cmbProductCategories.ValueMember = "ProductCategoryID"; } catch (Exception ex) { MessageBox.Show(ex.Message, "Product Subcategories", MessageBoxButtons.OK, MessageBoxIcon.Error); Cursor.Current = Cursors.Default; } Cursor.Current = Cursors.Default; }
private void LoadProductCategories() { ProductCategory cat = new ProductCategory(); ProductCategoryCollection col = new ProductCategoryCollection(); ProductCategory selectNew = new ProductCategory(); selectNew.ProductCategoryID = 0; selectNew.Name = "[Select Category]"; Cursor.Current = Cursors.WaitCursor; try { col = cat.GetAllProductCategoryCollection(); col.Insert(0, selectNew); cmbCategory.DataSource = col; cmbCategory.DisplayMember = "Name"; cmbCategory.ValueMember = "ProductCategoryID"; int catID = Int32.Parse(cmbCategory.SelectedValue.ToString()); LoadProductSubCategories(catID); } catch (Exception ex) { MessageBox.Show(ex.Message); Cursor.Current = Cursors.Default; } finally { cat = null; } Cursor.Current = Cursors.Default; }