protected void Page_Load(object sender, EventArgs e) { dlstTopClick.DataSource = videobll.getClickTop(); dlstTopClick.DataBind(); dlstHumour.DataSource = videobll.getVideoList("humour"); dlstHumour.DataBind(); dlstCartoon.DataSource = videobll.getVideoList("cartoon"); dlstCartoon.DataBind(); dlstFilm.DataSource = videobll.getVideoList("film"); dlstFilm.DataBind(); dlstSport.DataSource = videobll.getVideoList("sport"); dlstSport.DataBind(); dlstMusic.DataSource = videobll.getVideoList("music"); dlstMusic.DataBind(); dlstTV.DataSource = videobll.getVideoList("tv"); dlstTV.DataBind(); blm = adminbll.getBulletin(); if (Session["userInfo"] != null) { Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>$('#lTop').show();$('#lBot').show();</script>"); } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>$('#lTop').hide();$('#lBot').hide();</script>"); } }
/// <summary> /// 添加新公告 /// </summary> /// <param name="bm">公告实体类</param> /// <returns></returns> public bool addBulletin(BulletinModel bm) { bool flag = false; string cmdText = "insert into bulletin(title,contents) values(@title,@contents)"; SqlParameter[] paras = new SqlParameter[] { new SqlParameter ("@title",bm.Title), new SqlParameter ("@contents",bm.Contents) }; int res = sqlhelper.ExecuteNonQuery(cmdText, paras, CommandType.Text); if (res > 0) { flag = true; } return flag; }
//添加公告 public bool addBulletin(BulletinModel bm) { return admindal.addBulletin(bm); }
/// <summary> /// 站内公告查询 /// </summary> /// <returns>返回最新更新的一条站内公告</returns> public BulletinModel getBulletin() { BulletinModel bulletinModel = new BulletinModel(); DataTable dt = new DataTable(); string cmdText = "select top 1 * from bulletin order by issuanceDate desc"; dt = sqlhelper.getRow(cmdText, CommandType.Text); bulletinModel.Id = dt.Rows[0]["id"].ToString(); bulletinModel.Title = dt.Rows[0]["title"].ToString(); bulletinModel.Contents = dt.Rows[0]["contents"].ToString(); bulletinModel.issuanceDate = dt.Rows[0]["issuanceDate"].ToString(); return bulletinModel; }