/// <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> /// <returns>Collection of trade agreements which may be applied to the given items.</returns> public ReadOnlyCollection <TradeAgreement> ReadDiscountTradeAgreements( IEnumerable <string> itemIds, string customerAccount, DateTimeOffset minActiveDate, DateTimeOffset maxActiveDate, string currencyCode) { ThrowIf.Null(itemIds, "itemIds"); if (minActiveDate > maxActiveDate) { throw new ArgumentException("minActiveDate must be less than or equal to maxActiveDate."); } DateTimeOffset minActiveDateChannelTimeZone = this.Context.ConvertDateTimeToChannelDate(minActiveDate); DateTimeOffset maxActiveDateChannelTimeZone = this.Context.ConvertDateTimeToChannelDate(maxActiveDate); using (var context = new SqliteDatabaseContext(this.Context)) { return(DiscountProcedure.GetAllDiscountTradeAgreements( context, itemIds, customerAccount, minActiveDateChannelTimeZone, maxActiveDateChannelTimeZone, currencyCode)); } }