예제 #1
0
        /// <summary>
        /// 优先从cookie中取到数据
        /// </summary>
        /// <returns></returns>
        public static Member GetUserInfo()
        {
            string showname;//显示名
            string email;
            Member member = new Member();

            if ((member.ID = CookieHelper.VerifyUser(out showname, out email)) > 0)
            {
                member.Email    = email;
                member.ShowName = showname;
            }
            else
            {
                IMemberBusiness iMember = new MemberBusiness(new JustSayEntities());
                member.ID = Convert.ToInt32(HttpContext.Current.User.Identity.Name);
                member    = iMember.GetDetail(member.ID);
            }
            return(member);
        }
예제 #2
0
        public override Message Add(Message entity)
        {
            Member userInfo = MemberBusiness.GetUserInfo();

            entity.FromName = userInfo.ShowName;
            entity.FromID   = userInfo.ID;
            entity.Time     = DateTime.Now;
            IMemberBusiness iMember = new MemberBusiness(db);

            if (HotConfig.IsControlMessage == 1)
            {
                iMember.UpdataPostTime();
            }
            //To
            entity.Member1 = iMember.GetDetail(entity.ToID);
            entity.Member1.MessageCount += 1;
            entity.IsNew = true;
            return(base.Add(entity));
        }