Example #1
0
        public static Auth GetAuth(string sessionId)
        {
            Auth      auth      = null;
            AuthCache authCache = (AuthCache) new AuthCache().GetData();
            int       index     = authCache.dvAuthBy_SessionId.Find(sessionId);
            bool      flag      = index >= 0;

            if (flag)
            {
                Auth auth2 = new Auth();
                auth = AuthUtils.GetObject(authCache.dvAuthBy_SessionId[index].Row);
            }
            return(auth);
        }
Example #2
0
        internal static Auth SelectAuth(string sessionId)
        {
            Database database = LogicContext.GetDatabase();
            HSQL     sql      = new HSQL(database);

            sql.Add("select AUTH_SESSIONID,AUTH_USERID,USERS_USERNAME,AUTH_LOGINTIME,AUTH_LOGINTYPE,AUTH_CLIENTIP,AUTH_CLIENTNAME,AUTH_DBID");
            sql.Add(",AUTH_LASTREFRESH,AUTH_LASTREQUEST,AUTH_UPDATETIME,AUTH_EXINFO");
            sql.Add("from AUTH,USERS");
            sql.Add("where AUTH_SESSIONID=:AUTH_SESSIONID AND AUTH_USERID = USERS_USERID");
            sql.ParamByName("AUTH_SESSIONID").Value = sessionId;
            DataTable dataTable = database.OpenDataSet(sql).Tables[0];
            bool      flag      = dataTable.Rows.Count > 0;
            Auth      result;

            if (flag)
            {
                result = AuthUtils.GetObject(dataTable.Rows[0]);
            }
            else
            {
                result = null;
            }
            return(result);
        }