private void Insert_Click(object sender, EventArgs e) { using (SalesIEF frm = new SalesIEF(null, db)) { if (frm.ShowDialog() == DialogResult.OK) { salesBindingSource.DataSource = db.Sales.ToList(); } } }
private void Edit_Click(object sender, EventArgs e) { if (salesBindingSource.Current == null) { return; } using (SalesIEF frm = new SalesIEF(salesBindingSource.Current as Sales, db)) { if (frm.ShowDialog() == DialogResult.OK) { salesBindingSource.DataSource = db.Sales.ToList(); } else { db = new my_db_for_db_2Entities(); salesBindingSource.DataSource = db.Sales.ToList(); } } }