📄 enteprisereporting.asmx.cs
字号:
using System;
using System.Collections;
using System.Configuration;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Web;
using System.Web.Services;
using AWC.Reporter.Web.Entities;
using AWC.Reporter.Web.EnterpriseReporting.Security;
namespace AWC.Reporter.Web.EnterpriseReporting
{
/// <summary>
/// The enterprise reporting communication facade
/// </summary>
public class ReportingFacade : System.Web.Services.WebService
{
public ReportingFacade()
{
//CODEGEN: This call is required by the ASP.NET Web Services Designer
InitializeComponent();
}
#region Component Designer generated code
//Required by the Web Services Designer
private IContainer components = null;
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if(disposing && components != null)
{
components.Dispose();
}
base.Dispose(disposing);
}
#endregion
/// <summary>
/// Render report based on the passed report request.
/// </summary>
/// <param name="reportRequest">An instance of the ReportRequest Entity</param>
/// <returns>The report payload as base-64 encode array</returns>
[WebMethod]
public byte[] RenderReport(ReportRequest reportRequest)
{
string reportId = reportRequest.Report[0].ID;
// Check if the user is authorized to render this report
if (!SecurityManager.IsOperationPermitted(Int32.Parse(reportId)))
{
throw new System.Security.SecurityException(String.Format("Access to report id {0} denied.", reportId));
}
// Get the report adapter type name from the configuration store
string reportAdapterFullTypeName = ConfigurationSettings.AppSettings[reportId];
// instantiate the adapter
IReportAdapter reportAdapter = (IReportAdapter) GenericFactory.Create(reportAdapterFullTypeName);
if (reportAdapter is AWC.Reporter.Web.EnterpriseReporting.Adapters.RsAdapter)
reportRequest.Report[0].Path = ConfigurationSettings.AppSettings[Constants.CONFIG_REPORT_FOLDER] + "/" + reportRequest.Report[0].Name;
// late-bind to it to render the report
byte[] reportPayload = reportAdapter.RenderReport(reportRequest);
return reportPayload;
}
/// <summary>
/// Gets the application user from the application security framework.
/// </summary>
/// <returns>User object</returns>
[WebMethod]
public UserEntity GetApplicationUser()
{
SecurityManager securityManager = new SecurityManager();
return securityManager.GetApplicationUser();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -