Skip to content

Commit e3a7d66

Browse files
Bold Reports v2.3.26 release changes
1 parent beae7fb commit e3a7d66

File tree

175 files changed

+6824
-2147
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

175 files changed

+6824
-2147
lines changed

Controllers/ExternalReportServer.cs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,29 @@
1010
using BoldReports.ServerProcessor;
1111
using System.Web;
1212
using System.Text.RegularExpressions;
13+
using Microsoft.AspNetCore.Hosting;
1314

1415
namespace ReportsCoreSamples.Controllers
1516
{
1617
public sealed class ExternalServer : ReportingServer
1718
{
1819
// IHostingEnvironment used with sample to get the application data from wwwroot.
19-
private Microsoft.AspNetCore.Hosting.IHostingEnvironment _hostingEnvironment;
20+
#if NETCOREAPP2_1
21+
private IHostingEnvironment _hostingEnvironment;
22+
#else
23+
private IWebHostEnvironment _hostingEnvironment;
24+
#endif
2025
string basePath;
2126
public string reportType
2227
{
2328
get;
2429
set;
2530
}
26-
27-
public ExternalServer(Microsoft.AspNetCore.Hosting.IHostingEnvironment hostingEnvironment)
31+
#if NETCOREAPP2_1
32+
public ExternalServer(IHostingEnvironment hostingEnvironment)
33+
#else
34+
public ExternalServer(IWebHostEnvironment hostingEnvironment)
35+
#endif
2836
{
2937
_hostingEnvironment = hostingEnvironment;
3038
basePath = _hostingEnvironment.WebRootPath;

Controllers/MetaData.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,12 @@ public MetaDataInfo updatePreviewMetaData(dynamic sampleData)
6161
switch ((string)sampleData.basePath)
6262
{
6363
case "ReportViewer":
64-
metaContent = "The HTML5 web report viewer allows the end-users to visualize the " + title + " report in browsers.";
64+
metaContent = "The ASP.NET Core bold report viewer allows the end-users to visualize the " + title + " report in browsers.";
6565
title += " | Preview | ASP.NET Core Report Viewer";
6666
break;
6767
case "ReportWriter":
6868
title += " | Preview | ASP.NET Core Report Writer";
69-
metaContent = "The HTML5 web report writer allows the end-users to download the report in browsers without visualizing the report.";
69+
metaContent = "The ASP.NET Core bold report writer allows the end-users to download the report in browsers without visualizing the report.";
7070
break;
7171
default:
7272
title = "";

Controllers/ReportDesignerController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public void updateMetaData(string reportType)
7171
public void updateDesignerMetaData(dynamic sampleData)
7272
{
7373
string title = String.IsNullOrEmpty((string)sampleData.metaData.title) ? sampleData.sampleName : sampleData.metaData.title;
74-
string metaContent = "The HTML5 web report designer allows the end-users to arrange/customize the reports appearance in browsers." +
74+
string metaContent = "The ASP.NET Core bold report designer allows the end-users to arrange/customize the reports appearance in browsers." +
7575
"It helps to edit the " + title + " for customer\"s application needs.";
7676
title = title + " | ASP.NET Core Report Designer | Bold Reports";
7777
ViewBag.Title = title;

Controllers/ReportDesignerWebApiController.cs

Lines changed: 72 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,44 @@
88
using BoldReports.Web.ReportDesigner;
99
using BoldReports.Web.ReportViewer;
1010
using Newtonsoft.Json;
11+
using System.IO;
12+
using Microsoft.AspNetCore.Hosting;
13+
using System.Data;
14+
using Microsoft.Extensions.Caching.Memory;
15+
using System.Net;
1116

1217
namespace ReportsCoreSamples.Controllers
1318
{
1419
[Microsoft.AspNetCore.Cors.EnableCors("AllowAllOrigins")]
1520
public class ReportDesignerWebApiController : Controller, IReportDesignerController
1621
{
1722
private Microsoft.Extensions.Caching.Memory.IMemoryCache _cache;
18-
private Microsoft.AspNetCore.Hosting.IHostingEnvironment _hostingEnvironment;
23+
#if NETCOREAPP2_1
24+
private IHostingEnvironment _hostingEnvironment;
25+
#else
26+
private IWebHostEnvironment _hostingEnvironment;
27+
#endif
1928
internal ExternalServer Server
2029
{
2130
get;
2231
set;
2332
}
24-
25-
public ReportDesignerWebApiController(Microsoft.Extensions.Caching.Memory.IMemoryCache memoryCache, Microsoft.AspNetCore.Hosting.IHostingEnvironment hostingEnvironment)
33+
internal string ServerURL
34+
{
35+
get;
36+
set;
37+
}
38+
#if NETCOREAPP2_1
39+
public ReportDesignerWebApiController(Microsoft.Extensions.Caching.Memory.IMemoryCache memoryCache, IHostingEnvironment hostingEnvironment)
40+
#else
41+
public ReportDesignerWebApiController(Microsoft.Extensions.Caching.Memory.IMemoryCache memoryCache, IWebHostEnvironment hostingEnvironment)
42+
#endif
2643
{
2744
_cache = memoryCache;
2845
_hostingEnvironment = hostingEnvironment;
2946
ExternalServer externalServer = new ExternalServer(_hostingEnvironment);
47+
this.ServerURL = "Sample";
48+
externalServer.ReportServerUrl = this.ServerURL;
3049
ReportDesignerHelper.ReportingServer = this.Server = externalServer;
3150
}
3251

@@ -37,6 +56,45 @@ public object GetImage(string key, string image)
3756
return ReportDesignerHelper.GetImage(key, image, this);
3857
}
3958

59+
[HttpPost]
60+
public bool DisposeObjects()
61+
{
62+
try
63+
{
64+
string targetFolder = this._hostingEnvironment.WebRootPath + "\\";
65+
targetFolder += "Cache";
66+
67+
if (Directory.Exists(targetFolder))
68+
{
69+
string[] dirs = Directory.GetDirectories(targetFolder);
70+
71+
for (var index = 0; index < dirs.Length; index++)
72+
{
73+
string[] files = Directory.GetFiles(dirs[index]);
74+
75+
var fileCount = 0;
76+
for (var fileIndex = 0; fileIndex < files.Length; fileIndex++)
77+
{
78+
FileInfo fi = new FileInfo(files[fileIndex]);
79+
if (fi.LastAccessTimeUtc < DateTime.UtcNow.AddDays(-2))
80+
{
81+
fileCount++;
82+
}
83+
}
84+
85+
if (files.Length == 0 || (files.Length == fileCount))
86+
{
87+
Directory.Delete(dirs[index], true);
88+
}
89+
}
90+
}
91+
return true;
92+
}
93+
catch (Exception ex) { }
94+
return false;
95+
}
96+
97+
4098
[ActionName("GetResource")]
4199
[AcceptVerbs("GET")]
42100
public object GetResource(ReportResource resource)
@@ -46,6 +104,16 @@ public object GetResource(ReportResource resource)
46104

47105
public void OnInitReportOptions(ReportViewerOptions reportOption)
48106
{
107+
string reportName = reportOption.ReportModel.ReportPath;
108+
reportOption.ReportModel.ReportingServer = this.Server;
109+
reportOption.ReportModel.ReportServerUrl = this.ServerURL;
110+
reportOption.ReportModel.ReportServerCredential = new NetworkCredential("Sample", "Passwprd");
111+
if (reportName == "load-large-data.rdlc")
112+
{
113+
Models.SqlQuery.getJson(this._cache);
114+
reportOption.ReportModel.ProcessingMode = ProcessingMode.Remote;
115+
reportOption.ReportModel.DataSources.Add(new ReportDataSource("SalesOrderDetail", _cache.Get("SalesOrderDetail") as DataTable));
116+
}
49117

50118
}
51119

@@ -166,4 +234,4 @@ public ResourceInfo GetData(string key, string itemId)
166234
}
167235
}
168236

169-
}
237+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Threading.Tasks;
5+
using Microsoft.AspNetCore.Mvc;
6+
7+
namespace ReportsCoreSamples.Controllers.ReportViewer
8+
{
9+
public class LoadLargeDataController : PreviewController
10+
{
11+
public IActionResult Index()
12+
{
13+
this.updateMetaData();
14+
return View();
15+
}
16+
}
17+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Threading.Tasks;
5+
using Microsoft.AspNetCore.Mvc;
6+
7+
namespace ReportsCoreSamples.Controllers.ReportViewer
8+
{
9+
public class SalesByYearController : PreviewController
10+
{
11+
public IActionResult Index()
12+
{
13+
this.updateMetaData();
14+
return View();
15+
}
16+
}
17+
}

Controllers/ReportViewerWebApiController.cs

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@
44
using System.Linq;
55
using System.Threading.Tasks;
66
using Microsoft.AspNetCore.Mvc;
7+
using BoldReports.Web;
78
using BoldReports.Web.ReportViewer;
9+
using Microsoft.AspNetCore.Hosting;
10+
using BoldReports.Models.ReportViewer;
11+
using System.Data;
12+
using Microsoft.Extensions.Caching.Memory;
813

914
namespace ReportsCoreSamples.Controllers
1015
{
@@ -16,11 +21,20 @@ public class ReportViewerWebApiController : Controller, IReportController
1621
private Microsoft.Extensions.Caching.Memory.IMemoryCache _cache;
1722

1823
// IHostingEnvironment used with sample to get the application data from wwwroot.
19-
private Microsoft.AspNetCore.Hosting.IHostingEnvironment _hostingEnvironment;
24+
#if NETCOREAPP2_1
25+
private IHostingEnvironment _hostingEnvironment;
26+
#else
27+
private IWebHostEnvironment _hostingEnvironment;
28+
#endif
2029

2130
// Post action to process the report from server based json parameters and send the result back to the client.
31+
#if NETCOREAPP2_1
2232
public ReportViewerWebApiController(Microsoft.Extensions.Caching.Memory.IMemoryCache memoryCache,
23-
Microsoft.AspNetCore.Hosting.IHostingEnvironment hostingEnvironment)
33+
IHostingEnvironment hostingEnvironment)
34+
#else
35+
public ReportViewerWebApiController(Microsoft.Extensions.Caching.Memory.IMemoryCache memoryCache,
36+
IWebHostEnvironment hostingEnvironment)
37+
#endif
2438
{
2539
_cache = memoryCache;
2640
_hostingEnvironment = hostingEnvironment;
@@ -36,9 +50,16 @@ public object PostReportAction([FromBody] Dictionary<string, object> jsonArray)
3650
// Method will be called to initialize the report information to load the report with ReportHelper for processing.
3751
public void OnInitReportOptions(ReportViewerOptions reportOption)
3852
{
53+
string reportName = reportOption.ReportModel.ReportPath;
3954
string basePath = _hostingEnvironment.WebRootPath;
4055
FileStream reportStream = new FileStream(basePath + @"\resources\Report\" + reportOption.ReportModel.ReportPath, FileMode.Open, FileAccess.Read);
4156
reportOption.ReportModel.Stream = reportStream;
57+
if (reportName == "load-large-data.rdlc")
58+
{
59+
Models.SqlQuery.getJson(this._cache);
60+
reportOption.ReportModel.DataSources.Add(new BoldReports.Web.ReportDataSource("SalesOrderDetail", this._cache.Get("SalesOrderDetail") as DataTable));
61+
}
62+
4263
}
4364

4465
// Method will be called when reported is loaded with internally to start to layout process with ReportHelper.

Controllers/ReportWriterController.cs

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,25 @@
44
using System.Collections.Generic;
55
using System.Linq;
66
using System.Threading.Tasks;
7-
7+
using Microsoft.AspNetCore.Hosting;
88
using Microsoft.AspNetCore.Mvc;
99
using System.IO;
1010

1111
namespace ReportsCoreSamples.Controllers
1212
{
1313
public class ReportWriterController : PreviewController
1414
{
15-
public Microsoft.AspNetCore.Hosting.IHostingEnvironment _hostingEnvironment;
15+
#if NETCOREAPP2_1
16+
private IHostingEnvironment _hostingEnvironment;
17+
#else
18+
private IWebHostEnvironment _hostingEnvironment;
19+
#endif
1620

17-
public ReportWriterController(Microsoft.AspNetCore.Hosting.IHostingEnvironment hostingEnvironment)
21+
#if NETCOREAPP2_1
22+
public ReportWriterController(IHostingEnvironment hostingEnvironment)
23+
#else
24+
public ReportWriterController(IWebHostEnvironment hostingEnvironment)
25+
#endif
1826
{
1927
_hostingEnvironment = hostingEnvironment;
2028
}
@@ -46,28 +54,34 @@ public IActionResult generate(string reportName, string type)
4654
WriterFormat format;
4755
ReportWriter reportWriter = new ReportWriter();
4856
reportWriter.ReportProcessingMode = ProcessingMode.Remote;
57+
reportWriter.ExportResources.UsePhantomJS = true;
58+
reportWriter.ExportResources.PhantomJSPath = basePath + @"\PhantomJS\";
4959

5060
FileStream inputStream = new FileStream(basePath + @"\Resources\Report\" + reportName + ".rdl", FileMode.Open, FileAccess.Read);
5161
reportWriter.LoadReport(inputStream);
5262

5363
reportWriter.ExportResources.Scripts = new List<string>
5464
{
55-
basePath+ @"\Scripts\bold-reports\common\bold.reports.common.min.js",
56-
basePath+ @"\Scripts\bold-reports\common\bold.reports.widgets.min.js",
57-
//Chart component script
58-
basePath+ @"\Scripts\bold-reports\data-visualization\ej.chart.min.js",
5965
//Gauge component scripts
60-
basePath+ @"\Scripts\bold-reports\data-visualization\ej.lineargauge.min.js",
61-
basePath+ @"\Scripts\bold-reports\data-visualization\ej.circulargauge.min.js",
66+
"../../scripts/bold-reports/common/ej2-base.min.js",
67+
"../../scripts/bold-reports/common/ej2-pdf-export.min.js",
68+
"../../scripts/bold-reports/common/ej2-svg-base.min.js",
69+
"../../scripts/bold-reports/data-visualization/ej2-lineargauge.min.js",
70+
"../../scripts/bold-reports/data-visualization/ej2-circulargauge.min.js",
71+
72+
"../../scripts/bold-reports/common/bold.reports.common.min.js",
73+
"../../scripts/bold-reports/common/bold.reports.widgets.min.js",
74+
//Chart component script
75+
"../../scripts/bold-reports/data-visualization/ej.chart.min.js",
6276
//Map component script
63-
basePath+ @"\Scripts\bold-reports\data-visualization\ej.map.min.js",
77+
"../../scripts/bold-reports/data-visualization/ej.map.min.js",
6478
//Report Viewer Script
65-
basePath+ @"\Scripts\bold-reports\bold.report-viewer.min.js"
79+
"../../scripts/bold-reports/bold.report-viewer.min.js"
6680
};
67-
81+
6882
reportWriter.ExportResources.DependentScripts = new List<string>
6983
{
70-
basePath+ @"\dependent\jquery.min.js"
84+
"../../scripts/dependent/jquery.min.js"
7185
};
7286

7387
if (type == "pdf")
@@ -107,4 +121,4 @@ public IActionResult generate(string reportName, string type)
107121
}
108122
}
109123

110-
}
124+
}

Models/SampleData.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,23 @@ namespace ReportsCoreSamples.Models
99
{
1010
public class SampleData
1111
{
12+
#if NETCOREAPP2_1
1213
private IHostingEnvironment _hostingEnvironment;
14+
#else
15+
private IWebHostEnvironment _hostingEnvironment;
16+
#endif
1317

14-
18+
#if NETCOREAPP2_1
1519
public SampleData(IHostingEnvironment environment)
20+
#else
21+
public SampleData(IWebHostEnvironment environment)
22+
#endif
1623
{
1724
_hostingEnvironment = environment;
1825
}
1926
public dynamic getSampleData()
2027
{
21-
string json = System.IO.File.ReadAllText(_hostingEnvironment.WebRootPath + "/samples.json" );
28+
string json = System.IO.File.ReadAllText(_hostingEnvironment.WebRootPath + "/samples.json");
2229
dynamic sampleJson = JsonConvert.DeserializeObject(json);
2330
return sampleJson;
2431
}

0 commit comments

Comments
 (0)