📄 mp3player.aspx.cs
字号:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using Club.Framework;
using Club.Framework.Components;
using Club.Framework.Configuration;
using Club.Framework.Data;
namespace Club.Home.MP3Player
{
/// <summary>
/// MP3Player 的摘要说明。
/// </summary>
public class MP3Player : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Repeater rptMusicList;
protected System.Web.UI.WebControls.Repeater rptList;
protected string ids
{
get
{
if(Request.Params["ids"]==null||Request.Params["ids"]=="")
{
return "0";
}
return Request.Params["ids"];
}
}
protected int RegisterId
{
get
{
if(Request.Params["RegisterId"]==null||Request.Params["RegisterId"]=="")
{
return 0;
}
return int.Parse(Request.Params["RegisterId"]);
}
}
private DataSet ds;
private void Page_Load(object sender, System.EventArgs e)
{
bindList();
}
private void bindList()
{
try
{
string sql="select * from c_Music where id in ("+this.ids.Trim(',')+") order by orderid desc";
this.ds=Globals.DbProvider.GetDataSet(sql);
this.rptList.DataSource=ds;
this.rptList.DataBind();
}
catch
{
}
}
protected string bindMusicList()
{
string reText="";
DataTable dt=this.ds.Tables[0];
for(int i=0;i<dt.Rows.Count;i++)
{
reText+="mkList(\""+getMusicUrl((bool)dt.Rows[i]["IsUpLoad"],dt.Rows[i]["MusicUrl"].ToString())+"\",\""+getJavascriptShow(dt.Rows[i]["MusicName"].ToString())+"\");\n ";
}
return reText;
}
protected string getMusicUrl(bool isUpload,string musicUrl)
{
if(!isUpload)
{
return musicUrl;
}
string musicPath=Globals.GetWebPath(Config.ClubMusicPath);
if(Config.Settings.UpFileIsMakeDir)
{
musicPath=musicPath+this.RegisterId+"/";
}
return musicPath+musicUrl;
}
protected string getJavascriptShow(string content)
{
string reText = content;
reText = reText.Replace(@"\",@"\\");
reText = reText.Replace("'",@"\'");
reText = reText.Replace(@"""",@"\""");
return reText;
}
#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -