Пример #1
0
 public void updateCustomer(Customer anCustomer)
 {
     using (SqlCommand cmd = DatabaseContext.Connection.CreateCommand())
     {
         cmd.CommandText = "update customer set Name=" + "'" + anCustomer.Name + "'" + ",Street=" + "'" + anCustomer.Street + "',StreetNo='" + anCustomer.StreetNo + "', ZipCode='" + anCustomer.ZipCode + "',City='" + anCustomer.City+ "' where customerno=" + anCustomer.CustomerNo + ";";
         cmd.ExecuteNonQuery();
     }
 }
Пример #2
0
        public Customer getCustomerByNo(int no)
        {
            Customer result = null;

            using (SqlCommand cmd = new SqlCommand("select * from customer where customerNo = " + no, DatabaseContext.Connection))
            {
                SqlDataReader reader = cmd.ExecuteReader();
                while(reader.Read())
                {
                    result = new Customer { Name = reader["Name"].ToString() };
                }
            }
            return result;
        }
Пример #3
0
 public void updateCustomer(Customer anCustomer)
 {
     context.CustomerRepository.updateCustomer(anCustomer);
 }
Пример #4
0
        private void updateCustomer()
        {
            Customer anCustomer = new Customer
            {
                CustomerNo = Int32.Parse(tbAdminCustomerNo.Text),
                Name = tbAdminCustomerName.Text.ToString(),
                Street = tbAdminCustomerStreet.Text.ToString(),
                StreetNo = Int32.Parse(tbAdminCustomerStreetNo.Text),
                ZipCode = Int32.Parse(tbAdminCustomerZipCode.Text),
                City = tbAdminCustomerCity.Text.ToString(),
            };

            context.CustomerService.updateCustomer(anCustomer);
        }