Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature(REPORT-10918): Bold-reports 4.1 release changes #18

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions Controllers/PreviewController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,17 @@

namespace ReportsCoreSamples.Controllers
{
public class PreviewController: MetaData
public class PreviewController : MetaData
{
public IActionResult Preview()
{
string foderName = this.ControllerContext.RouteData.Values["controller"].ToString();
string foderName = this.ControllerContext.RouteData.Values["controller"].ToString();
ViewBag.action = "Preview";
if (foderName == "ExternalParameterReport")
{
ViewBag.parameterSettings = new BoldReports.Models.ReportViewer.ParameterSettings();
ViewBag.parameterSettings.HideParameterBlock = true;
}
this.updateMetaData();
return View("~/Views/" + foderName + "/Index.cshtml");
}
Expand Down
27 changes: 15 additions & 12 deletions Controllers/ReportDesignerWebApiController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -174,20 +174,13 @@ public void UploadReportAction()

private string GetFilePath(string itemName, string key)
{
string targetFolder = this._hostingEnvironment.WebRootPath + "\\";
targetFolder += "Cache";

if (!System.IO.Directory.Exists(targetFolder))
{
System.IO.Directory.CreateDirectory(targetFolder);
}

if (!System.IO.Directory.Exists(targetFolder + "\\" + key))
string dirPath = Path.Combine(this._hostingEnvironment.WebRootPath,"Cache",key);
if (!System.IO.Directory.Exists(dirPath))
{
System.IO.Directory.CreateDirectory(targetFolder + "\\" + key);
System.IO.Directory.CreateDirectory(dirPath);
}

return targetFolder + "\\" + key + "\\" + itemName;
return Path.Combine(dirPath, itemName);
}

public bool SetData(string key, string itemId, ItemInfo itemData, out string errMsg)
Expand Down Expand Up @@ -238,7 +231,17 @@ public ResourceInfo GetData(string key, string itemId)
var resource = new ResourceInfo();
try
{
resource.Data = System.IO.File.ReadAllBytes(this.GetFilePath(itemId, key));
var filePath = this.GetFilePath(itemId, key);
if (itemId.Equals(Path.GetFileName(filePath), StringComparison.InvariantCultureIgnoreCase) && System.IO.File.Exists(filePath))
{
resource.Data = System.IO.File.ReadAllBytes(filePath);
LogExtension.LogInfo(string.Format("Method Name: {0}; Class Name: {1}; Message: {2};", "GetData", "CacheHelper", string.Format("File data retrieved from the path: {0}", filePath)), null);
}
else
{
resource.ErrorMessage = "File not found from the specified path";
LogExtension.LogInfo(string.Format("Method Name: {0}; Class Name: {1}; Message: {2};", "GetData", "CacheHelper", string.Format("File not found from the specified path: {0}", filePath)), null);
}
}
catch (Exception ex)
{
Expand Down
17 changes: 17 additions & 0 deletions Controllers/ReportViewer/BarcodeController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;

namespace ReportsCoreSamples.Controllers
{
public class BarcodeController : PreviewController
{
public IActionResult Index()
{
this.updateMetaData();
return View();
}
}
}
17 changes: 17 additions & 0 deletions Controllers/ReportViewer/DataBarController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;

namespace ReportsCoreSamples.Controllers
{
public class DataBarController : PreviewController
{
public IActionResult Index()
{
this.updateMetaData();
return View();
}
}
}
17 changes: 17 additions & 0 deletions Controllers/ReportViewer/DynamicColumnsController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;

namespace ReportsCoreSamples.Controllers
{
public class DynamicColumnsController : PreviewController
{
public IActionResult Index()
{
this.updateMetaData();
return View();
}
}
}
26 changes: 26 additions & 0 deletions Controllers/ReportViewer/ExternalParameterReportController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using ReportsCoreSamples.Models;
using Microsoft.Extensions.Caching.Memory;
using Microsoft.AspNetCore.Mvc;

namespace ReportsCoreSamples.Controllers
{
public class ExternalParameterReportController : PreviewController
{
private Microsoft.Extensions.Caching.Memory.IMemoryCache _cache;
public ExternalParameterReportController(Microsoft.Extensions.Caching.Memory.IMemoryCache memoryCache)
{
_cache = memoryCache;
}
public IActionResult Index()
{
ViewBag.parameterSettings = new BoldReports.Models.ReportViewer.ParameterSettings();
ViewBag.parameterSettings.HideParameterBlock = true;
this.updateMetaData();
return View();
}
}
}
17 changes: 17 additions & 0 deletions Controllers/ReportViewer/SparkLineController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;

namespace ReportsCoreSamples.Controllers.ReportViewer
{
public class SparkLineController : PreviewController
{
public IActionResult Index()
{
this.updateMetaData();
return View();
}
}
}
8 changes: 8 additions & 0 deletions Controllers/ReportViewerWebApiController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,5 +95,13 @@ public void LogError(string errorCode, string message, Exception exception, stri
{
LogExtension.LogError(message, exception, System.Reflection.MethodBase.GetCurrentMethod(), errorCode + "-" + errorDetail);
}

[HttpGet]
public object GetExternalParameterData()
{
var productCategory = Models.SqlQuery.getProductCategory(this._cache);
var productSubCategory = Models.SqlQuery.getProductSubCategory(this._cache);
return Json(new { ProductCategoryDetail = productCategory, ProductSubCategoryDetail = productSubCategory });
}
}
}
38 changes: 38 additions & 0 deletions Models/SqlQuery.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,43 @@ public static string getJson(IMemoryCache _cache)
}
return null;
}
public static string getProductCategory(IMemoryCache _cache)
{

using (SqlConnection connection = new SqlConnection("Data Source=dataplatformdemodata.syncfusion.com;Initial Catalog=AdventureWorks2016;user id=demoreadonly@data-platform-demo;password=N@c)=Y8s*1&dh;"))
{
connection.Open();

string queryString = "SELECT DISTINCT ProductCategoryID, Name FROM Production.ProductCategory";
SqlDataAdapter adapter = new SqlDataAdapter(queryString, connection);

using (DataSet ProductCategories = new DataSet())
{
adapter.Fill(ProductCategories, "Orders");
_cache.Set("ProductCategoryDetail", ProductCategories.Tables[0]);
connection.Close();
return JsonConvert.SerializeObject(_cache.Get("ProductCategoryDetail"));
}
}
}
public static string getProductSubCategory(IMemoryCache _cache)
{

using (SqlConnection connection = new SqlConnection("Data Source=dataplatformdemodata.syncfusion.com;Initial Catalog=AdventureWorks2016;user id=demoreadonly@data-platform-demo;password=N@c)=Y8s*1&dh;"))
{
connection.Open();

string queryString = $"SELECT ProductSubcategoryID, ProductCategoryID, Name FROM Production.ProductSubcategory";
SqlDataAdapter adapter = new SqlDataAdapter(queryString, connection);

using (DataSet ProductCategories = new DataSet())
{
adapter.Fill(ProductCategories, "Orders");
_cache.Set("ProductSubCategoryDetail", ProductCategories.Tables[0]);
connection.Close();
return JsonConvert.SerializeObject(_cache.Get("ProductSubCategoryDetail"));
}
}
}
}
}
1 change: 1 addition & 0 deletions NuGet.config
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<packageSources>
<clear />
<add key="NuGet.org" value="https://www.nuget.org/api/v2" />
<add key="reportsnuget" value="Nuget" />

