Retrieving the 'SiteKey' of an OpenPetra installation

From OpenPetra Wiki
Revision as of 10:10, 23 August 2012 by Tim-ingham (talk | contribs)
Jump to navigation Jump to search

Overview

Each installation of OpenPetra is installed for a particular 'Site' - that is an office of your organisation.

  • An instance of the OpenPetra Server runs for one Site, and all OpenPetra Clients that access that OpenPetra Server are tied to that Site.
  • The Site is set up in the System Manager Module when OpenPetra is installed for an office.
  • The Site is identified in OpenPetra with a SiteKey, which is the PartnerKey of the Partner (of PartnerClass 'UNIT') that represents that office.

The SiteKey is needed by OpenPetra's software engineers in various circumstances and this page describes how to access it.

Accessing the Site Key on Client Side

Int64 SiteKey = Convert.ToInt64(TSystemDefaults.GetSystemDefault(SharedConstants.SYSDEFAULT_SITEKEY));

(TSystemDefaults is found in Namespace Ict.Petra.Client.App.Core)

Accessing the Site Key on Server Side

Int64 SiteKey = DomainManager.GSiteKey;

(DomainManager is found in Namespace Ict.Petra.Server.App.Core)

Accessing the Country Code of this office

On the server, call TAddressTools.GetCountryCodeFromSiteLedger(ATransaction), or if you don't have a transaction handy, you can call TPartnerServerLookups.GetCountryCodeFromSiteLedger() which uses a new or existing transaction.

This method uses the DomainManager (above) to find the site key, and uses this to call

string GetCountryCodeFromLedger(TDBTransaction ATransaction, Int32 LedgerNumber)

On the client, the ServerLookups method is accessible:

string LocalCountryCode = TRemote.MPartner.Partner.ServerLookups.WebConnectors.GetCountryCodeFromSiteLedger();