public void getDatosEstadoCerrado(int nIdDialogo)
    {
        SqlDataReader dr = DIALOGOALERTAS.ObtenerDatosDialogoCerrado(nIdDialogo);

        if (dr.Read())
        {
            //Si el diálogo está cerrado, todo en modo lectura y si es OC o FA se cargan los datos
            if (dr["bAbierto"].ToString() == "False")
            {
                btnNewAnot.Disabled       = true;
                btnDocumentacion.Disabled = true;
                pnDatos.Enabled           = false;

                if (hdnGrupoOC.Value == "1")
                {
                    if (dr["t831_justificada"].ToString() == "True")
                    {
                        rdbOC.SelectedValue = "1";
                    }
                    else
                    {
                        rdbOC.SelectedValue = "0";
                    }

                    txtCausa.Text    = dr["t831_causamotivoOC"].ToString();
                    txtAcciones.Text = dr["t831_accionesacordadas"].ToString();
                }
            }
        }
        dr.Close();
        dr.Dispose();
    }
 private string getDialogosOCyFA(
     string sAsunto,
     string sEstado,
     string sGestor,
     string sIdProyectosubnodo,
     string sIdNodo,
     string sIdCliente,
     string sIdInterlocutor,
     string sCausaJust,
     string sIdResponsable,
     string sMesDesde,
     string sMesHasta
     )
 {
     try
     {
         return("OK@#@" + DIALOGOALERTAS.ObtenerDialogosOCyFA((int)Session["UsuarioActual"],
                                                              (sAsunto == "-1")? null: (byte?)byte.Parse(sAsunto),
                                                              (sEstado == "-1") ? null : (byte?)byte.Parse(sEstado),
                                                              (sGestor == "-1")? null: (int?)int.Parse(sGestor),
                                                              (sIdProyectosubnodo == "0")? null: (int?)int.Parse(sIdProyectosubnodo),
                                                              (sIdNodo == "0")? null: (int?)int.Parse(sIdNodo),
                                                              (sIdCliente == "0")? null: (int?)int.Parse(sIdCliente),
                                                              (sIdInterlocutor == "0")? null: (int?)int.Parse(sIdInterlocutor),
                                                              (sCausaJust == "-1") ? null : (bool?)((sCausaJust == "1")? true:false),
                                                              (sIdResponsable == "0") ? null : (int?)int.Parse(sIdResponsable),
                                                              (sMesDesde == "") ? null : (int?)int.Parse(sMesDesde), //null, //Nullable<int> t831_anomesdecierre,
                                                              (sMesHasta == "") ? null : (int?)int.Parse(sMesHasta)  //null, //Nullable<int> t831_anomesdecierre,
                                                              ));
     }
     catch (Exception ex)
     {
         return("Error@#@" + Errores.mostrarError("Error al obtener los diálogos bajo mi gestión.", ex));
     }
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsCallback)
        {
            if (Session["IDRED"] == null)
            {
                try
                {
                    Response.Redirect("~/SesionCaducadaModal.aspx", true);
                }
                catch (System.Threading.ThreadAbortException) { return; }
            }

            nIdDialogo = int.Parse(Utilidades.decodpar(Request.QueryString["nID"].ToString()));
            this.hdnIdDialogo.Value = nIdDialogo.ToString();
            try
            {
                this.hdnModoAcceso.Value = Utilidades.decodpar(Request.QueryString["sMA"].ToString());
                div1.InnerHtml           = DIALOGOALERTAS.ObtenerDocumentos("DI", nIdDialogo, this.hdnModoAcceso.Value);
            }
            catch (Exception ex)
            {
                sErrores += Errores.mostrarError("Error al obtener datos complementarios", ex);
            }
            string cbRespuesta = Page.ClientScript.GetCallbackEventReference(this, "arg", "RespuestaCallBack", "context", false);
            string cbLlamada   = "function RealizarCallBack(arg, context)" + "{" + cbRespuesta + ";" + "}";
            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "RealizarCallBack", cbLlamada, true);
        }
    }
 private string ObtenerDialogosPendientes()
 {
     try
     {
         return("OK@#@" + DIALOGOALERTAS.ObtenerDialogosPendientes((int)Session["UsuarioActual"]));
     }
     catch (Exception ex)
     {
         return("Error@#@" + Errores.mostrarError("Error al obtener los diálogos pendientes.", ex));
     }
 }
Пример #5
0
 private string getDialogos(string sSoloActivos, string sPSN, string sRestringirOCyFACerrados)
 {
     try
     {
         return("OK@#@" + DIALOGOALERTAS.ObtenerDialogosByPSN(int.Parse(sPSN), (sSoloActivos == "1") ? true : false, (sRestringirOCyFACerrados == "1") ? true : false));
     }
     catch (Exception ex)
     {
         return("Error@#@" + Errores.mostrarError("Error al obtener los diálogos.", ex));
     }
 }
 public string grabar(string sIdDialogo, string sIdAlerta, string sFLR)
 {
     try
     {
         DIALOGOALERTAS.ActualizarFechaTipo(int.Parse(sIdDialogo), byte.Parse(sIdAlerta), ((sFLR == "")? null: (DateTime?)DateTime.Parse(sFLR)));
         return("OK@#@");
     }
     catch (Exception ex)
     {
         return("Error@#@" + Errores.mostrarError("Error al actualizar los datos del diálogo.", ex));
     }
 }
Пример #7
0
 protected string addDialogo(string sAsunto, string sMes, string sMensaje, string sPSN, string sInterlocutor, string sFLR)
 {
     try
     {
         DIALOGOALERTAS.crearDialogo(byte.Parse(sAsunto), (sMes == "") ? null : (int?)int.Parse(sMes), sMensaje,
                                     int.Parse(sPSN), (sInterlocutor == "1") ? "R" : "D", (sFLR == "") ? null : (DateTime?)DateTime.Parse(sFLR));
         return("OK");
     }
     catch (Exception ex)
     {
         return("Error@#@" + Errores.mostrarError("Error al crear el diálogo.", ex));
     }
 }
    protected string EliminarDocumentos(string strIdsDocs)
    {
        string sResul = "";

        try
        {
            sResul = DIALOGOALERTAS.EliminarDocumentos(strIdsDocs);
        }
        catch (Exception ex)
        {
            sResul = "Error@#@" + Errores.mostrarError("Error al eliminar los documentos", ex);
        }
        return(sResul);
    }
//    public string ObtenerDatosDialogo(bool bSoloTextos, int nIdDialogo)
//    {
//        string sResultado = "";
//        try
//        {
//            DataSet ds = DIALOGOALERTAS.ObtenerDialogoAlerta(nIdDialogo, int.Parse(Session["NUM_EMPLEADO_ENTRADA"].ToString()));
//            #region Datos cabecera del diálogo
//            if (!bSoloTextos)
//            {
//                if (ds.Tables[0].Rows.Count > 0)
//                {
//                    DataRow oFila = ds.Tables[0].Rows[0];
//                    txtIdDialogo.Text = ((int)oFila["t831_iddialogoalerta"]).ToString("#,###");
//                    if (oFila["t831_flr"] != DBNull.Value)
//                        txtFLR.Text = ((DateTime)oFila["t831_flr"]).ToShortDateString();
//                    txtProyecto.Text = ((int)oFila["t301_idproyecto"]).ToString("#,###") +" - " + oFila["t301_denominacion"].ToString();
//                    txtProyecto.Attributes.Add("title", "cssbody=[dvbdy] cssheader=[dvhdr] header=[<img src='../../../../images/info.gif' style='vertical-align:middle' />  Información] body=[<label style='width:70px;'>Proyecto:</label>" + ((int)oFila["t301_idproyecto"]).ToString("#,###") + " - " + oFila["t301_denominacion"].ToString().Replace((char)34, (char)39) + "<br><label style='width:70px;'>Responsable:</label>" + oFila["responsable"].ToString().Replace((char)34, (char)39) + "<br><label style='width:70px;'>" + Estructura.getDefCorta(Estructura.sTipoElem.NODO) + ":</label>" + oFila["t303_denominacion"].ToString().Replace((char)34, (char)39) + "<br><label style='width:70px;'>Cliente:</label>" + oFila["t302_denominacion"].ToString().Replace((char)34, (char)39) + "] hideselects=[off]");
//                    txtAsunto.Text = oFila["t820_denominacion"].ToString();
//                    txtEstado.Text = oFila["t827_denominacion"].ToString();
//                    txtEstado.ToolTip = oFila["t827_descripcion"].ToString();
//                    hdnIdEstado.Value = oFila["t827_idestadodialogoalerta"].ToString();
//                    hdnEntePromotor.Value = oFila["t831_entepromotor"].ToString();
//                    hdnIdResponsableProy.Value = oFila["t314_idusuario_responsable"].ToString();

//                    if (oFila["t314_idusuario_responsable"].ToString() == Session["UsuarioActual"].ToString())
//                        sEsResponsableProyecto = "true";
//                }
//            }
//            #endregion

