private void UpdateProductButton_Click(object sender, EventArgs e) { try { ProductsData ed = new ProductsData(); SqlProductRepository products = new SqlProductRepository(connectionString); products.UpdateProduct(Convert.ToInt32(ProductIdTextbox.Text), SKUTextbox.Text, ProductNameTextbox.Text, Convert.ToInt32(ProductTypeIDTextbox.Text), Convert.ToInt32(QuantityTextbox.Text), DescriptionTextbox.Text, PriceTextbox.Text, RatingTextbox.Text); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void CreateProductButton_Click(object sender, EventArgs e) { try { SqlProductRepository products = new SqlProductRepository(connectionString); Product createProduct = products.CreateProduct(SKUTextbox.Text, NameTextbox.Text, Convert.ToInt32(TypeIdTextbox.Text), Convert.ToInt32(QuantityTextbox.Text), DescriptionTextBox.Text, PriceTextBox.Text, RatingTextbox.Text); list.Add(createProduct); ProductsData pd = new ProductsData(); pd.dataGridView1.DataSource = list; } catch (Exception ex) { MessageBox.Show("There cannot be any empty or incorrectly entered parameters. Check submission."); } }
private void ProductsButton_Click(object sender, EventArgs e) { ProductsData ed = new ProductsData(); ed.ShowDialog(); }