private void btnAddCategory_Click(object sender, EventArgs e) { System.Data.DataRow new_category = this.categories.NewRow(); EditCategoryForm ecf = new EditCategoryForm(this.cConnection, ref new_category); if (ecf.ShowDialog() == DialogResult.OK){ this.categories.Rows.Add(new_category); } return; }
private void EditSelectedCategory() { if (this.lvCategories.SelectedItems.Count > 0) { System.Data.DataRow drw = (System.Data.DataRow)this.lvCategories.SelectedItems[0].Tag; EditCategoryForm ef = new EditCategoryForm(this.connection, ref drw); if (ef.ShowDialog() == DialogResult.OK) { } } return; }
private void tsmiCreate_Click(object sender, EventArgs e) { if (this.lvCategories.Focused) { System.Data.DataRow drw = this.categories.NewRow(); EditCategoryForm ef = new EditCategoryForm(this.connection, ref drw); if (ef.ShowDialog() == DialogResult.OK) { this.AddNewCategoryRow(this.lvCategories.Items.Count + 1, drw); this.categories.Rows.Add(drw); } } else if (this.lvProductTypes.Focused) { System.Data.DataRow drw = this.product_types.NewRow(); System.Data.DataRow cdrw = (System.Data.DataRow)this.lvCategories.SelectedItems[0].Tag; drw["Category"] = cdrw["CategoryID"]; ProductTypeForm ptf = new ProductTypeForm(this.connection, ref drw); if (ptf.ShowDialog() == DialogResult.OK) { this.AddNewProductTypeRow(this.lvProductTypes.Items.Count + 1, drw); this.product_types.Rows.Add(drw); } } }