Ejemplo n.º 1
0
 public ViewSubAccountManage(IViewFactory viewFacktory, IUserSubAccountBll subAccountBll)
 {
     InitializeComponent();
     _viewFacktory  = viewFacktory;
     _subAccountBll = subAccountBll;
     Init();
 }
Ejemplo n.º 2
0
 public ViewAddSubAccount(IUserSubAccountBll subAccountBll, IAreaBll areaBll)
 {
     InitializeComponent();
     _subAccountBll = subAccountBll;
     _areaBll       = areaBll;
     Init();
 }
Ejemplo n.º 3
0
        public ViewOptMain(IViewFactory viewFactory, IUserSubAccountBll subAccountBll,
                           IAreaBll areaBll, IRemoteOperationBll remoteOperationBll, IShopBll shopBll,
                           IOrderRecordBll orderRecordBll, IOrderStateBll orderStateBll, IGlobalApplicationData globalApplicationData)
        {
            InitializeComponent();

            _viewFactory           = viewFactory;
            _subAccountBll         = subAccountBll;
            _areaBll               = areaBll;
            _remoteOperationBll    = remoteOperationBll;
            _shopBll               = shopBll;
            _orderRecordBll        = orderRecordBll;
            _orderStateBll         = orderStateBll;
            _globalApplicationData = globalApplicationData;
            Init();
        }
Ejemplo n.º 4
0
        public GoldCalculator(IUserSubAccountBll subAccountBll,
                              IUserBll userBll, IHangUpTimeBll hangUpTimeBll)
        {
            _subAccountBll = subAccountBll;
            _userBll       = userBll;
            _hangUpTimeBll = hangUpTimeBll;
            _creator       = userId =>
            {
                return(_subAccountBll.Count(userId));
            };

            _timer = new Timer(obj =>
            {
                if (InterlockedEx.IfThen(ref _isExecuted, 1, 1))
                {
                    return;
                }

                Interlocked.Increment(ref _isExecuted);

                try
                {
                    foreach (var sessionId in Global.GetConnectedClientUserId())
                    {
                        if (sessionId.LastCalcTime.Value.AddMinutes(10) <= DateTime.Now)
                        {
                            _hangUpTimeBll.Add(new HangUpTime
                            {
                                UserId  = sessionId.Id,
                                Minutes = 10
                            });

                            var count = CacheManager.GetSubAccountCount(sessionId.Id, _creator);
                            int gold  = 0;
                            if (count == 1)
                            {
                                gold = 5;
                            }
                            else if (count == 2)
                            {
                                gold = 8;
                            }
                            else if (count >= 3)
                            {
                                gold = 13;
                            }

                            if (gold != 0)
                            {
                                _userBll.UpdateGold(sessionId.Id, gold);
                            }

                            sessionId.LastCalcTime = sessionId.LastCalcTime.Value.AddMinutes(10);
                        }
                    }
                }
                catch (Exception ex)
                {
                    Global.Resolve <ILoggerFactory>()
                    .GetCurrentClassLogger()
                    .ErrorException("GoldCalculator Timer Callback.", ex);
                }
                finally
                {
                    Interlocked.Decrement(ref _isExecuted);
                }
            }, null, Timeout.Infinite, CalculatePeriod);
        }
 public UserSubAccountMessageFilter(IUserSubAccountBll userSubAccountBll)
 {
     _userSubAccountBll = userSubAccountBll;
 }
Ejemplo n.º 6
0
 public UserSubAccountMessageFilter(IUserSubAccountBll subAccountBll, IShopBll shopBll)
 {
     _subAccountBll = subAccountBll;
     _shopBll       = shopBll;
 }