public StarBucksCustomer(Customer cust, int age) : this(cust.Name, age, cust.Card.Number) { // Customer can have some balance as well if (cust.Card.Balance != 0) { this.Card.ReloadCard(cust.Card.Balance); } }
private static void CreateCustomer(ISession session) { using (ITransaction tran = session.BeginTransaction()) { try { Customer cus = new Customer(); cus.Name = "jiguixin"; cus.ContactName = "123456789"; cus.ContactInfo = new CustomerContactInfo() {Address = "zhongbajie", PostalCode = "610000", Tel = "81402373"}; cus.Detail = new CustomerDetail() { CreateTime = DateTime.Now, CustomerEmail = "*****@*****.**", LastUpdated = DateTime.Now.AddDays(22), customer = cus }; session.SaveOrUpdate(cus); tran.Commit(); } catch (Exception) { tran.Rollback(); throw; } } }
public float CreateStarbucksCustomerWithBaseCust() { Customer c = new Customer("rimba", "343545345"); c.Card.ReloadCard(200); StarBucksCustomer s = new StarBucksCustomer(c, 32); s.Card.ReloadCard(150); return s.Card.Balance; // must show 350 }
public StarBucksCustomer(string name, int age, string cardNumber) { this.cust = new Customer(name, cardNumber); this.Age = age; }