Ejemplo n.º 1
0
 public long UpdateCustomer(Customer customer)
 {
     return (new CustomerDao(Connection, SchemaName)).Update(customer);
 }
Ejemplo 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;
        }
Ejemplo n.º 3
0
 public long AddCustomer(Customer customer)
 {
     return (new CustomerDao(Connection, SchemaName)).Insert(customer);
 }
Ejemplo n.º 4
0
        private static Customer CreateCustomer()
        {
            Customer customer = new Customer();
            customer.CustomerId = GetNewCustomerId();

            return GetCustomerInfo(customer);
        }
Ejemplo 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()));
 }
Ejemplo 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));
        }
Ejemplo 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);
        }
Ejemplo n.º 8
0
 public Order()
 {
     OrderId = 0;
     OrderDate = DateTime.Today;
     ShipDate = DateTime.Today;
     Customer = new Customer();
     OrderDetails = new List<OrderDetail>();
     SubTotal = 0;
 }