예제 #1
0
        public void StartYakkrTicker(YakkrTickerModel model)
        {
            _yakkrDictionary.TryAdd(model.AppUserState.ConnectionId, model);


            BroadcastYakkrTicker();
        }
예제 #2
0
        public IEnumerable <YakkrTickerModel> GetYakkrTickerData(YakkrTickerModel model)
        {
            model.YakkrCount = Convert.ToString(Utilities.Helper.GetYakkrCountByUserId(model.AppUserState.UserId, model.AppUserState.AgencyId));

            return(new List <YakkrTickerModel> {
                model
            });
        }
예제 #3
0
        public override Task OnReconnected()
        {
            string name        = Context.User.Identity.Name;
            var    connections = _connections.GetConnections(name);

            if (connections.Where(x => x.ConnectionId == Context.ConnectionId).Any())
            {
                _connections.Add(name, connections.Where(x => x.ConnectionId == Context.ConnectionId).FirstOrDefault());
                YakkrTickerModel model = new YakkrTickerModel();
                model.AppUserState = connections.Where(x => x.ConnectionId == Context.ConnectionId).FirstOrDefault();
                _yakkrTicker.AddYakkrTickerClient(Context.ConnectionId, model);
            }

            return(base.OnConnected());
        }
예제 #4
0
        public void Initialize(AppUserState appUserState)
        {
            var contexts = _connections.GetConnections(Context.User.Identity.Name).Where(x => x.ConnectionId == Context.ConnectionId && x.UserRoleType == "YakkrHub").ToList();

            contexts.ForEach(x =>
            {
                x.AgencyId = appUserState.AgencyId;
                x.UserId   = appUserState.UserId;
                x.RoleId   = appUserState.RoleId;
            });

            Parallel.ForEach(contexts, (current) =>
            {
                _connections.Add(Context.User.Identity.Name, current);
            });
            SetNotificationEntry();

            YakkrTickerModel model = new YakkrTickerModel();

            model.AppUserState = appUserState;
            _yakkrTicker.StartYakkrTicker(model);
        }
예제 #5
0
        public void RemoveYakkrTickerClient(string key)
        {
            YakkrTickerModel model = new YakkrTickerModel();

            _yakkrDictionary.TryRemove(key, out model);
        }
예제 #6
0
 public void AddYakkrTickerClient(string key, YakkrTickerModel model)
 {
     _yakkrDictionary.TryAdd(key, model);
 }