Beispiel #1
0
        public frmMostrarPromocion(PromocionWS.promocion promocionSeleccionada)
        {
            daoPromocionXProducto = new PromocionXProductoWS.PromocionXProductoWSClient();
            daoZona = new ZonaWS.ZonaWSClient();
            InitializeComponent();
            txtId.Text           = promocionSeleccionada.idPromocion.ToString();
            txtNombre.Text       = promocionSeleccionada.nombre;
            txtDescripcion.Text  = promocionSeleccionada.descripcion;
            dtpFechaInicio.Value = promocionSeleccionada.fechaInicio;
            dtpFechaFin.Value    = promocionSeleccionada.fechaFin;
            ZonaWS.zona[] listaZonas = daoZona.listarZonas();
            if (listaZonas == null || listaZonas.Length < 1)
            {
                cboZona.DataSource = new BindingList <ZonaWS.zona>();
            }
            cboZona.DataSource    = new BindingList <ZonaWS.zona>(listaZonas);
            cboZona.ValueMember   = "idZona";
            cboZona.DisplayMember = "nombre";

            cboZona.SelectedValue = promocionSeleccionada.zona.idZona;

            PromocionXProductoWS.promocionXProducto[] listaPromocionXProducto =
                daoPromocionXProducto.listarPromocionXProducto(promocionSeleccionada.idPromocion);
            dgvPromocionXProducto.AutoGenerateColumns = false;
            if (listaPromocionXProducto == null || listaPromocionXProducto.Length < 1)
            {
                dgvPromocionXProducto.DataSource = new BindingList <PromocionXProductoWS.promocionXProducto>();
            }
            else
            {
                dgvPromocionXProducto.DataSource = new BindingList <PromocionXProductoWS.promocionXProducto>(listaPromocionXProducto);
            }

            #region colores de seleccion
            dgvPromocionXProducto.ColumnHeadersDefaultCellStyle.SelectionBackColor = Program.colorR;
            dgvPromocionXProducto.ColumnHeadersDefaultCellStyle.SelectionForeColor = ThemeColor.ChangeColorBrightness(Program.colorR, -0.7);

            dgvPromocionXProducto.RowHeadersDefaultCellStyle.SelectionBackColor = Program.colorR;
            dgvPromocionXProducto.RowHeadersDefaultCellStyle.SelectionForeColor = ThemeColor.ChangeColorBrightness(Program.colorR, -0.7);

            dgvPromocionXProducto.RowsDefaultCellStyle.SelectionBackColor = Program.colorR;
            dgvPromocionXProducto.RowsDefaultCellStyle.SelectionForeColor = ThemeColor.ChangeColorBrightness(Program.colorR, -0.7);
            #endregion
        }
Beispiel #2
0
        public frmNuevaPromocion()
        {
            InitializeComponent();
            #region colores de seleccion
            dgvPromocionXProducto.ColumnHeadersDefaultCellStyle.SelectionBackColor = Program.colorR;
            dgvPromocionXProducto.ColumnHeadersDefaultCellStyle.SelectionForeColor = ThemeColor.ChangeColorBrightness(Program.colorR, -0.7);

            dgvPromocionXProducto.RowHeadersDefaultCellStyle.SelectionBackColor = Program.colorR;
            dgvPromocionXProducto.RowHeadersDefaultCellStyle.SelectionForeColor = ThemeColor.ChangeColorBrightness(Program.colorR, -0.7);

            dgvPromocionXProducto.RowsDefaultCellStyle.SelectionBackColor = Program.colorR;
            dgvPromocionXProducto.RowsDefaultCellStyle.SelectionForeColor = ThemeColor.ChangeColorBrightness(Program.colorR, -0.7);
            #endregion

            daoPromocion          = new PromocionWS.PromocionWSClient();
            daoPromocionXProducto = new PromocionXProductoWS.PromocionXProductoWSClient();
            daoZona               = new ZonaWS.ZonaWSClient();
            cboZona.DataSource    = new BindingList <ZonaWS.zona>(daoZona.listarZonas().ToArray());
            cboZona.ValueMember   = "idZona";
            cboZona.DisplayMember = "nombre";

            if (frmVentanaPrincipal.nBtn == 1)
            {   //OBTNER DATOS DE FILA SELECCIONADA
                PromocionWS.promocion miPromocion = new PromocionWS.promocion();

                if (Program.pantallas[Program.pantallas.Count - 1].Formulario.Name == "frmGestionarPromociones")
                {
                    frmGestionarPromociones.promocionSeleccionada = (PromocionWS.promocion)frmGestionarPromociones.dgv.CurrentRow.DataBoundItem;
                    miPromocion = frmGestionarPromociones.promocionSeleccionada;
                }
                else
                {
                    frmBuscarPromocion.promocionSeleccionada = (PromocionWS.promocion)frmBuscarPromocion.dgv.CurrentRow.DataBoundItem;
                    miPromocion = frmBuscarPromocion.promocionSeleccionada;
                }
                txtId.Text            = miPromocion.idPromocion.ToString();
                txtNombre.Text        = miPromocion.nombre;
                txtDescripcion.Text   = miPromocion.descripcion;
                dtpFechaInicio.Value  = miPromocion.fechaInicio;
                dtpFechaFin.Value     = miPromocion.fechaFin;
                cboZona.SelectedValue = miPromocion.zona.idZona;
                //Listar los productos de la promoción.
                txtDescuento.Enabled      = false;
                txtStock.Enabled          = false;
                btnAddProducto.Enabled    = false;
                btnRemoveProducto.Enabled = false;
                btnBuscarProducto.Enabled = false;
                cboZona.Enabled           = false;
                int idPromocion = miPromocion.idPromocion;
                PromocionXProductoWS.promocionXProducto[] auxPromoXProd = daoPromocionXProducto.listarPromocionXProducto(idPromocion);
                if (auxPromoXProd.Length == 0)
                {
                    misPromocionXProducto = new BindingList <PromocionXProductoWS.promocionXProducto>();
                }
                else
                {
                    misPromocionXProducto = new BindingList <PromocionXProductoWS.promocionXProducto>(auxPromoXProd.ToList());
                }
                cargarTabla();
            }
            else
            {
                misPromocionXProducto = new BindingList <PromocionXProductoWS.promocionXProducto>();
                cargarTabla();
            }

            #region colores de seleccion
            dgvPromocionXProducto.ColumnHeadersDefaultCellStyle.SelectionBackColor = Program.colorR;
            dgvPromocionXProducto.ColumnHeadersDefaultCellStyle.SelectionForeColor = ThemeColor.ChangeColorBrightness(Program.colorR, -0.7);

            dgvPromocionXProducto.RowHeadersDefaultCellStyle.SelectionBackColor = Program.colorR;
            dgvPromocionXProducto.RowHeadersDefaultCellStyle.SelectionForeColor = ThemeColor.ChangeColorBrightness(Program.colorR, -0.7);

            dgvPromocionXProducto.RowsDefaultCellStyle.SelectionBackColor = Program.colorR;
            dgvPromocionXProducto.RowsDefaultCellStyle.SelectionForeColor = ThemeColor.ChangeColorBrightness(Program.colorR, -0.7);
            #endregion
        }