Esempio n. 1
0
 public string getListByChannel(int id, string appkey)
 {
     common.visitorRecord(appkey);
     DataTable dt = new DataTable();
     try
     {
         common.isKeyValid(appkey);
         dt = new Bus.DAL.music().getListByChannel(id);
     }
     catch (Exception ex)
     {
         dt.Columns.Add("ErrMessage", typeof(string));
         dt.Rows.Add(ex.Message);
     }
     return dt.ToJson("Channels");
 }
Esempio n. 2
0
 public string isFaved(int userid, int songid)
 {
     common.visitorRecord();
     try
     {
         bool r = new Bus.DAL.music().isFaved(userid, songid);
         if (r)
         {
             return "1";
         }
         return "0";
     }
     catch (Exception ex)
     {
         return ex.Message;
     }
 }
Esempio n. 3
0
 //频道
 protected void btn_getlistbychannel_Click(object sender, EventArgs e)
 {
     try
     {
         DataTable dt = new Bus.DAL.music().getListByChannel(1);
         gv.DataSource = dt;
         gv.DataBind();
         txtresult.Text = dt.ToJson("list");
     }
     catch (Exception ex)
     {
         lblmsg.Text = ex.Message;
     }
 }
Esempio n. 4
0
 public string GetShengQu()
 {
     //common.visitorRecord();
     DataTable dt = new DataTable();
     try
     {
         dt = new Bus.DAL.music().getShengQu();
     }
     catch (Exception ex)
     {
         dt.Columns.Add("ErrMessage", typeof(string));
         dt.Rows.Add(ex.Message);
     }
     StringBuilder r = new StringBuilder();
     if (dt.Rows.Count > 0)
     {
         if (dt.Columns.Count < 5)
         {
             return "no data, "+dt.Rows[0][0].ToString();
         }
         foreach (DataRow dr in dt.Rows)
         {
             r.Append("[");
             r.Append("\"" + dr["id"].ToString() + "\",");
             r.Append("\"" + dr["title"].ToString() + "\",");
             r.Append("\"" + dr["url"].ToString() + "\",");
             r.Append("\"" + dr["album"].ToString() + "\",");
             r.Append("\"" + dr["thumb"].ToString() + "\"");
             r.Append("],");
         }
     }
     string rs = r.ToString().TrimEnd(',');
     return "[" + rs + "]";
 }
Esempio n. 5
0
    //个人收藏
    protected void btn_getlistbyid_Click(object sender, EventArgs e)
    {
        try
        {
            DataTable dt = new Bus.DAL.music().getListByUserID(4); ;
            gv.DataSource = dt;
            gv.DataBind();

            //string s=Jayrock.Json.Conversion.JsonConvert.ExportToString(dt);
            //string s = JSONHelper.DataTableToJson("list", dt);
            string s = dt.ToJson("list", "id", "title", "url");
            txtresult.Text = s;
        }
        catch (Exception ex)
        {
            lblmsg.Text = ex.Message;
        }
    }