Ejemplo n.º 1
0
        public void ModificarTest()
        {
            DevolucionDetalles devolucionDetalles = new DevolucionDetalles(1, 1, "Monki", DateTime.Now);

            List <DevolucionDetalles> list = new List <DevolucionDetalles>();

            list.Add(devolucionDetalles);
            Devoluciones devoluciones = new Devoluciones(1, true, 1, 1, null, 1, null, list, DateTime.Now, DateTime.Now);
            bool         realizado    = DevolucionesBLL.Guardar(devoluciones);

            Assert.AreEqual(true, realizado);
        }
Ejemplo n.º 2
0
        private void GuardarButton_Click(object sender, EventArgs e)
        {
            Devoluciones devoluciones = new Devoluciones();
            bool         paso         = false;

            if (!validar())
            {
                return;
            }

            devoluciones = LlenaClase();

            if (IdnumericUpDown1.Value == 0)
            {
                LlenaCombox();
                paso = DevolucionesBLL.Guardar(devoluciones);
            }
            else
            {
                if (!ExisteEnLaBaseDeDatos())
                {
                    MessageBox.Show("No se puede modificar un registro que no existe", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                paso = DevolucionesBLL.Modificar(devoluciones);
            }

            if (paso)
            {
                Limpiar();
                MessageBox.Show("Guardado", "Exito", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("No se pudo guardar", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 3
0
        //——————————————————————————————————————————————————————————————[ Guardar ]———————————————————————————————————————————————————————————————
        private void GuardarButton_Click(object sender, RoutedEventArgs e)
        {
            {
                if (!Validar())
                {
                    return;
                }

                //—————————————————————————————————[ Devolución Id ]—————————————————————————————————
                if (DevolucionesIdTextbox.Text.Trim() == string.Empty)
                {
                    MessageBox.Show("El Campo (Devolución Id) está vacío.\n\nAsigne un Id al Préstamo.", "Advertencia", MessageBoxButton.OK, MessageBoxImage.Warning);
                    DevolucionesIdTextbox.Text = "0";
                    DevolucionesIdTextbox.Focus();
                    DevolucionesIdTextbox.SelectAll();
                    return;
                }
                //—————————————————————————————————[ Cliente Id ]—————————————————————————————————
                if (ClienteIdComboBox.Text == string.Empty)
                {
                    MessageBox.Show("El Campo (Cliente Id) está vacío.\n\nSelecione un Cliente.", "Advertencia", MessageBoxButton.OK, MessageBoxImage.Warning);
                    ClienteIdComboBox.IsDropDownOpen = true;
                    return;
                }

                var paso = DevolucionesBLL.Guardar(this.devoluciones);
                if (paso)
                {
                    Limpiar();
                    MessageBox.Show("Transacción Exitosa", "Éxito", MessageBoxButton.OK, MessageBoxImage.Information);
                }
                else
                {
                    MessageBox.Show("Transacción Fallida", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
        }