示例#1
0
        public static bool UpdateUserExtend(T_UserExtend ue)
        {
            object o = MySqlHelper.ExecuteNonQuery(Util.GetConnectString(UserConnString),
                                                   "update T_UserExtend set Locked = @Locked where UserId = @UserId",
                                                   "@Locked".ToBitInPara(ue.Locked),
                                                   "@UserId".ToInt32InPara(ue.UserId)
                                                   );

            return(o == null ? false : true);
        }
示例#2
0
        /// <summary>
        /// 解锁
        /// </summary>
        /// <returns></returns>
        public int UnLock()
        {
            bool         b  = false;
            T_UserExtend ue = new T_UserExtend()
            {
                UserId = UserId, Locked = false
            };

            b = B_User.UpdateUserExtend(ue);

            return(b ? 0 : 1);
        }
示例#3
0
        public static T_UserExtend GetUserExtend(int userId)
        {
            T_UserExtend model = null;

            using (MySqlDataReader dr = MySqlHelper.ExecuteReader(Util.GetConnectString(UserConnString),
                                                                  "select UserId, Locked from T_UserExtend where UserId = @UserId",
                                                                  "@UserId".ToInt32InPara(userId)))
            {
                if (dr != null && dr.HasRows)
                {
                    model = MySqlDBHelper.ConvertDataReaderToEntitySingle <T_UserExtend>(dr);
                }
            }
            return(model);
        }
示例#4
0
        /// <summary>
        /// 锁定
        /// </summary>
        /// <returns></returns>
        public int Lock()
        {
            T_UserExtend ue = B_User.GetUserExtend(UserId);
            bool         b  = false;

            if (ue == null)
            {
                ue = new T_UserExtend()
                {
                    UserId = UserId, Locked = true
                };
                b = B_User.AddUserExtend(ue);
            }
            else
            {
                ue.Locked = true;
                b         = B_User.UpdateUserExtend(ue);
            }
            return(b ? 0 : 1);
        }
示例#5
0
        /// <summary>
        /// 关注我的
        /// </summary>
        /// <returns></returns>
        public ActionResult RelateMe()
        {
            //被关注列表
            List <dto_RelateUser> list = B_User.GetBeRelatedUser(UserId);

            if (list != null)
            {
                foreach (var l in list)
                {
                    T_User u = B_UserRedis.GetUser(l.UserId);
                    l.UserName = u.UserName;
                    l.TrueName = u.TrueName;
                }
            }
            ViewBag.List = list;

            T_UserExtend tue = B_User.GetUserExtend(UserId);

            ViewBag.Extend = tue;
            return(PartialView());
        }
示例#6
0
        /// <summary>
        /// 关注
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        public string Relate(int userId)
        {
            if (UserId == userId)
            {
                return("不能关注自己!");
            }
            //查询用户是否已经锁定
            T_UserExtend tue = B_User.GetUserExtend(userId);

            if (tue != null && tue.Locked)
            {
                return("用户已经锁定,不能关注!");
            }
            //查询是否关注过
            List <dto_RelateUser> list = B_User.GetRelateUser(UserId);

            if (list != null && list.Exists(a => a.RUserId == userId))
            {
                return("已经关注过,不能重复关注!");
            }

            return(B_User.AddRelate(UserId, userId, DateTime.Now) ? "" : "操作失败!");
        }