示例#1
0
        /// <summary>
        /// Returns the Logon Message for a certain LanguageCode.
        /// </summary>
        /// <param name="ALanguageCode">LanguageCode for which the LogonMessage should be returned</param>
        /// <param name="AReturnEnglishIfNotFound">Returns the LogonMessage in English if no
        /// LogonMessage was found for the specified LanguageCode</param>
        /// <param name="ATransaction">Instantiated DB Transaction.</param>
        /// <returns>The LogonMessage
        /// </returns>
        public String GetLogonMessage(String ALanguageCode, Boolean AReturnEnglishIfNotFound, TDBTransaction ATransaction)
        {
            String             ReturnValue;
            SLogonMessageTable LogonMessageTable;

            try
            {
                if (SLogonMessageAccess.Exists(ALanguageCode, ATransaction))
                {
                    LogonMessageTable = SLogonMessageAccess.LoadByPrimaryKey(ALanguageCode, ATransaction);
                    ReturnValue       = LogonMessageTable[0].LogonMessage;
                }
                else
                {
                    if (AReturnEnglishIfNotFound)
                    {
                        LogonMessageTable = SLogonMessageAccess.LoadByPrimaryKey("EN", ATransaction);
                        ReturnValue       = LogonMessageTable[0].LogonMessage;
                    }
                    else
                    {
                        ReturnValue = "";
                    }
                }
            }
            catch (Exception exp)
            {
                TLogging.Log("TMaintenanceLogonMessage.GetLogonMessage: Error loading Logon Message! " + "Possible cause: " + exp.ToString());
                return("");
            }

            return(ReturnValue);
        }
示例#2
0
        /// <summary>
        /// Returns the Logon Message for a certain LanguageCode.
        ///
        /// </summary>
        /// <param name="ALanguageCode">LanguageCode for which the LogonMessage should be returned</param>
        /// <param name="AReturnEnglishIfNotFound">Returns the LogonMessage in English if no
        /// LogonMessage was found for the specified LanguageCode</param>
        /// <returns>The LogonMessage
        /// </returns>
        public String GetLogonMessage(String ALanguageCode, Boolean AReturnEnglishIfNotFound)
        {
            String             ReturnValue;
            TDBTransaction     ReadTransaction;
            Boolean            NewTransaction = false;
            SLogonMessageTable LogonMessageTable;

            try
            {
                ReadTransaction = DBAccess.GDBAccessObj.GetNewOrExistingTransaction(IsolationLevel.ReadCommitted,
                                                                                    TEnforceIsolationLevel.eilMinimum,
                                                                                    out NewTransaction);
                try
                {
                    if (SLogonMessageAccess.Exists(ALanguageCode, ReadTransaction))
                    {
                        LogonMessageTable = SLogonMessageAccess.LoadByPrimaryKey(ALanguageCode, ReadTransaction);
                        ReturnValue       = LogonMessageTable[0].LogonMessage;
                    }
                    else
                    {
                        if (AReturnEnglishIfNotFound)
                        {
                            LogonMessageTable = SLogonMessageAccess.LoadByPrimaryKey("EN", ReadTransaction);
                            ReturnValue       = LogonMessageTable[0].LogonMessage;
                        }
                        else
                        {
                            ReturnValue = "";
                        }
                    }
                }
                catch (Exception exp)
                {
                    TLogging.Log("TMaintenanceLogonMessage.GetLogonMessage: Error loading Logon Message! " + "Possible cause: " + exp.ToString());
                    return("");
                }
            }
            finally
            {
                if (NewTransaction)
                {
                    DBAccess.GDBAccessObj.CommitTransaction();
                    TLogging.LogAtLevel(8, "TMaintenanceLogonMessage.GetLogonMessage: committed own transaction.");
                }
            }
            return(ReturnValue);
        }