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)); } }
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; //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(); 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;' 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:2px;vertical-align:middle;border: 0px;'>"; break; case 2: strHTMLAmbito += "<img src='../../../../../images/imgSN3.gif' style='margin-left:2px;margin-right:2px;vertical-align:middle;border: 0px;'>"; break; case 3: strHTMLAmbito += "<img src='../../../../../images/imgSN2.gif' style='margin-left:2px;margin-right:2px;vertical-align:middle;border: 0px;'>"; break; case 4: strHTMLAmbito += "<img src='../../../../../images/imgSN1.gif' style='margin-left:2px;margin-right:2px;vertical-align:middle;border: 0px;'>"; break; case 5: strHTMLAmbito += "<img src='../../../../../images/imgNodo.gif' style='margin-left:2px;margin-right:2px;vertical-align:middle;border: 0px;'>"; break; case 6: strHTMLAmbito += "<img src='../../../../../images/imgSubNodo.gif' style='margin-left:2px;margin-right:2px;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><span class='NBR W260'>" + dr["t441_denominacion"].ToString() + "</span></td></tr>"; break; case 3: if (strIDsNaturaleza != "") { strIDsNaturaleza += ","; } strIDsNaturaleza += dr["t441_valor"].ToString(); strHTMLNaturaleza += "<tr id='" + dr["t441_valor"].ToString() + "' style='height:16px;'><td><span class='NBR W260'>" + dr["t441_denominacion"].ToString() + "</span></td></tr>"; break; case 4: if (strIDsModeloCon != "") { strIDsModeloCon += ","; } strIDsModeloCon += dr["t441_valor"].ToString(); strHTMLModeloCon += "<tr id='" + dr["t441_valor"].ToString() + "' style='height:16px;'><td><span class='NBR W260'>" + dr["t441_denominacion"].ToString() + "</span></td></tr>"; break; case 5: if (strIDsHorizontal != "") { strIDsHorizontal += ","; } strIDsHorizontal += dr["t441_valor"].ToString(); strHTMLHorizontal += "<tr id='" + dr["t441_valor"].ToString() + "' style='height:16px;'><td><span class='NBR W260'>" + dr["t441_denominacion"].ToString() + "</span></td></tr>"; break; case 6: if (strIDsSector != "") { strIDsSector += ","; } strIDsSector += dr["t441_valor"].ToString(); strHTMLSector += "<tr id='" + dr["t441_valor"].ToString() + "' style='height:16px;'><td><span class='NBR W260'>" + dr["t441_denominacion"].ToString() + "</span></td></tr>"; break; case 7: if (strIDsSegmento != "") { strIDsSegmento += ","; } strIDsSegmento += dr["t441_valor"].ToString(); strHTMLSegmento += "<tr id='" + dr["t441_valor"].ToString() + "' style='height:16px;'><td><span class='NBR W260'>" + dr["t441_denominacion"].ToString() + "</span></td></tr>"; break; case 8: if (strIDsCliente != "") { strIDsCliente += ","; } strIDsCliente += dr["t441_valor"].ToString(); strHTMLCliente += "<tr id='" + dr["t441_valor"].ToString() + "' style='height:16px;'><td><span class='NBR W260'>" + dr["t441_denominacion"].ToString() + "</span></td></tr>"; break; case 9: if (strIDsContrato != "") { strIDsContrato += ","; } strIDsContrato += dr["t441_valor"].ToString(); strHTMLContrato += "<tr id='" + dr["t441_valor"].ToString() + "' style='height:16px;'><td><span class='NBR W260'>" + dr["t441_denominacion"].ToString() + "</span></td></tr>"; break; case 10: if (strIDsQn != "") { strIDsQn += ","; } strIDsQn += dr["t441_valor"].ToString(); strHTMLQn += "<tr id='" + dr["t441_valor"].ToString() + "' style='height:16px;'><td><span class='NBR W260'>" + dr["t441_denominacion"].ToString() + "</span></td></tr>"; break; case 11: if (strIDsQ1 != "") { strIDsQ1 += ","; } strIDsQ1 += dr["t441_valor"].ToString(); strHTMLQ1 += "<tr id='" + dr["t441_valor"].ToString() + "' style='height:16px;'><td><span class='NBR W260'>" + dr["t441_denominacion"].ToString() + "</span></td></tr>"; break; case 12: if (strIDsQ2 != "") { strIDsQ2 += ","; } strIDsQ2 += dr["t441_valor"].ToString(); strHTMLQ2 += "<tr id='" + dr["t441_valor"].ToString() + "' style='height:16px;'><td><span class='NBR W260'>" + dr["t441_denominacion"].ToString() + "</span></td></tr>"; break; case 13: if (strIDsQ3 != "") { strIDsQ3 += ","; } strIDsQ3 += dr["t441_valor"].ToString(); strHTMLQ3 += "<tr id='" + dr["t441_valor"].ToString() + "' style='height:16px;'><td><span class='NBR W260'>" + dr["t441_denominacion"].ToString() + "</span></td></tr>"; break; case 14: if (strIDsQ4 != "") { strIDsQ4 += ","; } strIDsQ4 += dr["t441_valor"].ToString(); strHTMLQ4 += "<tr id='" + dr["t441_valor"].ToString() + "' style='height:16px;'><td><span class='NBR W260'>" + dr["t441_denominacion"].ToString() + "</span></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 += "<span class='NBR W185' style='margin-left:10px;' onmouseover='TTip(event)'>" + dr["t441_denominacion"].ToString() + "</span></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)); } }