/// <summary> /// 用户添加 /// </summary> /// <param name="UserIDStr">用户ID</param> /// <param name="UserNameStr">用户信息</param> /// <param name="Level">级别</param> public static void NewUserLogin(string UserIDStr, string UserNameStr, string Level) { if (ExistUser(UserIDStr)) { throw new Exception("UserID有重复!"); } UserInfo UserItem = new UserInfo(); UserItem.UserID = UserIDStr; UserItem.UserPersonInfo = UserNameStr; UserItem.Level = Level; ListClass.Engin_UserList.Add(UserItem); HttpRuntime.Cache.Add(UserIDStr, false, new AggregateCacheDependency(), Cache.NoAbsoluteExpiration,TimeSpan.FromMinutes(20),CacheItemPriority.Normal, null); }
/// <summary> /// 随机游客用户添加 /// </summary> public static string NewClientUserLogin(bool AutoInList) { string UserIDStr = ""; UserIDStr = RadomName(); while (ExistUser("游客" + UserIDStr)) { UserIDStr = RadomName(); } UserInfo UserItem = new UserInfo(); UserItem.UserID = "游客" + UserIDStr; HttpRuntime.Cache.Add(UserItem.UserID, false, new AggregateCacheDependency(), Cache.NoAbsoluteExpiration, TimeSpan.FromMinutes(20), CacheItemPriority.Normal, null); UserItem.UserPersonInfo = UserIDStr + " 登录时间" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); UserItem.Level = "0"; if (AutoInList) { ListClass.Engin_UserList.Add(UserItem); } return UserItem.UserID; }
public bool PredicateUserList(UserInfo s) { if (s.UserID != UserId) { return true; } else { return false; } }