//            #region Textos del diálogo
//            StringBuilder sb = new StringBuilder();
//            DateTime dtAux = DateTime.Parse("01/01/1900");
//            string sCellWidth = "";

//            sb.Append("<table id='tblTextos' class='texto' style='width:880px; background-color:#ece4de' cellspacing='0' cellpadding='0' border='0'>");
//            sb.Append(@"<colgroup>
//                            <col style='width:60px;' />
//                            <col style='width:160px;' />
//                            <col style='width:220px;' />
//                            <col style='width:220px;' />
//                            <col style='width:160px;' />
//                            <col style='width:60px;' />
//                        </colgroup>");

//                foreach (DataRow oFila in ds.Tables[1].Rows){
//                    sCellWidth = (oFila["t832_texto"].ToString().Length > 40) ? "455px" : (oFila["t832_texto"].ToString().Length * 11).ToString() + "px";

//                    if (((DateTime)oFila["t832_fechacreacion"]).ToShortDateString() != dtAux.ToShortDateString())
//                    {
//                        dtAux = (DateTime)oFila["t832_fechacreacion"];
//                        sb.Append("<tr>");
//                        sb.Append("<td colspan='6' style='padding-top:4px;'>");
//                        sb.Append("<div style='margin-left:270px; width:300px; height:34px; background-image:url(../../../../Images/imgFondoFecha.gif);background-repeat:no-repeat; text-align:center; padding-top:8px; font-size:13pt;'>" + ((DateTime)oFila["t832_fechacreacion"]).ToLongDateString() + "</div>");
//                        sb.Append("</td>");
//                        sb.Append("</tr>");
//                    }

//                    sb.Append("<tr>");
//                    if (oFila["t832_posicion"].ToString() == "I")
//                    {
//                        sb.Append("<td style='vertical-align:bottom; padding-bottom: 10px;'>");

//                        if (oFila["t001_idficepi"] == DBNull.Value)
//                            sb.Append(@"<img src='../../../../Images/imgDiamanteDialogo.png' style='width:60px; height:90px;' border='0' />");
//                        else
//                            sb.Append(@"<img src='" + (((int)oFila["tiene_foto"] == 0) ? "../../../../Images/imgSmile.gif" : "../../../Inicio/ObtenerFotoByFicepi.aspx?nF=" + oFila["t001_idficepi"].ToString()) + @"' style='width:60px; height:auto;' border='0' />");
//                        sb.Append(@"<nobr class='NBR W60' style='text-align:center' title='" + oFila["Profesional"].ToString() + @"'>" + oFila["t001_nombre"].ToString() + @"</nobr>");

//                        sb.Append("</td>");

//                        sb.Append("<td colspan='3' style='padding-left:5px;'>");
//                        sb.Append(@"<table class='texto' style='float:left; margin-bottom:20px;' cellspacing='0' cellpadding='0' border='0'>
//                                <tr style='height:9px;'>
//                                    <td background='../../../../Images/Tabla/ConvIzda/1.gif' style='width:34px;'></td>
//                                    <td background='../../../../Images/Tabla/ConvIzda/2.gif' style='width:" + sCellWidth + @";'></td>
//                                    <td background='../../../../Images/Tabla/ConvIzda/3.gif' style='width:81px; height:9px;background-repeat:no-repeat;'></td>
//                                </tr>
//                                <tr>
//                                    <td background='../../../../Images/Tabla/ConvIzda/4.gif' style='width:34px;'>&nbsp;</td>
//                                    <td background='../../../../Images/Tabla/ConvIzda/5.gif' style='font-size:11pt; width:" + sCellWidth + @";'>
//                                        <!-- Inicio del contenido propio de la tabla -->
//                                        " + oFila["t832_texto"].ToString().Replace(((char)10).ToString(), "<br>") + @"
//                                        <!-- Fin del contenido propio de la tabla -->
//                                    </td>
//                                    <td background='../../../../Images/Tabla/ConvIzda/6.gif' style='width:81px;background-repeat:repeat-y;'></td>
//                                </tr>
//                                <tr style='height:55px;'>
//                                    <td background='../../../../Images/Tabla/ConvIzda/7.gif' style='width:34px;'></td>
//                                    <td background='../../../../Images/Tabla/ConvIzda/8.gif' style='width:" + sCellWidth + @";'></td>
//                                    <td background='../../../../Images/Tabla/ConvIzda/9.gif' style='width:81px; font-size:13pt; vertical-align:top; padding-left:15px; padding-top:10px; background-repeat:no-repeat;'>" + Fechas.HoraACadenaLarga((DateTime)oFila["t832_fechacreacion"]) + @"</td>
//                                </tr>
//                            </table>");
//                        sb.Append("</td>");
//                        sb.Append("<td colspan='2'></td>");
//                    }
//                    else //lado derecho
//                    {
//                        sb.Append("<td colspan='2'></td>");
//                        sb.Append("<td colspan='3' style='text-align:right; padding-right:5px;'>");// vertical-align: text-bottom;
//                        //sb.Append("<img src='../../../../Images/imgW2.gif' />");

