//视频排行榜 public void videoP() { string sql = "SELECT top 5 * from (select * from tb_Video as a inner join tb_Type as b on a.VideoType=b.TypeID order by [ClickSum] desc )"; gvVideoP.DataSource = mydo.rows(sql, "tb_Video").DefaultView; gvVideoP.DataBind(); }
//已发布视频 protected void Yvidoe() { string sql = "select * from tb_Video as a inner join tb_Type as b on a.VideoType=b.TypeID where a.Name='" + Session["UserName"].ToString() + "' order by VideoID desc"; this.gvFBVideo.DataSource = mydo.rows(sql, "tb_Video"); this.gvFBVideo.DataKeyNames = new string[] { "VideoID" }; this.gvFBVideo.DataBind(); }
//最新视频 protected void cretVideo() { try { string sql = "SELECT top 10 * from tb_Video as a inner join tb_Type as b on a.VideoType=b.TypeID ORDER BY VideoID DESC"; gvNewVideo.DataSource = mydo.rows(sql, "tb_Video").DefaultView; gvNewVideo.DataBind(); } catch (Exception error) { Response.Redirect(error.Message.ToString()); } }
//查看留言 protected void seekSpeak() { int noncePage = Convert.ToInt32(this.labPage.Text); PagedDataSource ps = new PagedDataSource(); string selectSql = "select * from tb_Speak where [TutorialID]=" + Request.QueryString["SoundID"] + " and [TutorialType]='Sound' ORDER BY SpeakID DESC "; ps.DataSource = mydo.rows(selectSql, "tb_Speak").DefaultView; ps.AllowPaging = true; ps.PageSize = 15; ps.CurrentPageIndex = noncePage - 1; this.lnkbtnFront.Enabled = true; this.lnkbtnNext.Enabled = true; this.lnkbtnLast.Enabled = true; this.lnkbtnFirst.Enabled = true; if (noncePage == 1) //等于第一页 { this.lnkbtnFirst.Enabled = false; //不显示第一页按钮 this.lnkbtnFront.Enabled = false; //不显示上一页按钮 } if (noncePage == ps.PageCount) //等于最后一页 { this.lnkbtnNext.Enabled = false; //不显示下一页 this.lnkbtnLast.Enabled = false; //不显示最后一页 } this.labBackPage.Text = Convert.ToString(ps.PageCount); this.dlSpeak.DataSource = ps; //设置数据源的关键字段 this.dlSpeak.DataKeyField = "SpeakID"; dlSpeak.DataBind(); }
protected void seeSpeak() { int curpage = Convert.ToInt32(this.labPage.Text); PagedDataSource ps = new PagedDataSource(); string selectSql = "select * from tb_Speak where [TutorialID]=" + Request.QueryString["VideoID"] + " and [TutorialType]='Video' ORDER BY SpeakID DESC "; string table = "tb_Speak"; ps.DataSource = mydo.rows(selectSql, table).DefaultView; //启用分页 ps.AllowPaging = true; ps.PageSize = 10; //设置当前页的索引 ps.CurrentPageIndex = curpage - 1; this.lnkbtnFront.Enabled = true; this.lnkbtnNext.Enabled = true; this.lnkbtnLast.Enabled = true; this.lnkbtnFirst.Enabled = true; if (curpage == 1) //等于第一页 { this.lnkbtnFirst.Enabled = false; //不显示第一页按钮 this.lnkbtnFront.Enabled = false; //不显示上一页按钮 } if (curpage == ps.PageCount) //等于最后一页 { this.lnkbtnNext.Enabled = false; //不显示下一页 this.lnkbtnLast.Enabled = false; //不显示最后一页 } this.labBackPage.Text = Convert.ToString(ps.PageCount); this.DataList1.DataSource = ps; //设置数据源的关键字段 this.DataList1.DataKeyField = "SpeakID"; DataList1.DataSource = ps; DataList1.DataBind(); }
protected void createGV() { string sql = Session["searchSql"].ToString(); string table = Session["table"].ToString(); DataTable dt = mydo.rows(sql, table); if (dt.DefaultView.Count > 0) { Panel1.Visible = false; if (table == "tb_Video") { this.GridView1.DataSource = dt.DefaultView; this.GridView1.DataBind(); } else { this.GridView2.DataSource = dt.DefaultView; this.GridView2.DataBind(); } } else { Panel1.Visible = true; } }
protected void bindLanguage() { string sql = "select * from tb_Type "; this.ddlLanguage.DataSource = mydo.rows(sql, "tb_Type").DefaultView; this.ddlLanguage.DataBind(); }
protected void createSound() { string sql = "select * from tb_Sound order by SoundID DESC"; grvSound.DataSource = mydo.rows(sql, "tb_Sound"); grvSound.DataKeyNames = new string[] { "SoundID" }; grvSound.DataBind(); }
protected void createBulletin() { string sql = "select * from tb_Bulletin order by ID DESC"; grvBulletin.DataSource = mydo.rows(sql, "tb_Bulletin"); grvBulletin.DataKeyNames = new string[] { "ID" }; grvBulletin.DataBind(); }
//语音排行榜 public void soundP() { dataOperate mydo = new dataOperate(); string sql = "select top 10 * from(select * from tb_sound as a inner join tb_Type as b on a.SoundType=b.TypeID order by [ClickSum] desc)"; gvSoundP.DataSource = mydo.rows(sql, "tb_Sound").DefaultView; gvSoundP.DataBind(); }
protected void createVideo() { string sql = "select * from tb_Video order by VideoID DESC"; grvVideo.DataSource = mydo.rows(sql, "tb_Video"); grvVideo.DataKeyNames = new string[] { "VideoID" }; grvVideo.DataBind(); }
protected void createUser() { string sql = "select * from tb_login"; this.GridView1.DataSource = mydo.rows(sql, "tb_login").DefaultView; this.GridView1.DataKeyNames = new string[] { "ID" }; this.GridView1.DataBind(); }
//公告信息 protected void createBulletin() { dataOperate mydo = new dataOperate(); try { string sql = "select * from tb_Bulletin order by Date DESC"; this.gvBulletin.DataSource = mydo.rows(sql, "tb_Bullentin").DefaultView; this.gvBulletin.DataBind(); } catch (Exception error) { Response.Redirect(error.Message.ToString()); } }
protected void createVideo() { int curpage = Convert.ToInt32(this.labPage.Text); PagedDataSource ps = new PagedDataSource(); try { string sql = "select * from tb_Video where VideoType=" + Request.QueryString["TypeID"] + " ORDER BY VideoID DESC"; ps.DataSource = mydo.rows(sql, "tb_Video").DefaultView; //ds.Tables["tb_Video"].DefaultView; //启用分页 ps.AllowPaging = true; //每页显示3条数据 ps.PageSize = 10; //设置当前页的索引 ps.CurrentPageIndex = curpage - 1; this.lnkbtnFront.Enabled = true; this.lnkbtnNext.Enabled = true; this.lnkbtnLast.Enabled = true; this.lnkbtnFirst.Enabled = true; if (curpage == 1) //等于第一页 { this.lnkbtnFirst.Enabled = false; //不显示第一页按钮 this.lnkbtnFront.Enabled = false; //不显示上一页按钮 } if (curpage == ps.PageCount) //等于最后一页 { this.lnkbtnNext.Enabled = false; //不显示下一页 this.lnkbtnLast.Enabled = false; //不显示最后一页 } this.labBackPage.Text = Convert.ToString(ps.PageCount); this.dlVideo.DataSource = ps; //设置数据源的关键字段 this.dlVideo.DataKeyField = "VideoID"; dlVideo.DataSource = ps; dlVideo.DataBind(); } catch (Exception ex) { Response.Write(ex.Message.ToString()); } }