Exemplo n.º 1
0
 public int DeleteCustomer(Customer or)
 {
     _Cuservice = new CustomerService();
     if (_Cuservice.Delete(or) == 1)
         return 1;
     else
         return 0;
 }
Exemplo n.º 2
0
 public int AddCustomer(Customer or)
 {
     _Cuservice = new CustomerService();
     if (_Cuservice.Add(or) == 1)
         return 1;
     else
         return 0;
 }
Exemplo n.º 3
0
 public IQueryable<Customer> GetAll()
 {
     List<Customer> ls_cus = new List<Customer>();
     string sqlcm = "Select * from Customers";
     using (IDataReader dr = ConnectionClass.GetInstance().ExecuteReader(sqlcm))
     {
         while (dr.Read())
         {
             Customer _cus = new Customer();
             _cus.CustomerID = dr.GetString(0);
             _cus.CompanyName = dr.GetString(1);
             _cus.ContactName = dr.GetString(2);
             _cus.ContactTitle = dr.GetString(3);
             _cus.Address = dr.GetString(4);
             _cus.City = dr.GetString(5);
             _cus.Region = dr.GetString(6);
             _cus.PostalCode = dr.GetString(7);
             _cus.Country = dr.GetString(8);
             _cus.Phone = dr.GetString(9);
             _cus.Fax = dr.GetString(10);
             ls_cus.Add(_cus);
         }
         dr.Close();
     }
     return ls_cus.AsQueryable();
 }
Exemplo n.º 4
0
 public int Delete(Customer _cus)
 {
     string sqlcm = "Delete from Customer where CustomerID=" + _cus.CustomerID;
     return ConnectionClass.GetInstance().ExecuteNonQuery(sqlcm);
 }
Exemplo n.º 5
0
 public int Update(Customer _cus)
 {
     string sqlcm = "update Customers set CompanyName='" + _cus.CompanyName + "',ContactName='" + _cus.ContactName + "',ContactTitle='" + _cus.ContactTitle + "',Address='" + _cus.Address + "',City='" + _cus.City + "',Region='" + _cus.Region + "',PosttalCode='" + _cus.PostalCode + "',Country='" + _cus.Country + "' where CustomerID=" + _cus.CustomerID;
     return ConnectionClass.GetInstance().ExecuteNonQuery(sqlcm);
 }
Exemplo n.º 6
0
 public int Add(Customer _cus)
 {
     string sqlcm = "insert into Customers(CustomerID,CompanyName,) values('" + _cus.CustomerID + "','" + _cus.CompanyName + "')"; 
     return ConnectionClass.GetInstance().ExecuteNonQuery(sqlcm);
 }