Beispiel #1
0
 /// <summary>
 /// Returns all available countries.
 /// </summary>
 /// <returns>Collection of all available countries</returns>
 public IEnumerable <CountryInfo> GetAllCountries()
 {
     return(repositoryCacheHelper.CacheObjects(() =>
     {
         return countryInfoProvider.Get();
     }, $"{nameof(CountryRepository)}|{nameof(GetAllCountries)}"));
 }
Beispiel #2
0
 /// <summary>
 /// Returns an enumerable collection of all enabled payment methods.
 /// </summary>
 /// <returns>Collection of enabled payment methods. See <see cref="PaymentOptionInfo"/> for detailed information.</returns>
 public IEnumerable <PaymentOptionInfo> GetAll()
 {
     return(repositoryCacheHelper.CacheObjects(() =>
     {
         return paymentOptionInfoProvider.GetBySite(SiteContext.CurrentSiteID, true);
     }, $"{nameof(PaymentMethodRepository)}|{nameof(GetAll)}"));
 }
Beispiel #3
0
 /// <summary>
 /// Returns all states in country with given ID.
 /// </summary>
 /// <param name="countryId">Country identifier</param>
 /// <returns>Collection of all states in county.</returns>
 public IEnumerable <StateInfo> GetCountryStates(int countryId)
 {
     return(RepositoryCacheHelper.CacheObjects(() =>
     {
         return stateInfoProvider.Get().WhereEquals("CountryID", countryId);
     }, $"{nameof(KenticoCountryRepository)}|{nameof(GetCountryStates)}|{countryId}"));
 }
 /// <summary>
 /// Returns an enumerable collection of all personas.
 /// </summary>
 public IEnumerable <PersonaInfo> GetAll()
 {
     return(RepositoryCacheHelper.CacheObjects(() =>
     {
         return personaInfoProvider.Get();
     }, $"{nameof(KenticoPersonaRepository)}|{nameof(GetAll)}"));
 }
 /// <summary>
 /// Returns an enumerable collection of all enabled shipping options.
 /// </summary>
 /// <returns>Collection of enabled shipping options. See <see cref="ShippingOptionInfo"/> for detailed information.</returns>
 public IEnumerable <ShippingOptionInfo> GetAllEnabled()
 {
     return(RepositoryCacheHelper.CacheObjects(() =>
     {
         return shippingOptionInfoProvider.GetBySite(SiteContext.CurrentSiteID, true);
     }, $"{nameof(KenticoShippingOptionRepository)}|{nameof(GetAllEnabled)}"));
 }
Beispiel #6
0
 /// <summary>
 /// Returns an enumerable collection of a customer's addresses.
 /// </summary>
 /// <param name="customerId">Customer's identifier.</param>
 /// <returns>Collection of customer's addresses. See <see cref="AddressInfo"/> for detailed information.</returns>
 public IEnumerable <AddressInfo> GetByCustomerId(int customerId)
 {
     return(repositoryCacheHelper.CacheObjects(() =>
     {
         return addressInfoProvider.GetByCustomer(customerId);
     }, $"{nameof(CustomerAddressRepository)}|{nameof(GetByCustomerId)}|{customerId}"));
 }
Beispiel #7
0
 /// <summary>
 /// Returns a collection of option categories used in a product's variants.
 /// </summary>
 /// <param name="productId">SKU identifier of the variant's parent product.</param>
 /// <returns>Collection of option categories used in a product's variants. See <see cref="OptionCategoryInfo"/> for detailed information.</returns>
 public IEnumerable <OptionCategoryInfo> GetVariantOptionCategories(int productId)
 {
     return(repositoryCacheHelper.CacheObjects(() =>
     {
         // Get a list of option categories
         return VariantHelper.GetProductVariantsCategories(productId);
     }, $"{nameof(VariantRepository)}|{nameof(GetVariantOptionCategories)}|{productId}"));
 }
Beispiel #8
0
 /// <summary>
 /// Returns an enumerable collection of TopN orders of the given customer ordered by OrderDate descending.
 /// </summary>
 /// <param name="customerId">Customer's identifier.</param>
 /// <param name="count">Number of retrieved orders. Using 0 returns all records.</param>
 /// <returns>Collection of the customer's orders. See <see cref="OrderInfo"/> for detailed information.</returns>
 public IEnumerable <OrderInfo> GetByCustomerId(int customerId, int count = 0)
 {
     return(repositoryCacheHelper.CacheObjects(() =>
     {
         return orderInfoProvider.GetBySite(SiteContext.CurrentSiteID)
         .WhereEquals("OrderCustomerID", customerId)
         .TopN(count)
         .OrderByDescending(orderInfo => orderInfo.OrderDate);
     }, $"{nameof(OrderRepository)}|{nameof(GetByCustomerId)}|{customerId}|{count}"));
 }
        /// <summary>
        /// Returns all media files in the media library.
        /// </summary>
        /// <param name="mediaLibraryName">Name of the media library.</param>
        public IEnumerable <MediaFileInfo> GetMediaFiles(string mediaLibraryName)
        {
            return(RepositoryCacheHelper.CacheObjects(() =>
            {
                var mediaLibrary = GetByName(mediaLibraryName);

                if (mediaLibrary == null)
                {
                    throw new InvalidOperationException("Media library not found.");
                }

                return mediaFileInfoProvider.Get()
                .WhereEquals("FileLibraryID", mediaLibrary.LibraryID);
            }, $"{nameof(KenticoMediaFileRepository)}|{nameof(GetMediaFiles)}|{mediaLibraryName}"));
        }