Пример #1
0
 public static string convertToHtmlTable(List <string[]> lista)
 {
     return(Gen.convertToHtmlTable(lista, "", ""));
 }
Пример #2
0
        public static string convertToHtmlTableDelete2(List <string[]> lista, string htmlId, string cssClass, List <int> listaEvitar, bool modificable, bool activable, bool desechable, bool detalles, int colEvitarDer, int colEvitarIzq, bool checkBox, List <int> ListcheckBox)
        {
            //int colEvitarIzq = 1;
            string html   = "";
            int    tamcol = lista[0].Length - colEvitarDer;

            html += "<table id='" + htmlId + "' class='" + cssClass + "'>" +
                    "<thead>";
            html += "<tr>";

            //bool checkBox = false;
            if (ListcheckBox.Count > 0)
            {
                checkBox = true;
            }

            ////
            if (checkBox == true)
            {
                //html += "<th class='tHide'>idCheck</th>";
                html += "<th>Check</th>";
            }
            ////

            for (int i = 0; i < tamcol; i++)
            {
                if (i < colEvitarIzq)
                {
                    html += "<th class='tHide'>" + lista[0][i] + "</th>"; // se agrega la clase de ocultar a la izquierda si es que se tiene considerado
                }
                else
                {
                    html += "<th>" + lista[0][i] + "</th>";
                }
            }
            if (activable || modificable || desechable || detalles)
            {
                html += "<th>Modificaciones</th>"; // agregar titulo de cambios para modificar, Activar/desactivar
            }

            html += "</tr></thead>";
            html += "<tbody>";
            for (int i = 1; i < lista.Count; i++)
            {
                string enviar           = "";
                string estatus          = "";
                string ComplementoBoton = "Activar";


                html += "<tr>";
                /////
                if (checkBox == true)
                {
                    //html += "<td class='tHide'>"+i+"</td>";
                    string isCheck = "";
                    for (int t = 0; t < ListcheckBox.Count; t++)
                    {
                        if (ListcheckBox[t] == i)
                        {
                            isCheck = "checked";
                        }
                    }
                    //
                    html += "<td><input type='checkbox' class='chk' value='" + i + "' " + isCheck + "/></td>";
                }
                ////
                for (int j = 0; j < tamcol; j++)
                {
                    if (tamcol - 1 == j) // esto es para tomar el ultimo registro, se pone el menos uno para tomar la ultima columna que es la que trae el estatus
                    {
                        estatus = lista[i][j];
                        if (lista[i][j] == "True")
                        {
                            html += "<td>" + "Activo" + "</td>";
                        }
                        else
                        {
                            if (activable) // si el activable quiere decir que trae informacion de bloqueo(esbloq)
                            {
                                html += "<td>" + "Inactivo" + "</td>";
                            }
                            else
                            {
                                html += "<td>" + lista[i][j] + "</td>"; // en caso de que no contenga el estatus se debe de mostrar el contenido
                            }
                        }
                    }
                    else
                    {
                        if (j < colEvitarIzq)
                        {
                            html += "<td class='tHide'>" + lista[i][j] + "</td>";
                        }
                        else
                        {
                            html += "<td>" + lista[i][j] + "</td>";
                        }
                    }
                }

                if (estatus == "True")
                {
                    ComplementoBoton = "Desactivar";
                }

                enviar = lista[i][0].ToString();


                if (!Gen.isIn(listaEvitar, enviar))
                {
                    if (activable || modificable || desechable || detalles)
                    {
                        html += "<td>";
                        html += "<center>";
                        if (activable)// si Activar
                        {
                            html += "<label class='btn plusBtn'onclick='workThis(this);'>" + ComplementoBoton + "</label>";
                        }
                        if (modificable) // editar
                        {
                            html += "<label class='btn plusBtn' onclick='workThis(this);'>Modificar</label>";
                        }
                        if (desechable) // eliminar
                        {
                            html += "<label class='btn plusBtn' onclick='workThis(this);'>Eliminar</label>";
                            if (detalles) // eliminar
                            {
                                html += "<label class='btn plusBtn' onclick='workThis(this);'>Ver más</label>";
                            }
                        }
                        html += "</center>";
                        html += "</td>";
                    }
                }
                else// si se encuentra en la lista sera imposible editar
                {
                    html += "<td>Imposible cambiar</td>";
                }
                html += "</tr>";
            }
            html += "</tbody>";
            html += "</table>";
            return(html);
        }