private void ButtonGuardar_Click(object sender, RoutedEventArgs e)
        {
            IngredienteDAO ingredienteDAO = new IngredienteDAO();

            if (ValidarEntradas())
            {
                AsignarValoresAIngrediente();

                if (!ValidarIngredienteExistente(ingredienteNuevo))
                {
                    try
                    {
                        ingredienteDAO.GuardarIngrediente(ingredienteNuevo);
                        MessageBox.Show("¡Registro Exitoso!");
                        Controlador.Regresar();
                    }
                    catch (ArgumentException ex)
                    {
                        MessageBox.Show(ex.Message + Environment.NewLine + ex.StackTrace.ToString(), "Alerta");
                    }
                }
                else
                {
                    MessageBox.Show("Este ingrediente ya se encuentra registrado, si desea aumentar su cantidad porfavor dirigase al apartado Editar Ingrediente");
                }
            }
            else
            {
                MostrarEstadoDeValidacion();
            }
        }
예제 #2
0
        private void ButtonCancelar_Click(object sender, RoutedEventArgs e)
        {
            MessageBoxResult messageBoxResult = MessageBox.Show("¿Desea salir del registro?", "Advertencia", MessageBoxButton.YesNo);

            if (messageBoxResult == MessageBoxResult.Yes)
            {
                Controlador.Regresar();
            }
        }
예제 #3
0
 private void NotificarPedidoRealizado()
 {
     LabelNotificacion.Content             = "Pedido realizado";
     LabelNotificacion.Foreground          = Brushes.LightGreen;
     ButtonNotificacionConfirmar.IsEnabled = false;
     ButtonNotificacionCancelar.IsEnabled  = false;
     Task.Delay(TIEMPO_DE_ESPERA_NOTIFICACION_PEDIDO_REALIZADO).ContinueWith(_ =>
     {
         Dispatcher.Invoke(() => { Controlador.Regresar(); });
     });
 }
        public GUIRegistrarIngrediente(ControladorDeCambioDePantalla controlador, Empleado empleado)
        {
            Controlador = controlador;
            Empleado    = empleado;
            InitializeComponent();
            IngredienteDAO ingredienteDAO = new IngredienteDAO();

            try
            {
                Ingredientes = ingredienteDAO.CargarIngredientesActivos();
            }
            catch (InvalidOperationException ex)
            {
                MessageBox.Show(ex.Message + "Porfavor contacte a su administrador", "Error! ", MessageBoxButton.OK);
                controlador.Regresar();
            }

            DataGridIngredientes.ItemsSource = Ingredientes;

            BarraDeEstado.Controlador = controlador;
            BarraDeEstado.ActualizarEmpleado(empleado);
            GridCompuestos.Visibility          = Visibility.Collapsed;
            ComboBoxUnidadMedida.ItemsSource   = Enum.GetValues(typeof(UnidadDeMedida));
            ComboBoxUnidadMedida.SelectedIndex = 0;
        }
예제 #5
0
        private void ButtonCancelar_Click(object sender, RoutedEventArgs e)
        {
            MessageBoxResult resultadoDeMessageBox = MessageBox.Show("¿Esta seguro que desea cancelar la edicion? Se perderan los cambios sin guardar", "Advertencia", MessageBoxButton.YesNo, MessageBoxImage.Exclamation);

            if (resultadoDeMessageBox == MessageBoxResult.Yes)
            {
                Controlador.Regresar();
            }
        }
예제 #6
0
        private void ButtonActualizar_Click(object sender, RoutedEventArgs e)
        {
            Cliente cliente = new Cliente
            {
                Id               = Cliente.Id,
                Nombre           = TextBoxNombre.Text,
                Telefono         = TextBoxTelefono.Text,
                Comentario       = TextBoxComentarios.Text,
                Direcciones      = Direcciones,
                NombreDelCreador = Empleado.Nombre
            };

            if (cliente.Validar())
            {
                ClienteDAO clienteDAO = new ClienteDAO();
                clienteDAO.Actualizar(cliente);
                MessageBox.Show("Cliente actualizado correctamente!", "EXITO");
                Controlador.Regresar();
            }
        }
