コード例 #1
0
        private void EditarOferta_Load(object sender, EventArgs e)
        {
            try
            {
                ProductoDAO prodDAO = new ProductoDAO();
                DataTable   dt      = prodDAO.getProductosCbx();
                this.cbxProducto.DataSource    = dt;
                this.cbxProducto.DisplayMember = "NOMBRE";
                this.cbxProducto.ValueMember   = "IDPRODUCTO";

                TiendaDAO tiendaDAO = new TiendaDAO();
                DataTable dtTienda  = tiendaDAO.getTiendasCbx();
                ((ListBox)this.chkListBoxTiendas).DataSource    = dtTienda;
                ((ListBox)this.chkListBoxTiendas).DisplayMember = "NOMBRE";
                ((ListBox)this.chkListBoxTiendas).ValueMember   = "IDTIENDA";

                OfertaDAO ofertaDAO = new OfertaDAO();
                //Carga de datos de oferta
                List <RlOFertaTienda> listaOfertas = ofertaDAO.getOfertasTiendas(this.ofertaSeleccionada.idOferta);

                this.dtpFechaFin.Value         = this.ofertaSeleccionada.fechaFin;
                this.dtpFechaInicio.Value      = this.ofertaSeleccionada.fechaInicio;
                this.cbxProducto.SelectedValue = this.ofertaSeleccionada.idProducto;
                //this.txtUrlImagen.Text = this.ofertaSeleccionada.rutaFoto;
                this.nudCantMinProd.Value = this.ofertaSeleccionada.minimoProductos;
                this.nudCantMaxProd.Value = this.ofertaSeleccionada.maximoProductos;
                this.pictureBox1.Image    = Image.FromStream(new MemoryStream(this.ofertaSeleccionada.fotografia));

                foreach (RlOFertaTienda rlofer in listaOfertas)
                {
                    for (var i = 0; i < this.chkListBoxTiendas.Items.Count; i++)
                    {
                        DataRowView item = (DataRowView)chkListBoxTiendas.Items[i];
                        chkListBoxTiendas.SetItemChecked(i, rlofer.nombreTienda.Trim().Equals(((DataRowView)item).Row["NOMBRE"].ToString()));
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error grave Cargando datos para creación.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
            }
        }
コード例 #2
0
ファイル: CrearOferta.cs プロジェクト: Widuk/PFT8461C2S003V
        private void CrearOferta_Load(object sender, EventArgs e)
        {
            try
            {
                ProductoDAO prodDAO = new ProductoDAO();
                DataTable   dt      = prodDAO.getProductosCbx();
                this.cbxProducto.DataSource    = dt;
                this.cbxProducto.DisplayMember = "NOMBRE";
                this.cbxProducto.ValueMember   = "IDPRODUCTO";

                TiendaDAO tiendaDAO = new TiendaDAO();
                DataTable dtTienda  = tiendaDAO.getTiendasCbx();
                ((ListBox)this.chkListBoxTiendas).DataSource    = dtTienda;
                ((ListBox)this.chkListBoxTiendas).DisplayMember = "NOMBRE";
                ((ListBox)this.chkListBoxTiendas).ValueMember   = "IDTIENDA";
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error grave Cargando datos para creación.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
            }
        }