public void GuardarTest()
        {
            Inventario inventario = new Inventario();
            bool       paso       = false;

            inventario.InventarioId    = 0;
            inventario.Fecha           = DateTime.Now;
            inventario.SuplidorId      = 1;
            inventario.TotalInventario = 1000;

            InventarioDetalle detalle = new InventarioDetalle();

            detalle.InventarioDetalleId = 0;
            detalle.InventarioId        = 0;
            detalle.ProductoId          = 1;
            detalle.costo           = 100;
            detalle.Inventario      = 10;
            detalle.ValorInventario = 1000;

            inventario.Productos.Add(detalle);

            paso = InventarioBLL.Guardar(inventario);

            Assert.AreEqual(paso, true);
        }
Beispiel #2
0
 private void Form1_Load(object sender, EventArgs e)
 {
     if (InventarioBLL.Buscar(1) == null)
     {
         InventarioBLL.Guardar(new Entidades.Inventarios(0));
     }
 }
Beispiel #3
0
        public void Guardar()
        {
            bool       paso       = false;
            Inventario inventario = new Inventario();

            inventario.Id    = 1;
            inventario.Total = 0;
            paso             = InventarioBLL.Guardar(inventario);
            Assert.AreEqual(paso, true);
        }
        private void Guardarbutton_Click(object sender, EventArgs e)
        {
            Inventarios i    = new Inventarios();
            bool        paso = false;


            if (!Validar())
            {
                return;
            }

            i = LlenaClase();


            if (IDnumericUpDown.Value == 0)
            {
                if (!ValidarRepeticion())
                {
                    return;
                }

                paso = InventarioBLL.Guardar(i);
            }
            else
            {
                if (!ExisteEnLaBaseDeDatos())
                {
                    MessageBox.Show("No se puede guardar.", "Rafa Motor", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                paso = InventarioBLL.Modificar(i);
            }

            if (paso)
            {
                MessageBox.Show("Guardado", "Rafa Motor", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("No fue posible guardar", "Rafa Motor", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            Limpiar();
        }
        private void SyncTotal()
        {
            Inventarios total = new Inventarios();

            try
            {
                if (InventarioBLL.Buscar() != null)
                {
                    InventarioBLL.Actualizar();
                    total = InventarioBLL.Buscar();
                }
                else
                {
                    Inventarios valor = new Inventarios();
                    InventarioBLL.Guardar(valor);
                    InventarioBLL.Actualizar();
                    valor = InventarioBLL.Buscar();
                }
            }
            catch (Exception)
            {
            }
            SyncedTotaltextBox.Text = total.ValorTotalInventario.ToString();
        }