public ActionResult Show() { string ReportNum = WebUtil.GetQueryStringValue<string>("ReportNum", string.Empty); string orderNum = WebUtil.GetQueryStringValue<string>("OrderNum",string.Empty); ReportProvider provider = new ReportProvider(); if (ReportNum.IsEmpty()) { return Redirect("/Report/Manager/List"); } ReportsEntity entity = provider.GetReport(ReportNum); if (entity.IsNull()) { return Redirect("/Report/Manager/List"); } List<ReportParamsEntity> list = provider.GetParams(ReportNum); list = list.IsNull() ? new List<ReportParamsEntity>() : list; string SearchValues = WebUtil.GetQueryStringValue<string>("SearchValues"); SearchValues = SearchValues.UnEscapge(); List<ReportParamsEntity> listParams = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ReportParamsEntity>>(SearchValues); if (!listParams.IsNullOrEmpty()) { foreach (ReportParamsEntity item in listParams) { item.ParamName = item.ParamName.Replace("arg_", "@"); if (list.Exists(a => a.ParamName == item.ParamName)) { list.First(a => a.ParamName == item.ParamName).DefaultValue = item.DefaultValue; } } } ViewBag.Entity = entity; ViewBag.ListParam = list; WebReport webReport = new WebReport(); webReport.Width = Unit.Percentage(100); webReport.Height = 600; webReport.ToolbarIconsStyle = ToolbarIconsStyle.Black; webReport.ToolbarIconsStyle = ToolbarIconsStyle.Black; webReport.PrintInBrowser = true; webReport.PrintInPdf = true; webReport.ShowExports = true; webReport.ShowPrint = true; webReport.SinglePage = true; DataSet ds = null; int orderType = 0; if (ReportNum == ResourceManager.GetSettingEntity("InOrder_Template").Value) { orderType = (int)EOrder.InOrder; } else if (ReportNum == ResourceManager.GetSettingEntity("OutOrder_Template").Value) { orderType = (int)EOrder.OutOrder; } ds = new ReportProvider().GetDataSource(entity, list, orderType, orderNum); string path = Server.MapPath("~" + entity.FileName); if (!FileManager.FileExists(path)) { string template = Server.MapPath("~/Theme/content/report/temp/Report.frx"); System.IO.File.Copy(template, path, true); } webReport.Report.Load(path); if (ds != null && ds.Tables != null && ds.Tables.Count > 0) { webReport.Report.RegisterData(ds); for (int i = 0; i < ds.Tables.Count; i++) { webReport.Report.GetDataSource(ds.Tables[i].TableName).Enabled = true; } } webReport.ID = ReportNum; ViewBag.WebReport = webReport; return View(); }
public ActionResult Designer() { string ReportNum = WebUtil.GetQueryStringValue<string>("SnNum", string.Empty); ReportProvider provider = new ReportProvider(); if (ReportNum.IsEmpty()) { return Redirect("/Report/Manager/List"); } ReportsEntity entity = provider.GetReport(ReportNum); if (entity.IsNull()) { return Redirect("/Report/Manager/List"); } List<ReportParamsEntity> list = provider.GetParams(ReportNum); WebReport webReport = new WebReport(); webReport.Width = Unit.Percentage(100); webReport.Height = 600; webReport.ToolbarIconsStyle = ToolbarIconsStyle.Black; webReport.ToolbarIconsStyle = ToolbarIconsStyle.Black; webReport.PrintInBrowser = true; webReport.PrintInPdf = true; webReport.ShowExports = true; webReport.ShowPrint = true; webReport.SinglePage = true; DataSet ds = null; int orderType = 0; if (ReportNum == ResourceManager.GetSettingEntity("InOrder_Template").Value) { orderType = (int)EOrder.InOrder; } else if (ReportNum == ResourceManager.GetSettingEntity("OutOrder_Template").Value) { orderType = (int)EOrder.OutOrder; } ds = new ReportProvider().GetDataSource(entity, list, orderType, ""); string path = Server.MapPath("~" + entity.FileName); if (!FileManager.FileExists(path)) { string template = Server.MapPath("~/Theme/content/report/temp/Report.frx"); System.IO.File.Copy(template, path, true); } webReport.Report.Load(path); if (ds != null && ds.Tables != null && ds.Tables.Count > 0) { webReport.Report.RegisterData(ds); for (int i = 0; i < ds.Tables.Count; i++) { webReport.Report.GetDataSource(ds.Tables[i].TableName).Enabled = true; } } webReport.DesignerPath = "~/WebReportDesigner/index.html"; webReport.DesignReport = true; webReport.DesignScriptCode = true; webReport.DesignerSavePath = "~/Theme/content/report/temp/"; webReport.DesignerSaveCallBack = "~/Report/Manager/SaveDesignedReport"; webReport.ID = ReportNum; ViewBag.WebReport = webReport; return View(); }
public ActionResult Edit() { string ReportNum = WebUtil.GetQueryStringValue<string>("ReportNum", string.Empty); Session[CacheKey.JOOSHOW_REPORTPARAM_CACHE] = null; if (ReportNum.IsEmpty()) { return Redirect("/Report/Manager/List"); } ReportProvider provider = new ReportProvider(); ReportsEntity entity = provider.GetReport(ReportNum); if (entity.IsNull()) { return Redirect("/Report/Manager/List"); } ViewBag.Entity = entity; ViewBag.ReportType = EnumHelper.GetOptions<EReportType>(entity.ReportType); ViewBag.DataSourceType = EnumHelper.GetOptions<EDataSourceType>(entity.DsType); List<ReportParamsEntity> list = provider.GetParams(ReportNum); if (!list.IsNullOrEmpty()) { Session[CacheKey.JOOSHOW_REPORTPARAM_CACHE] = list; } return View(); }