//                        sb.Append(@"<table class='texto' style='table-layout:fixed; float:right; margin-bottom:20px;' cellspacing='0' cellpadding='0' border='0'>
//                            <tr style='height:11px;'>
//                                <td background='../../../../Images/Tabla/ConvDcha/1.gif' style='width:80px;'></td>
//                                <td background='../../../../Images/Tabla/ConvDcha/2.gif' style='width:" + sCellWidth + @";'></td>
//                                <td background='../../../../Images/Tabla/ConvDcha/3.gif' style='width:37px;'></td>
//                            </tr>
//                            <tr>
//                                <td background='../../../../Images/Tabla/ConvDcha/4.gif' style='width:80px;'>&nbsp;</td>
//                                <td background='../../../../Images/Tabla/ConvDcha/5.gif' style='font-size:11pt; text-align: left;width:" + sCellWidth + @";'>
//                                    <!-- Inicio del contenido propio de la tabla -->" +
//                                        oFila["t832_texto"].ToString().Replace(((char)10).ToString(), "<br>") + @"
//                                    <!-- Fin del contenido propio de la tabla -->
//                                </td>
//                                <td background='../../../../Images/Tabla/ConvDcha/6.gif' style='width:37px;'></td>
//                            </tr>
//                            <tr style='height:54px;'>
//                                <td background='../../../../Images/Tabla/ConvDcha/7.gif'
//                                    style='width:80px; font-size:13pt; vertical-align:top; padding-top:10px;'>
//                                    <span style='margin-right:15px;'>" + Fechas.HoraACadenaLarga((DateTime)oFila["t832_fechacreacion"]) + @"</span></td>
//                                <td background='../../../../Images/Tabla/ConvDcha/8.gif' style='width:" + sCellWidth + @";'></td>
//                                <td background='../../../../Images/Tabla/ConvDcha/9.gif' style='width:37px;'></td>
//                            </tr>
//                            </table>");

//                        sb.Append("</td>");
//                        sb.Append("<td style='vertical-align:bottom; padding-bottom: 10px;'>");

//                        if (oFila["t001_idficepi"] == DBNull.Value)
//                            sb.Append(@"<img src='../../../../Images/imgDiamanteDialogo.png' style='width:60px; height:90px;' border='0' />");
//                        else
//                            sb.Append(@"<img src='" + (((int)oFila["tiene_foto"] == 0) ? "../../../../Images/imgSmile.gif" : "../../../Inicio/ObtenerFotoByFicepi.aspx?nF=" + oFila["t001_idficepi"].ToString()) + @"' style='width:60px; height:auto;' border='0' />");
//                        sb.Append(@"<nobr class='NBR W60' style='text-align:center' title='" + oFila["Profesional"].ToString() + @"'>" + oFila["t001_nombre"].ToString() + @"</nobr>");
//                        sb.Append("</td>");
//                    }
//                    sb.Append("</tr>");
//                }
//            //dr.Close();
//            ds.Dispose();
//            sb.Append("</table>");
//            sResultado = "OK@#@" + sb.ToString();

//            #endregion

