//Método onde podem ser realizadas validações acerca das informações informadas para o Cliente a ser inserido no banco.
        public string AdicionarPizza(Pizza pizza)
        {
            PizzaDAO pizz     = new PizzaDAO();
            string   mensagem = pizz.Adicionar(pizza);

            return(mensagem);
        }
コード例 #2
0
        public PizzaController()
        {
            string connection = ConfigurationManager.ConnectionStrings["dataSource"].ConnectionString;

            _pizzaDAO = new PizzaDAO(connection);
            _pizzaBLO = new PizzaBLO();
            _orderDAO = new OrderDAO(connection);
        }
コード例 #3
0
        internal void CadastrarIngredientesPizza(List <string> listIngrediente, PizzaDTO dadosPizza)
        {
            PizzaDAO       pizzaDAO        = new PizzaDAO();
            IngredienteDAO ingredientesDAO = new IngredienteDAO();

            int idPizza = ((int)pizzaDAO.BuscarIdPizza(dadosPizza));

            ingredientesDAO.CadastrarPizzaHasIngredientes(idPizza, listIngrediente);
        }
コード例 #4
0
        public static Pizza PizzaDAO_Pizza(PizzaDAO s)
        {
            Pizza e = new Pizza();

            e.PizzaID = s.ID;
            e.CrustID = s.Crust.ID;
            e.SauceID = s.Sauce.ID;
            e.SizeID  = s.Size.ID;
            return(e);
        }
コード例 #5
0
        public static List <Topping> PizzaDAO_Topping(PizzaDAO p)
        {
            List <Topping> t = new List <Topping>();

            foreach (var item in p.Toppings)
            {
                t.Add(ToppingMapper.ToppingDAO_Topping(item));
            }
            return(t);
        }
コード例 #6
0
        public ActionResult RemoverPizzaDoPedido()
        {
            if (SessaoClienteAtual == null)
            {
                return(RedirectToAction("Home", "Cliente"));
            }

            ViewBag.Pizzas = PizzaDAO.RetornarPizzaPedido();
            return(View());
        }
コード例 #7
0
        public static List <Cheese> PizzaDAO_Cheeses(PizzaDAO p)
        {
            List <Cheese> c = new List <Cheese>();

            foreach (var item in p.Cheeses)
            {
                c.Add(CheeseMapper.CheeseDAO_Cheese(item));
            }
            return(c);
        }
コード例 #8
0
        public static PizzaDAO MapToPizzaDAO(Pizza pizzaToMap)
        {
            PizzaDAO pizza = new PizzaDAO();

            pizza.Id         = pizzaToMap.Id;
            pizza.PizzaSize  = pizzaToMap.PizzaSizeId;
            pizza.CrustType  = pizzaToMap.CrustTypeId;
            pizza.SauceType  = pizzaToMap.SauceTypeId;
            pizza.CheeseType = pizzaToMap.CheeseTypeId;
            pizza.Order      = pizzaToMap.OrderId;

            return(pizza);
        }
コード例 #9
0
        internal bool PizzaCadastrada(string nome_Sabor)
        {
            PizzaDAO pizzaDAO = new PizzaDAO();

            if (pizzaDAO.PizzaCadastrada(nome_Sabor))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #10
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);
        }
コード例 #11
0
        public static PizzaDAO MapToPizzaDAO(Pizza pizza)
        {
            var p = new PizzaDAO();

            p.Id       = pizza.PizzaID;
            p.Size     = SizeMapper.MapToSizeDAO(pizza.Size);
            p.Crust    = CrustMapper.MapToCrustDAO(pizza.Crust);
            p.Sauce    = SauceMapper.MapToSauceDAO(pizza.Sauce);
            p.Cheese   = CheeseMapper.MapToCheeseDAO(pizza.Cheese);
            p.Quantity = pizza.Quantity;
            p.Active   = pizza.Active;

            return(p);
        }
