Esempio n. 1
0
        public void ProbarCargarIvaActual_CargarCorrecto_RegresaIva()
        {
            IvaDAO ivaDAO = new IvaDAO();
            Iva    iva    = ivaDAO.CargarIvaActual();

            Assert.AreEqual(VALOR_IVA_ACTUAL_EN_BASE, iva.Valor);
        }
Esempio n. 2
0
        public void ProbarCargarTodos_CargaCorrecto_RegresaListaDeIvas()
        {
            IvaDAO ivaDAO             = new IvaDAO();
            int    numeroDeIvasActual = ivaDAO.CargarTodos().Count();

            Assert.AreEqual(NUMERO_DE_IVAS_EN_BASE, numeroDeIvasActual);
        }
Esempio n. 3
0
        public GUIReciboDeCuenta(Cuenta cuenta)
        {
            InitializeComponent();
            IvaDAO ivaDAO = new IvaDAO();

            Iva    = ivaDAO.CargarIvaActual();
            Cuenta = cuenta;
            cuenta.CalcularPrecioTotal();
            LabelCuenta.Content         = "Cuenta: " + cuenta.Id + " " + cuenta.Estado.ToString();
            LabelIva.Content            = Iva.Valor * cuenta.PrecioTotal;
            LabelPrecioTotal.Content    = (cuenta.PrecioTotal * Iva.Valor) + cuenta.PrecioTotal;
            DataGridPedidos.ItemsSource = cuenta.Pedidos;
            DataGridPedidos.ItemsSource = CargarAlimentosDePedidos();
        }
Esempio n. 4
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");
            }
        }
Esempio n. 5
0
        private void MostrarIvas()
        {
            IvaDAO ivaDAO = new IvaDAO();

            Ivas      = ivaDAO.CargarTodos();
            IvaActual = Ivas.FirstOrDefault(i => i.Activo == true);
            if (IvaActual != null)
            {
                LabelValorIvaActual.Content         = "Valor: " + IvaActual.Valor;
                LabelFechaCreacionIvaActual.Content = "Fecha creación: " + IvaActual.FechaDeCreacion.ToString();
                LabelFechaDeInicioIvaActual.Content = "Fecha de inicio: " + IvaActual.FechaDeInicio.ToString();
                LabelCreadorIvaActual.Content       = "Creador: " + IvaActual.Creador;
            }
            Ivas.Remove(IvaActual);

            DataGridIvasAnteriores.ItemsSource = null;
            DataGridIvasAnteriores.ItemsSource = Ivas;
        }
Esempio n. 6
0
        public void ProbarGuardar_IvaInactivoCorrecto_RegresaVoid()
        {
            Iva iva = new Iva
            {
                Activo          = false,
                Creador         = "Test",
                FechaDeCreacion = DateTime.Now,
                FechaDeInicio   = DateTime.Now,
                Valor           = VALOR_IVA_A_GUARDAR_CORRECTO
            };

            IvaDAO ivaDAO = new IvaDAO();

            ivaDAO.Guardar(iva);


            bool resultado = ivaDAO.CargarTodos().Exists(i => i.Valor == VALOR_IVA_A_GUARDAR_CORRECTO && i.Activo == false);

            ivaDAO.Depuracion_Eliminar(VALOR_IVA_A_GUARDAR_CORRECTO);
            Assert.IsTrue(resultado);
        }
Esempio n. 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);
        }
Esempio n. 8
0
        private void LimpiarPantalla()
        {
            IvaDAO      ivaDAO      = new IvaDAO();
            PlatilloDAO platilloDAO = new PlatilloDAO();
            ProductoDAO productoDAO = new ProductoDAO();

            Iva = ivaDAO.CargarIvaActual();
            IvaLabel.Content  = "IVA(" + Iva.Valor * 10 + "%)";
            ProductosCargados = productoDAO.CargarProductosActivos();
            PlatillosCargados = platilloDAO.CargarTodos();
            AlimentosCargados = new List <Alimento>();
            AlimentosCargados = AlimentosCargados.Concat(PlatillosCargados).ToList();
            AlimentosCargados = AlimentosCargados.Concat(ProductosCargados).ToList();
            AlimentosVisibles = AlimentosCargados;
            Pedido            = new Pedido();
            ActualizarPantalla();
            BusquedaTextBox.Text             = string.Empty;
            NombreDeClienteTextBox.Text      = string.Empty;
            NumeroTelefonicoTextBox.Text     = string.Empty;
            DireccionClienteTextBlock.Text   = string.Empty;
            ComentariosClienteTextBlock.Text = string.Empty;
            ComentariosOrdenTextBlock.Text   = string.Empty;
        }