public ActionResult Index() { //Autentica if (Session["ConexaoSapiens"] == null) { return RedirectToAction("Login", "Home"); } //Autoriza if (!AutorizaUsuario(ControlAccessConfig.Workflow)) { return View("Erro", null, "Módulo não autorizado para este usuário. "); } using (var bll = new ConfiguracaoWorkflowBLL()) { var listaConfigWorkflow = bll.ListarTodos().Where(w => w.UsuSituacao == "A" && w.UsuGrupo.HasValue).ToList(); bll.ObterNomes(listaConfigWorkflow); var ajaxGridFactory = new Grid.Mvc.Ajax.GridExtensions.AjaxGridFactory(); var grid = ajaxGridFactory.CreateAjaxGrid(listaConfigWorkflow.OrderBy(c => c.UsuId).OrderBy(s => s.UsuId).AsQueryable(), 1, false); return View(grid); } }
public ActionResult Editar(ConfiguracaoWorkflow c) { //Autentica if (Session["ConexaoSapiens"] == null) { return RedirectToAction("Login", "Home"); } //Autoriza if (!AutorizaUsuario(ControlAccessConfig.Workflow)) { return View("Erro", null, "Módulo não autorizado para este usuário. "); } using (var bll = new ConfiguracaoWorkflowBLL()) { int usuId = c.UsuId.Value; var workflow = bll.ObterPorCodigo(usuId); workflow.UsuSituacao = c.UsuSituacao; workflow.UsuAlcada = c.UsuAlcada; workflow.UsuAlcadamax = c.UsuAlcadamax; workflow.UsuEncerra = c.UsuEncerra; bll.SalvarOuAtualizar(workflow); var listaConfigWorkflow = bll.ListarTodos().Where(w => w.UsuGrupo.HasValue).ToList(); bll.ObterNomes(listaConfigWorkflow); return View("Index", listaConfigWorkflow); } }
public ActionResult GridConfiguracoesWorkflowPaginado(int? page) { using (var bll = new ConfiguracaoWorkflowBLL()) { var listaConfigWorkflow = bll.ListarTodos().Where(w => w.UsuSituacao == "A" && w.UsuGrupo.HasValue).ToList(); bll.ObterNomes(listaConfigWorkflow); var ajaxGridFactory = new Grid.Mvc.Ajax.GridExtensions.AjaxGridFactory(); var grid = ajaxGridFactory.CreateAjaxGrid(listaConfigWorkflow.OrderBy(c => c.UsuId).OrderBy(s => s.UsuId).AsQueryable(), page.HasValue? page.Value:1, false); return Json(new { Html = grid.ToJson("_GridConfiguracoesWorkflow", this), grid.HasItems }, JsonRequestBehavior.AllowGet); } }