예제 #1
0
        public bool delete(string token, string oid)
        {
            string tableid = new Cook.DAL.load().GetIdByToken(token);

            try
            {
                int id;
                Int32.TryParse(oid, out id);
                StringBuilder strSql = new StringBuilder();
                strSql.Append("DELETE FROM henchman_" + tableid + "");
                strSql.Append(" WHERE id=@id");
                SqlParameter[] parameters =
                {
                    new SqlParameter("@id", SqlDbType.Int, 4)
                };
                parameters[0].Value = id;
                int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
                if (rows > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception)
            {
                return(false);
            }
        }
예제 #2
0
        //我的收藏
        public List <Views.trends> GetMyCollect(string token)
        {
            string tableid = new Cook.DAL.load().GetIdByToken(token);
            List <Views.trends> mycollect = new List <Views.trends>();

            DAL.course course = new DAL.course();
            DataTable  dt     = new DAL.collect_().getmycollect(tableid);

            foreach (DataRow itme in dt.Rows)
            {
                mycollect.Add(course.DataRowToTrends(itme));
            }
            return(mycollect);
        }
예제 #3
0
        //通过token获取我的教程
        public List <Views.trends> GetMyCourse(string type, string token)
        {
            string id = new Cook.DAL.load().GetIdByToken(token);
            List <Views.trends> List = new List <Views.trends>();

            DAL.course c = new DAL.course();

            DataTable dt = c.GetList(" authorid =" + id + " and type = " + type + " ", " time desc ");

            foreach (DataRow item in dt.Rows)
            {
                List.Add(c.DataRowToTrends(item, token));
            }
            return(List);
        }
예제 #4
0
        //注册
        public int register(string phone, string pwd)
        {
            int id = 0;

            try
            {
                Model.load load = new Model.load();
                load.phone  = phone;
                load.pwd    = pwd;
                load.status = "0";
                if (Add(load))
                {
                    id = new Cook.DAL.load().GetUserIdByInfo(phone, pwd);
                    Model.users user = new Model.users();
                    user.id       = id;
                    user.name     = phone;
                    user.type     = "1";
                    user.url      = "man0";
                    user.bg       = "#ffffff";
                    user.pagebg   = "./static/user/user-bg3.jpg";
                    user.henchman = 0;
                    user.follow   = 0;
                    user.phone    = phone;
                    user.status   = "0";
                    if (new DAL.users().Add(user))
                    {
                        new Cook.BLL.henchman_().creatTable(id.ToString());
                        new Cook.BLL.follow_().creatTable(id.ToString());
                        new Cook.BLL.aboutMe_().creatTable(id.ToString());
                        new Cook.BLL.collect_().creatTable(id.ToString());
                        return(id);
                    }
                    else
                    {
                        return(0);
                    }
                }
                else
                {
                    return(0);
                }
            }
            catch (Exception)
            {
                return(0);
            }
        }
예제 #5
0
        public bool setRead(string token)
        {
            string tableid = new Cook.DAL.load().GetIdByToken(token);

            return(new DAL.aboutMe_().setRead(tableid));
        }
예제 #6
0
        public List <Views.userSign> getFollow(string token)
        {
            string tableid = new Cook.DAL.load().GetIdByToken(token);

            return(getFollowbyid(tableid));
        }
예제 #7
0
        //根据token返回和id 添加
        public bool add(Cook.Model.henchman_ model, string token)
        {
            string tableid = new Cook.DAL.load().GetIdByToken(token);

            return(Add(model, tableid));
        }
예제 #8
0
        //根据token返回和id返回是否收藏
        public bool isCollect(string token, string id)
        {
            string tableid = new Cook.DAL.load().GetIdByToken(token);

            return(Exists(id, tableid));
        }
예제 #9
0
        /// <summary>
        /// 获取已被阅读的list
        /// </summary>
        /// <param name="tableid"></param>
        /// <returns></returns>
        public DataTable GetAboutMeRead(string token)
        {
            string tableid = new Cook.DAL.load().GetIdByToken(token);

            return(GetList(" isRead = '1' ", " time desc ", tableid));
        }