Beispiel #1
0
        /// <summary>
        /// Override the load event of the page
        /// </summary>
        /// <param name="e"></param>
        protected override void OnLoad(EventArgs e)
        {
            ApplicationSettings settings = (ApplicationSettings)SessionManager.GetSessionValueRedirect((IndBasePage)this, SessionStrings.APPLICATION_SETTINGS);

            if (settings == null)
            {
                return;//the page should be already redirected.
            }
            base.OnLoad(e);

            try
            {
                if (SessionManager.GetSessionValueNoRedirect(this, SessionStrings.CONNECTION_MANAGER) == null)
                {
                    SessionConnectionHelper sessionConnectionHelper = new SessionConnectionHelper();
                    object connectionManager = sessionConnectionHelper.GetNewConnectionManager(settings.ConnectionString, settings.CommandTimeout);
                    SessionManager.SetSessionValue(this, SessionStrings.CONNECTION_MANAGER, connectionManager);
                }

                //If there is no user information in the session
                if (BuildCurrentUserSession())
                {
                    BuildUserSettingsSession();
                }


                //Store the default accounts into the application list
                if (Application[SessionStrings.DEFAULT_ACCOUNTS] == null)
                {
                    object connectionManager = SessionManager.GetConnectionManager(this);
                    Application[SessionStrings.DEFAULT_ACCOUNTS] = EntityUtils.GetDefaultAccounts(connectionManager);
                }
                //Store the exportable catalog codes
                if (Application[SessionStrings.EXPORTABLE_CATALOG_CODES] == null)
                {
                    Application[SessionStrings.EXPORTABLE_CATALOG_CODES] = EntityUtils.GetExportableCatalogs();
                }
            }
            catch (IndException indExc)
            {
                this.ShowError(indExc);
                PageLoadSucceeded = false;
                return;
            }
            catch (Exception exc)
            {
                this.ShowError(new IndException(exc));
                PageLoadSucceeded = false;
                return;
            }
        }
 public void Initialize()
 {
     sessionConnectionHelper = new SessionConnectionHelper();
     connManager             = sessionConnectionHelper.GetNewConnectionManager(BLTestUtils.ConnString, BLTestUtils.COMMAND_TIMEOUT);
 }