private string ObtenerIntegrantes(string sTipo, string sID)
    {
        StringBuilder sb       = new StringBuilder();
        StringBuilder sbuilder = new StringBuilder();

        sbuilder.Append(" aFigIni = new Array();");
        int i = 0;

        try
        {
            //SqlDataReader dr = FIGURAPROYECTOSUBNODO.CatalogoFiguras(int.Parse(sIDProySubNodo));
            SqlDataReader dr;
            if (sTipo == "R")
            {
                dr = FIGURAPSN_RESPONSABLE.CatalogoFiguras(int.Parse(sID));
            }
            else
            {
                dr = FIGURAPSN_NODO.CatalogoFiguras(int.Parse(sID));
            }

            sb.Append("<TABLE id='tblFiguras2' class='texto MM' style='width: 410px;' mantenimiento='1'>");
            sb.Append("<colgroup><col style='width: 10px' /><col style='width: 20px' /><col style='width: 280px;' /><col style='width: 100px;' /></colgroup>");
            sb.Append("<tbody>");
            int    nUsuario  = 0;
            bool   bHayFilas = false;
            string sColor    = "black";
            while (dr.Read())
            {
                bHayFilas = true;
                sbuilder.Append("aFigIni[" + i.ToString() + "] = {idUser:\"" + dr["t314_idusuario"].ToString() + "\"," +
                                "sFig:\"" + dr["figura"].ToString() + "\"};");
                i++;
                sColor = "black";
                if ((int)dr["t314_idusuario"] != nUsuario)
                {
                    if (nUsuario != 0)
                    {
                        sb.Append("</ul></div></td>");
                        sb.Append("</tr>");
                    }
                    if (dr["baja"].ToString() == "1")
                    {
                        sColor = "red";
                    }
                    sb.Append("<tr id='" + dr["t314_idusuario"].ToString() + "' bd='' style='height:22px;color:" + sColor + "' ");
                    sb.Append("sexo='" + dr["t001_sexo"].ToString() + "' ");
                    sb.Append("tipo='" + dr["tipo"].ToString() + "' ");
                    //if (dr["t303_idnodo"].ToString() == "") sb.Append("tipo='E' ");
                    //else sb.Append("tipo='P' ");
                    sb.Append(" onclick='mm(event)' onmousedown='DD(event);'>");
                    sb.Append("<td></td>");
                    sb.Append("<td></td>");
                    sb.Append("<td style='padding-left:3px;'><nobr class='NBR W280' style='noWrap:true;' title=\"cssbody=[dvbdy] cssheader=[dvhdr] header=[<img src='../../../../images/info.gif' style='vertical-align:middle' />  Información] body=[<label style='width:60px;'>Profesional:</label>" + dr["Profesional"].ToString().Replace((char)34, (char)39) + "<br><label style='width:60px;'>Usuario:</label>" + int.Parse(dr["t314_idusuario"].ToString()).ToString("#,###") + "<br><label style='width:60px;'>" + Estructura.getDefCorta(Estructura.sTipoElem.NODO) + ":</label>" + dr["t303_denominacion"].ToString().Replace((char)34, (char)39) + "] hideselects=[off]\">" + dr["Profesional"].ToString() + "</nobr></td>");// ondblclick='insertarFigura(this.parentNode.parentNode)'
                    //Figuras
                    sb.Append("<td><div style='height:20px;'><ul id='box-" + dr["t314_idusuario"].ToString() + "'>");

                    switch (dr["figura"].ToString())
                    {
                    case "D": sb.Append("<li id='D' value='" + dr["orden"].ToString() + "'><img src='../../../../Images/imgDelegado.gif' title='Delegado' /></li>"); break;

                    case "C": sb.Append("<li id='C' value='" + dr["orden"].ToString() + "'><img src='../../../../Images/imgColaborador.gif' title='Colaborador' /></li>"); break;

                    case "J": sb.Append("<li id='J' value='" + dr["orden"].ToString() + "'><img src='../../../../Images/imgJefeProyecto.gif' title='Jefe' /></li>"); break;

                    case "M": sb.Append("<li id='M' value='" + dr["orden"].ToString() + "'><img src='../../../../Images/imgSubjefeProyecto.gif' title='Responsable técnico de proyecto económico' /></li>"); break;

                    case "B": sb.Append("<li id='B' value='" + dr["orden"].ToString() + "'><img src='../../../../Images/imgBitacorico.gif' title='Bitacórico' /></li>"); break;

                    case "S": sb.Append("<li id='S' value='" + dr["orden"].ToString() + "'><img src='../../../../Images/imgSecretaria.gif' title='Asistente' /></li>"); break;

                    case "I": sb.Append("<li id='I' value='" + dr["orden"].ToString() + "'><img src='../../../../Images/imgInvitado.gif' title='Invitado' /></li>"); break;
                    }

                    nUsuario = (int)dr["t314_idusuario"];
                }
                else
                {
                    switch (dr["figura"].ToString())
                    {
                    case "C": sb.Append("<li id='C' value='" + dr["orden"].ToString() + "'><img src='../../../../Images/imgColaborador.gif' title='Colaborador' /></li>"); break;

                    case "J": sb.Append("<li id='J' value='" + dr["orden"].ToString() + "'><img src='../../../../Images/imgJefeProyecto.gif' title='Jefe' /></li>"); break;

                    case "M": sb.Append("<li id='M' value='" + dr["orden"].ToString() + "'><img src='../../../../Images/imgSubjefeProyecto.gif' title='Responsable técnico de proyecto económico' /></li>"); break;

                    case "B": sb.Append("<li id='B' value='" + dr["orden"].ToString() + "'><img src='../../../../Images/imgBitacorico.gif' title='Bitacórico' /></li>"); break;

                    case "S": sb.Append("<li id='S' value='" + dr["orden"].ToString() + "'><img src='../../../../Images/imgSecretaria.gif' title='Secretaria' /></li>"); break;

                    case "I": sb.Append("<li id='I' value='" + dr["orden"].ToString() + "'><img src='../../../../Images/imgInvitado.gif' title='Invitado' /></li>"); break;
                    }
                }
            }
            dr.Close();
            dr.Dispose();
            if (bHayFilas)
            {
                sb.Append("</ul></div></td>");
                sb.Append("</tr>");
            }
            sb.Append("</tbody>");
            sb.Append("</table>");
            strTablaHTMLIntegrantes = sb.ToString();
            this.hdnAux.Value       = sbuilder.ToString();

            return(sb.ToString() + "@#@" + sbuilder.ToString());
        }
        catch (Exception ex)
        {
            return("Error@#@" + Errores.mostrarError("Error al obtener la relación de figuras.", ex));
        }
    }
    private string Grabar(string sTipo, string sID, string strFiguras)
    {
        string         sResul = "";
        SqlConnection  oConn  = null;
        SqlTransaction tr     = null;

        try
        {
            oConn = Conexion.Abrir();
            tr    = Conexion.AbrirTransaccion(oConn);
            if (strFiguras != "")//No se ha modificado nada de la pestaña de Figuras
            {
                string[] aUsuarios = Regex.Split(strFiguras, "///");
                foreach (string oUsuario in aUsuarios)
                {
                    if (oUsuario == "")
                    {
                        continue;
                    }
                    string[] aFig = Regex.Split(oUsuario, "##");
                    ///aFig[0] = bd
                    ///aFig[1] = idUsuario
                    ///aFig[2] = Figuras
                    if (aFig[0] == "D")
                    {
                        if (sTipo == "R")
                        {
                            FIGURAPSN_RESPONSABLE.DeleteUsuario(tr, int.Parse(sID), int.Parse(aFig[1]));
                        }
                        else
                        {
                            FIGURAPSN_NODO.DeleteUsuario(tr, int.Parse(sID), int.Parse(aFig[1]));
                        }
                    }
                    else
                    {
                        string[] aFiguras = Regex.Split(aFig[2], ",");
                        foreach (string oFigura in aFiguras)
                        {
                            if (oFigura == "")
                            {
                                continue;
                            }
                            string[] aFig2 = Regex.Split(oFigura, "@");
                            ///aFig2[0] = bd
                            ///aFig2[1] = Figura
                            if (aFig2[0] == "D")
                            {
                                if (sTipo == "R")
                                {
                                    FIGURAPSN_RESPONSABLE.Delete(tr, int.Parse(sID), int.Parse(aFig[1]), aFig2[1]);
                                }
                                else
                                {
                                    FIGURAPSN_NODO.Delete(tr, int.Parse(sID), int.Parse(aFig[1]), aFig2[1]);
                                }
                            }
                            else
                            {
                                if (sTipo == "R")
                                {
                                    FIGURAPSN_RESPONSABLE.Insert(tr, int.Parse(sID), int.Parse(aFig[1]), aFig2[1]);
                                }
                                else
                                {
                                    FIGURAPSN_NODO.Insert(tr, int.Parse(sID), int.Parse(aFig[1]), aFig2[1]);
                                }
                            }
                        }
                    }
                }
            }
            Conexion.CommitTransaccion(tr);
            sResul = "OK@#@";
        }
        catch (Exception ex)
        {
            Conexion.CerrarTransaccion(tr);
            sResul = "Error@#@" + Errores.mostrarError("Error al grabar la lista de figuras.", ex);
        }
        finally
        {
            Conexion.Cerrar(oConn);
        }
        return(sResul);
    }