Rock.Store.StoreService.GetOrganizationKey C# (CSharp) Method

GetOrganizationKey() public static method

Gets the organization key.
public static GetOrganizationKey ( ) : string
return string
        public static string GetOrganizationKey()
        {
            var globalAttributes = Rock.Web.Cache.GlobalAttributesCache.Read();
            return globalAttributes.GetValue( "StoreOrganizationKey" );
        }

Usage Example

Esempio n. 1
0
        /// <summary>
        /// Gets the package.
        /// </summary>
        /// <param name="packageId">The package identifier.</param>
        /// <param name="errorResponse">The error response.</param>
        /// <returns></returns>
        public Package GetPackage(int packageId, out string errorResponse)
        {
            errorResponse = string.Empty;

            var storeKey = StoreService.GetOrganizationKey();
            var response = ExecuteRestGetRequest <Package>($"api/Packages/GetPackageDetails/{packageId}/{storeKey}/true", null);

            var package = new Package();

            if (response.ResponseStatus == ResponseStatus.Completed)
            {
                package = response.Data;
                // If the key is null null out the price so it can't be installed.
                if (storeKey.IsNullOrWhiteSpace())
                {
                    if (!package.IsFree)
                    {
                        package.Price = null;
                    }
                }
            }
            else
            {
                errorResponse = response.ErrorMessage;
            }
            return(package);
        }
All Usage Examples Of Rock.Store.StoreService::GetOrganizationKey