public JsonResult UsuariosExportExcel([Bind(Include = "role_id")] UsersReportFilterViewModel filtros) { UserBL oUserBL = new UserBL(); var fileName = "Reporte_Usuarios_" + DateTime.Now.ToString("yyyyMMddHHmmssffff") + ".xlsx"; string errorMessage = ""; UserBL oUsertBL = new UserBL(); Stream fileBytes; string fullPath = ""; if (Int32.Parse(ConfigurationManager.AppSettings["role_id"]) == filtros.role_id) { List <InvestigatorViewModel> resultado = oUserBL.ObtenerInvestigadoresParaExcel(); fullPath = Path.Combine(Server.MapPath("~/temp"), fileName); fileBytes = CrearInvestigadoresReporteExcel(resultado, fullPath, true); } else { List <UserViewModel> resultado = oUserBL.ObtenerPorRole(filtros.role_id); fullPath = Path.Combine(Server.MapPath("~/temp"), fileName); fileBytes = CrearUsuariosReporteExcel(resultado, fullPath, true); } return(Json(new { fileName = fileName, errorMessage = errorMessage })); }
public ActionResult Usuarios() { SelectorBL oSelectorBL = new SelectorBL(); List <SelectOptionItem> oRoles = oSelectorBL.RolesSelector(); List <SelectListItem> roles = Helper.ConstruirDropDownList <SelectOptionItem>(oRoles, "Value", "Text", "", true, "0", "TODOS"); ViewBag.roles = roles; UsersReportFilterViewModel oUsersReportFilterViewModel = new UsersReportFilterViewModel(); return(View(oUsersReportFilterViewModel)); }