Ejemplo n.º 1
0
        private bool ExisteEnLaBasedeDatos()
        {
            OrdenRepositorio ord = new OrdenRepositorio();
            OrdenDeCompra    Pro = ord.Buscar((int)NoOrdenNumericUpDown.Value);

            return(Pro != null);
        }
Ejemplo n.º 2
0
 private void EditarButton_Click(object sender, EventArgs e)
 {
     try
     {
         OrdenRepositorio or = new OrdenRepositorio();
         if (ConsultaDataGridView.CurrentRow.Cells[0].Value != null)
         {
             OrdenDeCompra odc;
             int           id;
             int.TryParse(ConsultaDataGridView.CurrentRow.Cells[0].Value.ToString(), out id);
             odc = or.Buscar(id);
             new rOrdenCompra(odc);
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Ejemplo n.º 3
0
        private void AgregarButton_Click(object sender, EventArgs e)
        {
            OrdenRepositorio        ordr = new OrdenRepositorio();
            Repositorio <Productos> rp   = new Repositorio <Productos>();

            if (DetalleDataGridView.DataSource != null)
            {
                this.Detalle = (List <DetalleProductos>)DetalleDataGridView.DataSource;
            }
            OrdenDeCompra p    = ordr.Buscar((int)NoOrdenNumericUpDown.Value);
            Productos     prod = rp.Buscar((int)NoProductoNumericUpDown.Value);

            if (CantidadNumericUpDown.Value <= prod.Cantidad)
            {
                this.Detalle.Add(
                    new DetalleProductos(iD: 0,
                                         noProducto: (int)NoProductoNumericUpDown.Value,
                                         descripcion: prod.Descripcion,
                                         cantidad: (int)CantidadNumericUpDown.Value,
                                         precio: prod.Precio,
                                         importe: prod.Precio * (int)CantidadNumericUpDown.Value
                                         ));


                foreach (var item in this.Detalle)
                {
                    total         += item.Importe;
                    prod.Cantidad -= item.Cantidad;
                }
                TotalNumericUpDown.Value = total;
                CargarGrid();
            }
            else
            {
                MessageBox.Show("Se piden mas productos de los que hay", "Fallo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 4
0
        public void BuscarTest()
        {
            OrdenRepositorio test = new OrdenRepositorio();

            Assert.IsNotNull(test.Buscar(0));
        }