예제 #1
0
        public List <Views.userSign> getFollowbyid(string id)
        {
            List <Views.userSign> signList = new List <Views.userSign>();

            Cook.DAL.follow_          follow     = new Cook.DAL.follow_();
            Cook.DAL.users            user       = new DAL.users();
            List <Cook.Model.follow_> followList = DataTableToList(follow.GetList("", "", id));

            foreach (Cook.Model.follow_ item in followList)
            {
                Views.userSign sign = follow.getFollow(user.GetModel(item.id.ToString()));
                sign.time = item.time;
                signList.Add(sign);
            }
            return(signList);
        }
예제 #2
0
        public bool setfollow(string tableid, int type)
        {
            int num = new Cook.DAL.follow_().GetRecordCount("", tableid);

            if (type == 0)
            {
                num--;
                if (num < 0)
                {
                    num = 0;
                }
            }
            else if (type == 1)
            {
                num++;
            }
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update users set ");
            strSql.Append(" follow=@follow ");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@follow", SqlDbType.VarChar, -1),
                new SqlParameter("@id",     SqlDbType.Int, 4)
            };
            parameters[0].Value = num;
            parameters[1].Value = tableid;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }