Beispiel #1
0
        /// <summary>
        /// 方法:查询用户信息
        /// </summary>
        /// <returns>返回对象集合</returns>
        public List <Model.CustomerMusic> SelectLogin(string phone, string pwd)
        {
            List <Model.CustomerMusic> list = new List <Model.CustomerMusic>();
            string        sql = "select c.*,r.RankName from CustomerMusic c left join  RankUser r on c.RankID=r.RankID where c.Phone='" + phone + "' and c.UserPwd='" + pwd + "'";
            SqlDataReader dr  = Dbhelper.ExecReader(sql);

            if (dr != null)
            {
                while (dr.Read())
                {
                    list.Add(new Model.CustomerMusic(
                                 (int)dr["ID"],
                                 dr["UserName"].ToString(),
                                 dr["UserPwd"].ToString(),
                                 dr["Phone"].ToString(),
                                 dr["Birthday"].ToString(),
                                 dr["Sex"].ToString(),
                                 dr["Email"].ToString(),
                                 dr["LastLoginTime"].ToString(),
                                 dr["Remark"].ToString(),
                                 (int)dr["State"],
                                 (int)dr["RankID"],
                                 dr["RankName"].ToString()
                                 ));
                }
                dr.Close();
            }
            return(list);
        }
Beispiel #2
0
        /// <summary>
        /// 修改:修改登录时间
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public int UpdateCustomerID(int id)
        {
            string sql = "update CustomerMusic set LastLoginTime=default where ID=" + id + "";

            if (id != 0)
            {
                return(Dbhelper.ExecQuery(sql));
            }
            else
            {
                return(0);
            }
        }
        /// <summary>
        /// 修改歌单背景图片
        /// </summary>
        /// <param name="pic">修改图片路径</param>
        /// <param name="id">歌单ID</param>
        /// <returns></returns>
        public int UpdateAlbu(string pic, int id)
        {
            string sql = "update Albummusic set ImageUrl='" + pic + "' where AlbumID='" + id + "'";

            if (id != 0)
            {
                return(Dbhelper.ExecQuery(sql));
            }
            else
            {
                return(0);
            }
        }
        /// <summary>
        /// 查询方法
        /// </summary>
        /// <param name="albuID">歌单编号</param>
        /// <returns>查询对象</returns>
        public List <Model.Music> GetMusicData(int albuID)
        {
            List <Model.Music> cs  = new List <Model.Music>();
            string             sql = "select * from Muisc_Song_Type d where d.AlbID=" + albuID + "";
            SqlDataReader      dr  = Dbhelper.ExecReader(sql);

            if (dr != null)
            {
                while (dr.Read())
                {
                    cs.Add(new Model.Music(dr["MusicID"].ToString(), dr["MusicName"].ToString(), dr["Dearmer"].ToString(), dr["MusicTime"].ToString(), (int)dr["SongsterID"], (int)dr["MusicTypeID"], dr["Musicyear"].ToString(), (int)dr["ID"], (int)dr["Musicheart"], (int)dr["State"], dr["SongsterName"].ToString(), dr["TypeName"].ToString(), (int)dr["AlbID"]));
                }
                dr.Close();
            }
            return(cs);
        }
        /// <summary>
        /// 查询方法:显示歌单
        /// </summary>
        /// <param name="x"></param>
        /// <returns></returns>
        public List <Model.Albummusic> SelectAlbu(int x)
        {
            List <Model.Albummusic> cs = new List <Model.Albummusic>();
            string        sql          = "select * from Albummusic where ID=" + x + "";
            SqlDataReader dr           = Dbhelper.ExecReader(sql);

            if (dr != null)
            {
                while (dr.Read())
                {
                    cs.Add(new Model.Albummusic((int)dr["AlbumID"], dr["AlbumName"].ToString(), dr["Albumabstract"].ToString(), (int)dr["ID"], dr["AlbuTime"].ToString(), (int)dr["Listeners"], dr["ImageUrl"].ToString()));
                }

                dr.Close();
            }

            return(cs);
        }
Beispiel #6
0
 /// <summary>
 /// 方法:添加用户数据
 /// </summary>
 /// <param name="cus">操作对象</param>
 /// <returns>受影响行数</returns>
 public int InsterRegist(Model.CustomerMusic cus)
 {
     return(Dbhelper.ExecQuery("insert into CustomerMusic(UserName,UserPwd,Phone,Birthday,Sex,Email,LastLoginTime,Remark,[State],RankID) values('" + cus.UserName + "','" + cus.UserPwd + "','" + cus.Phone + "','" + cus.Birthday + "','" + cus.Sex + "','" + cus.Email + "',default,'',1,1)"));
 }
 /// <summary>
 /// 添加方法:创建新歌单
 /// </summary>
 /// <param name="cs"></param>
 /// <returns></returns>
 public int Insertalbudata(Model.Albummusic cs)
 {
     return(Dbhelper.ExecQuery("insert into Albummusic values('" + cs.AlbumName + "','" + cs.Albumabstract + "'," + cs.ID + ",default,0,default)"));
 }