コード例 #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if (!Page.IsCallback)
            {
                if (Session["IDRED"] == null)
                {
                    try
                    {
                        Response.Redirect("~/SesionCaducadaModal.aspx", true);
                    }
                    catch (System.Threading.ThreadAbortException) { return; }
                }
                if (Utilidades.EsAdminProduccionEntrada())
                {
                    gsEsAdm = "true";
                }

                if (Request.QueryString["id"] != null)
                {
                    sIdDialogo         = Utilidades.decodpar(Request.QueryString["id"].ToString());
                    hdnIdDialogo.Value = sIdDialogo;
                    if (DIALOGOALERTAS.EsGestorDeDialogoAlerta(int.Parse(sIdDialogo), int.Parse(Session["UsuarioActual"].ToString())))
                    {
                        sEsGestorDialogo = "true";
                    }
                }

                if (sIdDialogo != "")
                {
                    if (DIALOGOALERTAS.NumDocs(int.Parse(sIdDialogo)) > 0)
                    {
                        imgDocFact.Src = Session["strServer"].ToString() + "Images/imgCarpetaDoc32.png";
                        imgDocFact.Attributes.Add("title", "Existen documentos asociados");
                        hdnHayDocs.Value = "S";
                    }

                    string[] aTabla = Regex.Split(getDatosDialogo(false, int.Parse(sIdDialogo), (sEsGestorDialogo == "true") ? true : false), "@#@");
                    if (aTabla[0] == "OK")
                    {
                        this.strHTMLCaso = aTabla[1];
                    }
                    else
                    {
                        sErrores += Errores.mostrarError(aTabla[1]);
                    }

                    if (hdnIdDAlerta.Value == "0" && sEsGestorDialogo == "true")
                    {
                        txtAsunto.Style.Add("display", "none");
                        cboAsunto.Style.Add("display", "inline-block");
                        CargarAlertas();
                        cboAsunto.SelectedValue = hdnIdDAlerta.Value;
                    }
                }

                //1º Se indican (por este orden) la función a la que se va a devolver el resultado
                //   y la función que va a acceder al servidor
                string cbRespuesta = Page.ClientScript.GetCallbackEventReference(this, "arg", "RespuestaCallBack", "context", false);
                string cbLlamada   = "function RealizarCallBack(arg, context)" + "{" + cbRespuesta + ";" + "}";
                //2º Se "registra" la función que va a acceder al servidor.
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "RealizarCallBack", cbLlamada, true);
            }
        }
        catch (Exception ex)
        {
            sErrores += Errores.mostrarError("Error al cargar la página ", ex);
        }
    }