Example #1
0
        internal void CadastrarBebida(BebidaDTO dadosBebida)
        {
            BebidaDAO bebidaDAO = new BebidaDAO();

            FormatarPreco(dadosBebida);

            bebidaDAO.Cadastrar(dadosBebida);
        }
        private void BtnAdcionarBebida_Click(object sender, RoutedEventArgs e)
        {
            bebida = new Bebida();
            int idBebida = Convert.ToInt32(cbBebida.SelectedValue);

            bebida = BebidaDAO.BuscarBebidaPorId(idBebida);

            listaBebidas.Add(bebida);
            dtaBebida.ItemsSource = listaBebidas;
            dtaBebida.Items.Refresh();
        }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            cbSabor.ItemsSource       = SaborDAO.ListarSabores();
            cbSabor.DisplayMemberPath = "Nome";
            cbSabor.SelectedValuePath = "SaborId";

            cbTamanho.ItemsSource       = TamanhoDAO.ListarTamanhoes();
            cbTamanho.DisplayMemberPath = "Nome";
            cbTamanho.SelectedValuePath = "TamanhoId";

            cbBebida.ItemsSource       = BebidaDAO.ListarBebidas();
            cbBebida.DisplayMemberPath = "Nome";
            cbBebida.SelectedValuePath = "BebidaId";
        }
Example #4
0
        public PedidoController(TamanhoDAO tamanhoDAO, SaborDAO saborDAO, BebidaDAO bebidaDAO, VendaDAO vendaDAO, UtilsSession utilsSession,
                                UsuarioDAO usuarioDAO, UserManager <UsuarioLogado> userManager, SignInManager <UsuarioLogado> signInManager)
        {
            pizzas = new List <ItemPizza>();

            venda         = new Venda();
            pizza         = new Pizza();
            _tamanhoDAO   = tamanhoDAO;
            _saborDAO     = saborDAO;
            _bebidaDAO    = bebidaDAO;
            _vendaDAO     = vendaDAO;
            _utilsSession = utilsSession;

            _usuarioDAO    = usuarioDAO;
            _userManager   = userManager;
            _signInManager = signInManager;
        }
        private void BtnCadastrar_Click(object sender, RoutedEventArgs e)
        {
            Bebida bebida = new Bebida
            {
                Nome     = txtNome.Text,
                Preco    = Convert.ToDouble(txtPreco.Text),
                CriadoEm = DateTime.Now
            };

            if (BebidaDAO.CadastrarBebida(bebida))
            {
                MessageBox.Show("Bebida cadastrada com sucesso");
            }
            else
            {
                MessageBox.Show("Bebida já cadastrada!!!");
            }
        }
Example #6
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);
        }
 public BebidaController(BebidaDAO bebidaDAO)
 {
     _bebidaDAO = bebidaDAO;
 }
Example #8
0
        internal double AlterarTextBoxConformeCombo(string bebidaSelecionada)
        {
            BebidaDAO bebidaDAO = new BebidaDAO();

            return(bebidaDAO.AlterarTextBoxConformeCombo(bebidaSelecionada));
        }
Example #9
0
        internal DataTable BuscarTodasBebidas()
        {
            BebidaDAO bebidaDAO = new BebidaDAO();

            return(bebidaDAO.BuscarTodasBebidas());
        }
        private void BtnDeletar_Click(object sender, RoutedEventArgs e)
        {
            Bebida bebida = (Bebida)dtaBebidas.SelectedValue;

            BebidaDAO.DeletarBebida(bebida);
        }
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     dtaBebidas.ItemsSource = BebidaDAO.ListarBebidas();
 }