</packageSources>

Expand Down
13 changes: 7 additions & 6 deletions ReportsCoreSamples.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Bold.Licensing" Version="3.3.23" />
<PackageReference Include="BoldReports.AspNet.Core" Version="3.3.23" />
<PackageReference Include="BoldReports.Net.Core" Version="3.3.23" />
<PackageReference Include="BoldReports.Data.WebData" Version="3.3.23" />
<PackageReference Include="BoldReports.Data.Csv" Version="3.3.23" />
<PackageReference Include="BoldReports.Data.Excel" Version="3.3.23" />
<PackageReference Include="Bold.Licensing" Version="4.1.78" />
<PackageReference Include="BoldReports.AspNet.Core" Version="4.1.78" />
<PackageReference Include="BoldReports.CRI.Barcode" Version="4.1.78" />
<PackageReference Include="BoldReports.Net.Core" Version="4.1.78" />
<PackageReference Include="BoldReports.Data.WebData" Version="4.1.78" />
<PackageReference Include="BoldReports.Data.Csv" Version="4.1.78" />
<PackageReference Include="BoldReports.Data.Excel" Version="4.1.78" />
<PackageReference Include="BuildBundlerMinifier" Version="2.9.406" />
<PackageReference Include="log4net" Version="2.0.10" />
<PackageReference Include="Microsoft.AspNetCore.ResponseCompression" Version="2.1.1" />
Expand Down
2 changes: 2 additions & 0 deletions Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@ public void Configure(IApplicationBuilder app)
routes.MapRoute(
name: "default",
template: "{controller=Main}/{action=Index}/{id?}");
routes.MapRoute("NotFound", "{*url}",
new { controller = "main", action = "index" });
});
#else
app.UseRouting();
Expand Down
25 changes: 25 additions & 0 deletions Views/Barcode/index.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
@inject Globals globals;

