Table of Contents

Class BudaApplication

Namespace
PolarStudio
Assembly
PolarStudio.dll

An instanced application opened for a specific user. Use pContext.Session.OpenApplication() to create a new BudaApplication.

public class BudaApplication : IDisposable, PolarWeakEventListener
Inheritance
BudaApplication
Implements
Inherited Members
Extension Methods

Fields

ReportEngineAdminGroupPIDs

In ReportEngineAdminGroupPIDs a semi-colon separated list of GroupPID's can be specified for the groups that are allowed to edit the reports, for example: pContext.Application.ReportEngineAdminGroupPIDs = "Admins;PowerUsers"

public string ReportEngineAdminGroupPIDs

Field Value

string

ReportEngineStorageQuery

In ReportEngineStorageQuery, an Updatable Query-text can be set that is used to retrieve the definition for the reports, as in: SELECT Value FROM Settings WHERE Name = 'ReportsDefinitionXML' Make sure this Property is set before the user opens the Reports, for example in the OnOpenApplication-event. If this property is empty, a file in the file-system will be used. Instead of a Query-text, also a FileName in the file-system can be specified. Make sure the given file name ends on '.xml'

public string ReportEngineStorageQuery

Field Value

string

Properties

ApplicationAccessGUID

A GUID used to pinpoint this ApplicationAccess. Used for getting/setting user-settings.

public string ApplicationAccessGUID { get; set; }

Property Value

string

ApplicationID

The ApplicationID used internally in the repository

public int ApplicationID { get; }

Property Value

int

ApplicationPID

The internally used PID. This is a string-like GUID or identifier.

public string ApplicationPID { get; }

Property Value

string

DataConnector

The DataConnector is the connection used for this application to communicate with the attached database.

public DataConnector DataConnector { get; }

Property Value

DataConnector

Engine

The Engine that holds this BudaApplication

public BudaEngine Engine { get; }

Property Value

BudaEngine

GUID

A GUID for the current Application-instance. Is used internally for for example the Locking table.

public string GUID { get; }

Property Value

string

Group

The Group (user-group) the current user is part of. A user is always part of exactly one Group.

public BudaGroup Group { get; }

Property Value

BudaGroup

MessagesProfile

Returns the messages profile for the current session

public string MessagesProfile { get; set; }

Property Value

string

Name

The Name of this application (SystemName) as defined in the repository

public string Name { get; }

Property Value

string

PrivateRecordID

To get/set the PrivateRecordID for the user. Must be a Int/Long or Null

public object PrivateRecordID { get; set; }

Property Value

object

Session

The Session for the current logged on user.

public BudaSession Session { get; }

Property Value

BudaSession

Settings

The Settings property gives access to the repository-object representing the current application.

public repApplication Settings { get; }

Property Value

repApplication

SettingsForGroup

The SettingsForGroup property gives access to the repository-object representing the group-specific setting for the current application for the current user.

public repApplicationSettings SettingsForGroup { get; }

Property Value

repApplicationSettings

ShowDeletedRecords

When SoftDeletes are used in the application (where deletions do not actually delete the record from the database but only flag the record as Deleted), these deleted records can be made visible by setting this property to True.

public bool ShowDeletedRecords { get; set; }

Property Value

bool

SupportRecordLocking

A boolean to get/set the feature of RecordLocking for the current application-instance.

public bool SupportRecordLocking { get; set; }

Property Value

bool

Tag

The Tag is available for scripted use and can be filled with any text.

public string Tag { get; set; }

Property Value

string

UserSettings

The UserSettings object provides a standardized way to get/set settings for this application for the current user. Settings are Name/Value pairs of String/String.

public UserSettings UserSettings { get; }

Property Value

UserSettings

Variables

The Variables can be used to store custom information in the BudaApplication

public Dictionary Variables { get; }

Property Value

Dictionary

Methods

Destruct()

To free resources, the Destruct must be called whenever the DataSet is not used anymore. In Polar Studio it is advised to use a Using-block with the OpenDataset to ensure destruction.

public void Destruct()

Dispose()

Used to dispose the Application. Is equal to Destruct.

public void Dispose()

~BudaApplication()

protected ~BudaApplication()

GetMessage(string, object, string)

To get a message from this BudaApplication

public string GetMessage(string pMessage, object pContext = null, string pDefaultValue = null)

Parameters

pMessage string

The message to parse, like: ^MyMessageName This is <^MyMessageName> <%Now%>

pContext object

The Context to use for included script-expressions. If no pContext is given, script-expressions will not be parsed.

pDefaultValue string

If requesting a single message (like ^MyMessage) and this message is not found, by default an error-message is returned like '***Message not found'. With specifying pDefaultValue, this error will be replaced by the given default.

Returns

string

HasLock(BudaDataSet, long?)

Returns a boolean indicating the specified RecordID in the given pDataSet has a lock

public bool HasLock(BudaDataSet pDataSet, long? pRecordID = null)

Parameters

