Esempio n. 1
0
 public static List <ConversationRoom> GetRooms()
 {
     using (var redisClient = RedisManager.GetClient())
     {
         return(redisClient.Get <List <ConversationRoom> >(RedisKey.GetKey(RedisAppKeyEnum.Alpha, RedisCategoryKeyEnum.SignalRRoom)));
     }
 }
Esempio n. 2
0
 public static List <SignalRUser> GetUsers()
 {
     using (var redisClient = RedisManager.GetClient())
     {
         return(redisClient.Get <List <SignalRUser> >(RedisKey.GetKey(RedisAppKeyEnum.Alpha, RedisCategoryKeyEnum.SignalRUser)));
     }
 }
Esempio n. 3
0
 public static void Init()
 {
     using (var redisClient = RedisManager.GetClient())
     {
         redisClient.Set(RedisKey.GetKey(RedisAppKeyEnum.Alpha, RedisCategoryKeyEnum.SignalRUser), new List <SignalRUser>());
         redisClient.Set(RedisKey.GetKey(RedisAppKeyEnum.Alpha, RedisCategoryKeyEnum.SignalRRoom), new List <ConversationRoom>());
     }
 }
Esempio n. 4
0
        public static void RemoveRoom(ConversationRoom room)
        {
            var Rooms = GetRooms();

            Rooms.Remove(Rooms.First(c => c.RoomName == room.RoomName));
            using (var redisClient = RedisManager.GetClient())
            {
                redisClient.Set(RedisKey.GetKey(RedisAppKeyEnum.Alpha, RedisCategoryKeyEnum.SignalRRoom), Rooms);
            }
        }
Esempio n. 5
0
        public static void AddRoom(ConversationRoom room)
        {
            var Rooms = GetRooms();

            Rooms.Add(room);
            using (var redisClient = RedisManager.GetClient())
            {
                redisClient.Set(RedisKey.GetKey(RedisAppKeyEnum.Alpha, RedisCategoryKeyEnum.SignalRRoom), Rooms);
            }
        }
Esempio n. 6
0
        public static void RemoveUser(SignalRUser user)
        {
            var Users = GetUsers();

            Users.Remove(Users.First(c => c.UserCode == user.UserCode));
            using (var redisClient = RedisManager.GetClient())
            {
                redisClient.Set(RedisKey.GetKey(RedisAppKeyEnum.Alpha, RedisCategoryKeyEnum.SignalRUser), Users);
            }
        }
Esempio n. 7
0
        public static void SetUser(SignalRUser user)
        {
            var Users = GetUsers();

            Users[Users.FindIndex(c => c.UserCode == user.UserCode)] = user;
            using (var redisClient = RedisManager.GetClient())
            {
                redisClient.Set(RedisKey.GetKey(RedisAppKeyEnum.Alpha, RedisCategoryKeyEnum.SignalRUser), Users);
            }
        }
Esempio n. 8
0
        public static void AddUser(SignalRUser user)
        {
            var _users = GetUsers();

            _users.Add(user);
            using (var redisClient = RedisManager.GetClient())
            {
                redisClient.Set(RedisKey.GetKey(RedisAppKeyEnum.Alpha, RedisCategoryKeyEnum.SignalRUser), _users);
            }
        }
Esempio n. 9
0
        protected void Application_Start()
        {
            var config = new HubConfiguration();

            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            using (var redisClient = RedisManager.GetClient())
            {
                //设置超级管理员
                redisClient.Set <string>(RedisKey.GetKey(RedisAppKeyEnum.Alpha, RedisCategoryKeyEnum.SuperAdminUserCode), "58657C04BCADF3C6AA26F2B79D24994D");

                redisClient.Set <string>(RedisKey.GetKey(RedisAppKeyEnum.Alpha, RedisCategoryKeyEnum.CSSAndJSVersion), SystemConfigBll.Instance.GetValueByKey(RedisCategoryKeyEnum.CSSAndJSVersion.ToString()));
            }
        }
Esempio n. 10
0
 public override void OnAuthorization(AuthorizationContext filterContext)
 {
     filterContext.Controller.TempData["cssAndJSVersion"] = "?v=" + SystemConfigBll.Instance.GetValueByCache(RedisKey.GetKey(RedisAppKeyEnum.Alpha, RedisCategoryKeyEnum.CSSAndJSVersion));
 }