Skip to content
Merged
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
16 changes: 9 additions & 7 deletions Controllers/demos/ExternalReportServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,21 +52,23 @@ public override List<CatalogItem> GetItems(string folderName, ItemTypeEnum type,

if (type == ItemTypeEnum.DataSet)
{
foreach (var file in Directory.GetFiles(Path.Combine(targetFolder, "DataSet")))
var dataSetProvider = new Microsoft.Extensions.FileProviders.PhysicalFileProvider(Path.Combine(targetFolder, "DataSet"));
foreach (var file in dataSetProvider.GetDirectoryContents("").Where(f => !f.IsDirectory))
{
CatalogItem catalogItem = new CatalogItem();
catalogItem.Name = Path.GetFileNameWithoutExtension(file);
catalogItem.Name = Path.GetFileNameWithoutExtension(file.Name);
catalogItem.Type = ItemTypeEnum.DataSet;
catalogItem.Id = Regex.Replace(catalogItem.Name, @"[^0-9a-zA-Z]+", "_");
_items.Add(catalogItem);
}
}
else if (type == ItemTypeEnum.DataSource)
{
foreach (var file in Directory.GetFiles(Path.Combine(targetFolder, "DataSource")))
var dataSourceProvider = new Microsoft.Extensions.FileProviders.PhysicalFileProvider(Path.Combine(targetFolder, "DataSource"));
foreach (var file in dataSourceProvider.GetDirectoryContents("").Where(f => !f.IsDirectory))
{
CatalogItem catalogItem = new CatalogItem();
catalogItem.Name = Path.GetFileNameWithoutExtension(file);
catalogItem.Name = Path.GetFileNameWithoutExtension(file.Name);
catalogItem.Type = ItemTypeEnum.DataSource;
catalogItem.Id = Regex.Replace(catalogItem.Name, @"[^0-9a-zA-Z]+", "_");
_items.Add(catalogItem);
Expand All @@ -87,10 +89,11 @@ public override List<CatalogItem> GetItems(string folderName, ItemTypeEnum type,
{
string reportTypeExt = this.reportType == "RDLC" ? ".rdlc" : ".rdl";

foreach (var file in Directory.GetFiles(targetFolder, "*" + reportTypeExt))
var reportProvider = new Microsoft.Extensions.FileProviders.PhysicalFileProvider(targetFolder);
foreach (var file in reportProvider.GetDirectoryContents("").Where(f => !f.IsDirectory && f.Name.EndsWith(reportTypeExt)))
{
CatalogItem catalogItem = new CatalogItem();
catalogItem.Name = Path.GetFileNameWithoutExtension(file);
catalogItem.Name = Path.GetFileNameWithoutExtension(file.Name);
catalogItem.Type = ItemTypeEnum.Report;
catalogItem.Id = Regex.Replace(catalogItem.Name, @"[^0-9a-zA-Z]+", "_");
_items.Add(catalogItem);
Expand Down Expand Up @@ -139,7 +142,6 @@ public override bool EditReport(byte[] reportdata)
string targetFolder = Path.Combine(this.basePath, "resources", "demos", "Report");
string reportPat = Path.Combine(targetFolder, catagoryName, reportName);
File.WriteAllBytes(reportPat, reportdata.ToArray());

return true;
}

Expand Down
14 changes: 11 additions & 3 deletions Controllers/demos/LogExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,23 @@ public static void RegisterLog4NetConfig(string configPath = "")
var prjDir = Path.GetFullPath(Path.Combine(folderPath));
if (!string.IsNullOrEmpty(configPath) && File.Exists(configPath))
{
XmlConfigurator.Configure(repository, new System.IO.FileInfo(configPath));
var fileProvider = new Microsoft.Extensions.FileProviders.PhysicalFileProvider(Path.GetDirectoryName(configPath));
var fileInfo = fileProvider.GetFileInfo(Path.GetFileName(configPath));
using var configStream = fileInfo.CreateReadStream();
XmlConfigurator.Configure(repository, configStream);
}
else if (File.Exists(Path.Combine(prjDir, "log4net.config")))
{
XmlConfigurator.Configure(repository, new System.IO.FileInfo(Path.Combine(prjDir, "log4net.config")));
var configFile = new Microsoft.Extensions.FileProviders.PhysicalFileProvider(prjDir).GetFileInfo("log4net.config");
using var configStream = configFile.CreateReadStream();
XmlConfigurator.Configure(repository, configStream);
}
else if (File.Exists(Path.Combine(prjDir, "logs", "log4net.config")))
{
XmlConfigurator.Configure(repository, new System.IO.FileInfo(Path.Combine(prjDir, "logs", "log4net.config")));
var fileProvider = new Microsoft.Extensions.FileProviders.PhysicalFileProvider(Path.Combine(prjDir, "logs"));
var configFile = fileProvider.GetFileInfo("log4net.config");
using var configStream = configFile.CreateReadStream();
XmlConfigurator.Configure(repository, configStream);
}
else
{
Expand Down
12 changes: 7 additions & 5 deletions Controllers/demos/ReportDesignerWebApiController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using Samples.Core.Logger;
using System.Reflection;
using Microsoft.AspNetCore.Cors;
using Microsoft.Extensions.Configuration;

namespace ReportServices.Controllers.demos
{
Expand All @@ -21,6 +22,7 @@ public class ReportDesignerWebApiController : Controller, IReportDesignerControl
{
private Microsoft.Extensions.Caching.Memory.IMemoryCache _cache;
private IWebHostEnvironment _hostingEnvironment;
private readonly IConfiguration _configuration;
internal ReportHelperSettings _helperSettings = null;
internal ExternalServer Server
{
Expand All @@ -38,10 +40,11 @@ internal ReportHelperSettings HelperSettings
set { this._helperSettings = value; }
}

public ReportDesignerWebApiController(Microsoft.Extensions.Caching.Memory.IMemoryCache memoryCache, IWebHostEnvironment hostingEnvironment)
public ReportDesignerWebApiController(Microsoft.Extensions.Caching.Memory.IMemoryCache memoryCache, IWebHostEnvironment hostingEnvironment, IConfiguration configuration)
{
_cache = memoryCache;
_hostingEnvironment = hostingEnvironment;
_configuration = configuration;
ExternalServer externalServer = new ExternalServer(_hostingEnvironment);
this.Server = externalServer;
this.ServerURL = "Sample";
Expand All @@ -65,7 +68,7 @@ public bool DisposeObjects()
{
try
{
string targetFolder = Path.Combine(this._hostingEnvironment.WebRootPath, "Cache");
string targetFolder = Path.Combine(this._hostingEnvironment.WebRootPath, "Cache");

if (Directory.Exists(targetFolder))
{
Expand Down Expand Up @@ -113,14 +116,14 @@ public void OnInitReportOptions(ReportViewerOptions reportOption)
reportOption.ReportModel.ReportingServer = this.Server;
reportOption.ReportModel.ReportServerUrl = this.ServerURL;
reportOption.ReportModel.EmbedImageData = true;
reportOption.ReportModel.ReportServerCredential = new NetworkCredential("Sample", "Passwprd");
reportOption.ReportModel.ReportServerCredential = new NetworkCredential(_configuration["reportDesigner:userName"], _configuration["reportDesigner:password"]);

if (reportOption.ReportModel.FontSettings == null)
{
reportOption.ReportModel.FontSettings = new BoldReports.RDL.Data.FontSettings();
}
reportOption.ReportModel.FontSettings.BasePath = Path.Combine(_hostingEnvironment.WebRootPath, "fonts");

reportOption.ReportModel.ExportResources.BrowserExecutablePath = Path.Combine(_hostingEnvironment.WebRootPath, "puppeteer", "Win-901912", "chrome-win");
}

public void OnReportLoaded(ReportViewerOptions reportOption)
Expand Down Expand Up @@ -200,7 +203,6 @@ public bool SetData(string key, string itemId, ItemInfo itemData, out string err
{
System.IO.File.Delete(writePath);
}

System.IO.File.WriteAllBytes(writePath, bytes);
stream.Close();
stream.Dispose();
Expand Down
5 changes: 3 additions & 2 deletions Controllers/demos/ReportViewerWebApiController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,15 @@ public void OnInitReportOptions(ReportViewerOptions reportOption)
{
reportPath += ".rdlc";
}
FileStream reportStream = new FileStream(Path.Combine(basePath, "resources", "demos", "Report", reportPath), FileMode.Open, FileAccess.Read);
reportOption.ReportModel.Stream = reportStream;
var reportFileInfo = new Microsoft.Extensions.FileProviders.PhysicalFileProvider(Path.Combine(basePath, "resources", "demos", "Report")).GetFileInfo(reportPath);
reportOption.ReportModel.Stream = reportFileInfo.Exists ? reportFileInfo.CreateReadStream() : throw new FileNotFoundException();

if (reportOption.ReportModel.FontSettings == null)
{
reportOption.ReportModel.FontSettings = new BoldReports.RDL.Data.FontSettings();
}
reportOption.ReportModel.FontSettings.BasePath = Path.Combine(_hostingEnvironment.WebRootPath, "fonts");
reportOption.ReportModel.ExportResources.BrowserExecutablePath = Path.Combine(_hostingEnvironment.WebRootPath, "puppeteer", "Win-901912", "chrome-win");
}

// Method will be called when reported is loaded with internally to start to layout process with ReportHelper.
Expand Down
1 change: 0 additions & 1 deletion Controllers/docs/report-viewer/CSVOptionsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ public object GetResource(ReportResource resource)
return ReportHelper.GetResource(resource, this, this._cache);
}


[HttpPost]
public object PostFormReportAction()
{
Expand Down
7 changes: 2 additions & 5 deletions Controllers/docs/report-viewer/LoadReportStreamsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,8 @@ public object PostFormReportAction()

public void OnInitReportOptions(ReportViewerOptions reportOption)
{
string filePath = Path.Combine(this.basePath, "resources", "docs", "product-list.rdlc");

// Opens the report from application Resources folder usinf FileStream
FileStream reportStream = new FileStream(filePath, FileMode.Open, FileAccess.Read);
reportOption.ReportModel.Stream = reportStream;
var reportFileInfo = new Microsoft.Extensions.FileProviders.PhysicalFileProvider(Path.Combine(basePath, "resources", "docs")).GetFileInfo("product-list.rdlc");
reportOption.ReportModel.Stream = reportFileInfo.Exists ? reportFileInfo.CreateReadStream() : throw new FileNotFoundException();
reportOption.ReportModel.ProcessingMode = ProcessingMode.Local;
reportOption.ReportModel.DataSources.Add(new BoldReports.Web.ReportDataSource { Name = "list", Value = ProductList.GetData() });

Expand Down
11 changes: 7 additions & 4 deletions Controllers/docs/report-viewer/ReportViewerController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using System.Net.Mail;
using System.Net.Mime;
using Microsoft.AspNetCore.Cors;
using Microsoft.Extensions.Configuration;

namespace ReportServices.Controllers.docs
{
Expand All @@ -16,14 +17,16 @@ public class ReportViewerController : Controller, IReportController
{
private Microsoft.Extensions.Caching.Memory.IMemoryCache _cache;
private IWebHostEnvironment _hostingEnvironment;
private readonly IConfiguration _configuration;
string basePath;

public ReportViewerController(Microsoft.Extensions.Caching.Memory.IMemoryCache memoryCache,
IWebHostEnvironment hostingEnvironment)
IWebHostEnvironment hostingEnvironment, IConfiguration configuration)
{
_cache = memoryCache;
_hostingEnvironment = hostingEnvironment;
basePath = _hostingEnvironment.WebRootPath;
_configuration = configuration;
}
//Post action for processing the rdl/rdlc report
public object PostReportAction([FromBody] Dictionary<string, object> jsonResult)
Expand Down Expand Up @@ -60,8 +63,8 @@ public void OnInitReportOptions(ReportViewerOptions reportOption)
{
reportPath += ".rdlc";
}
FileStream reportStream = new FileStream(Path.Combine(basePath, reportPath), FileMode.Open, FileAccess.Read);
reportOption.ReportModel.Stream = reportStream;
var reportFileInfo = new Microsoft.Extensions.FileProviders.PhysicalFileProvider(Path.Combine(basePath)).GetFileInfo(reportPath);
reportOption.ReportModel.Stream = reportFileInfo.Exists ? reportFileInfo.CreateReadStream() : throw new FileNotFoundException();

if (reportOption.ReportModel.FontSettings == null)
{
Expand Down Expand Up @@ -105,7 +108,7 @@ public bool ComposeEmail(Stream stream, string reportName)
}

SmtpServer.Port = 587;
SmtpServer.Credentials = new System.Net.NetworkCredential("[email protected]", "xx");
SmtpServer.Credentials = new System.Net.NetworkCredential(_configuration["reportViewer:userName"], _configuration["reportViewer:password"]);
SmtpServer.EnableSsl = true;
SmtpServer.Send(mail);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
using Microsoft.AspNetCore.Cors;
using Microsoft.Extensions.Configuration;

namespace ReportServices.Controllers.docs
{
Expand All @@ -12,14 +13,16 @@ public class SSRSDataSourceCredentialsController : Controller, IReportController
{
private Microsoft.Extensions.Caching.Memory.IMemoryCache _cache;
private IWebHostEnvironment _hostingEnvironment;
private readonly IConfiguration _configuration;
string basePath;

public SSRSDataSourceCredentialsController(Microsoft.Extensions.Caching.Memory.IMemoryCache memoryCache,
IWebHostEnvironment hostingEnvironment)
IWebHostEnvironment hostingEnvironment, IConfiguration configuration)
{
_cache = memoryCache;
_hostingEnvironment = hostingEnvironment;
basePath = _hostingEnvironment.WebRootPath;
_configuration = configuration;
}

//Post action for processing the rdl/rdlc report
Expand Down Expand Up @@ -47,7 +50,7 @@ public object PostFormReportAction()
public void OnInitReportOptions(ReportViewerOptions reportOption)
{
//Add SSRS Report Server credential
reportOption.ReportModel.ReportServerCredential = new System.Net.NetworkCredential("ssrs", "RDLReport1");
reportOption.ReportModel.ReportServerCredential = new System.Net.NetworkCredential(_configuration["ssrsReport:userName"], _configuration["ssrsReport:password"]);

//Here the "AdventureWorks" is the data source name provided in report definition. Name is case sensitive.
reportOption.ReportModel.DataSourceCredentials.Add(new BoldReports.Web.DataSourceCredentials("AdventureWorks", "ssrs1", "RDLReport1"));
Expand Down
7 changes: 5 additions & 2 deletions Controllers/docs/report-viewer/SSRSReportsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
using Microsoft.AspNetCore.Cors;
using Microsoft.Extensions.Configuration;

namespace ReportServices.Controllers.docs
{
Expand All @@ -12,14 +13,16 @@ public class SSRSReportsController : Controller, IReportController
{
private Microsoft.Extensions.Caching.Memory.IMemoryCache _cache;
private IWebHostEnvironment _hostingEnvironment;
private readonly IConfiguration _configuration;
string basePath;

public SSRSReportsController(Microsoft.Extensions.Caching.Memory.IMemoryCache memoryCache,
IWebHostEnvironment hostingEnvironment)
IWebHostEnvironment hostingEnvironment, IConfiguration configuration)
{
_cache = memoryCache;
_hostingEnvironment = hostingEnvironment;
basePath = _hostingEnvironment.WebRootPath;
_configuration = configuration;
}

//Post action for processing the rdl/rdlc report
Expand Down Expand Up @@ -47,7 +50,7 @@ public object PostFormReportAction()
public void OnInitReportOptions(ReportViewerOptions reportOption)
{
//Add SSRS Report Server credential
reportOption.ReportModel.ReportServerCredential = new System.Net.NetworkCredential("ssrs", "RDLReport1");
reportOption.ReportModel.ReportServerCredential = new System.Net.NetworkCredential(_configuration["ssrsReport:userName"], _configuration["ssrsReport:password"]);

string resourcesPath = this.basePath;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public object GetResource(ReportResource resource)
{
return ReportHelper.GetResource(resource, this, this._cache);
}

16
[HttpPost]
public object PostFormReportAction()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ public void OnInitReportOptions(ReportViewerOptions reportOption)
if (reportOption.SubReportModel != null)
{
// Opens the report from application Resources folder using FileStream and loads the sub report stream.
FileStream reportStream = new FileStream(Path.Combine(this.basePath, "resources", "docs", "product-list.rdlc"), FileMode.Open, FileAccess.Read);
reportOption.SubReportModel.Stream = reportStream;
var reportFileInfo = new Microsoft.Extensions.FileProviders.PhysicalFileProvider(Path.Combine(basePath, "resources", "docs")).GetFileInfo("product-list.rdlc");
reportOption.SubReportModel.Stream = reportFileInfo.Exists ? reportFileInfo.CreateReadStream() : throw new FileNotFoundException();
}
else
{
FileStream reportStream = new FileStream(Path.Combine(this.basePath, "resources", "docs", "product-list-main.rdlc"), FileMode.Open, FileAccess.Read);
reportOption.ReportModel.Stream = reportStream;
var reportFileInfo = new Microsoft.Extensions.FileProviders.PhysicalFileProvider(Path.Combine(basePath, "resources", "docs")).GetFileInfo("product-list-main.rdlc");
reportOption.ReportModel.Stream = reportFileInfo.Exists ? reportFileInfo.CreateReadStream() : throw new FileNotFoundException();
}

string resourcesPath = this.basePath;
Expand Down
Binary file removed NuGet/BoldReports.Base.Logger.10.1.11.nupkg
Binary file not shown.
Binary file added NuGet/BoldReports.Base.Logger.11.1.10.nupkg
Binary file not shown.
Loading
Loading