Files
lux/Lux.Report.Manager/Components/Compo/ReportDesigner.razor.cs
T
2026-04-08 15:59:40 +02:00

76 lines
2.3 KiB
C#

using DevExpress.Blazor.Reporting;
using DevExpress.DataAccess;
using DevExpress.DataAccess.Json;
using DevExpress.Drawing.Internal.Fonts.Interop;
using DevExpress.Security;
using DevExpress.XtraReports;
using DevExpress.XtraReports.UI;
using Lux.Report.Data.Reports;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.WebUtilities;
namespace Lux.Report.Manager.Components.Compo
{
public partial class ReportDesigner
{
#region Protected Methods
[Parameter]
public string ReportPathName { get; set; } = "";
private string reportName = "";
private string pdfUrl
{
get => $"download-offer?id={oID}";
}
private int oID = 0;
protected string FileName(string fullName)
{
return Path.GetFileName(fullName);
}
protected override void OnInitialized()
{
// fix nome report
reportName = FileName(ReportPathName);
#if false
// 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;
}
#endif
}
#endregion Protected Methods
#region Private Fields
private OfferReport currReport = new();
private DxReportViewer? reportViewer;
#endregion Private Fields
#region Private Properties
[Inject]
private IConfiguration _config { get; set; } = null!;
[Inject]
private NavigationManager NavManager { get; set; } = null!;
#endregion Private Properties
}
}