コード例 #12
0
        public static PizzaDTO MapToDTO(PizzaDAO pizza)
        {
            var p = new PizzaDTO();

            p.Id       = pizza.Id;
            p.Size     = SizeMapper.MapToDTO(pizza.Size);
            p.Crust    = CrustMapper.MapToDTO(pizza.Crust);
            p.Sauce    = SauceMapper.MapToDTO(pizza.Sauce);
            p.Cheese   = CheeseMapper.MapToDTO(pizza.Cheese);
            p.Quantity = pizza.Quantity;
            p.Active   = pizza.Active;

            return(p);
        }
コード例 #13
0
        public static Pizza MapToPizza(PizzaDAO pizza)
        {
            var p = new Pizza();

            p.PizzaID  = pizza.Id;
            p.SizeID   = SizeMapper.MapToSize(pizza.Size).SizeID;
            p.CrustID  = CrustMapper.MapToCrust(pizza.Crust).CrustID;
            p.SauceID  = SauceMapper.MapToSauce(pizza.Sauce).SauceID;
            p.CheeseID = CheeseMapper.MapToCheese(pizza.Cheese).CheeseID;
            p.Quantity = pizza.Quantity;
            p.Active   = pizza.Active;

            return(p);
        }
コード例 #14
0
        public ActionResult Home(int[] lstIdPizzaConfirmado, Pedido pedido)
        {
            List <Pizza> retornoPizzaPedido = PizzaDAO.RetornarPizzaPedido();

            double valorTotalPedido = 0;

            foreach (var pizza in retornoPizzaPedido)
            {
                valorTotalPedido += pizza.PrecoPizza;
            }

            if (lstIdPizzaConfirmado != null)
            {
                List <Pizza> lstPizzasConfirmadas = new List <Pizza>();

                foreach (int IdPizzaConfirmada in lstIdPizzaConfirmado)
                {
                    lstPizzasConfirmadas.Add(PizzaDAO.RetornarPizzaPedidoPorId(IdPizzaConfirmada));
                }

                if (retornoPizzaPedido.Count == lstPizzasConfirmadas.Count)
                {
                    Cliente cliente = ClienteDAO.BuscarClientePorEmail(pedido.ClientePedido);

                    string sessaoPedidoAtual = Sessao.ValidarSessaoPizza_Pedido();

                    pedido.PrecoTotalPedido = valorTotalPedido;
                    pedido.PizzasPedido     = Pizza_PedidoDAO.RetornarPizza_PedidoPorGuid(sessaoPedidoAtual);
                    pedido.ClientePedido    = cliente;
                    pedido.DataPedido       = DateTime.Now;
                    pedido.GuidPedido       = sessaoPedidoAtual;

                    if (PedidoDAO.CadastrarPedido(pedido))
                    {
                        if (Sessao.KillTodasAsSessoes())
                        {
                            return(RedirectToAction("Home", "Cliente"));
                        }
                    }

                    return(RedirectToAction("AddIngredientesNaPizza", "Pizza"));
                }
            }

            ViewBag.Pizzas = retornoPizzaPedido;
            return(View());
        }
