Files
Annamaria Sassi 4b41ed6dde - Gestito ReportDesign
- Importazione ReportDesign in ReportViewer
2026-04-03 12:31:42 +02:00

80 lines
2.7 KiB
C#

using DevExpress.Blazor.Reporting;
using DevExpress.DataAccess;
using DevExpress.DataAccess.Json;
using DevExpress.DataAccess.ObjectBinding;
using DevExpress.Drawing.Internal.Fonts.Interop;
using DevExpress.Security;
using DevExpress.XtraPrinting.Native.Properties;
using DevExpress.XtraReports;
using DevExpress.XtraReports.Parameters;
using DevExpress.XtraReports.Services;
using DevExpress.XtraReports.UI;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.WebUtilities;
using System.Security.Cryptography;
using TestDevExpress.Components.Reports;
namespace TestDevExpress.Components.Pages
{
public partial class ReportViewer
{
#region Protected Methods
private string pdfUrl
{
get => $"download-offer?id={oID}";
}
private int oID = 0;
protected override void OnInitialized()
{
// calcolo i parametri x IMG e Json da conf
string apiUrl = _config.GetValue<string>("ServerConf:ApiBaseUrl") ?? "https://iis01.egalware.com/lux/srv/api";
string imgUrl = _config.GetValue<string>("ServerConf:ImageUrl") ?? "image";
string dataUrl = _config.GetValue<string>("ServerConf:DataUrl") ?? "report/offert/";
string imgFullUrl = $"{apiUrl}/{imgUrl}/";
string dataFullUrl = $"{apiUrl}/{dataUrl}";
//cerco id da URL x offerta da mostrare
//var uri = NavManager.ToAbsoluteUri(NavManager.Uri);
//if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("OfferId", out var offerId))
//{
// int.TryParse(offerId, out oID);
// currReport = new OfferReport(dataFullUrl, oID);
// currReport.Parameters["pImgPath"].Value = imgFullUrl;
//}
var uri = NavManager.ToAbsoluteUri(NavManager.Uri);
if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("OfferId", out var offerId))
{
int.TryParse(offerId, out oID);
Report = reportProvider.GetReport("TestReport1?URL=" + dataFullUrl + "?pOfferId=" + offerId + "&pImgPath=" + imgFullUrl, null);
}
}
#endregion Protected Methods
#region Private Fields
private OfferReport currReport = new();
private DxReportViewer? reportViewer;
private XtraReport Report = new OfferReport();
#endregion Private Fields
#region Private Properties
[Inject]
private IConfiguration _config { get; set; } = null!;
[Inject]
private NavigationManager NavManager { get; set; } = null!;
[Inject]
public IReportProvider reportProvider { get; set; }
#endregion Private Properties
}
}