private void EditSelectedProductType() { if (this.lvProductTypes.SelectedItems.Count > 0) { System.Data.DataRow drw = (System.Data.DataRow)this.lvProductTypes.SelectedItems[0].Tag; ProductTypeForm ptf = new ProductTypeForm(this.connection, ref drw); if (ptf.ShowDialog() == DialogResult.OK) { } } return; }
private void tsmiAddNewType_Click(object sender, EventArgs e) { System.Data.DataRow new_type = this.types_table.NewRow(); if (!System.Convert.IsDBNull(this.cbxCategories.SelectedValue)) new_type["Category"] = this.cbxCategories.SelectedValue; ProductTypeForm ptf = new ProductTypeForm(this.cConnection, ref new_type); if (ptf.ShowDialog() == DialogResult.OK){ this.types_table.Rows.Add(new_type); } 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); } } }