private void btnAddProduct_Click(object sender, EventArgs e) { System.Data.DataRow new_product = this.products.NewRow(); if (!System.Convert.IsDBNull(this.cbxCategory.SelectedValue)) new_product["Category"] = this.cbxCategory.SelectedValue; AddProductForm apf = new AddProductForm(this.connection, ref new_product); if (apf.ShowDialog() == DialogResult.OK){ this.products.Rows.Add(new_product); } }
private void tsmiChangeProduct_Click(object sender, EventArgs e) { if (this.lvProducts.SelectedItems.Count > 0){ int idx = this.lvProducts.SelectedItems[0].Index; System.Data.DataRow row = this.products.Rows[idx]; AddProductForm ptf = new AddProductForm(this.cConnection, ref row); if (ptf.ShowDialog() == DialogResult.OK){ // this.types_table.Rows.Add(new_type); this.RefreshProductList((Guid)row["Category"], new int[] { (int)row["Type"] }); } } return; }
private void tsmiAddNewProduct_Click(object sender, EventArgs e) { System.Data.DataRow new_product = this.products.NewRow(); if (!System.Convert.IsDBNull(this.cbxCategories.SelectedValue)) new_product["Category"] = this.cbxCategories.SelectedValue; if (!System.Convert.IsDBNull(this.clbxTypes.SelectedValue) && (this.clbxTypes.SelectedValue != null) ) new_product["Type"] = this.clbxTypes.SelectedValue; AddProductForm apf = new AddProductForm( this.cConnection, ref new_product ); if( apf.ShowDialog() == DialogResult.OK ){ this.AddNewRow(this.lvProducts.Items.Count, new_product); this.products.Rows.Add(new_product); } return; }
private void tsmiNewBySelected_Click(object sender, EventArgs e) { if ((this.lbxProducts.SelectedItem != null) && !System.Convert.IsDBNull(this.lbxProducts.SelectedValue)) { System.Data.DataRow product = this.products.Rows[this.lbxProducts.SelectedIndex]; System.Data.DataRow new_product = this.products.NewRow(); new_product["ProductName"] = product["ProductName"]; new_product["Category"] = product["Category"]; new_product["Type"] = product["Type"]; new_product["Maker"] = product["Maker"]; new_product["Barcode"] = product["Barcode"]; //if (!System.Convert.IsDBNull(this.cbxCategory.SelectedValue)) new_product["Category"] = this.cbxCategory.SelectedValue; AddProductForm apf = new AddProductForm(this.cConnection, ref new_product); if (apf.ShowDialog() == DialogResult.OK) { // this.AddNewRow(this.lvProducts.Items.Count, new_product); // this.lbxProducts // string message = ""; this.products.Rows.Add(new_product); } } }
private void tsmiEditProduct_Click(object sender, EventArgs e) { if ( (this.lbxProducts.SelectedItem != null) && !System.Convert.IsDBNull(this.lbxProducts.SelectedValue) ){ System.Data.DataRow product = this.products.Rows[this.lbxProducts.SelectedIndex]; AddProductForm apf = new AddProductForm(this.cConnection, ref product ); if (apf.ShowDialog() == DialogResult.OK){ } } }
private void tsmiAddProduct_Click(object sender, EventArgs e) { System.Data.DataRow new_product = this.products.NewRow(); new_product["ProductID"] = Guid.Empty; if (this.tbxSearchProduct.Text.Length == 13) new_product["Barcode"] = this.tbxSearchProduct.Text; else if (this.tbxSearchProduct.Text.Length > 0) new_product["ProductName"] = this.tbxSearchProduct.Text; if (!System.Convert.IsDBNull(this.cbxCategory.SelectedValue)) new_product["Category"] = this.cbxCategory.SelectedValue; AddProductForm apf = new AddProductForm(this.cConnection, ref new_product); if (apf.ShowDialog() == DialogResult.OK){ // this.AddNewRow(this.lvProducts.Items.Count, new_product); // this.lbxProducts // string message = ""; this.products.Rows.Add(new_product); } return; }