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

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