//        }
//        catch (Exception ex)
//        {
//            sResultado = "Error@#@" + Errores.mostrarError("Error al obtener los datos del diálogo.", ex);
//        }
//        return sResultado;
//    }

    //****En el caso de diálogos cerrados, obtener los datos "Se justifica", "Causas" y "Acciones acordadas" (ya definido, no se le llamaba)

    public string getDatosEstado(int nIdDialogo)
    {
        string sResultado = "";

        try
        {
            DIALOGOALERTAS oDA = DIALOGOALERTAS.ObtenerDatosDialogoAlerta(nIdDialogo);
            sResultado = "OK@#@" + oDA.t827_idestadodialogoalerta + "@#@" + Utilidades.escape(oDA.t827_denominacion) + "@#@" + Utilidades.escape(oDA.t827_descripcion);
        }
        catch (Exception ex)
        {
            sResultado = "Error@#@" + Errores.mostrarError("Error al obtener los datos del diálogo.", ex);
        }
        return(sResultado);
    }
    private string ObtenerDialogosGestion(
        string sSoloAbiertos,
        string sGrupo,
        string sAsunto,
        string sIdProyectosubnodo,
        string sIdInterlocutor,
        string sEstado,
        string sIdNodo,
        string sIdCliente,
        string sIdDialogo,
        string sFLR,
        string sGestor,
        string sIdResponsable,
        string sMesDesde,
        string sMesHasta,
        string sOrden,
        string sAscDesc
        )
    {
        try
        {
            return("OK@#@" + DIALOGOALERTAS.ObtenerDialogosMiGestion((int)Session["UsuarioActual"],
                                                                     (sSoloAbiertos == "1")? true:false,                                       //bool bSoloAbiertos,
                                                                     (sGrupo == "") ? null : (byte?)byte.Parse(sGrupo),                        //Nullable<byte> t821_idgrupoalerta,
                                                                     (sAsunto == "-1" || sAsunto == "") ? null : (byte?)byte.Parse(sAsunto),   //Nullable<byte> t820_idalerta,
                                                                     (sIdProyectosubnodo == "0") ? null : (int?)int.Parse(sIdProyectosubnodo), //Nullable<int> t305_idproyectosubnodo,
                                                                     (sIdInterlocutor == "0")? null: (int?)int.Parse(sIdInterlocutor),         //Nullable<int> t001_idficepi_interlocutor,
                                                                     (sEstado == "-1")? null: (byte?)byte.Parse(sEstado),                      //Nullable<byte> t827_idestadodialogoalerta,
                                                                     (sIdNodo == "0")? null: (int?)int.Parse(sIdNodo),                         //Nullable<int> t303_idnodo,
                                                                     (sIdCliente == "0")? null: (int?)int.Parse(sIdCliente),                   //Nullable<int> t302_idcliente,
                                                                     (sIdDialogo == "0")? null: (int?)int.Parse(sIdDialogo),                   //Nullable<int> t831_iddialogoalerta,
                                                                     (sFLR == "")? null: (DateTime?)DateTime.Parse(sFLR),                      //Nullable<DateTime> t831_flr,
                                                                     (sGestor == "-1")? null: (int?)int.Parse(sGestor),                        //Nullable<int> t314_idusuario_gestor,
                                                                     (sIdResponsable == "0") ? null : (int?)int.Parse(sIdResponsable),         //Nullable<int> t301_idproyecto
                                                                     (sMesDesde == "")? null: (int?)int.Parse(sMesDesde),                      //null, //Nullable<int> t831_anomesdecierre,
                                                                     (sMesHasta == "")? null: (int?)int.Parse(sMesHasta),                      //null, //Nullable<int> t831_anomesdecierre,
                                                                     byte.Parse(sOrden),
                                                                     byte.Parse(sAscDesc)

                                                                     ));
        }
        catch (Exception ex)
        {
            return("Error@#@" + Errores.mostrarError("Error al obtener los diálogos bajo mi gestión.", ex));
        }
    }
    public void RaiseCallbackEvent(string eventArg)
    {
        string sResultado = "";

        string[] aArgs = Regex.Split(eventArg, @"@#@");
        sResultado = aArgs[0] + @"@#@"; if (Session["IDRED"] == null)
        {
            _callbackResultado = aArgs[0] + @"@#@Error@#@SESIONCADUCADA"; return;
        }
        ;
        switch (aArgs[0])
        {
        case ("cerrarDialogo"):
            sResultado += DIALOGOALERTAS.CerrarDialogo(aArgs[1], aArgs[2], aArgs[3], aArgs[4]);
            break;
            //case ("borrarAlertas"):
            //    sResultado += BorrarAlertas(aArgs[1], aArgs[2]);
            //    break;
        }
        //3º Damos contenido a la variable que se envía de vuelta al cliente.
        _callbackResultado = sResultado;
    }
    public void RaiseCallbackEvent(string eventArg)
    {
        string sResultado = "", sCad = "";

        string[] aArgs = Regex.Split(eventArg, "@#@");
        sResultado = aArgs[0] + @"@#@"; if (Session["IDRED"] == null)
        {
            _callbackResultado = aArgs[0] + @"@#@Error@#@SESIONCADUCADA"; return;
        }
        ;
        switch (aArgs[0])
        {
        case ("documentos"):
            string sModoAcceso = "W";
            if (aArgs[3] != "")
            {
                sModoAcceso = aArgs[3];
            }

            sCad = DIALOGOALERTAS.ObtenerDocumentos("DI", int.Parse(aArgs[1]), sModoAcceso);

            if (sCad.IndexOf("Error@#@") >= 0)
            {
                sResultado += sCad;
            }
            else
            {
                sResultado += "OK@#@" + sCad + "@#@" + sModoAcceso;
            }
            break;

        case ("elimdocs"):
            sResultado += EliminarDocumentos(aArgs[1]);
            break;
        }
        _callbackResultado = sResultado;
    }
 public void ObtenerOtrosDialogosAbiertos()
 {
     strTablaHTMLOtrosDialogos = DIALOGOALERTAS.ObtenerOtrosDialogosAbiertos(int.Parse(hdnIdDialogo.Value), int.Parse(Session["UsuarioActual"].ToString()));
 }
