Exemplo n.º 1
0
        private void dgLaboratorios_SelectionChanged(object sender, EventArgs e)
        {
            try
            {
                l = null;

                idLaboratorio = int.Parse(dgLaboratorios.SelectedRows[0].Cells["Codigo_Laboratorio"].Value.ToString());

                l = lservice.ReadByIdLaboratorio(idLaboratorio);

                txtNombre.Text    = l.Nombre;
                txtDireccion.Text = l.Direccion;
                txtEmail.Text     = l.Email;
                cbEstado.Text     = l.Estado.ToString();
                txtTelefono.Text  = l.Telefono.ToString();
            }
            catch (Exception) { }
        }
        private void dgProductos_SelectionChanged(object sender, EventArgs e)
        {
            try {
                p            = null;
                nombreActual = "";

                id = Convert.ToInt32(dgProductos.SelectedRows[0].Cells["Codigo_Producto"].Value);

                p = pservice.ReadByIdProducto(id);

                nombreActual        = txtNombre.Text = p.NombreProd;
                txtComposicion.Text = p.Composicion;
                nudPrecio.Text      = p.Precio.ToString();
                nudCantidad.Text    = p.Cantidad_Por_Unidad_gr_.ToString();
                nudStock.Text       = p.Stock.ToString();

                cbMarca.Text        = mservice.ReadByIdMarca(p.Marca).NombreMarca;
                cbCategoria.Text    = cservice.ReadByIdCategoria(p.Categoria).NombreCategoria;
                cbPresentacion.Text = prservice.ReadByIdPresentacion(p.Presentacion).NombrePresentacion;
                cbLaboratorio.Text  = lservice.ReadByIdLaboratorio(p.Laboratorio).Nombre;
            }
            catch (Exception) { }
        }