Esempio n. 1
0
    private string getPreferencia(string sIdPrefUsuario)
    {
        StringBuilder sb = new StringBuilder();

        try
        {
            SqlDataReader dr = PREFERENCIAUSUARIO.Obtener(null, (sIdPrefUsuario == "") ? null : (int?)int.Parse(sIdPrefUsuario),
                                                          (int)Session["IDFICEPI_PC_ACTUAL"], 16);
            if (dr.Read())
            {
                bHayPreferencia = true;

                sb.Append(dr["Sobreescribir"].ToString() + "@#@"); //0
                sb.Append(dr["RPCCR"].ToString() + "@#@");         //1
                sb.Append(dr["ProfCon"].ToString());               //2
            }
            dr.Close();
            dr.Dispose();

            return("OK@#@" + sb.ToString());
        }
        catch (Exception ex)
        {
            return("Error@#@" + Errores.mostrarError("Error al obtener la preferencia.", ex, false));
        }
    }
Esempio n. 2
0
    private string getPreferencia(string sIdPrefUsuario)
    {
        StringBuilder sb = new StringBuilder();

        try
        {
            SqlDataReader dr = PREFERENCIAUSUARIO.Obtener(null, (sIdPrefUsuario == "") ? null : (int?)int.Parse(sIdPrefUsuario),
                                                          (int)Session["IDFICEPI_PC_ACTUAL"], 9);
            if (dr.Read())
            {
                bHayPreferencia = true;

                sb.Append(dr["idNodo"].ToString() + "@#@");            //0
                sb.Append(dr["t303_denominacion"].ToString() + "@#@"); //1
                sb.Append(dr["Incompletos"].ToString() + "@#@");       //2
                sb.Append(dr["Externos"].ToString() + "@#@");          //3
                sb.Append(dr["otrosNodos"].ToString() + "@#@");        //4
                sb.Append(dr["ActuAuto"].ToString() + "@#@");          //5
                sb.Append(dr["sSoloProyAbiertos"].ToString() + "@#@"); //6
                sb.Append(dr["Foraneos"].ToString() + "@#@");          //7
                sb.Append(dr["idGF"].ToString() + "@#@");              //8
                sb.Append(dr["t342_desgrupro"].ToString() + "@#@");    //9
            }
            dr.Close();
            dr.Dispose();

            return("OK@#@" + sb.ToString());
        }
        catch (Exception ex)
        {
            return("Error@#@" + Errores.mostrarError("Error al obtener la preferencia.", ex, false));
        }
    }
    private string getPreferencia(string sIdPrefUsuario)
    {
        StringBuilder sb = new StringBuilder();

        try
        {
            SqlDataReader dr = PREFERENCIAUSUARIO.Obtener(null, (sIdPrefUsuario == "") ? null : (int?)int.Parse(sIdPrefUsuario),
                                                          (int)Session["IDFICEPI_PC_ACTUAL"], 4);
            if (dr.Read())
            {
                bHayPreferencia = true;

                sb.Append(dr["idNodo"].ToString() + "@#@");                  //0
                sb.Append(dr["t303_denominacion"].ToString() + "@#@");       //1
                sb.Append(dr["estado"].ToString() + "@#@");                  //2
                sb.Append(dr["categoria"].ToString() + "@#@");               //3
                sb.Append(dr["idCliente"].ToString() + "@#@");               //4
                sb.Append(dr["t302_denominacion"].ToString() + "@#@");       //5
                sb.Append(dr["idContrato"].ToString() + "@#@");              //6
                sb.Append(dr["t377_denominacion"].ToString() + "@#@");       //7
                sb.Append(dr["idResponsable"].ToString() + "@#@");           //8
                sb.Append(dr["descResponsable"].ToString() + "@#@");         //9
                sb.Append(dr["idHorizontal"].ToString() + "@#@");            //10
                sb.Append(dr["t307_denominacion"].ToString() + "@#@");       //11
                sb.Append(dr["idProyecto"].ToString() + "@#@");              //12
                sb.Append(dr["t301_denominacion"].ToString() + "@#@");       //13
                sb.Append(dr["ActuAuto"].ToString() + "@#@");                //14
                sb.Append(dr["cualidad"].ToString() + "@#@");                //15
                sb.Append(dr["sTipoBusqueda"].ToString() + "@#@");           //16
                sb.Append(dr["sDenominacionProyecto"].ToString() + "@#@");   //17
                sb.Append(dr["t476_idcnp"].ToString() + "@#@");              //18
                sb.Append(dr["t476_denominacion"].ToString() + "@#@");       //19
                sb.Append(dr["t485_idcsn1p"].ToString() + "@#@");            //20
                sb.Append(dr["t485_denominacion"].ToString() + "@#@");       //21
                sb.Append(dr["t487_idcsn2p"].ToString() + "@#@");            //22
                sb.Append(dr["t487_denominacion"].ToString() + "@#@");       //23
                sb.Append(dr["t489_idcsn3p"].ToString() + "@#@");            //24
                sb.Append(dr["t489_denominacion"].ToString() + "@#@");       //25
                sb.Append(dr["t491_idcsn4p"].ToString() + "@#@");            //26
                sb.Append(dr["t491_denominacion"].ToString() + "@#@");       //27
                sb.Append(dr["idNaturaleza"].ToString() + "@#@");            //28
                sb.Append(dr["t323_denominacion"].ToString() + "@#@");       //29
                sb.Append(dr["t316_idmodalidad"].ToString() + "@#@");        //30
                sb.Append(dr["idSoporteAdm"].ToString() + "@#@");            //31
                sb.Append(dr["sDenominacionSoporteAdm"].ToString() + "@#@"); //32
            }
            dr.Close();
            dr.Dispose();

            return("OK@#@" + sb.ToString());
        }
        catch (Exception ex)
        {
            return("Error@#@" + Errores.mostrarError("Error al obtener la preferencia.", ex, false));
        }
    }
    private string getPreferencia(string sIdPrefUsuario)
    {
        StringBuilder sb = new StringBuilder();
        int           idPrefUsuario = 0, nConceptoEje = 0;
        int           nOpcion = 1;

        try
        {
            SqlDataReader dr = PREFERENCIAUSUARIO.Obtener(null, (sIdPrefUsuario == "") ? null : (int?)int.Parse(sIdPrefUsuario),
                                                          (int)Session["IDFICEPI_PC_ACTUAL"], 13);
            if (dr.Read())
            {
                bHayPreferencia = true;

                sb.Append(dr["t462_idPrefUsuario"].ToString() + "@#@"); //1
                sb.Append(dr["Estado"].ToString() + "@#@");             //2
                sb.Append(dr["categoria"].ToString() + "@#@");          //3
                sb.Append(dr["cualidad"].ToString() + "@#@");           //4
                sb.Append(dr["CerrarAuto"].ToString() + "@#@");         //5
                sb.Append(dr["ActuAuto"].ToString() + "@#@");           //6
                sb.Append(dr["OperadorLogico"].ToString() + "@#@");     //7
                sb.Append(dr["OpcionPeriodo"].ToString() + "@#@");      //8
                idPrefUsuario    = int.Parse(dr["t462_idPrefUsuario"].ToString());
                nUtilidadPeriodo = int.Parse(dr["OpcionPeriodo"].ToString());
            }
            dr.Close();
            //dr.Dispose();

            #region Fechas
            switch (nUtilidadPeriodo)
            {
            case 1:
                sb.Append((DateTime.Now.Year * 100 + 1).ToString() + "@#@");                    //9
                sb.Append(Fechas.AnnomesAFechaDescLarga(DateTime.Now.Year * 100 + 1) + "@#@");  //10
                sb.Append((DateTime.Now.Year * 100 + 12).ToString() + "@#@");                   //11
                sb.Append(Fechas.AnnomesAFechaDescLarga(DateTime.Now.Year * 100 + 12) + "@#@"); //12
                break;

            case 2:
                sb.Append((DateTime.Now.Year * 100 + DateTime.Now.Month).ToString() + "@#@");                   //9
                sb.Append(Fechas.AnnomesAFechaDescLarga(DateTime.Now.Year * 100 + DateTime.Now.Month) + "@#@"); //10
                sb.Append((DateTime.Now.Year * 100 + DateTime.Now.Month).ToString() + "@#@");                   //11
                sb.Append(Fechas.AnnomesAFechaDescLarga(DateTime.Now.Year * 100 + DateTime.Now.Month) + "@#@"); //12
                break;

            case 3:
                sb.Append((DateTime.Now.Year * 100 + 1).ToString() + "@#@");                                    //9
                sb.Append(Fechas.AnnomesAFechaDescLarga(DateTime.Now.Year * 100 + 1) + "@#@");                  //10
                sb.Append((DateTime.Now.Year * 100 + DateTime.Now.Month).ToString() + "@#@");                   //11
                sb.Append(Fechas.AnnomesAFechaDescLarga(DateTime.Now.Year * 100 + DateTime.Now.Month) + "@#@"); //12
                break;

            case 4:
                sb.Append("199001" + "@#@");                                                                    //9
                sb.Append(Fechas.AnnomesAFechaDescLarga(199001) + "@#@");                                       //10
                sb.Append((DateTime.Now.Year * 100 + DateTime.Now.Month).ToString() + "@#@");                   //11
                sb.Append(Fechas.AnnomesAFechaDescLarga(DateTime.Now.Year * 100 + DateTime.Now.Month) + "@#@"); //12
                break;

            case 5:
                sb.Append("199001" + "@#@");                              //9
                sb.Append(Fechas.AnnomesAFechaDescLarga(199001) + "@#@"); //10
                sb.Append("207812" + "@#@");                              //11
                sb.Append(Fechas.AnnomesAFechaDescLarga(207812) + "@#@"); //12
                break;

            default:
                sb.Append((DateTime.Now.Year * 100 + 1).ToString() + "@#@");                         //9
                sb.Append(mes[0] + " " + DateTime.Now.Year.ToString() + "@#@");                      //10
                sb.Append((DateTime.Now.Year * 100 + DateTime.Now.Month).ToString() + "@#@");        //11
                sb.Append(mes[DateTime.Now.Month - 1] + " " + DateTime.Now.Year.ToString() + "@#@"); //12
                break;
            }
            #endregion

            #region HTML, IDs
            int      nNivelMinimo = 0;
            bool     bAmbito      = false;
            string[] aID          = null;
            dr = PREFUSUMULTIVALOR.Obtener(null, idPrefUsuario);
            while (dr.Read())
            {
                switch (int.Parse(dr["t441_concepto"].ToString()))
                {
                case 1:
                    if (!bAmbito)
                    {
                        bAmbito      = true;
                        nNivelMinimo = 6;
                    }
                    aID = Regex.Split(dr["t441_valor"].ToString(), "-");
                    if (int.Parse(aID[0]) < nNivelMinimo)
                    {
                        nNivelMinimo = int.Parse(aID[0]);
                    }

                    if (strIDsAmbito != "")
                    {
                        strIDsAmbito += ",";
                    }
                    strIDsAmbito += aID[1];

                    aSubnodos      = PREFUSUMULTIVALOR.SelectSubnodosAmbito(null, aSubnodos, int.Parse(aID[0]), int.Parse(aID[1]));
                    strHTMLAmbito += "<tr id='" + aID[1] + "' tipo='" + aID[0] + "' style='height:16px;' idAux='";
                    strHTMLAmbito += SUBNODO.fgGetCadenaID(aID[0], aID[1]);
                    strHTMLAmbito += "'><td>";

                    switch (int.Parse(aID[0]))
                    {
                    case 1: strHTMLAmbito += "<img src='../../../../images/imgSN4.gif' style='margin-left:2px;margin-right:4px;vertical-align:middle;border: 0px;'>"; break;

                    case 2: strHTMLAmbito += "<img src='../../../../images/imgSN3.gif' style='margin-left:2px;margin-right:4px;vertical-align:middle;border: 0px;'>"; break;

                    case 3: strHTMLAmbito += "<img src='../../../../images/imgSN2.gif' style='margin-left:2px;margin-right:4px;vertical-align:middle;border: 0px;'>"; break;

                    case 4: strHTMLAmbito += "<img src='../../../../images/imgSN1.gif' style='margin-left:2px;margin-right:4px;vertical-align:middle;border: 0px;'>"; break;

                    case 5: strHTMLAmbito += "<img src='../../../../images/imgNodo.gif' style='margin-left:2px;margin-right:4px;vertical-align:middle;border: 0px;'>"; break;

                    case 6: strHTMLAmbito += "<img src='../../../../images/imgSubNodo.gif' style='margin-left:2px;margin-right:4px;vertical-align:middle;border: 0px;'>"; break;
                    }

                    strHTMLAmbito += "<nobr class='NBR W230'>" + dr["t441_denominacion"].ToString() + "</nobr></td></tr>";
                    break;

                case 2:
                    if (strIDsResponsable != "")
                    {
                        strIDsResponsable += ",";
                    }
                    strIDsResponsable  += dr["t441_valor"].ToString();
                    strHTMLResponsable += "<tr id='" + dr["t441_valor"].ToString() + "' style='height:16px;'><td><nobr class='NBR W260'>" + dr["t441_denominacion"].ToString() + "</nobr></td></tr>";
                    break;

                case 3:
                    if (strIDsNaturaleza != "")
                    {
                        strIDsNaturaleza += ",";
                    }
                    strIDsNaturaleza  += dr["t441_valor"].ToString();
                    strHTMLNaturaleza += "<tr id='" + dr["t441_valor"].ToString() + "' style='height:16px;'><td><nobr class='NBR W260'>" + dr["t441_denominacion"].ToString() + "</nobr></td></tr>";
                    break;

                case 4:
                    if (strIDsModeloCon != "")
                    {
                        strIDsModeloCon += ",";
                    }
                    strIDsModeloCon  += dr["t441_valor"].ToString();
                    strHTMLModeloCon += "<tr id='" + dr["t441_valor"].ToString() + "' style='height:16px;'><td><nobr class='NBR W260'>" + dr["t441_denominacion"].ToString() + "</nobr></td></tr>";
                    break;

                case 5:
                    if (strIDsHorizontal != "")
                    {
                        strIDsHorizontal += ",";
                    }
                    strIDsHorizontal  += dr["t441_valor"].ToString();
                    strHTMLHorizontal += "<tr id='" + dr["t441_valor"].ToString() + "' style='height:16px;'><td><nobr class='NBR W260'>" + dr["t441_denominacion"].ToString() + "</nobr></td></tr>";
                    break;

                case 6: if (strIDsSector != "")
                    {
                        strIDsSector += ",";
                    }
                    strIDsSector  += dr["t441_valor"].ToString();
                    strHTMLSector += "<tr id='" + dr["t441_valor"].ToString() + "' style='height:16px;'><td><nobr class='NBR W260'>" + dr["t441_denominacion"].ToString() + "</nobr></td></tr>";
                    break;

                case 7: if (strIDsSegmento != "")
                    {
                        strIDsSegmento += ",";
                    }
                    strIDsSegmento  += dr["t441_valor"].ToString();
                    strHTMLSegmento += "<tr id='" + dr["t441_valor"].ToString() + "' style='height:16px;'><td><nobr class='NBR W260'>" + dr["t441_denominacion"].ToString() + "</nobr></td></tr>";
                    break;

                case 8:
                    if (strIDsCliente != "")
                    {
                        strIDsCliente += ",";
                    }
                    strIDsCliente  += dr["t441_valor"].ToString();
                    strHTMLCliente += "<tr id='" + dr["t441_valor"].ToString() + "' style='height:16px;'><td><nobr class='NBR W260'>" + dr["t441_denominacion"].ToString() + "</nobr></td></tr>";
                    break;

                case 9:
                    if (strIDsContrato != "")
                    {
                        strIDsContrato += ",";
                    }
                    strIDsContrato  += dr["t441_valor"].ToString();
                    strHTMLContrato += "<tr id='" + dr["t441_valor"].ToString() + "' style='height:16px;'><td><nobr class='NBR W260'>" + dr["t441_denominacion"].ToString() + "</nobr></td></tr>";
                    break;

                case 10:
                    if (strIDsQn != "")
                    {
                        strIDsQn += ",";
                    }
                    strIDsQn  += dr["t441_valor"].ToString();
                    strHTMLQn += "<tr id='" + dr["t441_valor"].ToString() + "' style='height:16px;'><td><nobr class='NBR W260'>" + dr["t441_denominacion"].ToString() + "</nobr></td></tr>";
                    break;

                case 11:
                    if (strIDsQ1 != "")
                    {
                        strIDsQ1 += ",";
                    }
                    strIDsQ1  += dr["t441_valor"].ToString();
                    strHTMLQ1 += "<tr id='" + dr["t441_valor"].ToString() + "' style='height:16px;'><td><nobr class='NBR W260'>" + dr["t441_denominacion"].ToString() + "</nobr></td></tr>";
                    break;

                case 12:
                    if (strIDsQ2 != "")
                    {
                        strIDsQ2 += ",";
                    }
                    strIDsQ2  += dr["t441_valor"].ToString();
                    strHTMLQ2 += "<tr id='" + dr["t441_valor"].ToString() + "' style='height:16px;'><td><nobr class='NBR W260'>" + dr["t441_denominacion"].ToString() + "</nobr></td></tr>";
                    break;

                case 13:
                    if (strIDsQ3 != "")
                    {
                        strIDsQ3 += ",";
                    }
                    strIDsQ3  += dr["t441_valor"].ToString();
                    strHTMLQ3 += "<tr id='" + dr["t441_valor"].ToString() + "' style='height:16px;'><td><nobr class='NBR W260'>" + dr["t441_denominacion"].ToString() + "</nobr></td></tr>";
                    break;

                case 14:
                    if (strIDsQ4 != "")
                    {
                        strIDsQ4 += ",";
                    }
                    strIDsQ4  += dr["t441_valor"].ToString();
                    strHTMLQ4 += "<tr id='" + dr["t441_valor"].ToString() + "' style='height:16px;'><td><nobr class='NBR W260'>" + dr["t441_denominacion"].ToString() + "</nobr></td></tr>";
                    break;

                //case 15://Columnas a sacar
                //    if (strMagnitudes != "") strMagnitudes += "///";
                //    strMagnitudes += dr["t441_valor"].ToString() +"##"+ dr["t441_denominacion"].ToString();
                //    break;
                case 16:
                    aID = Regex.Split(dr["t441_valor"].ToString(), "-");
                    if (strIDsProyecto != "")
                    {
                        strIDsProyecto += ",";
                    }
                    strIDsProyecto += aID[0];

                    strHTMLProyecto += "<tr id='" + aID[0] + "' style='height:16px;' ";
                    strHTMLProyecto += "categoria='" + aID[1] + "' ";
                    strHTMLProyecto += "cualidad='" + aID[2] + "' ";
                    strHTMLProyecto += "estado='" + aID[3] + "'><td>";

                    if (aID[1] == "P")
                    {
                        strHTMLProyecto += "<img src='../../../../images/imgProducto.gif' style='margin-left:2px;margin-right:2px;vertical-align:middle;border: 0px;'>";
                    }
                    else
                    {
                        strHTMLProyecto += "<img src='../../../../images/imgServicio.gif' style='margin-left:2px;margin-right:2px;vertical-align:middle;border: 0px;'>";
                    }

                    switch (aID[2])
                    {
                    case "C": strHTMLProyecto += "<img src='../../../../images/imgIconoContratante.gif' style='margin-left:2px;margin-right:2px;vertical-align:middle;border: 0px;'>"; break;

                    case "J": strHTMLProyecto += "<img src='../../../../images/imgIconoRepJor.gif' style='margin-left:2px;margin-right:2px;vertical-align:middle;border: 0px;'>"; break;

                    case "P": strHTMLProyecto += "<img src='../../../../images/imgIconoRepPrecio.gif' style='margin-left:2px;margin-right:2px;vertical-align:middle;border: 0px;'>"; break;
                    }

                    switch (aID[3])
                    {
                    case "A": strHTMLProyecto += "<img src='../../../../images/imgIconoProyAbierto.gif' title='Proyecto abierto' style='margin-left:2px;margin-right:2px;vertical-align:middle;border: 0px;'>"; break;

                    case "C": strHTMLProyecto += "<img src='../../../../images/imgIconoProyCerrado.gif' title='Proyecto cerrado' style='margin-left:2px;margin-right:2px;vertical-align:middle;border: 0px;'>"; break;

                    case "H": strHTMLProyecto += "<img src='../../../../images/imgIconoProyHistorico.gif' title='Proyecto histórico' style='margin-left:2px;margin-right:2px;vertical-align:middle;border: 0px;'>"; break;

                    case "P": strHTMLProyecto += "<img src='../../../../images/imgIconoProyPresup.gif' title='Proyecto presupuestado' style='margin-left:2px;margin-right:2px;vertical-align:middle;border: 0px;'>"; break;
                    }

                    strHTMLProyecto += "<nobr class='NBR W190' style='margin-left:10px;' onmouseover='TTip(event)'>" + dr["t441_denominacion"].ToString() + "</nobr></td></tr>";
                    break;

                case 17:
                    if (strIDsOrgComercial != "")
                    {
                        strIDsOrgComercial += ",";
                    }
                    strIDsOrgComercial  += dr["t441_valor"].ToString();
                    strHTMLOrgComercial += "<tr id='" + dr["t441_valor"].ToString() + "' style='height:16px;'><td><nobr class='NBR W260'>" + dr["t441_denominacion"].ToString() + "</nobr></td></tr>";
                    break;
                }
            }
            dr.Close();
            dr.Dispose();
            #endregion

            if (nConceptoEje >= 7)
            {
                nOpcion = nConceptoEje;
            }
            else
            {
                if (nNivelMinimo != 0)
                {
                    nOpcion = nNivelMinimo;
                }
                else
                {
                    nOpcion = nEstructuraMinima;
                }
            }

            for (int i = 0; i < aSubnodos.Count; i++)
            {
                if (i > 0)
                {
                    sSubnodos += ",";
                }
                sSubnodos += aSubnodos[i];
            }

            sb.Append(nOpcion + "@#@");             //13
            sb.Append(sSubnodos + "@#@");           //14
            sb.Append(strHTMLAmbito + "@#@");       //15
            sb.Append(strIDsAmbito + "@#@");        //16
            sb.Append(strHTMLResponsable + "@#@");  //17
            sb.Append(strIDsResponsable + "@#@");   //18
            sb.Append(strHTMLNaturaleza + "@#@");   //19
            sb.Append(strIDsNaturaleza + "@#@");    //20
            sb.Append(strHTMLModeloCon + "@#@");    //21
            sb.Append(strIDsModeloCon + "@#@");     //22
            sb.Append(strHTMLHorizontal + "@#@");   //23
            sb.Append(strIDsHorizontal + "@#@");    //24
            sb.Append(strHTMLSector + "@#@");       //25
            sb.Append(strIDsSector + "@#@");        //26
            sb.Append(strHTMLSegmento + "@#@");     //27
            sb.Append(strIDsSegmento + "@#@");      //28
            sb.Append(strHTMLCliente + "@#@");      //29
            sb.Append(strIDsCliente + "@#@");       //30
            sb.Append(strHTMLContrato + "@#@");     //31
            sb.Append(strIDsContrato + "@#@");      //32
            sb.Append(strHTMLQn + "@#@");           //33
            sb.Append(strIDsQn + "@#@");            //34
            sb.Append(strHTMLQ1 + "@#@");           //35
            sb.Append(strIDsQ1 + "@#@");            //36
            sb.Append(strHTMLQ2 + "@#@");           //37
            sb.Append(strIDsQ2 + "@#@");            //38
            sb.Append(strHTMLQ3 + "@#@");           //39
            sb.Append(strIDsQ3 + "@#@");            //40
            sb.Append(strHTMLQ4 + "@#@");           //41
            sb.Append(strIDsQ4 + "@#@");            //42
            sb.Append(strMagnitudes + "@#@");       //43
            sb.Append(strHTMLProyecto + "@#@");     //44
            sb.Append(strIDsProyecto + "@#@");      //45
            sb.Append(strHTMLOrgComercial + "@#@"); //46
            sb.Append(strIDsOrgComercial + "@#@");  //47

            return("OK@#@" + sb.ToString());
        }
        catch (Exception ex)
        {
            return("Error@#@" + Errores.mostrarError("Error al obtener la preferencia.", ex, false));
        }
    }
