Esempio n. 1
0
 public long UpdateCustomer(Customer customer)
 {
     return (new CustomerDao(Connection, SchemaName)).Update(customer);
 }
Esempio n. 2
0
        private static Customer GetCustomerInfo(Customer customer)
        {
            customer.FirstName = GetCustomerFirstName();
            customer.LastName = GetCustomerLastName();
            customer.Address = GetCustomerAddress();
            customer.Phone = GetCustomerPhone();
            customer.Email = GetCustomerEmail();
            customer.LastOrderDate = GetCustomerLastOrderDate();

            return customer;
        }
Esempio n. 3
0
 public long AddCustomer(Customer customer)
 {
     return (new CustomerDao(Connection, SchemaName)).Insert(customer);
 }
Esempio n. 4
0
        private static Customer CreateCustomer()
        {
            Customer customer = new Customer();
            customer.CustomerId = GetNewCustomerId();

            return GetCustomerInfo(customer);
        }
Esempio n. 5
0
 private String BuildQuery(String statement, Customer customer)
 {
     return String.Format(statement,
         GFXDDbi.Escape(customer.FirstName),
         GFXDDbi.Escape(customer.LastName),
         customer.Address.AddressId,
         GFXDDbi.Escape(customer.Phone),
         GFXDDbi.Escape(customer.Email),
         GFXDDbi.Escape(customer.LastOrderDate.ToShortDateString()));
 }
Esempio n. 6
0
        public int Update(Customer customer)
        {
            String statement = QualifyTableName(DbDefault.GetUpdateStatement(
                TableName.CUSTOMER, new long[] { customer.CustomerId }));

            if(Connection != null)
                return GFXDDbi.Update(Connection,BuildQuery(statement, customer));
            else
                return GFXDDbi.Update(BuildQuery(statement, customer));
        }
Esempio n. 7
0
        public long Insert(Customer customer)
        {
            String statement = QualifyTableName(DbDefault.GetInsertStatement(
                TableName.CUSTOMER, new long[] { customer.CustomerId }));

            statement = BuildQuery(statement, customer);

            if(Connection != null)
                return GFXDDbi.Insert(Connection, statement);
            else 
                return GFXDDbi.Insert(statement);
        }
Esempio n. 8
0
 public Order()
 {
     OrderId = 0;
     OrderDate = DateTime.Today;
     ShipDate = DateTime.Today;
     Customer = new Customer();
     OrderDetails = new List<OrderDetail>();
     SubTotal = 0;
 }