Rock.Store.PackageService.GetPackage C# (CSharp) Méthode

GetPackage() public méthode

Gets a package from the store.
public GetPackage ( int packageId ) : Package
packageId int
Résultat Package
        public Package GetPackage( int packageId )
        {
            string error = null;
            return GetPackage( packageId, out error );
        }

Same methods

PackageService::GetPackage ( int packageId, string &errorResponse ) : Package

Usage Example

        private void DisplayPackageInfo()
        {
            string errorResponse = string.Empty;

            // check that store is configured
            if ( StoreService.OrganizationIsConfigured() )
            {

                PackageService packageService = new PackageService();
                var package = packageService.GetPackage( packageId, out errorResponse );

                // check for errors
                ErrorCheck( errorResponse );

                //lPackageName.Text = package.Name;
                imgPackageImage.ImageUrl = package.PackageIconBinaryFile.ImageUrl;

                if ( package.IsFree )
                {
                    //lCost.Text = "<div class='pricelabel free'><h4>Free</h4></div>";
                    lInstallMessage.Text = string.Format(_installFreeMessage, package.Name);
                }
                else
                {
                    //lCost.Text = string.Format( "<div class='pricelabel cost'><h4>${0}</h4></div>", package.Price );
                    lInstallMessage.Text = string.Format( _installPurchaseMessage, package.Name, package.Price.ToString() );
                }

                if ( package.IsPurchased )
                {
                    // check if it's installed
                    // determine the state of the install button (install, update, buy or installed)
                    InstalledPackage installedPackage = InstalledPackageService.InstalledPackageVersion( package.Id );

                    if ( installedPackage == null )
                    {
                        //lCost.Visible = false;
                        lInstallMessage.Text = _installPreviousPurchase;
                    }
                    else
                    {
                        //lCost.Visible = false;
                        lInstallMessage.Text = _updateMessage;
                        btnInstall.Text = "Update";
                    }

                }
            }
            else
            {
                var queryParams = new Dictionary<string, string>();
                queryParams.Add( "ReturnUrl", Request.RawUrl );

                NavigateToLinkedPage( "LinkOrganizationPage", queryParams );
            }
        }
All Usage Examples Of Rock.Store.PackageService::GetPackage