public Member_Action Create(Member member, int memberAction, string description) { Member_Action member_Action = new Member_Action() { MemberID = member.MemberID, ActionType = memberAction, AddTime = DateTime.Now, Description = description, IP = HttpHelper.IP }; DB_Service.Add<Member_Action>(member_Action); DB_Service.Commit(); return member_Action; }
public Member_Action Create(Core.MemberActionType MemberActionType, string description) { var MemberID = Convert.ToInt32(CookieHelper.UID); Member_Action member_Action = new Member_Action() { MemberID = MemberID, ActionType = (int)MemberActionType, AddTime = DateTime.Now, Description = description, IP = HttpHelper.IP }; DB_Service.Add<Member_Action>(member_Action); DB_Service.Commit(); return member_Action; }
public bool OpenUserLogin(OpenLoginStatus OpenUser, OpenLoginType openType) { int typeValue = (int)openType; var LoginUser = DB_Service.Set<Member>() .SingleOrDefault(x => x.OpenID.Equals(OpenUser.OpenId) && x.OpenType == typeValue); if (LoginUser != null) { DB_Service.Attach<Member>(LoginUser); LoginUser.LastIP = HttpHelper.IP; LoginUser.LastTime = DateTime.Now; LoginUser.LoginCount = LoginUser.LoginCount + 1; Member_Action ma = new Member_Action(); ma.ActionType = (int)MemberActionType.Login; ma.AddTime = DateTime.Now; ma.Description = "登录"; LoginUser.Member_Action.Add(ma); DB_Service.Commit(); SetLoginCookie(LoginUser); return true; } else { return false; } }
public bool Login(string Email, string Md5Password) { var LoginUser = DB_Service.Set<Member>() .SingleOrDefault(x => x.Email.Equals(Email, StringComparison.CurrentCultureIgnoreCase) && x.Password.Equals(Md5Password, StringComparison.CurrentCultureIgnoreCase)); if (LoginUser != null) { DB_Service.Attach<Member>(LoginUser); LoginUser.LastIP = HttpHelper.IP; LoginUser.LastTime = DateTime.Now; LoginUser.LoginCount = LoginUser.LoginCount + 1; int memberAction = (int)MemberActionType.Login; Member_Action ma = new Member_Action(); ma.ActionType = memberAction; ma.AddTime = DateTime.Now; ma.IP = HttpHelper.IP; ma.Description = "登录"; LoginUser.Member_Action.Add(ma); DB_Service.Commit(); SetLoginCookie(LoginUser); return true; } else { return false; } }