private void btn_OK_Click(object sender, EventArgs e) { double dPrice; double.TryParse(tb_Price.Text, out dPrice); NewProduct = new Product(tb_Name.Text, tb_Category.Text, dPrice); this.DialogResult = System.Windows.Forms.DialogResult.OK; }
private void btn_AddProduct_Click(object sender, EventArgs e) { FromProduct newFormProduct = new FromProduct(); if (newFormProduct.ShowDialog() == System.Windows.Forms.DialogResult.OK) { Product tempP = newFormProduct.NewProduct; Product clone = new Product(tempP.Name, tempP.Category, tempP.Price); products.list.Add(clone); newFormProduct.Close(); refreshProductsList(); } else { newFormProduct.Close(); } }
private void btn_AddtoCart_Click(object sender, EventArgs e) { if (lb_Products.SelectedIndex != -1) { Product tempP = (Product)lb_Products.SelectedItem; Product clone = new Product(tempP.Name, tempP.Category, tempP.Price, (int)nud_Amount.Value); cart.list.Add(clone); refreshCartList(); refreshTotal(); } }