//分页查询歌手列表 public List <Modelsinger> pageQuerySingerList(int offset, int rows) { DataSet data = dalsinger.pageQuerySingerList(offset, rows); List <Modelsinger> singerlist = new List <Modelsinger>(); int num = data.Tables[0].Rows.Count; for (int i = 0; i < num; i++) { Modelsinger singer = new Modelsinger(); singer.singerId = (int)data.Tables[0].Rows[i].ItemArray[1]; singer.singerName = data.Tables[0].Rows[i].ItemArray[2].ToString(); singer.singerSex = (int)data.Tables[0].Rows[i].ItemArray[3]; singer.singerImage = data.Tables[0].Rows[i].ItemArray[4].ToString(); singer.singerContent = data.Tables[0].Rows[i].ItemArray[5].ToString(); singer.singerVolume = (int)data.Tables[0].Rows[i].ItemArray[6]; singerlist.Add(singer); } return(singerlist); }
//通过singerName查询singerItem public Modelsinger querySingerItemByName(String singerName) { Modelsinger singeritem = new Modelsinger(); DataSet data = dalsinger.querySingerItemByName(singerName); if (data.Tables[0].Rows.Count == 0) { return(null); } else { singeritem.singerId = (int)data.Tables[0].Rows[0].ItemArray[0]; singeritem.singerName = data.Tables[0].Rows[0].ItemArray[1].ToString(); singeritem.singerSex = (int)data.Tables[0].Rows[0].ItemArray[2]; singeritem.singerImage = data.Tables[0].Rows[0].ItemArray[3].ToString(); singeritem.singerContent = data.Tables[0].Rows[0].ItemArray[4].ToString(); singeritem.singerVolume = (int)data.Tables[0].Rows[0].ItemArray[5]; return(singeritem); } }