public DataExporterContext(DataExportRequest request, bool isPreview, CancellationToken cancellationToken) { Request = request; IsPreview = isPreview; CancellationToken = cancellationToken; FolderContent = request.Profile.GetExportFolder(true, true); Filter = Deserialize <ExportFilter>(request.Profile.Filtering) ?? new(); Projection = Deserialize <ExportProjection>(request.Profile.Projection) ?? new(); if (request.Profile.Projection.IsEmpty()) { Projection.DescriptionMergingId = (int)ExportDescriptionMerging.Description; } Result = new DataExportResult { FileFolder = IsFileBasedExport ? FolderContent : null }; ExecuteContext = new ExportExecuteContext(Result, FolderContent, CancellationToken) { Filter = Filter, Projection = Projection, ProfileId = request.Profile.Id }; if (!IsPreview) { ExecuteContext.ProgressValueSetter = Request.ProgressValueSetter; } }
public static string GetFilePath(this DataExportResult result) { if (result != null && result.Succeeded && result.FileFolder.HasValue() && result.Files != null) { var file = result.Files.FirstOrDefault(); if (file != null) { return(Path.Combine(result.FileFolder, file.FileName)); } } return(null); }
public DataExporterContext( DataExportRequest request, CancellationToken cancellationToken, bool isPreview = false) { Request = request; CancellationToken = cancellationToken; Filter = XmlHelper.Deserialize <ExportFilter>(request.Profile.Filtering); Projection = XmlHelper.Deserialize <ExportProjection>(request.Profile.Projection); IsPreview = isPreview; if (request.Profile.Projection.IsEmpty()) { Projection.DescriptionMergingId = (int)ExportDescriptionMerging.Description; } FolderContent = request.Profile.GetExportFolder(true, true); DeliveryTimes = new Dictionary <int, DeliveryTime>(); QuantityUnits = new Dictionary <int, QuantityUnit>(); Stores = new Dictionary <int, Store>(); Languages = new Dictionary <int, Language>(); Countries = new Dictionary <int, Country>(); ProductTemplates = new Dictionary <int, string>(); CategoryTemplates = new Dictionary <int, string>(); NewsletterSubscriptions = new HashSet <string>(); Translations = new Dictionary <string, LocalizedPropertyCollection>(); TranslationsPerPage = new Dictionary <string, LocalizedPropertyCollection>(); UrlRecords = new Dictionary <string, UrlRecordCollection>(); UrlRecordsPerPage = new Dictionary <string, UrlRecordCollection>(); StatsPerStore = new Dictionary <int, RecordStats>(); EntityIdsLoaded = new List <int>(); EntityIdsPerSegment = new HashSet <int>(); Result = new DataExportResult { FileFolder = IsFileBasedExport ? FolderContent : null }; ExecuteContext = new ExportExecuteContext(Result, CancellationToken, FolderContent); ExecuteContext.Filter = Filter; ExecuteContext.Projection = Projection; ExecuteContext.ProfileId = request.Profile.Id; if (!IsPreview) { ExecuteContext.ProgressValueSetter = Request.ProgressValueSetter; } }
public DataExporterContext( DataExportRequest request, CancellationToken cancellationToken, bool isPreview = false) { Request = request; CancellationToken = cancellationToken; Filter = XmlHelper.Deserialize <ExportFilter>(request.Profile.Filtering); Projection = XmlHelper.Deserialize <ExportProjection>(request.Profile.Projection); IsPreview = isPreview; FolderContent = request.Profile.GetExportFolder(true, true); Categories = new Dictionary <int, Category>(); CategoryPathes = new Dictionary <int, string>(); DeliveryTimes = new Dictionary <int, DeliveryTime>(); QuantityUnits = new Dictionary <int, QuantityUnit>(); Stores = new Dictionary <int, Store>(); Languages = new Dictionary <int, Language>(); Countries = new Dictionary <int, Country>(); ProductTemplates = new Dictionary <int, string>(); CategoryTemplates = new Dictionary <int, string>(); NewsletterSubscriptions = new HashSet <string>(); RecordsPerStore = new Dictionary <int, int>(); EntityIdsLoaded = new List <int>(); EntityIdsPerSegment = new List <int>(); Result = new DataExportResult { FileFolder = (IsFileBasedExport ? FolderContent : null) }; ExecuteContext = new ExportExecuteContext(Result, CancellationToken, FolderContent); ExecuteContext.Projection = XmlHelper.Deserialize <ExportProjection>(request.Profile.Projection); if (!IsPreview) { ExecuteContext.ProgressValueSetter = Request.ProgressValueSetter; } }