示例#1
0
        public bool Login(string Email, string Md5Password)
        {
            var LoginUser = db.Set <Member>()
                            .SingleOrDefault(x => x.Email.Equals(Email, StringComparison.CurrentCultureIgnoreCase) &&
                                             x.Password.Equals(Md5Password, StringComparison.CurrentCultureIgnoreCase));

            if (LoginUser != null)
            {
                db.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.Commit();
                SetLoginCookie(LoginUser);
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#2
0
        public bool OpenUserLogin(ViewModels.OpenLoginViewModel OpenUser, OpenLoginType openType)
        {
            int typeValue = (int)openType;
            var LoginUser = db.Set <Member>()
                            .SingleOrDefault(x =>
                                             x.OpenID.Equals(OpenUser.OpenId) &&
                                             x.OpenType == typeValue);

            if (LoginUser != null)
            {
                db.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.Commit();
                SetLoginCookie(LoginUser);
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#3
0
        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.Add <Member_Action>(member_Action);
            db.Commit();
            return(member_Action);
        }
示例#4
0
        public Member_Action Create(MemberActionType MemberActionType, string description)
        {
            var           MemberID      = CookieHelper.MemberID;
            Member_Action member_Action = new Member_Action()
            {
                MemberID    = MemberID,
                ActionType  = (int)MemberActionType,
                AddTime     = DateTime.Now,
                Description = description,
                IP          = HttpHelper.IP
            };

            db.Add <Member_Action>(member_Action);
            db.Commit();
            return(member_Action);
        }