private void MostrarGridPizzasEscolhidas() { MessageBox.Show("Ola 3"); List <ClientesPizzas> list = ClientesPizzasController.PesquisarClientePedidos(clientePedido, NumReferencia); gridPizzasEscolhidas.ItemsSource = list; }
private void btnCancelar_Click(object sender, RoutedEventArgs e) { referenciaButton = 1; ClientesPizzasController.ExcluirPedidosCliente(clientePedido.ClienteID, NumReferencia); MainWindow w = new MainWindow(); this.Close(); w.ShowDialog(); }
private void SalvarPizzaEscolhida(Pizza pizza) { ClientesPizzas novo = new ClientesPizzas(); novo.ClienteID = clientePedido.ClienteID; novo.PizzaID = pizza.PizzaID; novo.Tamanho_Pizza = TamPizza; novo.NumReferencia = NumReferencia; ClientesPizzasController.SalvarItem(novo); MostrarGridPizzasEscolhidas(); }
private void ExcluirSelecaoAposMudarTamanho() { List <ClientesPizzas> listaSelecao = ClientesPizzasController.PesquisarClientePedidos(clientePedido, NumReferencia); foreach (var item in listaSelecao) { ClientesPizzasController.ExcluirSelecao(item.ClientesPizzasID); } MostrarGridPizzasEscolhidas(); valorTotal = 0; blockValorTotal.Text = valorTotal.ToString("C2"); }
private void GerarNumReferencia() { int num = ClientesPizzasController.RetornaUltimo(); if (num != -1) { NumReferencia = num + 1; } else { NumReferencia = 0; } }
private void SalvandoNaTabelaPedidos() { List <ClientesPizzas> list = ClientesPizzasController.PesquisarClientePedidos(clientePedido, NumReferencia); Pedido novoPed = new Pedido(); novoPed.Status = "EM PRODUÇÃO"; DateTime data = DateTime.Now; novoPed.Data = data; novoPed.ValorTotal = double.Parse(blockValorTotal.Text); PedidoController.SalvarPedido(novoPed); SalvarTabelaPedidoPizzas(novoPed.NumeroPedidoID, list); }
private void btnMudarQtd_Click(object sender, RoutedEventArgs e) { List <ClientesPizzas> listaEscolhidos = ClientesPizzasController.PesquisarClientePedidos(clientePedido, NumReferencia); foreach (var item in listaEscolhidos) { ClientesPizzasController.ExcluirSelecao(item.ClientesPizzasID); } MostrarGridPizzasEscolhidas(); MessageBox.Show("Escolha os sabores novamente !", "Mudando quantidade", MessageBoxButton.OK, MessageBoxImage.Information); valorTotal = 0; blockValorTotal.Text = Convert.ToString(valorTotal.ToString("C2")); txtQuantidade.IsEnabled = true; }
private void Bebidas_Click(object sender, RoutedEventArgs e) { referenciaButton = 2; if (gridPizzasEscolhidas.Items.Count > 0) { PedidoBebidas bebidas = new PedidoBebidas(); List <ClientesPizzas> list = ClientesPizzasController.PesquisarClientePedidos(clientePedido, NumReferencia); bebidas.MostrarClienteParteBebidas(clientePedido, valorTotal, numPedido, list); this.Close(); bebidas.ShowDialog(); } else { MessageBox.Show("Escolha alguma pizza", "Erro", MessageBoxButton.OK); } }
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { if (referenciaButton == 0) { if (MessageBox.Show("Deseja cancelar pedido ?", "Cancelar pedido", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes) { ClientesPizzasController.ExcluirPedidosCliente(clientePedido.ClienteID); Environment.Exit(0); } } else if (referenciaButton == 1) { if (MessageBox.Show("Deseja cancelar pedido ?", "Cancelar pedido", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes) { ClientesPizzasController.ExcluirPedidosCliente(clientePedido.ClienteID); } } }
private void Bebidas_Click(object sender, RoutedEventArgs e) { referenciaButton = 2; string verifica = "^[0-9]"; if (txtQuantidade.Text == "" || (!Regex.IsMatch(txtQuantidade.Text.Substring(0, 1), verifica))) { MessageBox.Show("Escolha uma quantidade de pizza."); } else if (gridPizzasEscolhidas.Items.Count > 0) { PedidoBebidas bebidas = new PedidoBebidas(); List <ClientesPizzas> list = ClientesPizzasController.PesquisarClientePedidos(clientePedido, NumReferencia); bebidas.MostrarClienteBebidas(clientePedido, valorTotal, numPedido, list, NumReferencia, int.Parse(txtQuantidade.Text)); this.Close(); bebidas.ShowDialog(); } else { MessageBox.Show("Escolha alguma pizza", "Erro", MessageBoxButton.OK, MessageBoxImage.Error); } }
private void gridPizzasEscolhidas_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (gridPizzasEscolhidas.SelectedItem != null) { MessageBoxResult result = MessageBox.Show("Confirma a exclusão do item " + ((ClientesPizzas)gridPizzasEscolhidas.SelectedItem)._Pizza.Nome + " ?", "Exclusão", MessageBoxButton.YesNo, MessageBoxImage.Question); if (result == MessageBoxResult.Yes) { try { int id = ((ClientesPizzas)gridPizzasEscolhidas.SelectedItem).ClientesPizzasID; ClientesPizzasController.ExcluirSelecao(id); MessageBox.Show("Item excluído com sucesso"); valorTotal -= ((ClientesPizzas)gridPizzasEscolhidas.SelectedItem).Preco; blockValorTotal.Text = Convert.ToString(valorTotal.ToString("C2")); MostrarGrid(); MostrarGridPizzasEscolhidas(); } catch (Exception erro) { MessageBox.Show("ERRO: " + erro); } } } }