@section control {

<bold-report-viewer id="reportviewer" report-service-url="@Globals.SERVICE_URL" report-path="barcode.rdl" toolbar-rendering="onToolbarRendering" tool-bar-item-click="onToolBarItemClick" export-item-click="onExportItemClick" />

}

@section description {
<div id="description">
<p>
Custom Report Item allows you to add the functionality that is not natively supported in the RDL or extend the
functionality of existing controls in the RDL standard.
</p>
<p>
This report showcases the one-dimensional and two-dimensional barcode types rendered in our Report Viewer
through Custom Report Item.
</p>
<p>
More information about Barcode can be found in this <a
href="https://help.boldreports.com/on-premise/report-designer/report-items/barcode/"
target="_blank">documentation</a> section.
</p>
</div>
}
22 changes: 22 additions & 0 deletions Views/DataBar/Index.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
@inject Globals globals;

@section control {

<bold-report-viewer id="reportviewer" report-service-url="@Globals.SERVICE_URL" report-path="data-bar.rdl" toolbar-rendering="onToolbarRendering" tool-bar-item-click="onToolBarItemClick" export-item-click="onExportItemClick" />
<script>

</script>
}

@section description {
<div id="description">
<p>
Data bars convey lot of information in a little space, and are mostly used in tables and matrices. In this report, sales data are interpreted to visualize the sales figures in a tabular format.
</p>
<p>
More information about the Databar report item can be found in this <a
href="https://help.boldreports.com/embedded-reporting/react-reporting/report-designer/designer-guide/report-items/data-bar/"
target="_blank">documentation</a> section.
</p>
</div>
}
2 changes: 1 addition & 1 deletion Views/DynamicChartSeries/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
@section description {
<div id="description">
<p>
This demo shows the VisitorsCount, PurchaserCount, AddedToCartCount by dynamically chossing the chart series.
This demo shows the VisitorsCount, PurchaserCount, AddedToCartCount by dynamically choosing the chart series.
</p>
<p>
More information about the Chart report item can be found in this <a href="https://help.boldreports.com/enterprise-reporting/designer-guide/report-designer/report-items/chart/"
Expand Down
26 changes: 26 additions & 0 deletions Views/DynamicColumns/Index.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
@inject Globals globals;

@section control {

<bold-report-viewer id="reportviewer" report-service-url="@Globals.SERVICE_URL" report-path="dynamic-columns.rdl" toolbar-rendering="onToolbarRendering" tool-bar-item-click="onToolBarItemClick" export-item-click="onExportItemClick" />

}

@section description {
<div id="description">
<p>
Dynamic column tabular report demonstrates to change the number of columns at runtime using ASP.NET Core Bold Report Viewer.
</p>
<ul>
<li>
Dynamic column is a feature that allows one to store different sets of columns for each row in a table.
<li>
In this table few columns are static and few can be varied, based on the column names selected in the parameter. This feature is achieved by changing the column visibility based on the parameter selected.
</li>
</ul>
<p>
More information about the Tablix data region can be found in this <a href="https://help.boldreports.com/on-premise/report-designer/report-items/tablix/"
target="_blank">documentation</a> section.
</p>
</div>
}
Loading