Exemplo n.º 1
0
 public _userInfo(Generics.User _user, CurrencyConfig currency)
 {
     this.currency = currency.Id;
     this.balance  = currency.DefaultBalance;
     Table         = "currency_account";
     this.user     = CacheHandler.FindAccount(_user);
 }
Exemplo 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);
        }
Exemplo n.º 3
0
        public static CurrencyConfig FindCurrency(uint currencyId)
        {
            CurrencyConfig _currency = Find(_currencyCache, x => x.Id == currencyId);

            if (_currency == null)
            {
                _currency = CurrencyConfig.Find(currencyId);
                if (_currency != null)
                {
                    _currencyCache.Add(_currency, DateTime.Now);
                }
            }

            return(_currency);
        }
Exemplo n.º 4
0
        public static CurrencyConfig Find(uint curid)
        {
            List <Tuple <string, object> > Params = new List <Tuple <string, object> > {
                new Tuple <string, object>("@0", curid)
            };
            List <object[]> Data = SQL.pubInstance.Read("SELECT * FROM currency_config WHERE currency_id = @0", Params);

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

            CurrencyConfig u = new CurrencyConfig();

            u.SetValues(Data[0]);

            return(u);
        }
Exemplo n.º 5
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);
        }