private static void Main(string[] args) { var customers = new List <ICustomer>(); var john = new Customer.Customer("john"); var tim = new Customer.Customer("tim"); var company = new CompositeCustomer("company"); var ceo = new Customer.Customer("ceo"); var team = new CompositeCustomer("team"); var kate = new Customer.Customer("kate"); var jill = new Customer.Customer("jill"); var message = new Message("Hello", "World"); team.AddCustomers(kate, jill); company.AddCustomers(ceo, team); customers.Add(john); customers.Add(tim); customers.Add(company); foreach (var customer in customers) { customer.Notify(message); } Console.ReadKey(); }
public CompositeCustomer CustumerCreation(string name, string address, string phoneNo, string email, int zip, string city) { CompositeCustomer compositeCustomer = new CompositeCustomer(); compositeCustomer.CustomerName = name; compositeCustomer.CustomerAddress = address; compositeCustomer.CustomerPhoneNo = phoneNo; compositeCustomer.CustomerEmail = email; compositeCustomer.CustomerZipcode = zip; compositeCustomer.CustomerCity = city; return(compositeCustomer); }
public ActionResult BuyView(FormCollection collection) { string name = collection["Name"]; string lAdress = collection["LAdress"]; string phone = collection["Phone"]; string email = collection["Email"]; string zip = collection["Zip"]; string city = collection["City"]; int intZip = int.Parse(zip); List <ProductViewModel> cart = (List <ProductViewModel>)Session["cart"]; List <CompositeProduct> compProductList = new List <CompositeProduct>(); foreach (ProductViewModel p in cart) { CompositeProduct compProduct = p.compositeProduct; compProductList.Add(compProduct); } CompositeCustomer compCustomer = CustumerCreation(name, lAdress, phone, email, intZip, city); string saleString = client.ProcessSale(compProductList, compCustomer); return(RedirectToAction("Payment", new { saleString })); }
public CustomerViewModel(CompositeCustomer compositeCustomer) { this.compositeCustomer = compositeCustomer; }