Corprio.AspNetCore.XtraReportSite
2.0.31.125
dotnet add package Corprio.AspNetCore.XtraReportSite --version 2.0.31.125
NuGet\Install-Package Corprio.AspNetCore.XtraReportSite -Version 2.0.31.125
<PackageReference Include="Corprio.AspNetCore.XtraReportSite" Version="2.0.31.125" />
<PackageVersion Include="Corprio.AspNetCore.XtraReportSite" Version="2.0.31.125" />
<PackageReference Include="Corprio.AspNetCore.XtraReportSite" />
paket add Corprio.AspNetCore.XtraReportSite --version 2.0.31.125
#r "nuget: Corprio.AspNetCore.XtraReportSite, 2.0.31.125"
#:package Corprio.AspNetCore.XtraReportSite@2.0.31.125
#addin nuget:?package=Corprio.AspNetCore.XtraReportSite&version=2.0.31.125
#tool nuget:?package=Corprio.AspNetCore.XtraReportSite&version=2.0.31.125
Corprio.AspNetCore.XtraReportSite
What is Corprio.AspNetCore.XtraReportSite for?
The Corprio.AspNetCore.XtraReportSite is the base library for develpers to build a web applicaiton working with Corprio using ASP.NET Core and need to execute reports in the web application. If your application does not need to execute reports, then you can use Corprio.AspNetCore.Site instead.
Technology
The application is developed using ASP.NET Core 8, DevExtreme and XtraReports.
To start
Follow the steps below to start building your web applicaiton with Corprio.
Prepare the development environment
Download and install the latest version of Visual Studio from Microsoft. You will need to select components for building ASP.NET Core applications.
Clone Corprio.Internal solution
Your web application needs to work the Corprio API. Instead of directly calling the online API, you can clone the Corprio.Internal repository onto your development machine so that you can have the Corprio API server running in your development machine.
Start new web application
- Launch Visual Studio
- Create a new project
- Select the ASP.NET Core Web App (Model-View-Controller) template using C#
- Right click on the project and select Manage NuGet Packages
- Search for Corprio.AspNetCore.XtraReportSite and install the package
- Create a class to get data for your reports running in this application. For example
/// <summary>
/// Service for getting data for reports
/// </summary>
public class ReportDataService : BaseReportDataService
{
/// <summary>
/// Constructor
/// </summary>
/// <param name="httpContextAccessor">HttpContextAccessor for getting organization ID from HttpContext</param>
/// <param name="corprio">Corprio client for getting data from server</param>
public ReportDataService(IHttpContextAccessor httpContextAccessor, APIClient corprio, IHttpClientFactory httpClientFactory) : base(httpContextAccessor, corprio, httpClientFactory)
{
}
public override IEnumerable<Type> GetAvailableTypes(string context)
{
return new Type[] {
//put the data types of your report data here, e.g. MySalesReportData
};
}
public override System.Collections.IEnumerable GetReportData(Type dataType, Guid organizationID, Dictionary<string, object> parameters)
{
//add code to return data for each of your report data type
throw new NotSupportedException($"DataType {dataType} is not supported");
}
public override IEnumerable<Corprio.DataModel.Report.Parameter> GetParametersOfDataType(Type reportDataType, string[] supportedLanguages)
{
//add code to return an array of Parameter for prompting users before executing the report
return Array.Empty<Corprio.DataModel.Report.Parameter>();
}
}
- Edit the Startup.cs and modify ConfigureServices as
public void ConfigureServices(IServiceCollection services)
{
services.AddCommonAppServices(Configuration);
services.AddXtraReports<ReportDataService>();
}
- Edit appsettings.Development.json to include the following sections
"CorprioApiSetting": {
"AuthServerUrl": "https://localhost:44334", //replace with the port of your local AuthServer project
"ApiUrl": "https://localhost:44394", //replace with the port of your local Corprio API project
"ApiVersion": "1.0"
},
"CorprioClientCredential": {
"ClientID": "your app ID", //replace with the ID of your application which will be used to register your application in Corprio Portal
"ClientSecret": "xxxxxxxxxxxxxxxxxxx" //replace with the secret of your application
},
Adding new report
Define report data type
- Create a class of the data type of your report data. For example
public class MySalesReportData
{
public string ProductName { get; set; }
public int QuantitySold { get; set; }
public decimal TotalSales { get; set; }
}
Save the class in the folder /Models/ReportData
Modify ReportDataService class to return the report data
- In the GetAvailableTypes method, add the data type of your report data
public override IEnumerable<Type> GetAvailableTypes(string context)
{
return new Type[] {
typeof(MySalesReportData) //add your report data type here
};
}
- In the GetReportData method, add code to return the data for your report data type
public override System.Collections.IEnumerable GetReportData(Type dataType, Guid organizationID, Dictionary<string, object> parameters)
{
if (dataType == typeof(MySalesReportData))
{
//add code to return the data for MySalesReportData
return GetDataFromAPI((int pageIndex) =>
corprio.InvoiceApi.QueryLines<MySalesReportData>(
organizationID: organizationID,
dynamicQuery: new DynamicQuery
{
Selector = "new (Product.Name as ProductName,Qty as QuantitySold,LineAmount*np(Invoice.ExchangeRate,1) as TotalSales)",
Where = "Invoice.InvoiceDate>=@0 && Invoice.InvoiceDate<@1 && Invoice.IsVoided==false",
WhereArguments = new object[] { dateRange.Start, dateRange.End },
GroupBy = "",
Skip = BatchRecordSize * pageIndex,
Take = BatchRecordSize
}
)).GetAwaiter().GetResult();
}
throw new NotSupportedException($"DataType {dataType} is not supported");
}
- If the report data needs parameters, then implement the GetParametersOfDataType method to return an array of Corprio.DataModel.Report.Parameter for new reports when users are creating custom reports in web designer using this report data type.
public override IEnumerable<Corprio.DataModel.Report.Parameter> GetParametersOfDataType(Type reportDataType, string[] supportedLanguages)
{
if (reportDataType == typeof(MySalesReportData))
{
return new Corprio.DataModel.Report.Parameter[]
{
new Corprio.DataModel.Report.Parameter
{
Hidden = false,
Name = "dateRange",
Type = Corprio.DataModel.Report.ParameterType.DateRange,
Prompt= new Global.Globalization.GlobalizedText(
resourceType: typeof(DataModel.Resources.Resource),
key: "DateRange",
langCodes: supportedLanguages),
Required = true
}
};
}
return Array.Empty<Corprio.DataModel.Report.Parameter>();
}
Create the report
- Create a new XtraReport in the folder /Reports
- In the Properties of the report, click the dropdown of Data > DataSource
- Select Add DataSource and select Object in Select a data connection type. Then click Next.
- Select the assembly containing MySalesReportData in the Select an assembly containing the class type definition of a data source and then click Next.
- In Select a data source type, select MySalesReportData and then click Next. If you cannot find the data type, then restart Visual Studio.
- Select Do not select a member, bind to the entire object. and then click Next.
- In Select the data binding mode, select Retrieve the data source schema and then click Finish.
- Drag and drop Report Controls to the report from the Toolbox to design your report.
- Developers can add the following report parameters in the report and they are populated autotmatically:
- organizationName: the name of the organization to run the report
- organizationLogoUrl: the url of the logo of the organization
- organizationPhone: the phone number of the organization
- organizationAddress: the address of the organization
Register the report
Developers must register the report in their applications so that the report can be executed in the web application. follow the steps below to register the report.
- Login the Corprio Portal site using the developer login
- Click on the user icon and select Developer Portal
- Select Applications and find the application which runs the report. In the action menu, select Reports.
- Click Download report definition file template file and then edit the file using a text/json editor. Make sure the ReportName field is filled with the class name of the XtraReport, e.g. MyApplication.Reports.MySalesReport
- Upload the report definition file to the Reports section of the application in the Corprio Portal to add the report definition.
- Click the down arrow to expand the report definition.
- Click Push to subscribers to push the report definition to all subscribers of the application.
Run a report
- After pusing the report definition to subscribers, they can run the report in the web application in the action /Report/Index
Run a report from code
You can run a report from code. For example, to print an invoice from an invoice record.
- Create a new controller and inherits from Corprio.AspNetCore.XtraReportSite.Controllers.BaseController
- Create a new action method to run the report
[HttpGet]
public async Task<IActionResult> Print([FromServices] ApplicationSettingService applicationSettingService,
[FromServices] IReportStorageService reportStorageService,
[FromRoute] Guid organizationID,
[FromRoute] Guid invoiceID)
{
//get definition of the report
string reportID = "InvoicePrintout";
ReportDefinition reportDefinition = await reportStorageService.GetReportDefinition(organizationID, reportID);
if (reportDefinition == null) return BadRequest($"Report {reportID} does not exist");
//call ExecuteReport action of the base controller to execute the report
return ExecuteReport(new ReportRequest
{
ReportID = reportID,
OrganizationID = organizationID,
Parameters = new Dictionary<string, object>() { ["invoiceID"] = invoiceID }
});
}
What happens under the hood
When the report is executed, the following steps are performed:
- The ExecuteReport action of the BaseController is called with a ReportRequest parameter. The ReportRequest contains
- the report ID (which is the ID of the report to run),
- organization ID and
- parameters for running the report.
- Redirect the request to the action ViewerRedirect of the Report controller with the ReportQuest as a query string parameter.
return RedirectToAction("ViewerRedirect", "Report", new { OrganizationID, request = reportRequest.ToUrl() });
- The ViewerRedirect action displays the Viewer view of the Report controller with the report request as the vieew model.
- The javascript in Viewer view executes the OpenReport function of WebDocumentViewer widget.
- The WebDocumentViewer widget uses CustomWebDocumentViewerReportResolver (which implements the IWebDocumentViewerReportResolver interface) to resolve the report to run by parsing the ReportRequest url.
- If the report request can be parsed, then calls the ReportHelper.PrepareXtraReport method to prepare the XtraReport to run.
- The PrepareXtraReport method calls the GetXtraReport method of IReportStorageService to creaet an instance of the XtraReport.
- Then assign parameter values from the report request to the parameters of the XtraReport.
- Then assign values to the object datasource(s) of the XtraReport.
- For each object datasource, the GetReportData method of the ReportDataService is called to get the data for the report.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- Corprio.AspNetCore.Site (>= 2.0.31.125)
- DevExpress.AspNetCore.Reporting (>= 25.1.3)
- DevExpress.Drawing.Skia (>= 25.1.3)
- DevExpress.Pdf.SkiaRenderer (>= 25.1.3)
- Microsoft.ICU.ICU4C.Runtime (>= 72.1.0.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated |
---|---|---|
2.0.31.125 | 204 | 8/29/2025 |
2.0.31.124 | 118 | 7/29/2025 |
2.0.31.65 | 255 | 4/22/2025 |
2.0.31.54 | 222 | 3/31/2025 |
2.0.31.51 | 202 | 3/19/2025 |
2.0.31.15 | 183 | 1/23/2025 |
2.0.31 | 198 | 12/3/2024 |
2.0.30.1 | 145 | 11/29/2024 |
2.0.30 | 156 | 11/14/2024 |
2.0.29.55 | 208 | 9/23/2024 |
2.0.29.54 | 168 | 9/19/2024 |
2.0.29.38 | 156 | 9/9/2024 |
2.0.29 | 168 | 8/6/2024 |
2.0.28.1 | 125 | 8/5/2024 |
2.0.28 | 139 | 8/1/2024 |
2.0.27 | 133 | 7/31/2024 |
2.0.26.1 | 141 | 7/26/2024 |
2.0.26 | 146 | 7/26/2024 |
2.0.25.4 | 169 | 7/18/2024 |
2.0.25.3 | 160 | 7/18/2024 |
2.0.25.2 | 149 | 7/17/2024 |
2.0.25.1 | 146 | 7/17/2024 |
2.0.25 | 161 | 7/16/2024 |
2.0.24.33 | 195 | 6/24/2024 |
2.0.24.32 | 164 | 6/3/2024 |
2.0.24.31 | 164 | 5/27/2024 |
2.0.24.28 | 155 | 5/18/2024 |
2.0.24.27 | 144 | 5/17/2024 |
2.0.24.24 | 141 | 5/14/2024 |
2.0.24.7 | 184 | 5/9/2024 |
2.0.24.6 | 184 | 5/9/2024 |
2.0.24.1 | 148 | 5/3/2024 |
2.0.24 | 149 | 5/2/2024 |
2.0.23.1 | 174 | 4/26/2024 |
2.0.23 | 154 | 4/26/2024 |
2.0.22.5 | 164 | 4/26/2024 |
2.0.22.3 | 148 | 4/26/2024 |
2.0.22.2 | 174 | 4/22/2024 |
2.0.22.1 | 167 | 4/19/2024 |
2.0.22 | 174 | 4/19/2024 |
2.0.21 | 186 | 4/16/2024 |
2.0.20.2 | 180 | 4/15/2024 |
2.0.20.1 | 185 | 4/14/2024 |
2.0.20 | 172 | 4/14/2024 |
2.0.19.2 | 179 | 4/12/2024 |
2.0.19 | 171 | 4/11/2024 |
2.0.18 | 195 | 4/5/2024 |
2.0.17 | 167 | 3/28/2024 |
2.0.16.4 | 164 | 3/27/2024 |
2.0.16.3 | 155 | 3/27/2024 |
2.0.16 | 168 | 3/27/2024 |
2.0.15.11 | 174 | 3/27/2024 |
2.0.15.10 | 167 | 3/27/2024 |
2.0.15.4 | 164 | 3/25/2024 |
2.0.15.3 | 168 | 3/22/2024 |
2.0.15 | 172 | 3/20/2024 |
2.0.14.18 | 160 | 3/15/2024 |
2.0.14.17 | 184 | 3/11/2024 |
2.0.14.13 | 166 | 3/11/2024 |
2.0.14.10 | 180 | 3/7/2024 |
2.0.14.8 | 158 | 3/6/2024 |
2.0.14.6 | 187 | 3/4/2024 |
2.0.14.4 | 196 | 3/1/2024 |
2.0.14.3 | 180 | 3/1/2024 |
2.0.14.2 | 180 | 3/1/2024 |
2.0.14 | 189 | 3/1/2024 |
2.0.13.8 | 177 | 3/1/2024 |
2.0.13.7 | 182 | 2/27/2024 |
2.0.13.6 | 177 | 2/27/2024 |
2.0.13 | 184 | 2/26/2024 |
2.0.12.5 | 182 | 2/22/2024 |
2.0.12.4 | 176 | 2/22/2024 |
2.0.12.2 | 173 | 2/22/2024 |
2.0.12 | 183 | 2/21/2024 |
2.0.11.8 | 165 | 2/19/2024 |
2.0.11 | 189 | 2/18/2024 |
2.0.10.2 | 168 | 2/16/2024 |
2.0.10.1 | 157 | 2/16/2024 |
2.0.9 | 169 | 2/16/2024 |
2.0.8 | 172 | 2/15/2024 |
2.0.7 | 195 | 1/30/2024 |
2.0.6.1 | 154 | 1/30/2024 |
2.0.6 | 163 | 1/30/2024 |
2.0.5 | 154 | 1/30/2024 |
2.0.1 | 177 | 1/19/2024 |
1.2.0 | 179 | 1/18/2024 |
1.1.60.1 | 177 | 1/19/2024 |
1.1.60 | 171 | 1/17/2024 |
1.1.59.14 | 166 | 1/17/2024 |
1.1.59.6 | 175 | 1/15/2024 |
1.1.59.3 | 184 | 1/12/2024 |
1.1.59 | 176 | 1/12/2024 |
1.1.58 | 207 | 1/4/2024 |
1.1.57 | 207 | 12/20/2023 |
1.1.56 | 204 | 12/18/2023 |
1.1.55 | 194 | 12/15/2023 |
1.1.54.5 | 200 | 12/14/2023 |
1.1.54.3 | 182 | 12/12/2023 |
1.1.54 | 191 | 12/12/2023 |
1.1.53.16 | 200 | 12/5/2023 |
1.1.53.11 | 219 | 11/29/2023 |
1.1.53.6 | 194 | 11/25/2023 |
1.1.53 | 198 | 11/17/2023 |
1.1.52.22 | 177 | 11/17/2023 |
1.1.52.11 | 176 | 11/14/2023 |
1.1.52.9 | 166 | 11/14/2023 |
1.1.52.5 | 183 | 11/14/2023 |
1.1.52.3 | 178 | 11/10/2023 |
1.1.52 | 186 | 11/6/2023 |
1.1.51 | 177 | 11/2/2023 |
1.1.50.9 | 171 | 10/30/2023 |
1.1.50.8 | 179 | 10/27/2023 |
1.1.50.7 | 190 | 10/27/2023 |
1.1.50.6 | 173 | 10/27/2023 |
1.1.50 | 199 | 10/25/2023 |
1.1.49 | 207 | 10/19/2023 |
1.1.48.3 | 195 | 10/19/2023 |
1.1.48 | 207 | 10/18/2023 |
1.1.47.6 | 210 | 10/18/2023 |
1.1.47.5 | 204 | 10/17/2023 |
1.1.47.2 | 179 | 10/17/2023 |
1.1.47.1 | 200 | 10/17/2023 |
1.1.47 | 206 | 10/17/2023 |
1.1.45.6 | 228 | 10/16/2023 |
1.1.45 | 217 | 10/13/2023 |
1.1.44.11 | 197 | 10/12/2023 |
1.1.44.10 | 203 | 10/12/2023 |
1.1.44 | 227 | 10/11/2023 |
1.1.43.1 | 253 | 10/11/2023 |
1.1.43 | 228 | 10/6/2023 |
1.1.42.12 | 212 | 10/6/2023 |
1.1.42.11 | 230 | 9/28/2023 |
1.1.42.10 | 235 | 9/21/2023 |
1.1.42.2 | 203 | 9/19/2023 |
1.1.42.1 | 200 | 9/19/2023 |
1.1.42 | 207 | 9/17/2023 |
1.1.41.1 | 198 | 9/15/2023 |
1.1.41 | 213 | 9/13/2023 |
1.1.40 | 256 | 9/7/2023 |
1.1.39.1 | 264 | 8/25/2023 |
1.1.39 | 277 | 8/18/2023 |
1.1.38 | 255 | 8/11/2023 |
1.1.37.1 | 287 | 7/26/2023 |
1.1.37 | 287 | 7/22/2023 |
1.1.36.1 | 279 | 7/20/2023 |
1.1.36 | 264 | 7/19/2023 |
1.1.35 | 281 | 7/19/2023 |
1.1.34.6 | 311 | 7/7/2023 |
1.1.34.5 | 276 | 7/7/2023 |
1.1.34.4 | 278 | 7/4/2023 |
1.1.34 | 307 | 7/3/2023 |
1.1.33.45 | 311 | 7/3/2023 |
1.1.33.42 | 331 | 6/12/2023 |
1.1.33.41 | 265 | 6/5/2023 |
1.1.33.26 | 371 | 4/11/2023 |
1.1.33.25 | 328 | 4/11/2023 |
1.1.33.20 | 352 | 4/4/2023 |
1.1.33.19 | 329 | 4/3/2023 |
1.1.33.15 | 316 | 3/31/2023 |
1.1.33.14 | 309 | 3/31/2023 |
1.1.33.11 | 370 | 3/29/2023 |