private void SellerAddToolStripMenuItem1_Click(object sender, EventArgs e) { var formseller = new SellerForm(); if (formseller.ShowDialog() == DialogResult.OK) { db.Sellers.Add(formseller.Seller); db.SaveChanges(); } }
private void button2_Click(object sender, System.EventArgs e) { var id = dataGridView.SelectedRows[0].Cells[0].Value; if (typeof(T) == typeof(Product)) { var product = set.Find(id) as Product; if (product != null) { var form = new ProductForm(product); if (form.ShowDialog() == DialogResult.OK) { product = form.Product; db.SaveChanges(); dataGridView.Update(); } } } else if (typeof(T) == typeof(Seller)) { var seller = set.Find(id) as Seller; if (seller != null) { var sellerform = new SellerForm(seller); if (sellerform.ShowDialog() == DialogResult.OK) { seller = sellerform.Seller; db.SaveChanges(); dataGridView.Update(); } } } else if (typeof(T) == typeof(Customer)) { var customer = set.Find(id) as Customer; if (customer != null) { var customerform = new CustomerForm(customer); if (customerform.ShowDialog() == DialogResult.OK) { customer = customerform.Customer; db.SaveChanges(); dataGridView.Update(); } } } }