Ejemplo n.º 1
0
        public __tuple <ErrorCode_, Account> _loginAccount(string nAccountName, string nPassward, uint nDeviceType)
        {
            ErrorCode_ errorCode_ = this._checkDevice(nDeviceType);

            if (ErrorCode_.mSucess_ == errorCode_)
            {
                __tuple <SqlStatus_, AccountB> accountDB_ = this._LoginAccountB(nAccountName);
                errorCode_ = this._getErrorCode(accountDB_._get_0());
                if (ErrorCode_.mSucess_ == errorCode_)
                {
                    AccountB accountB_ = accountDB_._get_1();
                    errorCode_ = accountB_._checkPassward(nPassward);
                }
            }
            Account account_ = null;

            if (ErrorCode_.mSucess_ == errorCode_)
            {
                uint accountId_ = AccountB._accountId(nAccountName);
                account_ = this._getAccount(accountId_);
                if (null == account_)
                {
                    account_ = new Account();
                    account_._setAccountId(accountId_);
                    account_._addDeviceType(nDeviceType);
                    mAccounts[accountId_] = account_;
                }
                account_._setTicks(DateTime.Now.Ticks);
            }
            return(new __tuple <ErrorCode_, Account>(errorCode_, account_));
        }
Ejemplo n.º 2
0
        public Account _getAccount(string nAccountName)
        {
            Account result_    = null;
            uint    accountId_ = AccountB._accountId(nAccountName);

            if (mAccounts.ContainsKey(accountId_))
            {
                result_ = mAccounts[accountId_];
            }
            return(result_);
        }
Ejemplo n.º 3
0
        public ErrorCode_ _createAccount(string nAccountName, string nNickname, string nPassward)
        {
            AccountB accountB_ = new AccountB();

            accountB_._setAccountName(nAccountName);
            accountB_._setNickName(nNickname);
            accountB_._setPassward(nPassward);
            accountB_._setMgrId(mId);
            accountB_._setTicks(DateTime.Now.Ticks);

            MySqlInsert mySqlInsert_ = new MySqlInsert();

            mySqlInsert_._selectStream(accountB_._streamName());
            accountB_._serialize(mySqlInsert_);

            MySqlSingleton mySqlSingleton_ = __singleton <MySqlSingleton> ._instance();

            SqlStatus_ sqlStatus_ = mySqlSingleton_._runSql(mySqlInsert_);

            return(_getErrorCode(sqlStatus_));
        }
Ejemplo n.º 4
0
        __tuple <SqlStatus_, AccountB> _LoginAccountB(string nAccountName)
        {
            AccountB accountB_ = new AccountB();

            accountB_._setMgrId(mId);
            accountB_._setAccountName(nAccountName);

            MySqlSelect mySqlSelect_ = new MySqlSelect();

            mySqlSelect_._selectStream(accountB_._streamName());
            accountB_._serialize(mySqlSelect_);

            MySqlWhere mySqlWhere_ = new MySqlWhere();

            mySqlWhere_._selectStream(accountB_._loginWhere());

            MySqlSingleton mySqlSingleton_ = __singleton <MySqlSingleton> ._instance();

            SqlStatus_ sqlStatus_ = mySqlSingleton_._runSql(mySqlSelect_, mySqlWhere_, accountB_);

            return(new __tuple <SqlStatus_, AccountB>(sqlStatus_, accountB_));
        }