Пример #1
0
 public bool Delete(string id)
 {
     using (CustomerDataAdapter adapter = new CustomerDataAdapter())
     {
         return adapter.DeleteCustomer(id);
     }
 }
Пример #2
0
 public Customer GetCustomerByEmail(string email)
 {
     Customer customer = new Customer();
     IDataReader dr = new CustomerDataAdapter().GetCustomerByEmail(email);
     if (dr.Read())
     {
         customer = PopulateReader(dr);
     }
     dr.Close();
     return customer;
 }
Пример #3
0
 public bool Insert(Customer customer)
 {
     using (CustomerDataAdapter adapter = new CustomerDataAdapter())
     {
         return adapter.InsertCustomer(customer.Company,
                                                         customer.Name, customer.PhoneNo, customer.Email,
                                                         customer.Fax,
                                                         customer.Address, customer.Website, customer.Remarks,
                                                         customer.PostCode
                                                         , customer.Country, customer.Rating);
     }
 }
Пример #4
0
        public string GetMaxId()
        {
            string maxid = string.Empty;
            IDataReader dr = new CustomerDataAdapter().GetMaxId();

            while (dr.Read())
            {
                maxid = dr["id"].ToString();
            }
            dr.Close();
            return maxid;
        }
Пример #5
0
 public Customer GetCustomersById(int id)
 {
     Customer customer = new Customer();
     using (IDataReader dr = new CustomerDataAdapter().GetCustomerByCode(id))
     {
         if (dr.Read())
         {
             customer = PopulateReader(dr);
         }
         dr.Close();
     }
     return customer;
 }
Пример #6
0
        public CustomerCollection GetCustomers()
        {
            CustomerCollection customers = new CustomerCollection();

            using(IDataReader dr = new CustomerDataAdapter().GetCustomers())
            {
            while (dr.Read())
            {
                customers.Add(PopulateReader(dr));
            }
            dr.Close();
            }
            return customers;
        }
Пример #7
0
        public bool IsCustomerExist(int id)
        {
            bool exist = false;

            using (IDataReader dr = new CustomerDataAdapter().GetCustomerByCode(id))
            {
                if (dr.Read())
                    exist = true;

                dr.Close();
            }

            return exist;
        }