/// <summary> /// Initializes a new instance of the <see cref="T:EPiServer.Commerce.FindSearchProvider.FindDocument" /> class. /// </summary> /// <param name="source">The source.</param> public FindDocument(FindDocument source) { this.CatalogEntryId = source.CatalogEntryId; this.CatalogEntryCode = source.CatalogEntryCode; this.CatalogEntryType = source.CatalogEntryType; this.AllowPreorder = source.AllowPreorder; this.PreorderAvailableDate = source.PreorderAvailableDate; this.StartDate = source.StartDate; this.EndDate = source.EndDate; this.Languages = source.Languages.ToList <string>(); this.Currencies = source.Currencies.ToList <string>(); this.Markets = source.Markets.ToList <string>(); this.Catalogs = source.Catalogs.ToList <string>(); this.Outlines = source.Outlines.ToList <string>(); this.CatalogNodes = source.CatalogNodes.ToList <string>(); this.Name = source.Name; this.IsActive = source.IsActive; this.ListPrices = source.ListPrices.ToDictionary <KeyValuePair <string, double?>, string, double?>((Func <KeyValuePair <string, double?>, string>)(kv => kv.Key), (Func <KeyValuePair <string, double?>, double?>)(kv => kv.Value)); this.SalePrices = source.SalePrices.ToDictionary <KeyValuePair <string, double?>, string, double?>((Func <KeyValuePair <string, double?>, string>)(kv => kv.Key), (Func <KeyValuePair <string, double?>, double?>)(kv => kv.Value)); this.StringFields = source.StringFields.ToDictionary <KeyValuePair <string, string>, string, string>((Func <KeyValuePair <string, string>, string>)(kv => kv.Key), (Func <KeyValuePair <string, string>, string>)(kv => kv.Value)); this.StringCollectionFields = source.StringCollectionFields.ToDictionary <KeyValuePair <string, List <string> >, string, List <string> >((Func <KeyValuePair <string, List <string> >, string>)(kv => kv.Key), (Func <KeyValuePair <string, List <string> >, List <string> >)(kv => kv.Value.ToList <string>())); this.IntFields = source.IntFields.ToDictionary <KeyValuePair <string, int?>, string, int?>((Func <KeyValuePair <string, int?>, string>)(kv => kv.Key), (Func <KeyValuePair <string, int?>, int?>)(kv => kv.Value)); this.BoolFields = source.BoolFields.ToDictionary <KeyValuePair <string, bool?>, string, bool?>((Func <KeyValuePair <string, bool?>, string>)(kv => kv.Key), (Func <KeyValuePair <string, bool?>, bool?>)(kv => kv.Value)); this.LongFields = source.LongFields.ToDictionary <KeyValuePair <string, long?>, string, long?>((Func <KeyValuePair <string, long?>, string>)(kv => kv.Key), (Func <KeyValuePair <string, long?>, long?>)(kv => kv.Value)); this.DoubleFields = source.DoubleFields.ToDictionary <KeyValuePair <string, double?>, string, double?>((Func <KeyValuePair <string, double?>, string>)(kv => kv.Key), (Func <KeyValuePair <string, double?>, double?>)(kv => kv.Value)); this.DateTimeFields = source.DateTimeFields.ToDictionary <KeyValuePair <string, DateTime?>, string, DateTime?>((Func <KeyValuePair <string, DateTime?>, string>)(kv => kv.Key), (Func <KeyValuePair <string, DateTime?>, DateTime?>)(kv => kv.Value)); }
private void BuildCatalogStructure(FindDocument document, CatalogEntryDto.CatalogEntryRow entryRow) { Dictionary <int, FindDocumentBuilder.CatalogInfo> catalogs = new Dictionary <int, FindDocumentBuilder.CatalogInfo>(); Dictionary <int, FindDocumentBuilder.CatalogNodeInfo> catalogNodes = new Dictionary <int, FindDocumentBuilder.CatalogNodeInfo>(); List <FindDocumentBuilder.NodeEntryRelationInfo> list = FindDocumentBuilder.CatalogSystem.GetCatalogRelationDto(entryRow.CatalogEntryId).NodeEntryRelation.Select <CatalogRelationDto.NodeEntryRelationRow, FindDocumentBuilder.NodeEntryRelationInfo>((Func <CatalogRelationDto.NodeEntryRelationRow, FindDocumentBuilder.NodeEntryRelationInfo>)(r => new FindDocumentBuilder.NodeEntryRelationInfo(r, catalogs, catalogNodes))).ToList <FindDocumentBuilder.NodeEntryRelationInfo>(); FindDocumentBuilder.CatalogInfo.GetCatalog(entryRow.CatalogId, catalogs); document.Catalogs = catalogs.Select <KeyValuePair <int, FindDocumentBuilder.CatalogInfo>, string>((Func <KeyValuePair <int, FindDocumentBuilder.CatalogInfo>, string>)(kv => kv.Value.CatalogName)).Distinct <string>().OrderBy <string, string>((Func <string, string>)(s => s)).ToList <string>(); document.CatalogNodes = catalogNodes.Select <KeyValuePair <int, FindDocumentBuilder.CatalogNodeInfo>, string>((Func <KeyValuePair <int, FindDocumentBuilder.CatalogNodeInfo>, string>)(kv => kv.Value.CatalogNodeCode)).Distinct <string>().OrderBy <string, string>((Func <string, string>)(s => s)).ToList <string>(); document.Outlines = list.SelectMany <FindDocumentBuilder.NodeEntryRelationInfo, string>((Func <FindDocumentBuilder.NodeEntryRelationInfo, IEnumerable <string> >)(r => this.BuildOutlines(r))).Distinct <string>().OrderBy <string, string>((Func <string, string>)(s => s)).ToList <string>(); }
private void BuildPreorderFields(FindDocument document, string entryCode) { DateTime safeBeginningOfTime = new DateTime(1900, 1, 1, 0, 0, 0, DateTimeKind.Utc); IEnumerable <InventoryRecord> source = ServiceLocator.Current.GetInstance <IInventoryService>().QueryByEntry((IEnumerable <string>) new string[1] { entryCode }).Where <InventoryRecord>((Func <InventoryRecord, bool>)(i => i.PreorderAvailableUtc > safeBeginningOfTime)); bool flag = source.Any <InventoryRecord>(); document.AllowPreorder = flag; if (!flag) { return; } document.PreorderAvailableDate = source.Select <InventoryRecord, DateTime>((Func <InventoryRecord, DateTime>)(i => i.PreorderAvailableUtc)).Min <DateTime>(); }
private void AddOperation(int catalogEntryId, FindDocument document) { Dictionary <int, FindDocument> operations = (Dictionary <int, FindDocument>)null; lock (this._lock) { this._pendingOperations[catalogEntryId] = document; if (this._pendingOperations.Count >= 50) { operations = this.TakePendingOperations(); } } if (operations == null) { return; } this.SendOperations(operations); }
private void BuildPrices(FindDocument document, CatalogEntryDto.CatalogEntryRow entryRow, ISearchConfiguration configuration) { IPriceService instance = ServiceLocator.Current.GetInstance <IPriceService>(); CatalogKey catalogKey = new CatalogKey(entryRow); HashSet <Mediachase.Commerce.Currency> source1 = new HashSet <Mediachase.Commerce.Currency>(); HashSet <MarketId> source2 = new HashSet <MarketId>(); IFieldConfiguration <double?> field = null; foreach (IPriceValue catalogEntryPrice in instance.GetCatalogEntryPrices(catalogKey)) { HashSet <Mediachase.Commerce.Currency> currencySet = source1; Money unitPrice = catalogEntryPrice.UnitPrice; Mediachase.Commerce.Currency currency1 = unitPrice.Currency; if (currencySet.Add(currency1)) { ISearchConfiguration searchConfiguration = configuration; unitPrice = catalogEntryPrice.UnitPrice; Mediachase.Commerce.Currency currency2 = unitPrice.Currency; searchConfiguration.AddCurrency(currency2); } if (source2.Add(catalogEntryPrice.MarketId)) { configuration.AddMarket(catalogEntryPrice.MarketId); } ISearchConfiguration searchConfiguration1 = configuration; string name = "saleprice"; unitPrice = catalogEntryPrice.UnitPrice; Mediachase.Commerce.Currency currencyCode = (Mediachase.Commerce.Currency)unitPrice.Currency.CurrencyCode; MarketId marketId = (MarketId)catalogEntryPrice.MarketId.Value; ref IFieldConfiguration <double?> local = ref field; if (searchConfiguration1.TryGetPriceField(name, currencyCode, marketId, out local)) { unitPrice = catalogEntryPrice.UnitPrice; double amount = (double)unitPrice.Amount; double?nullable = field.GetValue(document); if (!nullable.HasValue || nullable.Value > amount) { field.SetValue(document, new double?(amount)); } } }
public abstract void SetObjectValue(FindDocument document, object value);
public abstract object GetObjectValue(FindDocument document);