public void Permisos(string nombreControlador) { //controlar permisos var usuario = UsuarioLogeadoSession.IdUsuario; ViewBag.NombreControlador = nombreControlador; ViewBag.AccionesUsuario = ManejoPermisosDAL.ListadoAccionesCatalogoUsuario(usuario, nombreControlador); ViewBag.AccionesControlador = GetMetodosControlador(nombreControlador);//Obtener Acciones del controlador }
public async Task <PartialViewResult> _IndexGrid(String search) { ViewBag.NombreListado = Etiquetas.TituloGridCatalogo; //Controlar permisos var usuario = UsuarioLogeadoSession.IdUsuario; string nombreControlador = ControllerContext.RouteData.Values["controller"].ToString(); ViewBag.NombreControlador = nombreControlador; ViewBag.AccionesUsuario = ManejoPermisosDAL.ListadoAccionesCatalogoUsuario(usuario, nombreControlador); //Obtener Acciones del controlador ViewBag.AccionesControlador = GetMetodosControlador(nombreControlador); //Búsqueda var listado = CatalogoDAL.ListarCatalogos(); search = !string.IsNullOrEmpty(search) ? search.Trim() : ""; if (!string.IsNullOrEmpty(search))//filter { var type = listado.GetType().GetGenericArguments()[0]; var properties = type.GetProperties(); listado = listado.Where(x => properties .Any(p => { var value = p.GetValue(x); return(value != null && value.ToString().ToLower().Contains(search.ToLower())); })).ToList(); } // Only grid query values will be available here. return(PartialView(await Task.Run(() => listado))); }
public async Task <PartialViewResult> IndexGridSubcatalogo(String search, int?tipo, int?subcatalogo, string filtro) { //Controlar permisos var usuario = UsuarioLogeadoSession.IdUsuario; string nombreControlador = ControllerContext.RouteData.Values["controller"].ToString(); ViewBag.NombreControlador = nombreControlador; ViewBag.AccionesUsuario = ManejoPermisosDAL.ListadoAccionesCatalogoUsuario(usuario, nombreControlador); ViewBag.AccionesControlador = GetMetodosControlador(nombreControlador);//Obtener Acciones del controlador //Búsqueda //Cuando no selecciona tipo if (tipo == null && subcatalogo == null) { //Obtener le id del catalogo var id_catalogo = ViewData["IdCatalogo"] = System.Web.HttpContext.Current.Session["IdCatalogo"] as String; var nombre = CatalogoDAL.ConsultarNombreCatalogo(Convert.ToInt32(id_catalogo)); ViewBag.NombreListado = "Catálogo -" + nombre; var listado = CatalogoDAL.ListarCatalogosPorId(Convert.ToInt32(id_catalogo), filtro); search = !string.IsNullOrEmpty(search) ? search.Trim() : ""; if (!string.IsNullOrEmpty(search))//filter { var type = listado.GetType().GetGenericArguments()[0]; var properties = type.GetProperties(); listado = listado.Where(x => properties .Any(p => { var value = p.GetValue(x); return(value != null && value.ToString().ToLower().Contains(search.ToLower())); })).ToList(); } // Only grid query values will be available here. return(PartialView("_IndexGridSubcatalogo", await Task.Run(() => listado))); } else { //Cuando no selecciona tipo if (tipo != null && subcatalogo != null) { //Obtener le id del catalogo var id_catalogo = ViewData["IdCatalogo"] = System.Web.HttpContext.Current.Session["IdCatalogo"] as String; var nombre = CatalogoDAL.ConsultarNombreCatalogo(Convert.ToInt32(subcatalogo)); ViewBag.NombreListado = "Catálogo -" + nombre; var listado = CatalogoDAL.ListarCatalogosPorId(subcatalogo.Value, filtro); search = !string.IsNullOrEmpty(search) ? search.Trim() : ""; if (!string.IsNullOrEmpty(search))//filter { var type = listado.GetType().GetGenericArguments()[0]; var properties = type.GetProperties(); listado = listado.Where(x => properties .Any(p => { var value = p.GetValue(x); return(value != null && value.ToString().ToLower().Contains(search.ToLower())); })).ToList(); } // Only grid query values will be available here. return(PartialView("_IndexGridSubcatalogo", await Task.Run(() => listado))); } else { //Obtener le id del catalogo var id_catalogo = ViewData["IdCatalogo"] = System.Web.HttpContext.Current.Session["IdCatalogo"] as String; var nombre = CatalogoDAL.ConsultarNombreCatalogo(Convert.ToInt32(tipo)); ViewBag.NombreListado = "Catálogo -" + nombre; var listado = CatalogoDAL.ListarCatalogosPorId(Convert.ToInt32(tipo), filtro); search = !string.IsNullOrEmpty(search) ? search.Trim() : ""; if (!string.IsNullOrEmpty(search))//filter { var type = listado.GetType().GetGenericArguments()[0]; var properties = type.GetProperties(); listado = listado.Where(x => properties .Any(p => { var value = p.GetValue(x); return(value != null && value.ToString().ToLower().Contains(search.ToLower())); })).ToList(); } // Only grid query values will be available here. return(PartialView("_IndexGridSubcatalogo", await Task.Run(() => listado))); } } }