Пример #1
0
        }       //	close

        /// <summary>
        /// Reset Cache
        /// </summary>
        /// <param name="finalCall">everything otherwise login data remains</param>
        public static void Reset(bool finalCall)
        {
            _log.Info("finalCall=" + finalCall);
            // CloseWindows();
            _sWindows.Clear();

            //	Clear all Context
            if (finalCall)
            {
                _sCtx.Clear();
            }
            else        //	clear window context only
            {
                Object[] keys = _sCtx.KeySet().ToArray();
                for (int i = 0; i < keys.Length; i++)
                {
                    String tag = keys[i].ToString();
                    //if (Character.isDigit(tag.charAt(0)))
                    if (char.IsDigit(Convert.ToChar(tag.Substring(0, Convert.ToInt32(tag.Length - (tag.Length - 1))))))
                    {
                        _sCtx.Remove(keys[i].ToString());
                    }
                }
            }

            //	Cache
            CacheMgt.Get().Reset();
            DataBase.DB.CloseTarget();
            //	Reset Role Access
            if (!finalCall)
            {
                //DataBase.DB.SetDBTarget(CConnection.get());
                //DataBase.DB.SetDBTarget(DataBase.DB.GetConnection());
                MRole defaultRole = MRole.GetDefault(_sCtx, false);
                if (defaultRole != null)
                {
                    defaultRole.LoadAccess(true);       //	Reload
                }
            }
        }