Exemplo n.º 1
0
        public List <SizeDAO> getSizes()
        {
            List <SizeDAO> sizes = new List <SizeDAO>();

            foreach (var item in data.GetSizesList())
            {
                sizes.Add(SizeMapper.Size_SizeDAO(item));
            }
            return(sizes);
        }
Exemplo n.º 2
0
        public PizzaOrderDAO GetPizzaOrder(int id)
        {
            PizzaOrderDAO   po           = new PizzaOrderDAO();
            PizzaOrder      temppo       = new PizzaOrder();
            List <Order>    temporder    = new List <Order>();
            List <Pizza>    temppizzas   = new List <Pizza>();
            List <PizzaDAO> temppizzaDAO = new List <PizzaDAO>();


            temppo      = data.GetPizzaOrderByID(id);
            po.ID       = temppo.PizzaOrderID;
            po.Customer = GetCustomerByID(int.Parse(temppo.CustomerID.ToString()));
            temporder   = data.GetOrderByID(po.ID);
            temppizzas  = data.GetPizzaList(temporder);

            foreach (var item in temppizzas)
            {
                var tempToppings    = data.GetToppingsOnPizza(int.Parse(item.PizzaID.ToString()));
                var tempCheeses     = data.GetCheesesOnPizza(int.Parse(item.PizzaID.ToString()));
                var tempToppingsDAO = new List <ToppingDAO>();
                var tempCheesesDAO  = new List <CheeseDAO>();

                foreach (var i in tempToppings)
                {
                    tempToppingsDAO.Add(ToppingMapper.Topping_ToppingDAO(i));
                }
                foreach (var y in tempCheeses)
                {
                    tempCheesesDAO.Add(CheeseMapper.Cheese_CheeseDAO(y));
                }


                var t = new PizzaDAO
                {
                    ID       = item.PizzaID,
                    Crust    = CrustMapper.Crust_CrustDAO(data.GetCrustOnPizza(int.Parse(item.CrustID.ToString()))),
                    Sauce    = SauceMapper.Sauce_SauceDAO(data.GetSauceOnPizza(int.Parse(item.SauceID.ToString()))),
                    Size     = SizeMapper.Size_SizeDAO(data.GetSizeOfPizza(int.Parse(item.SizeID.ToString()))),
                    Toppings = tempToppingsDAO,
                    Cheeses  = tempCheesesDAO
                };

                temppizzaDAO.Add(t);
            }
            OrderDAO order = new OrderDAO();

            order.Pizzas = temppizzaDAO;
            po.Order     = order;

            return(po);
        }