コード例 #15
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            // Aqui que vamos fazer a instancia dos objetos para trabalhar
            // de forma com injecão de dependencias.
            services.AddMvc()
            .SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
            services.AddCors();

            var connectionString = @"Data Source=DESKTOP-BFGEAHA\SQLEXPRESS03;
                                     Initial Catalog=PizzariaApi;
                                     User Id=sa;
                                     Password=123456;";

            IClienteDAO clienteDAO         = new ClienteDAO(connectionString);
            var         repositorioCliente = new ClienteRepositorio(clienteDAO);
            var         servicoCliente     = new ClienteService(repositorioCliente);

            IPizzaDAO pizzaDAO         = new PizzaDAO(connectionString);
            var       repositorioPizza = new PizzaRepositorio(pizzaDAO);
            var       servicoPizza     = new PizzaService(repositorioPizza);

            IPedidoDAO pedidoDAO         = new PedidoDAO(connectionString);
            var        repositorioPedido = new PedidoRepositorio(pedidoDAO);
            var        servicoPedido     = new PedidoService(repositorioPedido);

            IBebidaDAO bebidaDAO         = new BebidaDAO(connectionString);
            var        repositorioBebida = new BebidaRepositorio(bebidaDAO);
            var        servicoBebida     = new BebidaService(repositorioBebida);

            IEnderecoDAO enderecoDAO         = new EnderecoDAO(connectionString);
            var          repositorioEndereco = new EnderecoRepositorio(enderecoDAO);
            var          servicoEndereco     = new EnderecoService(repositorioEndereco);

            //Para cada servico
            services.AddSingleton <IBebidaService>(servicoBebida);
            services.AddSingleton <IPedidoService>(servicoPedido);
            services.AddSingleton <IClienteService>(servicoCliente);
            services.AddSingleton <IEnderecoService>(servicoEndereco);
            services.AddSingleton <IPizzaService>(servicoPizza);
        }
コード例 #16
0
        public ActionResult CadastrarPizza(Pizza novaPizza)
        {
            string sessaoPizza = Sessao.CriarSessaoIngrediente_Pizza();

            List <Ingrediente_Pizza> lstIngrediente_Pizza = Ingrediente_PizzaDAO.RetornarTodosNaSessao(sessaoPizza);

            double valorTotaldeIngredientePizza = 0;

            foreach (var ingrediente in lstIngrediente_Pizza)
            {
                valorTotaldeIngredientePizza += ingrediente.ingredientePizza.PrecoIngrediente;
            }

            novaPizza.PrecoPizza      = valorTotaldeIngredientePizza;
            novaPizza.GuidPizza       = sessaoPizza;
            novaPizza.GuidPedido      = Sessao.CriarSessaoPizza_Pedido();
            novaPizza.DataPizza       = DateTime.Now;
            novaPizza.lstIngredientes = Ingrediente_PizzaDAO.RetornarTodosNaSessao(sessaoPizza);

            if (PizzaDAO.CadastrarPizza(novaPizza))
            {
                Pizza_Pedido pizza_Pedido = new Pizza_Pedido
                {
                    pizza            = novaPizza,
                    DataPizza_Pedido = DateTime.Now,
                    GuidPedido       = Sessao.CriarSessaoPizza_Pedido()
                };



                if (Pizza_PedidoDAO.CadastrarPizza_Pedido(pizza_Pedido))
                {
                    return(RedirectToAction("Home", "Pedido"));
                }
            }

            ViewBag.Ingredientes = lstIngrediente_Pizza;
            return(View());
        }
コード例 #17
0
        internal double AlterarTextBoxConformeCombo(string pizzaSelecionada)
        {
            PizzaDAO pizzaDAO = new PizzaDAO();

            return(pizzaDAO.AlterarTextBoxConformeCombo(pizzaSelecionada));
        }
コード例 #18
0
        internal DataTable BuscarTodasPizzas()
        {
            PizzaDAO pizzaDAO = new PizzaDAO();

            return(pizzaDAO.BuscarTodasPizzas());
        }
コード例 #19
0
 public bool DeletePizza(PizzaDAO pizza)
 {
     return(data.DeletePizza(PizzaMapper.MapToPizza(pizza)));
 }
コード例 #20
0
 public bool InsertPizza(PizzaDAO pizza)
 {
     return(data.InsertPizza(PizzaMapper.MapToPizza(pizza)));
 }
コード例 #21
0
        internal void Cadastrar(PizzaDTO dadosPizza)
        {
            PizzaDAO pizzaDAO = new PizzaDAO();

            pizzaDAO.Cadastrar(dadosPizza);
        }
