예제 #1
0
        public ActionResult Buscar(string campo)
        {
            per.Buscar(campo);
            DataTable personas     = per.Buscar(campo);
            string    tablaEsquema = "";

            for (int i = 0; i < personas.Rows.Count; i++)
            {
                string boton = "";
                string p     = personas.Rows[i][7].ToString();
                if (p.Equals("Activo"))
                {
                    boton = "<button title='Deshabilitar persona' id=" + personas.Rows[i][0].ToString() + "  value='habilitado'  class=" + "'btn btn-linkEdit btn-sm'" + " onclick='CambiarEstado(this.id,this.value)' ><em class='flaticon-eye'></em></button>";
                }
                else
                {
                    boton = "<button title='Habilitar persona' id=" + personas.Rows[i][0].ToString() + "  value='deshabilitado'  class=" + "'btn btn-linkOcultar btn-sm'" + " onclick='CambiarEstado(this.id,this.value)' ><em class='flaticon-visibility'></em></button>";
                }
                string temp = "<tr><td>" + personas.Rows[i][0].ToString() + "</td>" +
                              "<td>" + personas.Rows[i][1].ToString() + "</td>" +
                              "<td>" + personas.Rows[i][2].ToString() + "</td>" +
                              "<td>" + personas.Rows[i][3].ToString() + "</td>" +
                              "<td>" + personas.Rows[i][4].ToString() + "</td>" +
                              "<td>" + personas.Rows[i][5].ToString() + "</td>" +
                              "<td>" + personas.Rows[i][6].ToString() + "</td>" +
                              "<td>" + personas.Rows[i][7].ToString() + "</td>" +
                              "<td>" + boton + "</td></tr>";
                tablaEsquema += temp;
            }
            return(Json(tablaEsquema, JsonRequestBehavior.AllowGet));
        }