private void NewSupplier()
        {
            Supplier        supplier        = new Supplier();
            frmEditSupplier frmEditSupplier = new frmEditSupplier(supplier);

            if (frmEditSupplier.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                using (var db = new StoreManagerContext())
                {
                    db.Suppliers.Add(supplier);
                    db.SaveChanges();
                }
            }
        }
        private void EditSupplier()
        {
            Supplier        supplier        = GetSelectedSupplier();
            frmEditSupplier frmEditSupplier = new frmEditSupplier(supplier);

            if (frmEditSupplier.ShowDialog() == DialogResult.OK)
            {
                using (var db = new StoreManagerContext())
                {
                    var originalSupplier = (from s in db.Suppliers
                                            where s.SupplierID == supplier.SupplierID
                                            select s).Single();

                    CloneSupplier(supplier, originalSupplier);
                    db.SaveChanges();
                }
            }
        }
 private void NewSupplier()
 {
     Supplier supplier = new Supplier();
     frmEditSupplier frmEditSupplier = new frmEditSupplier(supplier);
     if (frmEditSupplier.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         using (var db = new StoreManagerContext())
         {
             db.Suppliers.Add(supplier);
             db.SaveChanges();
         }
     }
 }
        private void EditSupplier()
        {
            Supplier supplier = GetSelectedSupplier();
            frmEditSupplier frmEditSupplier = new frmEditSupplier(supplier);
            if (frmEditSupplier.ShowDialog() == DialogResult.OK)
            {
                using (var db = new StoreManagerContext())
                {
                    var originalSupplier = (from s in db.Suppliers
                                            where s.SupplierID == supplier.SupplierID
                                            select s).Single();

                    CloneSupplier(supplier, originalSupplier);
                    db.SaveChanges();
                }
            }
        }