コード例 #22
0
        public SqlDataReader RetornarPizza(int indice)
        {
            PizzaDAO pizz = new PizzaDAO();

            return(pizz.RetornarPizza(indice));
        }
コード例 #23
0
        //Método intermediário utilizado para retornar informações dos clientes que estão salvos no banco.
        public SqlDataReader RetornarPizzas()
        {
            PizzaDAO pizz = new PizzaDAO();

            return(pizz.RetornarPizzas());
        }
コード例 #24
0
 public bool ChangePizza(PizzaDAO pizza)
 {
     return(data.ChangePizza(PizzaMapper.MapToPizza(pizza)));
 }
コード例 #25
0
        public ActionResult Ordering(PizzaStoreModel m)
        {
            data = TempData["temp"] as PizzaStoreModel;
            //data.PizzaOrder.Order = new OrderDAO();
            //data.PizzaOrder.Order.Pizzas = new List<PizzaDAO>();
            PizzaDAO pizza = new PizzaDAO();

            pizza.Toppings = new List <ToppingDAO>();
            pizza.Cheeses  = new List <CheeseDAO>();
            pizza.Crust    = new CrustDAO();
            pizza.Sauce    = new SauceDAO();
            pizza.Size     = new SizeDAO();

            for (int i = 0; i < m.ListOfTopping.Count; i++)
            {
                m.ListOfTopping[i].ID   = data.ListOfTopping[i].ID;
                m.ListOfTopping[i].Name = data.ListOfTopping[i].Name;
            }
            for (int i = 0; i < m.ListOfCheeses.Count; i++)
            {
                m.ListOfCheeses[i].ID   = data.ListOfCheeses[i].ID;
                m.ListOfCheeses[i].Name = data.ListOfCheeses[i].Name;
            }
            for (int i = 0; i < m.ListOfSizes.Count; i++)
            {
                m.ListOfSizes[i].ID   = data.ListOfSizes[i].ID;
                m.ListOfSizes[i].Name = data.ListOfSizes[i].Name;
            }
            for (int i = 0; i < m.ListOfCrusts.Count; i++)
            {
                m.ListOfCrusts[i].ID   = data.ListOfCrusts[i].ID;
                m.ListOfCrusts[i].Name = data.ListOfCrusts[i].Name;
            }

            for (int i = 0; i < m.ListOfSauces.Count; i++)
            {
                m.ListOfSauces[i].ID   = data.ListOfSauces[i].ID;
                m.ListOfSauces[i].name = data.ListOfSauces[i].name;
            }

            foreach (var item in m.ListOfTopping)
            {
                if (item.picked == true)
                {
                    pizza.Toppings.Add(item);
                }
            }
            foreach (var item in m.ListOfCheeses)
            {
                if (item.picked == true)
                {
                    pizza.Cheeses.Add(item);
                }
            }
            foreach (var item in m.ListOfCrusts)
            {
                if (item.picked == true)
                {
                    pizza.Crust.ID   = item.ID;
                    pizza.Crust.Name = item.Name;
                }
            }
            foreach (var item in m.ListOfSauces)
            {
                if (item.picked == true)
                {
                    pizza.Sauce.ID   = item.ID;
                    pizza.Sauce.name = item.name;
                }
            }
            foreach (var item in m.ListOfSizes)
            {
                if (item.picked == true)
                {
                    pizza.Size.ID   = item.ID;
                    pizza.Size.Name = item.Name;
                }
            }
            data.PizzaOrder.Order.Pizzas.Add(pizza);
            TempData["temp"] = data;
            return(View(data));
        }
コード例 #26
0
        protected void Page_Load(object sender, EventArgs e)
        {
            oPizzaDAO = new PizzaDAO();

            FacadeMth("Listar");
        }
コード例 #27
0
 protected void Page_Load(object sender, EventArgs e)
 {
     oPizzaBO  = new PizzaBO();
     oPizzaDAO = new PizzaDAO();
 }