Beispiel #1
0
        public static Result getListaMunicipios(string valorBuscado, int registroPartida, int totalAExtraer, int usuarioId)
        {
            Result r = ValidateSession.validarSession(usuarioId, HttpContext.Current.Session["usuarioId"]);

            if (r.error != "")
            {
                return(r);
            }
            int totalRegistros             = 0;
            List <MunicipiosViewModel> lst = new List <MunicipiosViewModel>();

            try
            {
                MunicipiosController mc = new MunicipiosController();
                lst            = mc.getListaMunicipios(valorBuscado);
                totalRegistros = lst.Count();
                totalAExtraer  = (lst.Count() - registroPartida) < totalAExtraer ? (lst.Count() - registroPartida) : totalAExtraer;
            }
            catch (Exception e)
            {
                return(new Result()
                {
                    error = e.Message, id = 0, tipoAlerta = "warning"
                });
            }
            return(new Result()
            {
                error = "", getCadena = new JavaScriptSerializer().Serialize(lst.GetRange(registroPartida, totalAExtraer)), totalRegistros = totalRegistros
            });
        }