public DatabaseSession GetDatabaseSession()
        {
            string Function_Name = "GetDatabaseSession";

            LogHelper.Trace(CLASS_NAME, Function_Name, "Function_Entered");

            bool bConnected = false;
            int  nTrytimes  = 0;

            while (!bConnected && nTrytimes++ <= MAX_TIMES)
            {
                DatabaseSession currentSession = m_sessionStore.GetCurrentSession();
                if (currentSession != null && currentSession.IsTransactionOpen())
                {
                    LogHelper.Debug(CLASS_NAME, Function_Name, "Transaction open in current Session");
                    if (currentSession.CheckDatabaseConnection())
                    {
                        LogHelper.Trace(CLASS_NAME, Function_Name, "Function_Exited");
                        return(currentSession);
                    }
                }
                else
                {
                    string connectionString = DBConnectionStrings.GetInstance().GetConnectionString();
                    if (connectionString != null)
                    {
                        DatabaseSession session = m_sessionStore.GetSession(connectionString);
                        if (session == null)
                        {
                            CreateDatabaseSession(connectionString);
                            session = m_sessionStore.GetSession(connectionString);
                        }
                        if (session.CheckDatabaseConnection())
                        {
                            /*if (m_DBSwitched.Length != 0 && (m_DBSwitched == connectionString))
                             * {
                             *  m_DBSwitched = "";
                             * }*/
                            m_sessionStore.StoreCurrentSession(session);
                            LogHelper.Trace(CLASS_NAME, Function_Name, "Function_Exited");
                            return(session);
                        }
                        else
                        {
                            // m_DBSwitched = connectionString;
                            // DBConnectionStrings.GetInstance().UpdateDBStatus(connectionString, DBStatus.DB_OFFLINE);
                        }
                    }
                }
            }
            throw new DatabaseConnectionException("No Database Connection");
        }
        public static void ReleaseInstance()
        {
            string Function_Name = "ReleaseInstance";

            LogHelper.Trace(CLASS_NAME, Function_Name, "Function_Entered");
            lock (s_Singleton)
            {
                if (s_DBConnectionStrings != null)
                {
                    s_DBConnectionStrings = null;
                }
            }
            LogHelper.Trace(CLASS_NAME, Function_Name, "Function_Exited");
        }
        public static DBConnectionStrings GetInstance()
        {
            string Function_Name = "GetInstance";

            LogHelper.Trace(CLASS_NAME, Function_Name, "Function_Entered");
            lock (s_Singleton)
            {
                if (s_DBConnectionStrings == null)
                {
                    s_DBConnectionStrings = new DBConnectionStrings();
                }
            }
            LogHelper.Trace(CLASS_NAME, Function_Name, "Function_Exited");
            return(s_DBConnectionStrings);
        }