public ActionResult Search(string filter, int? page, int? pagesize) { try { using (Context db = new Context()) { BLL.ModuloBLL moduloBLL = new BLL.ModuloBLL(db, _idUsuario); var result = moduloBLL.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, string descricao, int? page, int? pagesize, bool searching = false) { try { if (searching) { using (Context db = new Context()) { BLL.ModuloBLL moduloBLL = new BLL.ModuloBLL(db, _idUsuario); var result = moduloBLL.Search(nome, descricao, 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.ModuloBLL moduloBLL = new BLL.ModuloBLL(db, _idUsuario); var result = moduloBLL.Search(filter, page, pagesize); var list = result.Select(s => new { s.idModulo, s.nmModulo, s.dsModulo }); 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.ModuloBLL moduloBLL; try { using (var db = new Context()) { moduloBLL = new BLL.ModuloBLL(db, idUsuario); var modulos = moduloBLL.Search(filter); table.Columns.Add(new System.Data.DataColumn("idmodulo", System.Type.GetType("System.Int32"))); table.Columns.Add(new System.Data.DataColumn("dsmodulo", System.Type.GetType("System.String"))); table.Columns.Add(new System.Data.DataColumn("nrordem", System.Type.GetType("System.Int32"))); table.Columns.Add(new System.Data.DataColumn("nmmodulo", System.Type.GetType("System.String"))); table.Columns.Add(new System.Data.DataColumn("nmurl", System.Type.GetType("System.String"))); foreach (Modulo modulo in modulos) { row = table.NewRow(); row["idmodulo"] = modulo.idModulo; row["dsmodulo"] = modulo.dsModulo; row["nrordem"] = modulo.nrOrdem; row["nmmodulo"] = modulo.nmModulo; row["nmurl"] = modulo.nmURL; 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 Módulos{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(); } }