Exemple #1
0
 private Models.EMarcas ObtenerMarcaSeleccionada()
 {
     try
     {
         int rowindex = dgvDatos.CurrentCell.RowIndex;
         var id       = (Int32)dgvDatos.Rows[rowindex].Cells[0].Value;
         var a        = MarcasRepository.ObtenerMarcaPorId(id);
         return(a);
     }
     catch (Exception)
     {
         return(null);
     }
 }
Exemple #2
0
        private void dgvDatos_SelectionChanged(object sender, EventArgs e)
        {
            var a = ObtenerArticuloSeleccionado();

            if (a == null)
            {
                txtDescripcion.Text  = "";
                txtCodBarra.Text     = "";
                txtMarca.Text        = "";
                txtRubro.Text        = "";
                txtProveedor.Text    = "";
                txtStock.Text        = "";
                txtStockMin.Text     = "";
                txtCostoInicial.Text = "";
                txtDesc1.Text        = "";
                txtDesc2.Text        = "";
                txtDesc3.Text        = "";
                txtCosto.Text        = "";
                txtLista1.Text       = "";
                txtLista2.Text       = "";
                txtLista3.Text       = "";
                txtIVA.Text          = "";
                return;
            }
            txtDescripcion.Text  = a.Descripcion;
            txtCodBarra.Text     = a.CodBarra;
            txtMarca.Text        = MarcasRepository.ObtenerMarcaPorId(Convert.ToInt16(a.IdMarca)).Marca;
            txtRubro.Text        = RubrosRepository.ObtenerRubroPorId(Convert.ToInt16(a.IdRubro)).Rubro;
            txtProveedor.Text    = ProveedoresRepository.ObtenerProveedorPorId(Convert.ToInt16(a.IdProveedor)).RazonSocial;
            txtStock.Text        = Convert.ToString(a.Stock);
            txtStockMin.Text     = Convert.ToString(a.StockMinimo);
            txtCostoInicial.Text = "$ " + Convert.ToString(a.CostoInicial);
            txtDesc1.Text        = "$ " + Convert.ToString(a.Descuento1) + " (" + Convert.ToString(a.DescuentoPorc1) + "%)";
            txtDesc2.Text        = "$ " + Convert.ToString(a.Descuento2) + " (" + Convert.ToString(a.DescuentoPorc2) + "%)";;
            txtDesc3.Text        = "$ " + Convert.ToString(a.Descuento3) + " (" + Convert.ToString(a.DescuentoPorc3) + "%)";;
            txtCosto.Text        = "$ " + Convert.ToString(a.Costo);
            txtLista1.Text       = "$ " + Convert.ToString(a.PrecioL1) + " (" + Convert.ToString(a.PrecioPorcL1) + "%)";
            txtLista2.Text       = "$ " + Convert.ToString(a.PrecioL2) + " (" + Convert.ToString(a.PrecioPorcL2) + "%)";
            txtLista3.Text       = "$ " + Convert.ToString(a.PrecioL3) + " (" + Convert.ToString(a.PrecioPorcL3) + "%)";
            txtIVA.Text          = Convert.ToString(a.IVA);
        }