private List <Order> GetOrders() { ContentPlaceHolder cph = (ContentPlaceHolder)Master.FindControl("ContentPlaceHolder1"); ControlFinder <TextBox> cf = new ControlFinder <TextBox>(); cf.findChildControlsRecursive(cph); var textBoxList = cf.foundsControls; List <Order> orderList = new List <Order>(); foreach (TextBox textBox in textBoxList) { if (textBox.Text != "") { int amountOfOrder = Convert.ToInt32(textBox.Text); if (amountOfOrder > 0) { Drinks aDrinks = drinksGateway.GetDrinksById(int.Parse(textBox.ID)); Order order = new Order(); order.Client = Session["logIn"].ToString(); order.Product = aDrinks.Name; order.Amount = amountOfOrder; order.Price = aDrinks.Price; order.Date = DateTime.Now; order.OrderShipped = false; orderList.Add(order); } } } return(orderList); }
private List<Order> GetOrders() { ContentPlaceHolder cph = (ContentPlaceHolder)Master.FindControl("ContentPlaceHolder1"); ControlFinder<TextBox> cf = new ControlFinder<TextBox>(); cf.findChildControlsRecursive(cph); var textBoxList = cf.foundsControls; List<Order> orderList = new List<Order>(); foreach (TextBox textBox in textBoxList) { if (textBox.Text != "") { int amountOfOrder = Convert.ToInt32(textBox.Text); if (amountOfOrder > 0) { Drinks aDrinks = drinksGateway.GetDrinksById(int.Parse(textBox.ID)); Order order = new Order(); order.Client = Session["logIn"].ToString(); order.Product = aDrinks.Name; order.Amount = amountOfOrder; order.Price = aDrinks.Price; order.Date = DateTime.Now; order.OrderShipped = false; orderList.Add(order); } } } return orderList; }