public static bool Login(string username, string password) { using (MainDatadbmlDataContext db = new MainDatadbmlDataContext()) { UserInfo ui = db.UserInfo.FirstOrDefault(x => x.UserID == username && x.UserPwd == password); return ui != null; } }
/// <summary> /// 实例化一个新的池 /// </summary> public MyPond() { Tokens = new List<UserTokenAndCallback>(); using (MainDatadbmlDataContext db = new MainDatadbmlDataContext()) { db.UserInfo.ToList().ForEach(x => { UserToken token = new UserToken(x.UserID, x.ID, x.ParentUID); token.TimeoutEventHandler += RemoveCallback; UserTokenAndCallback t = new UserTokenAndCallback { Token = token, TargetUser = "", Callback = null }; Tokens.Add(t); }); } StartTimeline(); }