diff --git a/MessageQueue/EbMqBaseService.cs b/MessageQueue/EbMqBaseService.cs index 5341185c..79cd0bca 100644 --- a/MessageQueue/EbMqBaseService.cs +++ b/MessageQueue/EbMqBaseService.cs @@ -31,6 +31,8 @@ public class EbMqBaseService : Service protected EbStaticFileClient FileClient { get; private set; } + protected EbStaticFileClient2 FileClient2 { get; private set; } + protected PooledRedisClientManager PooledRedisManager { get; private set; } protected EbConnectionFactory InfraConnectionFactory @@ -80,7 +82,7 @@ public EbMqBaseService(IEbConnectionFactory _dbf, IMessageProducer _mqp) this.MessageProducer3 = _mqp as RabbitMqProducer; } - public EbMqBaseService(IEbConnectionFactory _dbf, IEbStaticFileClient _sfc, IMessageProducer _mqp, IMessageQueueClient _mqc, IServiceClient _ssclient, IEbServerEventClient _sec, PooledRedisClientManager pooledRedisManager) + public EbMqBaseService(IEbConnectionFactory _dbf, IEbStaticFileClient _sfc, IMessageProducer _mqp, IMessageQueueClient _mqc, IServiceClient _ssclient, IEbServerEventClient _sec, PooledRedisClientManager pooledRedisManager, EbStaticFileClient2 staticFileClient2) { this.EbConnectionFactory = _dbf as EbConnectionFactory; this.FileClient = _sfc as EbStaticFileClient; @@ -89,6 +91,7 @@ public EbMqBaseService(IEbConnectionFactory _dbf, IEbStaticFileClient _sfc, IMes this.ServiceStackClient = _ssclient as JsonServiceClient; this.ServerEventClient = _sec as EbServerEventClient; this.PooledRedisManager = pooledRedisManager; + this.FileClient2 = staticFileClient2; } public EbMqBaseService(IEbConnectionFactory _dbf, IServiceClient _ssclient) diff --git a/Objects/ReportRelated/EbReport.cs b/Objects/ReportRelated/EbReport.cs index 596572cd..69306508 100644 --- a/Objects/ReportRelated/EbReport.cs +++ b/Objects/ReportRelated/EbReport.cs @@ -12,6 +12,7 @@ using ExpressBase.Common.ServiceClients; using ExpressBase.Common.Singletons; using ExpressBase.Common.Structures; +using ExpressBase.Common.WebApi.RequestNResponse; using ExpressBase.CoreBase.Globals; using ExpressBase.Objects.Helpers; using ExpressBase.Objects.Objects; @@ -625,6 +626,8 @@ public float PossibleSpaceForDetail [JsonIgnore] public EbStaticFileClient FileClient { get; set; } + public EbStaticFileClient2 FileClient2 { get; set; } + [JsonIgnore] public float RowHeight { get; set; } @@ -679,12 +682,12 @@ public float PossibleSpaceForDetail public dynamic GetDataFieldValue(string columnName, int iterator, int tableIndex) { dynamic value = ""; - if (DataSet == null||tableIndex < 0 || tableIndex >= DataSet.Tables.Count) + if (DataSet == null || tableIndex < 0 || tableIndex >= DataSet.Tables.Count) return value; - + EbDataTable table = DataSet.Tables[tableIndex]; - if (!table.Columns.Contains(columnName)||table.Rows.Count == 0) + if (!table.Columns.Contains(columnName) || table.Rows.Count == 0) return value; int rowIndex = (table.Rows.Count > 1) ? iterator : 0; @@ -1450,17 +1453,31 @@ public byte[] GetImage(int refId) } } - if (ImgBytes.Length == 0 && !string.IsNullOrEmpty(FileClient?.BearerToken)) + if (ImgBytes.Length == 0) { - DownloadFileResponse response = FileClient.Get(new DownloadImageByIdRequest + MemoryStream stream = null; + ImageMeta imageMeta = new ImageMeta + { + FileRefId = refId, + FileCategory = Common.Enums.EbFileCategory.Images, + FileName = refId.ToString() + }; + + if (this.Solution.SolutionSettings.EnableNewFileServer) + { + DownloadFileResponse2 response = this.FileClient2.DownloadFile(imageMeta, "/download/image", this.Solution.SolutionID, 0, null, ImageQuality.original, true); + + stream = new MemoryStream(response?.FileBytes); + } + else if (!string.IsNullOrEmpty(FileClient?.BearerToken)) { - ImageInfo = new ImageMeta + DownloadFileResponse response = FileClient.Get(new DownloadImageByIdRequest { - FileRefId = refId, - FileCategory = Common.Enums.EbFileCategory.Images - } - }); - MemoryStream stream = response?.StreamWrapper?.Memorystream; + ImageInfo = imageMeta + }); + stream = response?.StreamWrapper?.Memorystream; + } + if (stream != null) { stream.Position = 0; @@ -1471,6 +1488,7 @@ public byte[] GetImage(int refId) } } + ImageCollection.Add(refId, ImgBytes); } catch (Exception e) @@ -1772,7 +1790,7 @@ public void Draw() this.DrawPageHeader(); this.HandleEmptyDetailsection(); this.detailEnd += 30; - this.DrawPageFooter(); + this.DrawPageFooter(); } if (ReportFooterHeightRepeatAsPf != ReportFooterHeight) @@ -1799,8 +1817,8 @@ public void HandleExceptionPdf(Exception e) public void HandleEmptyDetailsection() { ColumnText ct = new ColumnText(this.Canvas); - Phrase phrase; - phrase = new Phrase("No rows available."); + Phrase phrase; + phrase = new Phrase("No rows available."); phrase.Font.Size = 10; float y = this.HeightPt - (this.ReportHeaderHeight + this.Margin.Top + this.PageHeaderHeight); diff --git a/ServiceStack_Artifacts/EbBaseService.cs b/ServiceStack_Artifacts/EbBaseService.cs index 11bb6c04..cfe469ff 100644 --- a/ServiceStack_Artifacts/EbBaseService.cs +++ b/ServiceStack_Artifacts/EbBaseService.cs @@ -47,6 +47,8 @@ public EbConnectionFactory EbConnectionFactory protected EbStaticFileClient FileClient { get; private set; } + protected EbStaticFileClient2 FileClient2 { get; private set; } + protected PooledRedisClientManager PooledRedisManager { get; private set; } protected EbConnectionFactory InfraConnectionFactory @@ -193,13 +195,14 @@ public EbBaseService(IEbConnectionFactory _dbf, IEbStaticFileClient _sfc, IMessa this.MessageQueueClient = _mqc as RabbitMqQueueClient; } - public EbBaseService(IEbConnectionFactory _dbf, IEbStaticFileClient _sfc, IMessageProducer _mqp, IMessageQueueClient _mqc, PooledRedisClientManager pooledRedisManager) + public EbBaseService(IEbConnectionFactory _dbf, IEbStaticFileClient _sfc, IMessageProducer _mqp, IMessageQueueClient _mqc, PooledRedisClientManager pooledRedisManager, EbStaticFileClient2 _sfc2) { this.EbConnectionFactory = _dbf as EbConnectionFactory; this.FileClient = _sfc as EbStaticFileClient; this.MessageProducer3 = _mqp as RabbitMqProducer; this.MessageQueueClient = _mqc as RabbitMqQueueClient; this.PooledRedisManager = pooledRedisManager; + this.FileClient2 = _sfc2; } private static Dictionary _infraDbSqlQueries;