コード例 #1
0
    protected void btnGuardarGrupo_Click(object sender, EventArgs e)
    {
        string strMsg        = null;
        int    numMaxDigitos = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["NroMaxDigitos"]);

        List <SCE_CARTEL_MODELO_CATEGORIA_PROMOCION_BE> lstCartelModeloCategPromo = new List <SCE_CARTEL_MODELO_CATEGORIA_PROMOCION_BE>();

        strMsg = CARTEL_MODELO_BL.IsValid(cboCartelModelo.SelectedValue,
                                          Convert.ToInt32(cboCategoria.SelectedValue),
                                          Convert.ToInt32(cboPromocion.SelectedValue));

        if (strMsg.Length > 0)
        {
            Util.RegisterAsyncAlert(upnlDetalle, "__Alerta__", strMsg);

            pnlListado.Visible      = true;
            pnlDetalleGrupo.Visible = true;

            return;
        }

        CARTEL_MODELO_CATEGORIA_PROMOCION_BE = new SCE_CARTEL_MODELO_CATEGORIA_PROMOCION_BE();
        CARTEL_MODELO_CATEGORIA_PROMOCION_BE.ID_CATEGORIA = Convert.ToInt32(cboCategoria.SelectedValue);
        CARTEL_MODELO_CATEGORIA_PROMOCION_BE.ID_PROMOCION = Convert.ToInt32(cboPromocion.SelectedValue);
        lstCartelModeloCategPromo.Add(CARTEL_MODELO_CATEGORIA_PROMOCION_BE);

        CARTEL_MODELO_BL.ActualizarCMCP(cboCartelModelo.SelectedValue, numMaxDigitos, lstCartelModeloCategPromo);

        pnlDetalleGrupo.Visible = false;
        pnlListado.Visible      = true;
        pnlBtnAgregar.Visible   = true;

        System.Text.StringBuilder sbScript = new System.Text.StringBuilder();
        sbScript.AppendFormat("document.getElementById('{0}').disabled=false;", cboCategoria.ClientID);
        sbScript.AppendFormat("document.getElementById('{0}').disabled=false;", cboPromocion.ClientID);
        Util.RegisterScript(upnlDetalle, "__DesabilitaCtrol__", sbScript.ToString());

        GetData(Convert.ToInt32(cboCategoria.SelectedValue), Convert.ToInt32(cboPromocion.SelectedValue));
    }