public void GuardarTest()
        {
            Cotizaciones cotizaciones = new Cotizaciones
            {
                Fecha         = DateTime.Now,
                Observaciones = "Producto bueno"
            };

            cotizaciones.Detalle.Add(new DetalleCotizaciones(0, 0, 1, 1, 2f, 50f, 100f));
            cotizaciones.Detalle.Add(new DetalleCotizaciones(0, 0, 2, 3, 4f, 10f, 40f));

            bool paso = CotizacionesBLL.Guardar(cotizaciones);

            Assert.AreEqual(true, paso);
        }
Esempio n. 2
0
        public JsonResult Guardar(Cotizaciones nueva)
        {
            int id = 0;

            if (ModelState.IsValid)
            {
                if (CotizacionesBLL.Guardar(nueva))
                {
                    id = nueva.CotizacionId;
                }
            }
            else
            {
                id = +1;
            }
            return(Json(id));
        }
Esempio n. 3
0
        private void BtnGuardar_Click(object sender, EventArgs e)
        {
            Cotizaciones cotizacion;
            bool         Paso = false;

            if (HayErrores())
            {
                MessageBox.Show("Favor revisar todos los campos", "Validación",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            cotizacion = LlenaClase();

            //Determinar si es Guardar o Modificar
            if (CotizacionIdnumericUpDown.Value == 0)
            {
                Paso = CotizacionesBLL.Guardar(cotizacion);
            }
            else
            {
                //validar que exista.
                Paso = CotizacionesBLL.Modificar(cotizacion);
            }

            //Informar el resultado
            if (Paso)
            {
                BtnNuevo.PerformClick();
                MessageBox.Show("Guardado!!", "Exito",
                                MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("No se pudo guardar!!", "Fallo",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 4
0
        private void GuardarBtn(object sender, RoutedEventArgs e)
        {
            bool     paso    = false;
            Clientes cliente = (Clientes)clienteComboBox.SelectedValue;

            cotizaciones.ClienteId = cliente.ClienteId;

            if (!Validar())
            {
                return;
            }

            if (String.IsNullOrEmpty(cotizacionIdTextBox.Text) || cotizacionIdTextBox.Text == "0")
            {
                paso = CotizacionesBLL.Guardar(cotizaciones);
            }
            else
            {
                if (!Existe())
                {
                    MessageBox.Show("No existe el en la Base de datos", "Informacion", MessageBoxButton.OK, MessageBoxImage.Information);
                    return;
                }
                paso = CotizacionesBLL.Modificar(cotizaciones);
            }

            if (paso)
            {
                MessageBox.Show("Guardado!!", "EXITO", MessageBoxButton.OK, MessageBoxImage.Information);
                Limpiar();
            }
            else
            {
                MessageBox.Show(" No guardado!!", "Informacion", MessageBoxButton.OK, MessageBoxImage.Information);
            }
        }