public ActionResult Search(string filter, int? page, int? pagesize) { try { using (Context db = new Context()) { BLL.MenuBLL menuBLL = new BLL.MenuBLL(db, _idUsuario); var result = menuBLL.Search(filter, page, pagesize); return View("Index", result); } } catch (Exception ex) { this.AddFlashMessage(RP.Util.Exception.Message.Get(ex), FlashMessage.ERROR); RP.Util.Entity.ErroLog.Add(ex, Session.SessionID, _idUsuario); return RedirectToAction("Index"); } }
public ActionResult Query(string nome, int? page, int? pagesize, bool searching = false) { try { if (searching) { using (Context db = new Context()) { BLL.MenuBLL menuBLL = new BLL.MenuBLL(db, _idUsuario); var result = menuBLL.Search(nome, page, pagesize); return View("Query", result); } } return View("Query"); } catch (Exception ex) { this.AddFlashMessage(RP.Util.Exception.Message.Get(ex), FlashMessage.ERROR); RP.Util.Entity.ErroLog.Add(ex, Session.SessionID, _idUsuario); return RedirectToAction("Query"); } }
public JsonResult JsSearch(string filter, int? page, int? pagesize) { try { using (Context db = new Context()) { BLL.MenuBLL menuBLL = new BLL.MenuBLL(db, _idUsuario); var result = menuBLL.Search(filter, page, pagesize); var list = result.Select(s => new { s.idMenu, s.nmMenu }); return Json(new Util.Class.JsonCollection { result = list, count = result.TotalCount }, JsonRequestBehavior.AllowGet); } } catch (Exception ex) { Response.StatusCode = 500; return Json(RP.Util.Exception.Message.Get(ex), JsonRequestBehavior.AllowGet); } }
public ActionResult Report(string filter) { //if (report.Acao == RP.Report.TipoAcao.Agendar) //{ // return RP.Report.Generic.Json(report); //} int idUsuario = _idUsuario > 0 ? _idUsuario : Convert.ToInt32(Request["idUsuario"]); Dictionary<string, System.Data.DataSet> listData = new Dictionary<string, System.Data.DataSet>(); System.Data.DataSet ds = new System.Data.DataSet(); System.Data.DataTable table = new System.Data.DataTable("table"); System.Data.DataRow row; string titulo; BLL.MenuBLL menuBLL; BLL.AcaoBLL acaoBLL; try { using (var db = new Context()) { menuBLL = new BLL.MenuBLL(db, idUsuario); acaoBLL = new BLL.AcaoBLL(db, idUsuario); var menus = menuBLL.Search(filter); table.Columns.Add(new System.Data.DataColumn("idmenu", System.Type.GetType("System.Int32"))); table.Columns.Add(new System.Data.DataColumn("nmmenu", System.Type.GetType("System.String"))); table.Columns.Add(new System.Data.DataColumn("nmacao", System.Type.GetType("System.String"))); table.Columns.Add(new System.Data.DataColumn("dsacao", System.Type.GetType("System.String"))); table.Columns.Add(new System.Data.DataColumn("acaomenu", System.Type.GetType("System.String"))); foreach (Menu menu in menus) { var acoes = acaoBLL.Find(e => e.idMenu == menu.idMenu).ToList(); if (acoes.Count() > 0) { foreach (Acao acao in acoes) { row = table.NewRow(); row["idmenu"] = menu.idMenu; row["nmmenu"] = menu.nmMenu; row["nmacao"] = acao.nmAcao; row["dsacao"] = acao.dsAcao; row["acaomenu"] = acao.nmMenu; table.Rows.Add(row); } } else { row = table.NewRow(); row["idmenu"] = menu.idMenu; row["nmmenu"] = menu.nmMenu; table.Rows.Add(row); } } ds.Tables.Add(table); listData.Add("subentidade.rpt", RP.Sistema.BLL.EntidadeBLL.getDtSetEntidade(db)); listData.Add("table", ds); } titulo = string.Format("<center>Relação de Menus{0}</center>", !string.IsNullOrEmpty(filter) ? ("</br>Nome contendo: " + filter) : ""); return View(); //return RP.Report.Generic.Report(new RP.Report.Generic.GenericData //{ // exportTO = RP.Report.Generic.stringTOExportFormatType("PDF"), // fileRPT = "relModulo.rpt", // listData = listData, // parameters = new Dictionary<string, object> { { "titulo", titulo } }, //}); } catch (RP.Report.Exception rex) { RP.Util.Entity.ErroLog.Add(rex, Session.SessionID, idUsuario); return RedirectToAction("Index", "Erro"); } catch (Exception ex) { RP.Util.Entity.ErroLog.Add(ex, Session.SessionID, idUsuario); return RedirectToAction("Index", "Erro"); } finally { ds.Dispose(); } }