/// <summary> /// Get all the mix and match line groups associated with the given offers. /// </summary> /// <param name="offerIds">Offer Ids to fetch mix and match line groups by.</param> /// <returns>Collection of mix and match line groups associated with the given offer Ids of type ReadOnlyCollection<MixAndMatchLineGroup>.</returns> public object GetMixAndMatchLineGroupsByOfferIds(object offerIds) { IEnumerable <string> offerIdSet = offerIds as IEnumerable <string>; using (SimpleProfiler profiler = new SimpleProfiler("GetMixAndMatchLineGroupsByOfferIds", 1)) { return(this.ExecuteDataService <MixAndMatchLineGroup>(new EntityDataServiceRequest <IEnumerable <string>, MixAndMatchLineGroup>(offerIdSet, QueryResultSettings.AllRecords))); } }
/// <summary> /// Gets the customer price group. /// </summary> /// <param name="customerPriceGroupId">Customer price group Id.</param> /// <returns>Customer price group.</returns> public PriceGroup GetCustomerPriceGroup(string customerPriceGroupId) { using (SimpleProfiler profiler = new SimpleProfiler("GetCustomerPriceGroup", 1)) { var response = this.ExecuteDataService <PriceGroup>(new GetCustomerPriceGroupDataRequest(customerPriceGroupId)); return(response.Single()); } }
/// <summary> /// Get all the threshold tiers associated with the given offers. /// </summary> /// <param name="offerIds">Offer Ids to fetch tiers by.</param> /// <returns>Collection of tiers (if any) associated with the given offer IdsCollection of dimension values of type ReadOnlyCollection<ThresholdDiscountTier>.</returns> public object GetThresholdTiersByOfferIds(object offerIds) { IEnumerable <string> offerIdSet = offerIds as IEnumerable <string>; using (SimpleProfiler profiler = new SimpleProfiler("GetThresholdTiersByOfferIds", 1)) { return(this.ExecuteDataService <ThresholdDiscountTier>(new EntityDataServiceRequest <IEnumerable <string>, ThresholdDiscountTier>(offerIdSet, QueryResultSettings.AllRecords))); } }
/// <summary> /// Get all the multi buy discount lines associated with the given offers. /// </summary> /// <param name="offerIds">Offer Ids to fetch discount lines by.</param> /// <returns>Collection of multi buy discount lines associated with the given offer Ids of type ReadOnlyCollection<QuantityDiscountLevel>.</returns> public object GetMultipleBuyDiscountLinesByOfferIds(object offerIds) { IEnumerable <string> offerIdSet = offerIds as IEnumerable <string>; using (SimpleProfiler profiler = new SimpleProfiler("GetMultipleBuyDiscountLinesByOfferIds", 1)) { return(this.ExecuteDataService <QuantityDiscountLevel>(new EntityDataServiceRequest <IEnumerable <string>, QuantityDiscountLevel>(offerIdSet, QueryResultSettings.AllRecords))); } }
/// <summary> /// Gets the items using the specified item identifiers. /// </summary> /// <param name="itemIds">The collection of item identifiers.</param> /// <returns>The collection of items of type ReadOnlyCollection<Item>.</returns> public object GetItems(object itemIds) { IEnumerable <string> itemIdSet = itemIds as IEnumerable <string>; using (SimpleProfiler profiler = new SimpleProfiler("GetItems", 1)) { return(this.ExecuteDataService <Item>(new EntityDataServiceRequest <IEnumerable <string>, Item>(itemIdSet, QueryResultSettings.AllRecords))); } }
/// <summary> /// Get the variant dimensions populated for the given dimension Ids. This is lightweight and /// only returns the dimension Ids, not translations. /// </summary> /// <param name="inventoryDimensionIds">The dimension Ids which need dimension values fetched.</param> /// <returns>Collection of dimension values of type ReadOnlyCollection<ProductVariant>.</returns> public object GetVariantDimensionsByInventDimensionIds(object inventoryDimensionIds) { IEnumerable <string> inventoryDimensionIdSet = inventoryDimensionIds as IEnumerable <string>; using (SimpleProfiler profiler = new SimpleProfiler("GetVariantDimensionsByItemIds", 1)) { return(this.ExecuteDataService <ProductVariant>(new EntityDataServiceRequest <IEnumerable <string>, ProductVariant>(inventoryDimensionIdSet, QueryResultSettings.AllRecords))); } }
/// <summary> /// Retrieves PriceParameters from the database. This indicates which types of /// trade agreements are active for various combinations of customer and item types. /// </summary> /// <returns>The first (and only) row in PriceParameters in the database.</returns> public PriceParameters GetPriceParameters() { using (SimpleProfiler profiler = new SimpleProfiler("GetPriceParameters", 1)) { var response = this.ExecuteDataService <PriceParameters>(new EntityDataServiceRequest <PriceParameters>(QueryResultSettings.SingleRecord)); return(response.Single()); } }
/// <summary> /// Gets the variants for the specified collection of item variant inventory dimension identifiers. /// </summary> /// <param name="itemVariants">The collection of item variant inventory dimension.</param> /// <returns>The variant with specified columns populated. Null if variant not found of type ReadOnlyCollection<ProductVariant>.</returns> public object GetVariants(object itemVariants) { IEnumerable <ItemVariantInventoryDimension> itemVariantSet = itemVariants as IEnumerable <ItemVariantInventoryDimension>; using (SimpleProfiler profiler = new SimpleProfiler("GetVariants", 1)) { GetProductVariantsDataRequest getVariantsRequest = new GetProductVariantsDataRequest(itemVariantSet); getVariantsRequest.QueryResultSettings = QueryResultSettings.AllRecords; return(this.ExecuteDataService <ProductVariant>(getVariantsRequest)); } }
private static DiscountDealEstimate BuildEstimates( Dictionary <string, DiscountDealEstimate> offerIdToEstimateNonCompoundedLookupHolder, List <DiscountBase> compoundedDiscountsHolder, DiscountDealEstimate existingCombinedEstimatesForCompounded, Dictionary <string, DiscountBase> discounts, DiscountableItemGroup[] discountableItemGroups, decimal[] remainingQuantities, decimal[] remainingQuantitiesForCompound, HashSet <int> itemsWithOverlappingDiscounts, HashSet <int> itemsWithOverlappingDiscountsCompoundedOnly) { using (SimpleProfiler profiler = new SimpleProfiler("OverlappedDiscounts.BuildEstimates", 2)) { DiscountDealEstimate combinedEstimateForCompounded = existingCombinedEstimatesForCompounded; foreach (KeyValuePair <string, DiscountBase> pair in discounts) { DiscountBase discount = pair.Value; DiscountDealEstimate estimate = discount.GetDiscountDealEstimate( discountableItemGroups, discount.CanCompound ? remainingQuantitiesForCompound : remainingQuantities, itemsWithOverlappingDiscounts, itemsWithOverlappingDiscountsCompoundedOnly); if (discount.CanCompound) { if (combinedEstimateForCompounded == null) { combinedEstimateForCompounded = estimate; } else { combinedEstimateForCompounded = DiscountDealEstimate.Combine(combinedEstimateForCompounded, estimate); } compoundedDiscountsHolder.Add(discount); } else { offerIdToEstimateNonCompoundedLookupHolder[discount.OfferId] = estimate; } } // returns combined estimate for compounded return(combinedEstimateForCompounded); } }
public void StartWebsite(DirectoryInfo projectDirectory, int port) { using (SimpleProfiler.Trace(string.Format("StartWebsite(projectDirectory: {0}, port: {1})", projectDirectory, port))) { var processStartInfo = new ProcessStartInfo { WindowStyle = ProcessWindowStyle.Normal, ErrorDialog = true, LoadUserProfile = true, CreateNoWindow = false, UseShellExecute = false, Arguments = String.Format("/path:\"{0}\" /port:{1}", projectDirectory.FullName, port), FileName = GetIISExpressFile().FullName }; Process = Process.Start(processStartInfo); } }
public override void Update(GameTime gameTime) { SimpleProfiler.StartProfileBlock("BulletXNA"); lock (addRemoveLock) { // go through and add / remove new objects in thread safe way. // FIXME MAN - should do the same for constraints at somepoint. int cnt = m_removeList.Count; for (int r = 0; r < cnt; r++) { if (m_removeList[r] is RigidBody) { _world.RemoveRigidBody(m_removeList[r] as RigidBody); } else { _world.RemoveCollisionObject(m_removeList[r]); } } m_removeList.Clear(); cnt = m_addList.Count; for (int a = 0; a < cnt; a++) { if (m_addList[a].collisionObject is RigidBody) { _world.AddRigidBody(m_addList[a].collisionObject as RigidBody, m_addList[a].filterGroup, m_addList[a].filterMask); } else { _world.AddCollisionObject(m_addList[a].collisionObject, m_addList[a].filterGroup, m_addList[a].filterMask); } } m_addList.Clear(); if (Enabled) { _world.StepSimulation((float)gameTime.ElapsedGameTime.TotalMilliseconds, 1); _world.DebugDrawWorld(); } } SimpleProfiler.EndProfileBlock("BulletXNA"); }
private void Aquire( Dictionary <int, OverlapppedDiscounts> itemGroupIndexToOverlapppedDiscountsLookup, OverlapppedDiscounts overlapppedDiscountsToAcquire) { using (SimpleProfiler profiler = new SimpleProfiler("OverlappedDiscounts.Aquire", 4)) { this.MixAndMatchAndQuantityDiscounts.AddRange(overlapppedDiscountsToAcquire.MixAndMatchAndQuantityDiscounts); this.CoveredItemGroupIndexSet.AddRange(overlapppedDiscountsToAcquire.CoveredItemGroupIndexSet); foreach (KeyValuePair <string, DiscountBase> pairOfferIdToDiscount in overlapppedDiscountsToAcquire.MixAndMatchAndQuantityDiscounts) { DiscountBase discount = pairOfferIdToDiscount.Value; foreach (KeyValuePair <int, HashSet <decimal> > pair in discount.ItemGroupIndexToDiscountLineNumberSetMap) { int itemGroupIndex = pair.Key; itemGroupIndexToOverlapppedDiscountsLookup[itemGroupIndex] = this; } } } }
/// <summary> /// Fetch all price adjustments for the given items, striped by item Id and dimension Id. /// </summary> /// <param name="items">The set of items to search by. Set of pairs of item Id and variant dimension Id. Ignores the unit.</param> /// <param name="priceGroups">Set of price groups to search by.</param> /// <param name="minActiveDate">The earliest inclusive active date to search by. Must be less than or equal to maxActiveDate.</param> /// <param name="maxActiveDate">The latest inclusive active date to search by. Must be greater than or equal to minActiveDate.</param> /// <param name="settings">The query result settings.</param> /// <returns>Collection of price adjustments striped by item Id and variant dimension Id (if any) of type ReadOnlyCollection<PriceAdjustment>.</returns> public object ReadPriceAdjustments( object items, object priceGroups, DateTimeOffset minActiveDate, DateTimeOffset maxActiveDate, QueryResultSettings settings) { IEnumerable <ItemUnit> itemSet = items as IEnumerable <ItemUnit>; ISet <string> priceGroupSet = priceGroups as ISet <string>; ReadOnlyCollection <ValidationPeriod> validationPeriods; ReadOnlyCollection <PriceAdjustment> priceAdjustments; using (SimpleProfiler profiler = new SimpleProfiler("ReadPriceAdjustments", 1)) { var dataRequest = new ReadPriceAdjustmentsDataRequest( itemSet, priceGroupSet, minActiveDate, maxActiveDate); dataRequest.QueryResultSettings = settings; priceAdjustments = this.ExecuteDataService <PriceAdjustment, ValidationPeriod>(dataRequest, out validationPeriods); } IDictionary <string, ValidationPeriod> validationPeriodLookup = validationPeriods.ToDictionary(p => p.PeriodId, p => p, StringComparer.OrdinalIgnoreCase); foreach (PriceAdjustment adjustment in priceAdjustments) { if (!string.IsNullOrWhiteSpace(adjustment.ValidationPeriodId)) { ValidationPeriod validationPeriod = null; if (validationPeriodLookup.TryGetValue(adjustment.ValidationPeriodId, out validationPeriod)) { adjustment.ValidationPeriod = validationPeriod; } } } return(priceAdjustments); }
/// <summary> /// Fetch the superset of discount trade agreements which could apply to all of these items and customer for the given dates. /// </summary> /// <param name="itemIds">The item Ids to fetch for agreements for.</param> /// <param name="customerAccount">Optional. Customer account number to search by.</param> /// <param name="minActiveDate">The earliest inclusive active date to search by. Must be less than or equal to maxActiveDate.</param> /// <param name="maxActiveDate">The latest inclusive active date to search by. Must be greater than or equal to minActiveDate.</param> /// <param name="currencyCode">Currency code to filter by.</param> /// <param name="settings">The query result settings.</param> /// <returns>Collection of trade agreements which may be applied to the given items of type ReadOnlyCollection<TradeAgreement>.</returns> public object ReadDiscountTradeAgreements( object itemIds, string customerAccount, DateTimeOffset minActiveDate, DateTimeOffset maxActiveDate, string currencyCode, QueryResultSettings settings) { ISet <string> itemIdSet = itemIds as ISet <string>; using (SimpleProfiler profiler = new SimpleProfiler("ReadDiscountTradeAgreements", 1)) { var dataRequest = new ReadDiscountTradeAgreementsDataRequest( itemIdSet, customerAccount, minActiveDate, maxActiveDate, currencyCode); dataRequest.QueryResultSettings = settings; return(this.ExecuteDataService <TradeAgreement>(dataRequest)); } }
/// <summary> /// Gets the channel price configuration. /// </summary> /// <returns>Channel price configuration.</returns> public ChannelPriceConfiguration GetChannelPriceConfiguration() { using (SimpleProfiler profiler = new SimpleProfiler("GetChannelPriceConfiguration", 1)) { ChannelPriceConfiguration channelPriceConfiguration = null; var response = this.ExecuteDataService <ChannelPriceConfiguration>(new EntityDataServiceRequest <ChannelPriceConfiguration>(QueryResultSettings.FirstRecord)); channelPriceConfiguration = response.SingleOrDefault(); if (channelPriceConfiguration == null) { channelPriceConfiguration = new ChannelPriceConfiguration() { Company = this.requestContext.GetChannelConfiguration().InventLocationDataAreaId, CompanyCurrency = this.requestContext.GetChannelConfiguration().CompanyCurrency, ChannelTimeZoneId = this.requestContext.GetChannelConfiguration().TimeZoneInfoId, }; } return(channelPriceConfiguration); } }
internal DiscountBase[] GetSortedDiscountsToApplyInFastMode( DiscountableItemGroup[] discountableItemGroups, decimal[] remainingQuantities, decimal[] remainingQuantitiesForCompound, HashSet <int> itemsWithOverlappingDiscounts, HashSet <int> itemsWithOverlappingDiscountsCompoundedOnly) { using (SimpleProfiler profiler = new SimpleProfiler("OverlappedDiscounts.GetDiscountsToApplyInFastMode", 2)) { Dictionary <string, DiscountDealEstimate> offerIdToEstimateNonCompoundedLookup = new Dictionary <string, DiscountDealEstimate>(StringComparer.OrdinalIgnoreCase); // Consolidate all compounded discounts into one estimate, to be sorted with the rest later. List <DiscountBase> compoundedDiscounts = new List <DiscountBase>(); DiscountDealEstimate combinedEstimateForCompounded = null; // Build estimates for offer discounts. combinedEstimateForCompounded = OverlapppedDiscounts.BuildEstimates( offerIdToEstimateNonCompoundedLookup, compoundedDiscounts, combinedEstimateForCompounded, this.OfferDiscounts, discountableItemGroups, remainingQuantities, remainingQuantitiesForCompound, itemsWithOverlappingDiscounts, itemsWithOverlappingDiscountsCompoundedOnly); // Build estimates for mix and match and quantity discounts. combinedEstimateForCompounded = OverlapppedDiscounts.BuildEstimates( offerIdToEstimateNonCompoundedLookup, compoundedDiscounts, combinedEstimateForCompounded, this.MixAndMatchAndQuantityDiscounts, discountableItemGroups, remainingQuantities, remainingQuantitiesForCompound, itemsWithOverlappingDiscounts, itemsWithOverlappingDiscountsCompoundedOnly); List <DiscountDealEstimate> estimatedSorted = new List <DiscountDealEstimate>(offerIdToEstimateNonCompoundedLookup.Values); if (combinedEstimateForCompounded != null) { estimatedSorted.Add(combinedEstimateForCompounded); } estimatedSorted.Sort(DiscountDealEstimate.GetComparison()); #if DEBUG foreach (DiscountDealEstimate estimate in estimatedSorted) { estimate.DebugDisplay(); } #endif DiscountBase[] discountsSorted = new DiscountBase[this.MixAndMatchAndQuantityDiscounts.Count + this.OfferDiscounts.Count]; int discountIndex = 0; for (int i = estimatedSorted.Count - 1; i >= 0; i--) { DiscountDealEstimate estimate = estimatedSorted[i]; if (estimate.CanCompound) { for (int compoundedIndex = 0; compoundedIndex < compoundedDiscounts.Count; compoundedIndex++) { discountsSorted[discountIndex] = compoundedDiscounts[compoundedIndex]; discountIndex++; } } else { DiscountBase discount = null; if (this.MixAndMatchAndQuantityDiscounts.TryGetValue(estimate.OfferId, out discount)) { discountsSorted[discountIndex] = discount; discountIndex++; } else if (this.OfferDiscounts.TryGetValue(estimate.OfferId, out discount)) { discountsSorted[discountIndex] = discount; discountIndex++; } } } return(discountsSorted); } }