pDataSet BudaDataSet

The DataSet to search for

pRecordID long?

The RecordID. If not specified, the current RecordID will be chekced.

Returns

bool

LockRecord(BudaDataSet, long?)

When using RecordLocking, LockRecord and UnlockRecord can be used to specifically Lock and Unlock a record. Is normally called internally.

public string LockRecord(BudaDataSet pDataSet, long? pRecordID = null)

Parameters

pDataSet BudaDataSet

The DataSet for which to lock the record

pRecordID long?

The optional RecordID to lock if it is not the current record that has to be locked.

Returns

string

OpenDataSet(object, BudaDataSet, string, bool, object, string, string, string, bool, string, object, string, bool, Form)

To open a dataset use this OpenDataSet method.

public BudaDataSet OpenDataSet(object pTableID, BudaDataSet pParentDataSet = null, string pFollowedRelationship = "", bool pGotoRelatedTable = false, object pActivateRecordID = null, string pGroupIdentifier = "", string pPreGroupingOrder = "", string pBaseFilter = "", bool pSuppressDefaultFilter = false, string pTableOrder = "", object pRequireFilter = null, string pDefaultPredefinedFilter = "", bool pSuppressViewConditions = false, Form pForm = null)

Parameters

pTableID object

The TableID (Int, as stored in the reporitory or a String representing the unique name)

pParentDataSet BudaDataSet

When this dataset is opened from another dataset, for example to get the child-records or to get the dataset for a foreign key, the pParentDataSet can be specified. Polar Studio will automatically set the Where Clause for the opened DataSet and when Inserting in a set of child-records, the foreign key to this dataset is automatically set. If pParentDataSet is given, then also parameters pFollowedRelationship and pGotoRelatedTable must be specified.

pFollowedRelationship string

If a relationship is 'followed', as going to child-records or going to a foreign key, then the name of the followed relationship MUST be specified. This name is the name as set in Polar Studio.

pGotoRelatedTable bool

A boolean indicating to go to a set of child-records (true) or to go to the foreign key (false). Is used in combination with pParentDataSet and pFollowedRelationship

pActivateRecordID object

The ID of the record to initially activate. Use Int or Null/Empty. Polar Studio will try to activate this specific record, but no error is raised if it does not succeed.

pGroupIdentifier string

The GroupIdentifier is a SQL expression that returns a string to identify a group of records. Is used withing PolarStudio internally.

pPreGroupingOrder string

When Grouping is used (pGroupIdentifier is specified), the SQL Group-By clause in pPreGroupingOrder can be used to ensure a specific Order. Is used withing PolarStudio internally.

pBaseFilter string

The base-filter for this dataset. Cannot be 'removed' by user-actions. A SQL Expression, like: Customer.CountryID IN (SELECT Country.CountryID FROM Country WHERE Country.Region = 3)

pSuppressDefaultFilter bool

In Polar Studio, a default filter can be specified for a table. When opening a dataset, this filter is always applied by default. To suppress this default filter, set pSuppressDefaultFilter to True

pTableOrder string

A SQL Order-By expression to set a specific order of the returned records.

pRequireFilter object

Used for the user-interface, to suppress showing forms without any filtering. In an application where millions of customers are in the database, it is useless to open the customers-form without searching first.

pDefaultPredefinedFilter string

In Polar Studio, predefined filters can be created. If wanted, then name one of these filters can be specified to be applied.

pSuppressViewConditions bool

When opening a dataset, all view conditions for the current user are applied. Sometimes when opening a dataset in script, it is needed to go beyond these restrictions. To do so, the pSuppressViewConditions can be set to True.

pForm Form

The form that contains this dataset. Is used withing PolarStudio internally.

Returns

BudaDataSet

BudaDataSet

Exceptions

PolarException

When the dataset cannot be opened, for example because of a database error or when the user has no access to this table (and pSuppressViewConditions is not set to True), an exception is raised.

OpenDynamicRecordSet(string)

To open a Dynamic Recordset on the database connection for this application.

public Recordset OpenDynamicRecordSet(string pSQLstring)

Parameters

pSQLstring string

The full query

Returns

Recordset

OpenStaticRecordSet(string)

To open a Static Recordset on the database connection for this application.

public Recordset OpenStaticRecordSet(string pSQLstring)

Parameters

pSQLstring string

The full query

Returns

Recordset

ReNewLocks()

To ReNew the locks for the current application-instance. Locks have a limited lifetime. If not renewed in time, they will expire (after 5 minutes). The ReNewLocks is called with each user request and in the KeepAlive processing.

public void ReNewLocks()

UnlockRecord(string, long?)

To release a lock in the RecordLocking table.

public void UnlockRecord(string pDataSetGUID = "", long? pRecordID = null)

Parameters

pDataSetGUID string

The dataset to release the lock for. If not specified, all RecordLocks for the current application are released.

pRecordID long?

The RecordID to release the lock for. If not specified, all RecordLocks for the current dataset are released.