Esempio n. 5
0
    private string getPreferencia(string sIdPrefUsuario)
    {
        StringBuilder sb            = new StringBuilder();
        int           idPrefUsuario = 0; //, nConceptoEje=0;

        try
        {
            bHayPreferencia = false;
            SqlDataReader dr = PREFERENCIAUSUARIO.Obtener(null, (sIdPrefUsuario == "")? null:(int?)int.Parse(sIdPrefUsuario),
                                                          (int)Session["IDFICEPI_PC_ACTUAL"], 37);
            if (dr.Read())
            {
                bHayPreferencia = true;

                sb.Append(dr["t462_idPrefUsuario"].ToString() + "@#@"); //1
                sb.Append(dr["cboDisponibilidad"].ToString() + "@#@");  //2
                sb.Append(dr["CerrarAuto"].ToString() + "@#@");         //3
                sb.Append(dr["ActuAuto"].ToString() + "@#@");           //4
                sb.Append(dr["OpcionPeriodo"].ToString() + "@#@");      //5
                sb.Append(dr["chkMisProyectos"].ToString() + "@#@");    //6

                idPrefUsuario    = int.Parse(dr["t462_idPrefUsuario"].ToString());
                nUtilidadPeriodo = int.Parse(dr["OpcionPeriodo"].ToString());
            }

            dr.Close();
            //dr.Dispose();

            if (bHayPreferencia == false)
            {
                return("OK@#@NO@#@");
            }

            #region Fechas
            switch (nUtilidadPeriodo)
            {
            case 1:
                sb.Append((DateTime.Now.Year * 100 + 1).ToString() + "@#@");                    //7
                sb.Append(Fechas.AnnomesAFechaDescLarga(DateTime.Now.Year * 100 + 1) + "@#@");  //8
                sb.Append((DateTime.Now.Year * 100 + 12).ToString() + "@#@");                   //9
                sb.Append(Fechas.AnnomesAFechaDescLarga(DateTime.Now.Year * 100 + 12) + "@#@"); //10
                break;

            case 2:
                sb.Append((DateTime.Now.Year * 100 + DateTime.Now.Month).ToString() + "@#@");                   //7
                sb.Append(Fechas.AnnomesAFechaDescLarga(DateTime.Now.Year * 100 + DateTime.Now.Month) + "@#@"); //8
                sb.Append((DateTime.Now.Year * 100 + DateTime.Now.Month).ToString() + "@#@");                   //9
                sb.Append(Fechas.AnnomesAFechaDescLarga(DateTime.Now.Year * 100 + DateTime.Now.Month) + "@#@"); //10
                break;

            case 3:
                sb.Append((DateTime.Now.Year * 100 + 1).ToString() + "@#@");                                    //7
                sb.Append(Fechas.AnnomesAFechaDescLarga(DateTime.Now.Year * 100 + 1) + "@#@");                  //8
                sb.Append((DateTime.Now.Year * 100 + DateTime.Now.Month).ToString() + "@#@");                   //9
                sb.Append(Fechas.AnnomesAFechaDescLarga(DateTime.Now.Year * 100 + DateTime.Now.Month) + "@#@"); //10
                break;

            case 4:
                sb.Append("199001" + "@#@");                                                                    //7
                sb.Append(Fechas.AnnomesAFechaDescLarga(199001) + "@#@");                                       //8
                sb.Append((DateTime.Now.Year * 100 + DateTime.Now.Month).ToString() + "@#@");                   //9
                sb.Append(Fechas.AnnomesAFechaDescLarga(DateTime.Now.Year * 100 + DateTime.Now.Month) + "@#@"); //10
                break;

            case 5:
                sb.Append("199001" + "@#@");                              //7
                sb.Append(Fechas.AnnomesAFechaDescLarga(199001) + "@#@"); //8
                sb.Append("207812" + "@#@");                              //9
                sb.Append(Fechas.AnnomesAFechaDescLarga(207812) + "@#@"); //10
                break;

            default:
                sb.Append((DateTime.Now.Year * 100 + 1).ToString() + "@#@");                         //7
                sb.Append(mes[0] + " " + DateTime.Now.Year.ToString() + "@#@");                      //8
                sb.Append((DateTime.Now.Year * 100 + DateTime.Now.Month).ToString() + "@#@");        //9
                sb.Append(mes[DateTime.Now.Month - 1] + " " + DateTime.Now.Year.ToString() + "@#@"); //10
                break;
            }
            #endregion

            #region HTML, IDs
            //int nNivelMinimo = 0;
            //bool bAmbito = false;
            string[] aID = null;
            dr = PREFUSUMULTIVALOR.Obtener(null, idPrefUsuario);
            while (dr.Read())
            {
                switch (int.Parse(dr["t441_concepto"].ToString()))
                {
                case 1:
                    aID = Regex.Split(dr["t441_valor"].ToString(), "-");

                    if (strIDsAmbito != "")
                    {
                        strIDsAmbito += ",";
                    }
                    strIDsAmbito += aID[1];

                    aNodos = PREFUSUMULTIVALOR.SelectNodosAmbito(null, aNodos, int.Parse(aID[0]), int.Parse(aID[1]));
                    //aSubnodos = PREFUSUMULTIVALOR.SelectSubnodosAmbito(null, aSubnodos, int.Parse(aID[0]), int.Parse(aID[1]));
                    strHTMLAmbito += "<tr id='" + aID[1] + "' tipo='" + aID[0] + "' style='height:18px;' idAux='";
                    //strHTMLAmbito += SUBNODO.fgGetCadenaID(aID[0], aID[1]);
                    strHTMLAmbito += NODO.fgGetCadenaID(aID[0], aID[1]);
                    strHTMLAmbito += "'><td>";

                    switch (int.Parse(aID[0]))
                    {
                    case 1: strHTMLAmbito += "<img src='../../../../images/imgSN4.gif' style='margin-left:2px; margin-right:4px; vertical-align:middle; border:0px; height:16px;'>"; break;

                    case 2: strHTMLAmbito += "<img src='../../../../images/imgSN3.gif' style='margin-left:2px; margin-right:4px; vertical-align:middle; border:0px; height:16px;'>"; break;

                    case 3: strHTMLAmbito += "<img src='../../../../images/imgSN2.gif' style='margin-left:2px; margin-right:4px; vertical-align:middle; border:0px; height:16px;'>"; break;

                    case 4: strHTMLAmbito += "<img src='../../../../images/imgSN1.gif' style='margin-left:2px; margin-right:4px; vertical-align:middle; border:0px; height:16px;'>"; break;

                    case 5: strHTMLAmbito += "<img src='../../../../images/imgNodo.gif' style='margin-left:2px; margin-right:4px; vertical-align:middle; border:0px; height:16px;'>"; break;

                    case 6: strHTMLAmbito += "<img src='../../../../images/imgSubNodo.gif' style='margin-left:2px; margin-right:4px; vertical-align:middle; border:0px; height:16px;'>"; break;
                    }

                    strHTMLAmbito += "<nobr class='NBR W230'>" + dr["t441_denominacion"].ToString() + "</nobr></td></tr>";
                    break;

                case 2:
                    if (strIDsResponsable != "")
                    {
                        strIDsResponsable += ",";
                    }
                    strIDsResponsable  += dr["t441_valor"].ToString();
                    strHTMLResponsable += "<tr id='" + dr["t441_valor"].ToString() + "' style='height:16px;'><td><nobr class='NBR W260'>" + dr["t441_denominacion"].ToString() + "</nobr></td></tr>";
                    break;

                case 23:
                    if (strIDsRol != "")
                    {
                        strIDsRol += ",";
                    }
                    strIDsRol  += dr["t441_valor"].ToString();
                    strHTMLRol += "<tr id='" + dr["t441_valor"].ToString() + "' style='height:16px;'><td><nobr class='NBR W260'>" + dr["t441_denominacion"].ToString() + "</nobr></td></tr>";
                    break;

                case 24:
                    if (strIDsSupervisor != "")
                    {
                        strIDsSupervisor += ",";
                    }
                    strIDsSupervisor  += dr["t441_valor"].ToString();
                    strHTMLSupervisor += "<tr id='" + dr["t441_valor"].ToString() + "' style='height:16px;'><td><nobr class='NBR W260'>" + dr["t441_denominacion"].ToString() + "</nobr></td></tr>";
                    break;

                case 25:
                    if (strIDsCentroTrabajo != "")
                    {
                        strIDsCentroTrabajo += ",";
                    }
                    strIDsCentroTrabajo  += dr["t441_valor"].ToString();
                    strHTMLCentroTrabajo += "<tr id='" + dr["t441_valor"].ToString() + "' style='height:16px;'><td><nobr class='NBR W260'>" + dr["t441_denominacion"].ToString() + "</nobr></td></tr>";
                    break;

                case 26:
                    if (strIDsOficina != "")
                    {
                        strIDsOficina += ",";
                    }
                    strIDsOficina  += dr["t441_valor"].ToString();
                    strHTMLOficina += "<tr id='" + dr["t441_valor"].ToString() + "' style='height:16px;'><td><nobr class='NBR W260'>" + dr["t441_denominacion"].ToString() + "</nobr></td></tr>";
                    break;

                case 27: if (strIDsProfesional != "")
                    {
                        strIDsProfesional += ",";
                    }
                    strIDsProfesional  += dr["t441_valor"].ToString();
                    strHTMLProfesional += "<tr id='" + dr["t441_valor"].ToString() + "' style='height:16px;'><td><nobr class='NBR W260'>" + dr["t441_denominacion"].ToString() + "</nobr></td></tr>";
                    break;
                }
            }
            dr.Close();
            dr.Dispose();
            #endregion


            //for (int i = 0; i < aSubnodos.Count; i++)
            //{
            //    if (i > 0) sSubnodos += ",";
            //    sSubnodos += aSubnodos[i];
            //}

            for (int i = 0; i < aNodos.Count; i++)
            {
                if (i > 0)
                {
                    sNodos += ",";
                }
                sNodos += aNodos[i];
            }

            sb.Append(sNodos + "@#@");               //11
            sb.Append(strHTMLAmbito + "@#@");        //12
            sb.Append(strIDsAmbito + "@#@");         //13
            sb.Append(strHTMLRol + "@#@");           //14
            sb.Append(strIDsRol + "@#@");            //15
            sb.Append(strHTMLSupervisor + "@#@");    //16
            sb.Append(strIDsSupervisor + "@#@");     //17
            sb.Append(strHTMLCentroTrabajo + "@#@"); //18
            sb.Append(strIDsCentroTrabajo + "@#@");  //19
            sb.Append(strHTMLOficina + "@#@");       //20
            sb.Append(strIDsOficina + "@#@");        //21
            sb.Append(strHTMLProfesional + "@#@");   //22
            sb.Append(strIDsProfesional + "@#@");    //23
            //sb.Append((bHayPreferencia) ? "S@#@" : "N@#@"); //24
            sb.Append(strHTMLResponsable + "@#@");   //24
            sb.Append(strIDsResponsable + "@#@");    //25
            return("OK@#@" + sb.ToString());
        }
        catch (Exception ex)
        {
            return("Error@#@" + Errores.mostrarError("Error al obtener la preferencia.", ex, false));
        }
    }
    private string getPreferencia(string sIdPrefUsuario)
    {
        StringBuilder sb            = new StringBuilder();
        int           idPrefUsuario = 0;

        //int nOpcion = 1;
        //string sEstado = "";
        try
        {
            SqlDataReader dr = PREFERENCIAUSUARIO.Obtener(null, (sIdPrefUsuario == "") ? null : (int?)int.Parse(sIdPrefUsuario),
                                                          (int)Session["IDFICEPI_PC_ACTUAL"], 20);
            if (dr.Read())
            {
                bHayPreferencia = true;

                sb.Append(dr["t462_idPrefUsuario"].ToString() + "@#@"); //1
                sb.Append(dr["CerrarAuto"].ToString() + "@#@");         //5
                sb.Append(dr["ActuAuto"].ToString() + "@#@");           //6
                //sb.Append(dr["OperadorLogico"].ToString() + "@#@"); //7
                //sb.Append(dr["OpcionPeriodo"].ToString() + "@#@"); //8

                //sEstado = dr["estado"].ToString();
                //sObraCurso = (dr["ObraCurso"].ToString() == "") ? "1" : dr["ObraCurso"].ToString();
                //sFactuAnti = (dr["FactAnti"].ToString() == "") ? "1" : dr["FactAnti"].ToString();

                idPrefUsuario = int.Parse(dr["t462_idPrefUsuario"].ToString());
                //nConceptoEje = (dr["ConceptoEje"].ToString() == "") ? 0 : int.Parse(dr["ConceptoEje"].ToString());
                //nUtilidadPeriodo = int.Parse(dr["OpcionPeriodo"].ToString());
            }
            dr.Close();
            //dr.Dispose();

            #region HTML, IDs
            int      nNivelMinimo = 0;
            bool     bAmbito      = false;
            string[] aID          = null;
            dr = PREFUSUMULTIVALOR.Obtener(null, idPrefUsuario);
            while (dr.Read())
            {
                switch (int.Parse(dr["t441_concepto"].ToString()))
                {
                case 1:
                    if (!bAmbito)
                    {
                        bAmbito      = true;
                        nNivelMinimo = 6;
                    }
                    aID = Regex.Split(dr["t441_valor"].ToString(), "-");
                    if (int.Parse(aID[0]) < nNivelMinimo)
                    {
                        nNivelMinimo = int.Parse(aID[0]);
                    }

                    if (strIDsAmbito != "")
                    {
                        strIDsAmbito += ",";
                    }
                    strIDsAmbito += aID[1];

                    aSubnodos      = PREFUSUMULTIVALOR.SelectSubnodosAmbito(null, aSubnodos, int.Parse(aID[0]), int.Parse(aID[1]));
                    strHTMLAmbito += "<tr id='" + aID[1] + "' tipo='" + aID[0] + "' style='height:18px;' idAux='";
                    strHTMLAmbito += SUBNODO.fgGetCadenaID(aID[0], aID[1]);
                    strHTMLAmbito += "'><td>";

                    switch (int.Parse(aID[0]))
                    {
                    case 1: strHTMLAmbito += "<img src='../../../../images/imgSN4.gif' style='margin-left:2px;margin-right:4px;vertical-align:middle;border: 0px;'>"; break;

                    case 2: strHTMLAmbito += "<img src='../../../../images/imgSN3.gif' style='margin-left:2px;margin-right:4px;vertical-align:middle;border: 0px;'>"; break;

                    case 3: strHTMLAmbito += "<img src='../../../../images/imgSN2.gif' style='margin-left:2px;margin-right:4px;vertical-align:middle;border: 0px;'>"; break;

                    case 4: strHTMLAmbito += "<img src='../../../../images/imgSN1.gif' style='margin-left:2px;margin-right:4px;vertical-align:middle;border: 0px;'>"; break;

                    case 5: strHTMLAmbito += "<img src='../../../../images/imgNodo.gif' style='margin-left:2px;margin-right:4px;vertical-align:middle;border: 0px;'>"; break;

                    case 6: strHTMLAmbito += "<img src='../../../../images/imgSubNodo.gif' style='margin-left:2px;margin-right:4px;vertical-align:middle;border: 0px;'>"; break;
                    }

                    strHTMLAmbito += "<nobr class='NBR W230'>" + dr["t441_denominacion"].ToString() + "</nobr></td></tr>";
                    break;

                case 2:
                    if (strIDsResponsable != "")
                    {
                        strIDsResponsable += ",";
                    }
                    strIDsResponsable  += dr["t441_valor"].ToString();
                    strHTMLResponsable += "<tr id='" + dr["t441_valor"].ToString() + "' style='height:16px;'><td><nobr class='NBR W260'>" + dr["t441_denominacion"].ToString() + "</nobr></td></tr>";
                    break;

                case 3:
                    if (strIDsNaturaleza != "")
                    {
                        strIDsNaturaleza += ",";
                    }
                    strIDsNaturaleza  += dr["t441_valor"].ToString();
                    strHTMLNaturaleza += "<tr id='" + dr["t441_valor"].ToString() + "' style='height:16px;'><td><nobr class='NBR W260'>" + dr["t441_denominacion"].ToString() + "</nobr></td></tr>";
                    break;

                case 4:
                    if (strIDsModeloCon != "")
                    {
                        strIDsModeloCon += ",";
                    }
                    strIDsModeloCon  += dr["t441_valor"].ToString();
                    strHTMLModeloCon += "<tr id='" + dr["t441_valor"].ToString() + "' style='height:16px;'><td><nobr class='NBR W260'>" + dr["t441_denominacion"].ToString() + "</nobr></td></tr>";
                    break;

                case 8:
                    if (strIDsCliente != "")
                    {
                        strIDsCliente += ",";
                    }
                    strIDsCliente  += dr["t441_valor"].ToString();
                    strHTMLCliente += "<tr id='" + dr["t441_valor"].ToString() + "' style='height:16px;'><td><nobr class='NBR W260'>" + dr["t441_denominacion"].ToString() + "</nobr></td></tr>";
                    break;

                case 9:
                    if (strIDsContrato != "")
                    {
                        strIDsContrato += ",";
                    }
                    strIDsContrato  += dr["t441_valor"].ToString();
                    strHTMLContrato += "<tr id='" + dr["t441_valor"].ToString() + "' style='height:16px;'><td><nobr class='NBR W260'>" + dr["t441_denominacion"].ToString() + "</nobr></td></tr>";
                    break;
                }
            }
            dr.Close();
            dr.Dispose();
            #endregion

            //if (nConceptoEje >= 7)
            //{
            //    nOpcion = nConceptoEje;
            //}
            //else
            //{
            //    if (nNivelMinimo != 0) nOpcion = nNivelMinimo;
            //    else nOpcion = nEstructuraMinima;
            //}

            for (int i = 0; i < aSubnodos.Count; i++)
            {
                if (i > 0)
                {
                    sSubnodos += ",";
                }
                sSubnodos += aSubnodos[i];
            }

            //sb.Append(nOpcion + "@#@"); //13
            sb.Append(sSubnodos + "@#@");          //14
            sb.Append(strHTMLAmbito + "@#@");      //15
            sb.Append(strIDsAmbito + "@#@");       //16
            sb.Append(strHTMLResponsable + "@#@"); //17
            sb.Append(strIDsResponsable + "@#@");  //18
            sb.Append(strHTMLNaturaleza + "@#@");  //19
            sb.Append(strIDsNaturaleza + "@#@");   //20
            sb.Append(strHTMLModeloCon + "@#@");   //21
            sb.Append(strIDsModeloCon + "@#@");    //22
            //sb.Append(strHTMLHorizontal + "@#@"); //23
            //sb.Append(strIDsHorizontal + "@#@"); //24
            //sb.Append(strHTMLSector + "@#@"); //25
            //sb.Append(strIDsSector + "@#@"); //26
            //sb.Append(strHTMLSegmento + "@#@"); //27
            //sb.Append(strIDsSegmento + "@#@"); //28
            sb.Append(strHTMLCliente + "@#@");  //29
            sb.Append(strIDsCliente + "@#@");   //30
            sb.Append(strHTMLContrato + "@#@"); //31
            sb.Append(strIDsContrato + "@#@");  //32
            //sb.Append(strHTMLQn + "@#@"); //33
            //sb.Append(strIDsQn + "@#@"); //34
            //sb.Append(strHTMLQ1 + "@#@"); //35
            //sb.Append(strIDsQ1 + "@#@"); //36
            //sb.Append(strHTMLQ2 + "@#@"); //37
            //sb.Append(strIDsQ2 + "@#@"); //38
            //sb.Append(strHTMLQ3 + "@#@"); //39
            //sb.Append(strIDsQ3 + "@#@"); //40
            //sb.Append(strHTMLQ4 + "@#@"); //41
            //sb.Append(strIDsQ4 + "@#@"); //42
            //sb.Append(strHTMLProyecto + "@#@"); //43
            //sb.Append(strIDsProyecto + "@#@"); //44
            //sb.Append(sEstado + "@#@"); //45
            //sb.Append(sObraCurso + "@#@"); //46
            //sb.Append(sFactuAnti + "@#@"); //47


            return("OK@#@" + sb.ToString());
        }
        catch (Exception ex)
        {
            return("Error@#@" + Errores.mostrarError("Error al obtener la preferencia.", ex, false));
        }
    }
    private string getPreferencia(string sIdPrefUsuario)
    {
        StringBuilder sb = new StringBuilder();
        ArrayList     aSubnodos = new ArrayList();
        string        strHTMLAmbito = "", strHTMLResponsable = "", strHTMLNaturaleza = "", strHTMLModeloCon = "", strHTMLHorizontal = "", strHTMLSector = "", strHTMLSegmento = "", strHTMLCliente = "", strHTMLContrato = "", strHTMLQn = "", strHTMLQ1 = "", strHTMLQ2 = "", strHTMLQ3 = "", strHTMLQ4 = "", strHTMLProyecto = "";
        int           idPrefUsuario = 0;

        try
        {
            SqlDataReader dr = PREFERENCIAUSUARIO.Obtener(null, (sIdPrefUsuario == "") ? null : (int?)int.Parse(sIdPrefUsuario),
                                                          (int)Session["IDFICEPI_PC_ACTUAL"], nPantallaPreferencia);
            if (dr.Read())
            {
                sb.Append(dr["t462_idPrefUsuario"].ToString() + "@#@"); //2
                sb.Append(dr["categoria"].ToString() + "@#@");          //3
                sb.Append(dr["estado"].ToString() + "@#@");             //4
                sb.Append(dr["cualidad"].ToString() + "@#@");           //5
                sb.Append(dr["CerrarAuto"].ToString() + "@#@");         //6
                sb.Append(dr["ActuAuto"].ToString() + "@#@");           //7
                sb.Append(dr["OperadorLogico"].ToString() + "@#@");     //8
                idPrefUsuario = int.Parse(dr["t462_idPrefUsuario"].ToString());
            }
            dr.Close();
            //dr.Dispose();

            #region HTML, IDs
            //int nNivelMinimo = 0;
            //bool bAmbito = false;
            string[] aID = null;
            dr = PREFUSUMULTIVALOR.Obtener(null, idPrefUsuario);
            while (dr.Read())
            {
                switch (int.Parse(dr["t441_concepto"].ToString()))
                {
                case 1:
                    //if (!bAmbito)
                    //{
                    //    bAmbito = true;
                    //    nNivelMinimo = 6;
                    //}
                    aID = Regex.Split(dr["t441_valor"].ToString(), "-");
                    //if (int.Parse(aID[0]) < nNivelMinimo) nNivelMinimo = int.Parse(aID[0]);

                    aSubnodos      = PREFUSUMULTIVALOR.SelectSubnodosAmbito(null, aSubnodos, int.Parse(aID[0]), int.Parse(aID[1]));
                    strHTMLAmbito += "<tr id='" + aID[1] + "' tipo='" + aID[0] + "' style='height:16px;' idAux='";
                    strHTMLAmbito += SUBNODO.fgGetCadenaID(aID[0], aID[1]);
                    strHTMLAmbito += "'><td>";

                    switch (int.Parse(aID[0]))
                    {
                    case 1: strHTMLAmbito += "<img src='../../../../images/imgSN4.gif' style='margin-left:2px;margin-right:4px;vertical-align:middle;border: 0px;'>"; break;

                    case 2: strHTMLAmbito += "<img src='../../../../images/imgSN3.gif' style='margin-left:2px;margin-right:4px;vertical-align:middle;border: 0px;'>"; break;

                    case 3: strHTMLAmbito += "<img src='../../../../images/imgSN2.gif' style='margin-left:2px;margin-right:4px;vertical-align:middle;border: 0px;'>"; break;

                    case 4: strHTMLAmbito += "<img src='../../../../images/imgSN1.gif' style='margin-left:2px;margin-right:4px;vertical-align:middle;border: 0px;'>"; break;

                    case 5: strHTMLAmbito += "<img src='../../../../images/imgNodo.gif' style='margin-left:2px;margin-right:4px;vertical-align:middle;border: 0px;'>"; break;

                    case 6: strHTMLAmbito += "<img src='../../../../images/imgSubNodo.gif' style='margin-left:2px;margin-right:4px;vertical-align:middle;border: 0px;'>"; break;
                    }

                    strHTMLAmbito += "<nobr class='NBR W230'>" + dr["t441_denominacion"].ToString() + "</nobr></td></tr>";
                    break;

                case 2:
                    strHTMLResponsable += "<tr id='" + dr["t441_valor"].ToString() + "' style='height:16px;'><td><nobr class='NBR W260'>" + dr["t441_denominacion"].ToString() + "</nobr></td></tr>";
                    break;

                case 3:
                    strHTMLNaturaleza += "<tr id='" + dr["t441_valor"].ToString() + "' style='height:16px;'><td><nobr class='NBR W260'>" + dr["t441_denominacion"].ToString() + "</nobr></td></tr>";
                    break;

                case 4:
                    strHTMLModeloCon += "<tr id='" + dr["t441_valor"].ToString() + "' style='height:16px;'><td><nobr class='NBR W260'>" + dr["t441_denominacion"].ToString() + "</nobr></td></tr>";
                    break;

                case 5:
                    strHTMLHorizontal += "<tr id='" + dr["t441_valor"].ToString() + "' style='height:16px;'><td><nobr class='NBR W260'>" + dr["t441_denominacion"].ToString() + "</nobr></td></tr>";
                    break;

                case 6:
                    strHTMLSector += "<tr id='" + dr["t441_valor"].ToString() + "' style='height:16px;'><td><nobr class='NBR W260'>" + dr["t441_denominacion"].ToString() + "</nobr></td></tr>";
                    break;

                case 7:
                    strHTMLSegmento += "<tr id='" + dr["t441_valor"].ToString() + "' style='height:16px;'><td><nobr class='NBR W260'>" + dr["t441_denominacion"].ToString() + "</nobr></td></tr>";
                    break;

                case 8:
                    strHTMLCliente += "<tr id='" + dr["t441_valor"].ToString() + "' style='height:16px;'><td><nobr class='NBR W260'>" + dr["t441_denominacion"].ToString() + "</nobr></td></tr>";
                    break;

                case 9:
                    strHTMLContrato += "<tr id='" + dr["t441_valor"].ToString() + "' style='height:16px;'><td><nobr class='NBR W260'>" + dr["t441_denominacion"].ToString() + "</nobr></td></tr>";
                    break;

                case 10:
                    strHTMLQn += "<tr id='" + dr["t441_valor"].ToString() + "' style='height:16px;'><td><nobr class='NBR W260'>" + dr["t441_denominacion"].ToString() + "</nobr></td></tr>";
                    break;

                case 11:
                    strHTMLQ1 += "<tr id='" + dr["t441_valor"].ToString() + "' style='height:16px;'><td><nobr class='NBR W260'>" + dr["t441_denominacion"].ToString() + "</nobr></td></tr>";
                    break;

                case 12:
                    strHTMLQ2 += "<tr id='" + dr["t441_valor"].ToString() + "' style='height:16px;'><td><nobr class='NBR W260'>" + dr["t441_denominacion"].ToString() + "</nobr></td></tr>";
                    break;

                case 13:
                    strHTMLQ3 += "<tr id='" + dr["t441_valor"].ToString() + "' style='height:16px;'><td><nobr class='NBR W260'>" + dr["t441_denominacion"].ToString() + "</nobr></td></tr>";
                    break;

                case 14:
                    strHTMLQ4 += "<tr id='" + dr["t441_valor"].ToString() + "' style='height:16px;'><td><nobr class='NBR W260'>" + dr["t441_denominacion"].ToString() + "</nobr></td></tr>";
                    break;

                case 16:
                    aID = Regex.Split(dr["t441_valor"].ToString(), "-");

                    strHTMLProyecto += "<tr id='" + aID[0] + "' style='height:16px;' ";
                    strHTMLProyecto += "categoria='" + aID[1] + "' ";
                    strHTMLProyecto += "cualidad='" + aID[2] + "' ";
                    strHTMLProyecto += "estado='" + aID[3] + "'><td>";

                    if (aID[1] == "P")
                    {
                        strHTMLProyecto += "<img src='../../../../images/imgProducto.gif' style='margin-left:2px;margin-right:2px;vertical-align:middle;border: 0px;'>";
                    }
                    else
                    {
                        strHTMLProyecto += "<img src='../../../../images/imgServicio.gif' style='margin-left:2px;margin-right:2px;vertical-align:middle;border: 0px;'>";
                    }

                    switch (aID[2])
                    {
                    case "C": strHTMLProyecto += "<img src='../../../../images/imgIconoContratante.gif' style='margin-left:2px;margin-right:2px;vertical-align:middle;border: 0px;'>"; break;

                    case "J": strHTMLProyecto += "<img src='../../../../images/imgIconoRepJor.gif' style='margin-left:2px;margin-right:2px;vertical-align:middle;border: 0px;'>"; break;

                    case "P": strHTMLProyecto += "<img src='../../../../images/imgIconoRepPrecio.gif' style='margin-left:2px;margin-right:2px;vertical-align:middle;border: 0px;'>"; break;
                    }

                    switch (aID[3])
                    {
                    case "A": strHTMLProyecto += "<img src='../../../../images/imgIconoProyAbierto.gif' title='Proyecto abierto' style='margin-left:2px;margin-right:2px;vertical-align:middle;border: 0px;'>"; break;

                    case "C": strHTMLProyecto += "<img src='../../../../images/imgIconoProyCerrado.gif' title='Proyecto cerrado' style='margin-left:2px;margin-right:2px;vertical-align:middle;border: 0px;'>"; break;

                    case "H": strHTMLProyecto += "<img src='../../../../images/imgIconoProyHistorico.gif' title='Proyecto histórico' style='margin-left:2px;margin-right:2px;vertical-align:middle;border: 0px;'>"; break;

                    case "P": strHTMLProyecto += "<img src='../../../../images/imgIconoProyPresup.gif' title='Proyecto presupuestado' style='margin-left:2px;margin-right:2px;vertical-align:middle;border: 0px;'>"; break;
                    }

                    strHTMLProyecto += "<nobr class='NBR W190' style='margin-left:10px;' onmouseover='TTip(event)'>" + dr["t441_denominacion"].ToString() + "</nobr></td></tr>";
                    break;
                }
            }
            dr.Close();
            dr.Dispose();
            #endregion

            for (int i = 0; i < aSubnodos.Count; i++)
            {
                if (i > 0)
                {
                    sSubnodos += ",";
                }
                sSubnodos += aSubnodos[i];
            }

            sb.Append(sSubnodos + "@#@");          //9
            sb.Append(strHTMLAmbito + "@#@");      //10
            sb.Append(strHTMLResponsable + "@#@"); //11
            sb.Append(strHTMLNaturaleza + "@#@");  //12
            sb.Append(strHTMLModeloCon + "@#@");   //13
            sb.Append(strHTMLHorizontal + "@#@");  //14
            sb.Append(strHTMLSector + "@#@");      //15
            sb.Append(strHTMLSegmento + "@#@");    //16
            sb.Append(strHTMLCliente + "@#@");     //17
            sb.Append(strHTMLContrato + "@#@");    //18
            sb.Append(strHTMLQn + "@#@");          //19
            sb.Append(strHTMLQ1 + "@#@");          //20
            sb.Append(strHTMLQ2 + "@#@");          //21
            sb.Append(strHTMLQ3 + "@#@");          //22
            sb.Append(strHTMLQ4 + "@#@");          //23
            sb.Append(strHTMLProyecto + "@#@");    //24

            return("OK@#@" + sb.ToString());
        }
        catch (Exception ex)
        {
            return("Error@#@" + Errores.mostrarError("Error al obtener la preferencia.", ex, false));
        }
    }
    private string getPreferencia(string sIdPrefUsuario)
    {
        StringBuilder sb            = new StringBuilder();
        int           idPrefUsuario = 0;
        string        sEstado       = "";

        try
        {
            SqlDataReader dr = PREFERENCIAUSUARIO.Obtener(null, (sIdPrefUsuario == "") ? null : (int?)int.Parse(sIdPrefUsuario),
                                                          (int)Session["IDFICEPI_PC_ACTUAL"], 27);
            if (dr.Read())
            {
                bHayPreferencia = true;

                sb.Append(dr["t462_idPrefUsuario"].ToString() + "@#@"); //1
                sb.Append(dr["categoria"].ToString() + "@#@");          //2
                sb.Append(dr["cualidad"].ToString() + "@#@");           //3
                sb.Append(dr["CerrarAuto"].ToString() + "@#@");         //4
                sb.Append(dr["ActuAuto"].ToString() + "@#@");           //5
                sb.Append(dr["OperadorLogico"].ToString() + "@#@");     //6
                sb.Append(dr["estado"].ToString() + "@#@");             //7
                sEstado       = dr["estado"].ToString();
                idPrefUsuario = int.Parse(dr["t462_idPrefUsuario"].ToString());
            }
            dr.Close();
            //dr.Dispose();

            sb.Append("0@#@");//8
            //sb.Append("0@#@");//9
            //sb.Append("0@#@");//10
            //sb.Append("0@#@");//11
            //sb.Append("0@#@");//12
            DateTime dHoy = DateTime.Now, dtAux;
            int      nDias = dHoy.Day;
            dtAux = dHoy.AddDays(-nDias + 1);
            txtFechaInicio.Text = dtAux.ToShortDateString();
            dtAux            = dtAux.AddMonths(1).AddDays(-1);
            txtFechaFin.Text = dtAux.ToShortDateString();

            hdnDesde.Text = (DateTime.Now.Year * 100 + 1).ToString();
            hdnHasta.Text = (DateTime.Now.Year * 100 + DateTime.Now.Month).ToString();

            sb.Append(hdnDesde.Text + "@#@");       //9
            sb.Append(txtFechaInicio.Text + "@#@"); //10
            sb.Append(hdnHasta.Text + "@#@");       //11
            sb.Append(txtFechaFin.Text + "@#@");    //12


            #region HTML, IDs
            int      nNivelMinimo = 0;
            bool     bAmbito      = false;
            string[] aID          = null;
            dr = PREFUSUMULTIVALOR.Obtener(null, idPrefUsuario);
            while (dr.Read())
            {
                switch (int.Parse(dr["t441_concepto"].ToString()))
                {
                case 1:
                    if (!bAmbito)
                    {
                        bAmbito      = true;
                        nNivelMinimo = 6;
                    }
                    aID = Regex.Split(dr["t441_valor"].ToString(), "-");
                    if (int.Parse(aID[0]) < nNivelMinimo)
                    {
                        nNivelMinimo = int.Parse(aID[0]);
                    }

                    if (strIDsAmbito != "")
                    {
                        strIDsAmbito += ",";
                    }
                    strIDsAmbito += aID[1];

                    aSubnodos      = PREFUSUMULTIVALOR.SelectSubnodosAmbito(null, aSubnodos, int.Parse(aID[0]), int.Parse(aID[1]));
                    strHTMLAmbito += "<tr id='" + aID[1] + "' tipo='" + aID[0] + "' style='height:16px;'><td>";

                    switch (int.Parse(aID[0]))
                    {
                    case 1: strHTMLAmbito += "<img src='../../../images/imgSN4.gif' style='margin-left:2px;margin-right:4px;vertical-align:middle;border: 0px;'>"; break;

                    case 2: strHTMLAmbito += "<img src='../../../images/imgSN3.gif' style='margin-left:2px;margin-right:4px;vertical-align:middle;border: 0px;'>"; break;

                    case 3: strHTMLAmbito += "<img src='../../../images/imgSN2.gif' style='margin-left:2px;margin-right:4px;vertical-align:middle;border: 0px;'>"; break;

                    case 4: strHTMLAmbito += "<img src='../../../images/imgSN1.gif' style='margin-left:2px;margin-right:4px;vertical-align:middle;border: 0px;'>"; break;

                    case 5: strHTMLAmbito += "<img src='../../../images/imgNodo.gif' style='margin-left:2px;margin-right:4px;vertical-align:middle;border: 0px;'>"; break;

                    case 6: strHTMLAmbito += "<img src='../../../images/imgSubNodo.gif' style='margin-left:2px;margin-right:4px;vertical-align:middle;border: 0px;'>"; break;
                    }

                    strHTMLAmbito += "<nobr class='NBR W230'>" + dr["t441_denominacion"].ToString() + "</nobr></td></tr>";
                    break;

                case 2:
                    if (strIDsResponsable != "")
                    {
                        strIDsResponsable += ",";
                    }
                    strIDsResponsable  += dr["t441_valor"].ToString();
                    strHTMLResponsable += "<tr id='" + dr["t441_valor"].ToString() + "' style='height:16px;'><td><nobr class='NBR W260'>" + dr["t441_denominacion"].ToString() + "</nobr></td></tr>";
                    break;

                case 3:
                    if (strIDsNaturaleza != "")
                    {
                        strIDsNaturaleza += ",";
                    }
                    strIDsNaturaleza  += dr["t441_valor"].ToString();
                    strHTMLNaturaleza += "<tr id='" + dr["t441_valor"].ToString() + "' style='height:16px;'><td><nobr class='NBR W260'>" + dr["t441_denominacion"].ToString() + "</nobr></td></tr>";
                    break;

                case 4:
                    if (strIDsModeloCon != "")
                    {
                        strIDsModeloCon += ",";
                    }
                    strIDsModeloCon  += dr["t441_valor"].ToString();
                    strHTMLModeloCon += "<tr id='" + dr["t441_valor"].ToString() + "' style='height:16px;'><td><nobr class='NBR W260'>" + dr["t441_denominacion"].ToString() + "</nobr></td></tr>";
                    break;

                case 5:
                    if (strIDsHorizontal != "")
                    {
                        strIDsHorizontal += ",";
                    }
                    strIDsHorizontal  += dr["t441_valor"].ToString();
                    strHTMLHorizontal += "<tr id='" + dr["t441_valor"].ToString() + "' style='height:16px;'><td><nobr class='NBR W260'>" + dr["t441_denominacion"].ToString() + "</nobr></td></tr>";
                    break;

                case 6: if (strIDsSector != "")
                    {
                        strIDsSector += ",";
                    }
                    strIDsSector  += dr["t441_valor"].ToString();
                    strHTMLSector += "<tr id='" + dr["t441_valor"].ToString() + "' style='height:16px;'><td><nobr class='NBR W260'>" + dr["t441_denominacion"].ToString() + "</nobr></td></tr>";
                    break;

                case 7: if (strIDsSegmento != "")
                    {
                        strIDsSegmento += ",";
                    }
                    strIDsSegmento  += dr["t441_valor"].ToString();
                    strHTMLSegmento += "<tr id='" + dr["t441_valor"].ToString() + "' style='height:16px;'><td><nobr class='NBR W260'>" + dr["t441_denominacion"].ToString() + "</nobr></td></tr>";
                    break;

                case 8:
                    if (strIDsCliente != "")
                    {
                        strIDsCliente += ",";
                    }
                    strIDsCliente  += dr["t441_valor"].ToString();
                    strHTMLCliente += "<tr id='" + dr["t441_valor"].ToString() + "' style='height:16px;'><td><nobr class='NBR W260'>" + dr["t441_denominacion"].ToString() + "</nobr></td></tr>";
                    break;

                case 9:
                    if (strIDsContrato != "")
                    {
                        strIDsContrato += ",";
                    }
                    strIDsContrato  += dr["t441_valor"].ToString();
                    strHTMLContrato += "<tr id='" + dr["t441_valor"].ToString() + "' style='height:16px;'><td><nobr class='NBR W260'>" + dr["t441_denominacion"].ToString() + "</nobr></td></tr>";
                    break;

                case 10:
                    if (strIDsQn != "")
                    {
                        strIDsQn += ",";
                    }
                    strIDsQn  += dr["t441_valor"].ToString();
                    strHTMLQn += "<tr id='" + dr["t441_valor"].ToString() + "' style='height:16px;'><td><nobr class='NBR W260'>" + dr["t441_denominacion"].ToString() + "</nobr></td></tr>";
                    break;

                case 11:
                    if (strIDsQ1 != "")
                    {
                        strIDsQ1 += ",";
                    }
                    strIDsQ1  += dr["t441_valor"].ToString();
                    strHTMLQ1 += "<tr id='" + dr["t441_valor"].ToString() + "' style='height:16px;'><td><nobr class='NBR W260'>" + dr["t441_denominacion"].ToString() + "</nobr></td></tr>";
                    break;

                case 12:
                    if (strIDsQ2 != "")
                    {
                        strIDsQ2 += ",";
                    }
                    strIDsQ2  += dr["t441_valor"].ToString();
                    strHTMLQ2 += "<tr id='" + dr["t441_valor"].ToString() + "' style='height:16px;'><td><nobr class='NBR W260'>" + dr["t441_denominacion"].ToString() + "</nobr></td></tr>";
                    break;

                case 13:
                    if (strIDsQ3 != "")
                    {
                        strIDsQ3 += ",";
                    }
                    strIDsQ3  += dr["t441_valor"].ToString();
                    strHTMLQ3 += "<tr id='" + dr["t441_valor"].ToString() + "' style='height:16px;'><td><nobr class='NBR W260'>" + dr["t441_denominacion"].ToString() + "</nobr></td></tr>";
                    break;

                case 14:
                    if (strIDsQ4 != "")
                    {
                        strIDsQ4 += ",";
                    }
                    strIDsQ4  += dr["t441_valor"].ToString();
                    strHTMLQ4 += "<tr id='" + dr["t441_valor"].ToString() + "' style='height:16px;'><td><nobr class='NBR W260'>" + dr["t441_denominacion"].ToString() + "</nobr></td></tr>";
                    break;

                //case 15: //strMagnitudes  break;
                case 16:
                    aID = Regex.Split(dr["t441_valor"].ToString(), "-");
                    if (strIDsProyecto != "")
                    {
                        strIDsProyecto += ",";
                    }
                    strIDsProyecto += aID[0];

                    strHTMLProyecto += "<tr id='" + aID[0] + "' style='height:16px;' ";
                    strHTMLProyecto += "categoria='" + aID[1] + "' ";
                    strHTMLProyecto += "cualidad='" + aID[2] + "' ";
                    strHTMLProyecto += "estado='" + aID[3] + "'><td>";

                    if (aID[1] == "P")
                    {
                        strHTMLProyecto += "<img src='../../../images/imgProducto.gif' style='margin-left:2px;margin-right:2px;vertical-align:middle;border: 0px;'>";
                    }
                    else
                    {
                        strHTMLProyecto += "<img src='../../../images/imgServicio.gif' style='margin-left:2px;margin-right:2px;vertical-align:middle;border: 0px;'>";
                    }

                    switch (aID[2])
                    {
                    case "C": strHTMLProyecto += "<img src='../../../images/imgIconoContratante.gif' style='margin-left:2px;margin-right:2px;vertical-align:middle;border: 0px;'>"; break;

                    case "J": strHTMLProyecto += "<img src='../../../images/imgIconoRepJor.gif' style='margin-left:2px;margin-right:2px;vertical-align:middle;border: 0px;'>"; break;

                    case "P": strHTMLProyecto += "<img src='../../../images/imgIconoRepPrecio.gif' style='margin-left:2px;margin-right:2px;vertical-align:middle;border: 0px;'>"; break;
                    }

                    switch (aID[3])
                    {
                    case "A": strHTMLProyecto += "<img src='../../../images/imgIconoProyAbierto.gif' title='Proyecto abierto' style='margin-left:2px;margin-right:2px;vertical-align:middle;border: 0px;'>"; break;

                    case "C": strHTMLProyecto += "<img src='../../../images/imgIconoProyCerrado.gif' title='Proyecto cerrado' style='margin-left:2px;margin-right:2px;vertical-align:middle;border: 0px;'>"; break;

                    case "H": strHTMLProyecto += "<img src='../../../images/imgIconoProyHistorico.gif' title='Proyecto histórico' style='margin-left:2px;margin-right:2px;vertical-align:middle;border: 0px;'>"; break;

                    case "P": strHTMLProyecto += "<img src='../../../images/imgIconoProyPresup.gif' title='Proyecto presupuestado' style='margin-left:2px;margin-right:2px;vertical-align:middle;border: 0px;'>"; break;
                    }

                    strHTMLProyecto += "<nobr class='NBR W190' style='margin-left:10px;' onmouseover='TTip(event)'>" + dr["t441_denominacion"].ToString() + "</nobr></td></tr>";
                    break;
                }
            }
            dr.Close();
            dr.Dispose();
            #endregion

            for (int i = 0; i < aSubnodos.Count; i++)
            {
                if (i > 0)
                {
                    sSubnodos += ",";
                }
                sSubnodos += aSubnodos[i];
            }

            sb.Append(sSubnodos + "@#@");          //12
            sb.Append(strHTMLAmbito + "@#@");      //13
            sb.Append(strIDsAmbito + "@#@");       //14
            sb.Append(strHTMLResponsable + "@#@"); //15
            sb.Append(strIDsResponsable + "@#@");  //16
            sb.Append(strHTMLNaturaleza + "@#@");  //17
            sb.Append(strIDsNaturaleza + "@#@");   //18
            sb.Append(strHTMLModeloCon + "@#@");   //19
            sb.Append(strIDsModeloCon + "@#@");    //20
            sb.Append(strHTMLHorizontal + "@#@");  //21
            sb.Append(strIDsHorizontal + "@#@");   //22
            sb.Append(strHTMLSector + "@#@");      //23
            sb.Append(strIDsSector + "@#@");       //24
            sb.Append(strHTMLSegmento + "@#@");    //25
            sb.Append(strIDsSegmento + "@#@");     //26
            sb.Append(strHTMLCliente + "@#@");     //27
            sb.Append(strIDsCliente + "@#@");      //28
            sb.Append(strHTMLContrato + "@#@");    //29
            sb.Append(strIDsContrato + "@#@");     //30
            sb.Append(strHTMLQn + "@#@");          //31
            sb.Append(strIDsQn + "@#@");           //32
            sb.Append(strHTMLQ1 + "@#@");          //33
            sb.Append(strIDsQ1 + "@#@");           //34
            sb.Append(strHTMLQ2 + "@#@");          //35
            sb.Append(strIDsQ2 + "@#@");           //36
            sb.Append(strHTMLQ3 + "@#@");          //37
            sb.Append(strIDsQ3 + "@#@");           //38
            sb.Append(strHTMLQ4 + "@#@");          //39
            sb.Append(strIDsQ4 + "@#@");           //40
            sb.Append(strHTMLProyecto + "@#@");    //41
            sb.Append(strIDsProyecto + "@#@");     //42
            return("OK@#@" + sb.ToString());
        }
        catch (Exception ex)
        {
            return("Error@#@" + Errores.mostrarError("Error al obtener la preferencia.", ex, false));
        }
    }