Beispiel #1
0
        //busca producto
        private void busqueda(string id)
        {
            DataTable datos = new DataTable();
            string    nombrepod = prod.nomprod(id);
            string    tipo = "0", estilo = "0", color = "0";

            tipo   = prod.codtipo(id);
            estilo = prod.codestilo(id);
            color  = prod.codcolor(id);
            datos  = prod.prodId(id);
            llenartipo(id, nombrepod);
            CboTipo.SelectedValue   = int.Parse(tipo);
            CboEstilo.SelectedValue = int.Parse(estilo);
            CboColor.SelectedValue  = int.Parse(color);
            CboTalla.SelectedValue  = id;
            while (CboPrecio.Items.Count > 0)
            {
                CboPrecio.Items.RemoveAt(0);
            }
            while (CboPrecioM.Items.Count > 0)
            {
                CboPrecioM.Items.RemoveAt(0);
            }
            CboPrecioM.Items.Add(datos.Rows[0][2].ToString());
            CboPrecioM.Items.Add(datos.Rows[0][3].ToString());
            CboPrecio.Items.Add(datos.Rows[0][4].ToString());
            CboPrecio.Items.Add(datos.Rows[0][5].ToString());
            CboPrecio.Items.Add(datos.Rows[0][6].ToString());
            char[] elim = { 'r', 'R' };
            TxtCod.Text = datos.Rows[0][0].ToString().TrimStart(elim);
            CboPrecioM.SelectedIndex = 1;
            CboPrecio.SelectedIndex  = 2;
            LblPosi.Text             = "Ubicación: " + datos.Rows[0][15].ToString();
            try
            {
                using (var stream = File.Open(@".\" + @".\imagen\" + prod.imagen(id), FileMode.Open))
                {
                    Bitmap archivo = new Bitmap(stream);
                    Bitmap muestra = new Bitmap(RedimImage(archivo, 200, 150));
                    PicExemp.Image = muestra;
                }
                //   PicExemp.Image = Image.FromFile();
                PicExemp.Tag = @".\imagen\" + prod.imagen(id);
            }
            catch (FileNotFoundException ex)
            {
                using (var stream = File.Open(@".\" + @".\imagen\0.jpg", FileMode.Open))
                {
                    Bitmap archivo = new Bitmap(stream);
                    Bitmap muestra = new Bitmap(RedimImage(archivo, 200, 150));
                    PicExemp.Image = muestra;
                }
                //   PicExemp.Image = Image.FromFile();
                PicExemp.Tag = @".\imagen\" + prod.imagen(id);
            }
            int total = prod.cantidadprod(id);

            lbldisp.Text = total.ToString();
        }