コード例 #1
0
        public void llernarDatos(ProductoModel productoModel)
        {
            try
            {
                ProductoBusiness ctr   = new ProductoBusiness();
                ProductoModel    model = new ProductoModel();
                model.Cd_Prod = productoModel.Cd_Prod;

                ClassResult cr = ctr.Producto_ConsUn(model);
                if (cr.Dt1.Rows.Count > 0)
                {
                    DataRow row = cr.Dt1.Rows[0];
                    txt_nom1.Text        = row["Nombre1"].ToString();
                    txt_nom2.Text        = row["Nombre2"].ToString();
                    txt_nomcorto.Text    = row["NCorto"].ToString();
                    txt_Descripcion.Text = row["Descrip"].ToString();

                    txt_categoria.Text    = row["Categoria"].ToString();
                    txt_marca.Text        = row["Marca"].ToString();
                    txt_presentacion.Text = row["Presentacion"].ToString();

                    Id_Categoria    = Convert.ToInt32(row["Id_Categoria"].ToString());
                    Id_Mca          = Convert.ToInt32(row["Id_Mca"].ToString());
                    Id_Presentacion = Convert.ToInt32(row["Id_Presentacion"].ToString());

                    nud_stockmin.Value = Convert.ToInt32(row["StockMin"].ToString());
                    nud_stockmax.Value = Convert.ToInt32(row["StockMax"].ToString());

                    if (!(row["Img"] == DBNull.Value))
                    {
                        Byte[] data = new Byte[0];
                        data   = (Byte[])(row["Img"]);
                        Imagen = data;
                        MemoryStream mem = new MemoryStream(data);
                        pic_producto.Image = Image.FromStream(mem);
                    }

                    Cd_Prod = productoModel.Cd_Prod;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("error :" + ex.Message + "-" + ex.StackTrace.ToString());
                this.Dispose();
            }
        }