Example #1
0
        public void deleteCustomer(int id)
        {
            using (DataClassesOurCompanyDataContext db = new DataClassesOurCompanyDataContext())
            {
                Customer customer = (from c in db.Customers where c.id == id select c).First();
                db.Customers.DeleteOnSubmit(customer);
                db.SubmitChanges();

            }
        }
Example #2
0
 public void editCustomer(Customer c)
 {
     using (DataClassesOurCompanyDataContext db = new DataClassesOurCompanyDataContext())
     {
         var q = (from cust in db.Customers where cust.id == c.id select cust).First();
         q.Name = c.Name;
         q.Address = c.Address;
         q.TelephoneNo = c.TelephoneNo;
         q.EmailAddress = c.EmailAddress;
         db.SubmitChanges();
     }
 }
Example #3
0
        public void create(Customer c)
        {
            try
            {
                using (DataClassesOurCompanyDataContext db = new DataClassesOurCompanyDataContext())
                {
                    Customer cust = new Customer();
                    cust.Name = c.Name;
                    cust.Address = c.Address;
                    cust.TelephoneNo = c.TelephoneNo;
                    cust.EmailAddress = c.EmailAddress;
                    db.Customers.InsertOnSubmit(cust);
                    db.SubmitChanges();

                }
            }
            catch (Exception e)
            {
                throw e;
            }
        }