partial void UpdateSupplier(Supplier instance);
 partial void DeleteSupplier(Supplier instance);
 partial void InsertSupplier(Supplier instance);
 public Supplier CreateSupplier(Supplier supplier)
 {
     var dc = new DataClassesDataContext(_connectionString);
     dc.Suppliers.InsertOnSubmit(supplier);
     dc.SubmitChanges();
     return supplier;
 }
 public Supplier UpdateSupplier(Supplier supplier)
 {
     var dc = new DataClassesDataContext(_connectionString);
     dc.Suppliers.Attach(supplier, ReadSupplier(supplier.SupplierID));
     dc.SubmitChanges();
     return supplier;
 }
        public Product[] SearchProduct(Category category, Supplier supplier)
        {
            var dc = new DataClassesDataContext(_connectionString);
            IQueryable<Product> s = from e in dc.Products
                                    select e;
            IEnumerable<Product> ss = from e in s.ToList()
                                      where (category == null || e.Category.CategoryID == category.CategoryID)
                                            && (supplier == null || e.SupplierID == supplier.SupplierID)
                                      select e;

            try
            {
                return ss.ToArray();
            }
            catch (Exception e)
            {
                Debug.WriteLine(e);
            }
            return new Product[0];
        }
 public void DeleteSupplier(Supplier supplier)
 {
     var dc = new DataClassesDataContext(_connectionString);
     IQueryable<Supplier> s = from e in dc.Suppliers
                              where e.SupplierID == supplier.SupplierID
                              select e;
     dc.Suppliers.DeleteOnSubmit(s.First());
     dc.SubmitChanges();
 }