예제 #7
0
        public GUIEditarPedido(ControladorDeCambioDePantalla controlador, Empleado empleadoDeCallCenter, Pedido pedido)
        {
            InitializeComponent();
            this.EmpleadoDeCallCenter = empleadoDeCallCenter;
            this.Pedido = pedido;
            IvaDAO      ivaDAO      = new IvaDAO();
            PlatilloDAO platilloDAO = new PlatilloDAO();
            ProductoDAO productoDAO = new ProductoDAO();

            try
            {
                Iva = ivaDAO.CargarIvaActual();
            }
            catch (InvalidOperationException e)
            {
                MessageBox.Show(e.Message + "Porfavor contacte a su administrador", "Error! ", MessageBoxButton.OK);
                controlador.Regresar();
            }

            IvaLabel.Content          = "IVA(" + Iva.Valor * 10 + "%)";
            Controlador               = controlador;
            BarraDeEstado.Controlador = controlador;
            try
            {
                ProductosCargados = productoDAO.CargarProductosActivos();
                PlatillosCargados = platilloDAO.CargarTodos();
            }
            catch (InvalidOperationException e)
            {
                MessageBox.Show(e.Message + "Porfavor contacte a su administrador", "Error! ", MessageBoxButton.OK);
                controlador.Regresar();
            }
            AlimentosCargados = AlimentosCargados.Concat(PlatillosCargados).ToList();
            AlimentosCargados = AlimentosCargados.Concat(ProductosCargados).ToList();
            AlimentosVisibles = AlimentosCargados;
            ActualizarPantalla();
            BarraDeEstado.ActualizarEmpleado(empleadoDeCallCenter);
        }
예제 #8
0
        private void ButtonActualizarIva_Click(object sender, RoutedEventArgs e)
        {
            Iva ivaAGuardar = new Iva()
            {
                Creador         = Empleado.Nombre,
                FechaDeCreacion = DateTime.Now
            };
            bool validacion = false;

            if (double.TryParse(TextBoxValor.Text, out double valor) && DatePickerFechaDeInicio.SelectedDate >= DateTime.Now.Date)
            {
                ivaAGuardar.Valor         = valor;
                ivaAGuardar.FechaDeInicio = DatePickerFechaDeInicio.SelectedDate.GetValueOrDefault();
                if (valor <= 0 && valor > 100)
                {
                    validacion = false;
                }
                validacion = true;
            }

            if (validacion && ValidarNumeroDecimal(TextBoxValor.Text))
            {
                if (ivaAGuardar.Valor <= 0 && ivaAGuardar.Valor > 100)
                {
                    MessageBox.Show("Debe insertar un valor mayor a 0 y menor o igual a 100.");
                }
                else
                {
                    ivaAGuardar.Valor = ivaAGuardar.Valor / 100;
                    IvaDAO ivaDAO = new IvaDAO();
                    ivaAGuardar.Activo = false;
                    if (DatePickerFechaDeInicio.SelectedDate.GetValueOrDefault().Date == DateTime.Now.Date)
                    {
                        ivaAGuardar.Activo = true;
                    }

                    ivaDAO.Guardar(ivaAGuardar);
                    MessageBox.Show("Iva registrado correctamente!", "NOTIFICACION", MessageBoxButton.OK);
                    Controlador.Regresar();
                }
            }
            else
            {
                MessageBox.Show("Ingrese un numero como valor");
            }
        }
예제 #9
0
        void ButtonMesa_Click(object sender, RoutedEventArgs e)
        {
            Mesa             mesa      = ((FrameworkElement)sender).DataContext as Mesa;
            MessageBoxResult resultado = MessageBox.Show("¿Abrir nueva cuenta?", "CREAR NUEVA CUENTA", MessageBoxButton.OKCancel);

            if (resultado == MessageBoxResult.OK)
            {
                Cuenta cuenta = new Cuenta
                {
                    Mesa     = mesa,
                    Empleado = Empleado
                };
                CuentaDAO cuentaDAO = new CuentaDAO();
                cuentaDAO.CrearCuenta(cuenta);
            }
            MostrarMesasDisponibles();
            Task.Delay(TIEMPO_DE_ESPERA_REGRESAR).ContinueWith(_ =>
            {
                Dispatcher.Invoke(() =>
                {
                    Controlador.Regresar();
                });
            });
        }
예제 #10
0
 private void RegresarButton_Click(object sender, RoutedEventArgs e)
 {
     Controlador.Regresar();
 }
예제 #11
0
 private void RechazarCancelacionButton_Click(object sender, RoutedEventArgs e)
 {
     Controlador.Regresar();
 }
예제 #12
0
 private void RespaldoGenerado()
 {
     MessageBox.Show("Se ha generado el respaldo correctamente!");
     Controlador.Regresar();
 }