Beispiel #1
0
 /// <summary>
 /// Returns a public status with the specified name.
 /// </summary>
 /// <param name="name">The code name of the public status.</param>
 public PublicStatusInfo GetByName(string name)
 {
     return(repositoryCacheHelper.CacheObject(() =>
     {
         return publicStatusInfoProvider.Get(name, SiteContext.CurrentSiteID);
     }, $"{nameof(PublicStatusRepository)}|{nameof(GetByName)}|{name}"));
 }
Beispiel #2
0
 /// <summary>
 /// Returns the country with the specified ID.
 /// </summary>
 /// <param name="countryId">The identifier of the country.</param>
 /// <returns>The country with the specified ID, if found; otherwise, null.</returns>
 public CountryInfo GetCountry(int countryId)
 {
     return(repositoryCacheHelper.CacheObject(() =>
     {
         return countryInfoProvider.Get(countryId);
     }, $"{nameof(CountryRepository)}|{nameof(GetCountry)}|{countryId}"));
 }
Beispiel #3
0
 /// <summary>
 /// Returns instance of <see cref="MediaFileInfo"/> specified by library name.
 /// </summary>
 /// <param name="mediaLibraryName">Name of the media library.</param>
 public MediaLibraryInfo GetByName(string mediaLibraryName)
 {
     return(repositoryCacheHelper.CacheObject(() =>
     {
         return mediaLibraryInfoProvider.Get(mediaLibraryName, SiteContext.CurrentSiteID);
     }, $"{nameof(MediaFileRepository)}|{nameof(GetByName)}|{mediaLibraryName}"));
 }
Beispiel #4
0
 /// <summary>
 /// Returns the state with the specified code name.
 /// </summary>
 /// <param name="stateName">The code name of the state.</param>
 /// <returns>The state with the specified code name, if found; otherwise, null.</returns>
 public StateInfo GetState(string stateName)
 {
     return(RepositoryCacheHelper.CacheObject(() =>
     {
         return stateInfoProvider.Get(stateName);
     }, $"{nameof(KenticoCountryRepository)}|{nameof(GetState)}|{stateName}"));
 }
Beispiel #5
0
 /// <summary>
 /// Returns the country with the specified code name.
 /// </summary>
 /// <param name="countryName">The code name of the country.</param>
 /// <returns>The country with the specified code name, if found; otherwise, null.</returns>
 public CountryInfo GetCountry(string countryName)
 {
     return(RepositoryCacheHelper.CacheObject(() =>
     {
         return countryInfoProvider.Get(countryName);
     }, $"{nameof(KenticoCountryRepository)}|{nameof(GetCountry)}|{countryName}"));
 }
Beispiel #6
0
 /// <summary>
 /// Returns a customer's address with the specified identifier.
 /// </summary>
 /// <param name="addressId">Identifier of the customer's address.</param>
 /// <returns>Customer's address with the specified identifier. Returns <c>null</c> if not found.</returns>
 public AddressInfo GetById(int addressId)
 {
     return(repositoryCacheHelper.CacheObject(() =>
     {
         return addressInfoProvider.Get(addressId);
     }, $"{nameof(CustomerAddressRepository)}|{nameof(GetById)}|{addressId}"));
 }
 /// <summary>
 /// Returns a public status with the specified id.
 /// </summary>
 /// <param name="statusId">The id of the public status.</param>
 public PublicStatusInfo GetById(int statusId)
 {
     return(RepositoryCacheHelper.CacheObject(() =>
     {
         return publicStatusInfoProvider.Get(statusId);
     }, $"{nameof(KenticoPublicStatusRepository)}|{nameof(GetById)}|{statusId}"));
 }
 /// <summary>
 /// Returns media file with given identifier and site name.
 /// </summary>
 /// <param name="fileIdentifier">Identifier of the media file.</param>
 /// <param name="siteName">Site ID.</param>
 public MediaFileInfo GetMediaFile(Guid fileIdentifier, int siteId)
 {
     return(RepositoryCacheHelper.CacheObject(() =>
     {
         return mediaFileInfoProvider.Get(fileIdentifier, siteId);
     }, $"{nameof(KenticoMediaFileRepository)}|{nameof(GetMediaFile)}|{fileIdentifier}|{siteId}"));
 }
Beispiel #9
0
        /// <summary>
        /// Returns an order with the specified identifier.
        /// </summary>
        /// <param name="orderId">Order's identifier.</param>
        /// <returns><see cref="OrderInfo"/> object representing an order with the specified identifier. Returns <c>null</c> if not found.</returns>
        public OrderInfo GetById(int orderId)
        {
            return(repositoryCacheHelper.CacheObject(() =>
            {
                var orderInfo = orderInfoProvider.Get(orderId);

                if (orderInfo == null || orderInfo.OrderSiteID != SiteContext.CurrentSiteID)
                {
                    return null;
                }

                return orderInfo;
            }, $"{nameof(OrderRepository)}|{nameof(GetById)}|{orderId}"));
        }
        /// <summary>
        /// Returns a shipping option with the specified identifier.
        /// </summary>
        /// <param name="shippingOptionId">Shipping option's identifier.</param>
        /// <returns><see cref="ShippingOptionInfo"/> object representing a shipping option with the specified identifier. Returns <c>null</c> if not found.</returns>
        public ShippingOptionInfo GetById(int shippingOptionId)
        {
            return(RepositoryCacheHelper.CacheObject(() =>
            {
                var shippingInfo = shippingOptionInfoProvider.Get(shippingOptionId);

                if (shippingInfo == null || shippingInfo.ShippingOptionSiteID != SiteContext.CurrentSiteID)
                {
                    return null;
                }

                return shippingInfo;
            }, $"{nameof(KenticoShippingOptionRepository)}|{nameof(GetById)}|{shippingOptionId}"));
        }
Beispiel #11
0
        /// <summary>
        /// Returns a payment method with the specified identifier.
        /// </summary>
        /// <param name="paymentMethodId">Payment method's identifier.</param>
        /// <returns><see cref="PaymentOptionInfo"/> object representing a payment method with the specified identifier. Returns <c>null</c> if not found.</returns>
        public PaymentOptionInfo GetById(int paymentMethodId)
        {
            return(repositoryCacheHelper.CacheObject(() =>
            {
                var paymentInfo = paymentOptionInfoProvider.Get(paymentMethodId);

                if (paymentInfo?.PaymentOptionSiteID == SiteContext.CurrentSiteID)
                {
                    return paymentInfo;
                }

                if (paymentInfo?.PaymentOptionSiteID == 0 && ECommerceSettings.AllowGlobalPaymentMethods(SiteContext.CurrentSiteID))
                {
                    return paymentInfo;
                }

                return null;
            }, $"{nameof(PaymentMethodRepository)}|{nameof(GetById)}|{paymentMethodId}"));
        }