// // GET: /Ventana/ public ActionResult Index() { try { VentanaView vv = new VentanaView(); VentanaRepository vr = new VentanaRepository(); List <Ventana> ventanas = vr.Listar(); vv.Ventana = new Ventana(); vv.Ventanas = ventanas; string mensaje = ""; if (ventanas.Count == 0) { mensaje = "No existen ventanas de ejecuciĆ³n definidas."; } vv.Mensaje = mensaje; return(View(vv)); } catch (Exception ex) { return(View("Mensaje", new VentanaView { Mensaje = ex.Message })); } }
// // GET: /Home/ public ActionResult Index() { try { string nombreUsuario = FormsAuthentication.Decrypt(Request.Cookies[FormsAuthentication.FormsCookieName].Value).UserData; Usuario usuario = new UsuarioRepository().Obtener(nombreUsuario); HomeView hv = new HomeView(); SolicitudRepository sr = new SolicitudRepository(); VentanaRepository vr = new VentanaRepository(); hv.Pendientes = sr.ListarPendientesCM(); string nombreVista = "Index"; if (User.IsInRole("RM")) { hv.Pendientes = sr.ListarPendientesRM(); hv.Aprobados = sr.ListarAprobadosRM(); hv.Ventanas = vr.Listar(); nombreVista = "IndexRM"; } if (User.IsInRole("CM")) { hv.Pendientes = sr.ListarPendientesCM(); nombreVista = "IndexCM"; } if (User.IsInRole("Operador")) { hv.Pendientes = sr.ListarPendientesOperador(usuario.Id); nombreVista = "IndexOperador"; } if (User.IsInRole("Ejecutor")) { hv.Pendientes = sr.ListarPendientesEjecutor(usuario.Id); nombreVista = "IndexEjecutor"; } return(View(nombreVista, hv)); } catch (Exception ex) { return(View("Mensaje", new HomeView { Mensaje = ex.Message })); } }