Ejemplo n.º 1
0
 public static _userInfo AddUser(_userInfo user)
 {
     user.Insert();
     user = _userInfo.Find(user.user.user, user.currency);
     _userCache.Add(user, DateTime.Now);
     return(user);
 }
Ejemplo n.º 2
0
        public static _userInfo[] FindUsers(User[] users, CurrencyConfig currency)
        {
            _userInfo[] _uInfos = new _userInfo[users.Length];

            for (int i = 0; i < users.Length; i++)
            {
                _uInfos[i] = FindUser(users[i], currency);
            }

            return(_uInfos);
        }
Ejemplo n.º 3
0
        public static _userInfo Find(User user, uint curid)
        {
            UserAccount A = CacheHandler.FindAccount(user);

            List <Tuple <string, object> > Params = new List <Tuple <string, object> > {
                new Tuple <string, object>("@0", A.Id),
                new Tuple <string, object>("@1", curid)
            };
            List <object[]> Data = SQL.pubInstance.Read("SELECT * FROM currency_account WHERE currency_user = @0 AND currency_id = @1", Params);

            if (Data.Count == 0)
            {
                return(null);
            }

            _userInfo u = new _userInfo();

            u.SetValues(Data[0]);

            return(u);
        }
Ejemplo n.º 4
0
        public static _userInfo FindUser(User user, CurrencyConfig currency)
        {
            _userInfo _uInfo = Find(_userCache, x => x.user.Equals(user) && x.currency == currency.Id);

            if (_uInfo == null)
            {
                _uInfo = _userInfo.Find(user, currency.Id);
                if (_uInfo != null)
                {
                    _userCache.Add(_uInfo, DateTime.Now);
                }
            }

            if (_uInfo == null)
            {
                _uInfo = new _userInfo(user, currency);
                return(AddUser(_uInfo));
            }

            return(_uInfo);
        }