Пример #14
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsCallback)
        {
            if (Session["IDRED"] == null)
            {
                try
                {
                    Response.Redirect("~/SesionCaducadaModal.aspx", true);
                }
                catch (System.Threading.ThreadAbortException) { return; }
            }

            if (Request.QueryString["psn"] != null)
            {
                idPSN = Utilidades.decodpar(Request.QueryString["psn"].ToString());
            }
            else
            {
                idPSN = Session["ID_PROYECTOSUBNODO"].ToString();
            }
            if (Request.QueryString["tipo"] != null && Utilidades.decodpar(Request.QueryString["tipo"].ToString()) == "OCyFA")
            {
                this.Title = "Diálogos cerrados de Obra en curso y Facturación anticipada";
                chkSoloAbiertos.Checked  = false;
                chkSoloAbiertos.Disabled = true;
                sRestringirOCyFACerrados = "1";
            }
            if ((int)Session["IDFICEPI_PC_ACTUAL"] != (int)Session["IDFICEPI_ENTRADA"] || !DIALOGOALERTAS.TienePermisoCreacion(int.Parse(idPSN), int.Parse(Session["UsuarioActual"].ToString())))
            {
                btnNuevo.Disabled = true;
                sNuevo            = "false";
            }

            //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);
        }
    }
    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);
        }
    }
    public string getDatosDialogo(bool bSoloTextos, int nIdDialogo, bool bEsGestor)
    {
        string sResultado = "";

        try
        {
            DataSet ds = DIALOGOALERTAS.ObtenerDialogoAlerta(nIdDialogo, int.Parse(Session["NUM_EMPLEADO_ENTRADA"].ToString()), bEsGestor);
            #region Datos cabecera del diálogo
            if (!bSoloTextos)
            {
                if (ds.Tables[0].Rows.Count > 0)
                {
                    DataRow oFila = ds.Tables[0].Rows[0];
                    txtIdDialogo.Text = ((int)oFila["t831_iddialogoalerta"]).ToString("#,###");
                    if (oFila["t831_flr"] != DBNull.Value)
                    {
                        txtFLR.Text = ((DateTime)oFila["t831_flr"]).ToShortDateString();
                    }
                    txtProyecto.Text = ((int)oFila["t301_idproyecto"]).ToString("#,###") + " - " + oFila["t301_denominacion"].ToString();

                    string sTooltip = "<label style=width:70px;>Proyecto:</label>" + ((int)oFila["t301_idproyecto"]).ToString("#,###") + " - " + oFila["t301_denominacion"].ToString().Replace("\"", "&#34;").Replace(((char)39).ToString(), "&#39;"); //(char)34, (char)39
                    sTooltip += "<br><label style=width:70px;>Responsable:</label>" + oFila["Responsable"].ToString().Replace("\"", "&#34;");
                    sTooltip += "<br><label style=width:70px;>Interlocutor:</label>" + oFila["Interlocutor"].ToString().Replace("\"", "&#34;");
                    sTooltip += "<br><label style=width:70px;>" + Estructura.getDefCorta(Estructura.sTipoElem.NODO) + ":</label>" + oFila["t303_denominacion"].ToString().Replace("\"", "&#34;").Replace(((char)39).ToString(), "&#39;");
                    sTooltip += "<br><label style=width:70px;>Cliente:</label>" + oFila["t302_denominacion"].ToString().Replace("\"", "&#34;").Replace(((char)39).ToString(), "&#39;");

                    txtProyecto.Attributes.Add("onmouseover", "showTTE('" + Utilidades.escape(sTooltip) + "');");
                    txtProyecto.Attributes.Add("onmouseout", "hideTTE();");


                    txtAsunto.Text             = oFila["t820_denominacion"].ToString();
                    txtEstado.Text             = oFila["t827_denominacion"].ToString();
                    txtEstado.ToolTip          = oFila["t827_descripcion"].ToString();
                    hdnIdEstado.Value          = oFila["t827_idestadodialogoalerta"].ToString();
                    hdnEntePromotor.Value      = oFila["t831_entepromotor"].ToString();
                    hdnIdResponsableProy.Value = oFila["t314_idusuario_responsable"].ToString();
                    txtMes.Text        = (oFila["t831_anomesdecierre"] != DBNull.Value)? Fechas.AnnomesAFechaDescLarga((int)oFila["t831_anomesdecierre"]) :"";
                    hdnIdDAlerta.Value = oFila["t820_idalerta"].ToString();
                    //if (oFila["t314_idusuario_responsable"].ToString() == Session["UsuarioActual"].ToString())
                    //    sEsResponsableProyecto = "true";
                    if ((bool)oFila["bInterlocutor"])
                    {
                        sEsInterlocutorProyecto = "true";
                    }
                }
            }
            #endregion

            #region Textos del diálogo
            StringBuilder sb         = new StringBuilder();
            DateTime      dtAux      = DateTime.Parse("01/01/1900");
            string        sCellWidth = "";

            sb.Append("<table id='tblTextos' class='texto' style='width:880px; background-color:#ece4de' cellspacing='0' cellpadding='0' border='0'>");
            sb.Append(@"<colgroup>
                            <col style='width:60px;' />
                            <col style='width:160px;' />
                            <col style='width:220px;' />
                            <col style='width:220px;' />
                            <col style='width:160px;' />
                            <col style='width:60px;' />
                        </colgroup>");

            foreach (DataRow oFila in ds.Tables[1].Rows)
            {
                sCellWidth = (oFila["t832_texto"].ToString().Length > 40) ? "455px" : (oFila["t832_texto"].ToString().Length * 11).ToString() + "px";

                if (((DateTime)oFila["t832_fechacreacion"]).ToShortDateString() != dtAux.ToShortDateString())
                {
                    dtAux = (DateTime)oFila["t832_fechacreacion"];
                    sb.Append("<tr>");
                    sb.Append("<td colspan='6' style='padding-top:4px;'>");
                    sb.Append("<div style='margin-left:270px; width:300px; height:34px; background-image:url(../../../../Images/imgFondoFecha.gif);background-repeat:no-repeat; text-align:center; padding-top:8px; font-size:13pt;'>" + ((DateTime)oFila["t832_fechacreacion"]).ToLongDateString() + "</div>");
                    sb.Append("</td>");
                    sb.Append("</tr>");
                }

                sb.Append("<tr>");
                if (oFila["t832_posicion"].ToString() == "I")
                {
                    sb.Append("<td style='vertical-align:bottom; padding-bottom: 10px;'>");

                    if (oFila["t001_idficepi"] == DBNull.Value)
                    {
                        sb.Append(@"<img src='../../../../Images/imgDiamanteDialogo.png' style='width:60px; height:90px;' border='0' />");
                    }
                    else
                    {
                        sb.Append(@"<img src='" + (((int)oFila["tiene_foto"] == 0) ? "../../../../Images/imgSmile.gif" : "../../../Inicio/ObtenerFotoByFicepi.aspx?nF=" + oFila["t001_idficepi"].ToString()) + @"' style='width:60px; height:auto;' border='0' />");
                    }
                    sb.Append(@"<nobr class='NBR W60' style='text-align:center' title='" + oFila["Profesional"].ToString() + @"'>" + oFila["t001_nombre"].ToString() + @"</nobr>");

                    sb.Append("</td>");

                    sb.Append("<td colspan='3' style='padding-left:5px;'>");
                    sb.Append(@"<table class='texto' style='float:left; margin-bottom:20px;' cellspacing='0' cellpadding='0' border='0'>
                            <tr style='height:9px;'>
                                <td background='../../../../Images/Tabla/ConvIzda/1.gif' style='width:34px;'></td>
                                <td background='../../../../Images/Tabla/ConvIzda/2.gif' style='width:" + sCellWidth + @";'></td>
                                <td background='../../../../Images/Tabla/ConvIzda/3.gif' style='width:81px; height:9px;background-repeat:no-repeat;'></td>
                            </tr>
                            <tr>
                                <td background='../../../../Images/Tabla/ConvIzda/4.gif' style='width:34px;'>&nbsp;</td>
                                <td background='../../../../Images/Tabla/ConvIzda/5.gif' style='font-size:11pt; width:" + sCellWidth + @";'>
                                    <!-- Inicio del contenido propio de la tabla -->
                                    " + oFila["t832_texto"].ToString().Replace(((char)10).ToString(), "<br>") + @"
                                    <!-- Fin del contenido propio de la tabla -->
                                </td>
                                <td background='../../../../Images/Tabla/ConvIzda/6.gif' style='width:81px;background-repeat:repeat-y;'></td>
                            </tr>
                            <tr style='height:55px;'>
                                <td background='../../../../Images/Tabla/ConvIzda/7.gif' style='width:34px;'></td>
                                <td background='../../../../Images/Tabla/ConvIzda/8.gif' style='width:" + sCellWidth + @";'></td>
                                <td background='../../../../Images/Tabla/ConvIzda/9.gif' style='width:81px; font-size:13pt; vertical-align:top; padding-left:15px; padding-top:10px; background-repeat:no-repeat;'>" + Fechas.HoraACadenaLarga((DateTime)oFila["t832_fechacreacion"]) + @"</td>
                            </tr>
                        </table>");
                    sb.Append("</td>");
                    sb.Append("<td colspan='2'></td>");
                }
                else //lado derecho
                {
                    sb.Append("<td colspan='2'></td>");
                    sb.Append("<td colspan='3' style='text-align:right; padding-right:5px;'>");// vertical-align: text-bottom;
                    //sb.Append("<img src='../../../../Images/imgW2.gif' />");

                    sb.Append(@"<table class='texto' style='table-layout:fixed; float:right; margin-bottom:20px;' cellspacing='0' cellpadding='0' border='0'>
                        <tr style='height:11px;'>
                            <td background='../../../../Images/Tabla/ConvDcha/1.gif' style='width:80px;'></td>
                            <td background='../../../../Images/Tabla/ConvDcha/2.gif' style='width:" + sCellWidth + @";'></td>
                            <td background='../../../../Images/Tabla/ConvDcha/3.gif' style='width:37px;'></td>
                        </tr>
                        <tr>
                            <td background='../../../../Images/Tabla/ConvDcha/4.gif' style='width:80px;'>&nbsp;</td>
                            <td background='../../../../Images/Tabla/ConvDcha/5.gif' style='font-size:11pt; text-align: left;width:" + sCellWidth + @";'>
                                <!-- Inicio del contenido propio de la tabla -->" +
                              oFila["t832_texto"].ToString().Replace(((char)10).ToString(), "<br>") + @"
                                <!-- Fin del contenido propio de la tabla -->
                            </td>
                            <td background='../../../../Images/Tabla/ConvDcha/6.gif' style='width:37px;'></td>
                        </tr>
                        <tr style='height:54px;'>
                            <td background='../../../../Images/Tabla/ConvDcha/7.gif' 
                                style='width:80px; font-size:13pt; vertical-align:top; padding-top:10px;'>
                                <span style='margin-right:15px;'>" + Fechas.HoraACadenaLarga((DateTime)oFila["t832_fechacreacion"]) + @"</span></td>
                            <td background='../../../../Images/Tabla/ConvDcha/8.gif' style='width:" + sCellWidth + @";'></td>
                            <td background='../../../../Images/Tabla/ConvDcha/9.gif' style='width:37px;'></td>
                        </tr>
                        </table>");

                    sb.Append("</td>");
                    sb.Append("<td style='vertical-align:bottom; padding-bottom: 10px;'>");

                    if (oFila["t001_idficepi"] == DBNull.Value)
                    {
                        sb.Append(@"<img src='../../../../Images/imgDiamanteDialogo.png' style='width:60px; height:90px;' border='0' />");
                    }
                    else
                    {
                        sb.Append(@"<img src='" + (((int)oFila["tiene_foto"] == 0) ? "../../../../Images/imgSmile.gif" : "../../../Inicio/ObtenerFotoByFicepi.aspx?nF=" + oFila["t001_idficepi"].ToString()) + @"' style='width:60px; height:auto;' border='0' />");
                    }
                    sb.Append(@"<nobr class='NBR W60' style='text-align:center' title='" + oFila["Profesional"].ToString() + @"'>" + oFila["t001_nombre"].ToString() + @"</nobr>");
                    sb.Append("</td>");
                }
                sb.Append("</tr>");
            }
            ds.Dispose();
            sb.Append("</table>");

            sResultado = "OK@#@" + sb.ToString();

            #endregion
        }
        catch (Exception ex)
        {
            sResultado = "Error@#@" + Errores.mostrarError("Error al obtener los datos del diálogo.", ex);
        }
        return(sResultado);
    }