protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { BulletinBll bb = new BulletinBll(); tb_Bulletin bull = bb.selOneBulletin(Convert.ToInt32(Request.Params["ID"])); lblTitle.Text = bull.Title; lblDate.Text = bull.Date.ToString(); lblName.Text = bull.Name; txtContent.Text = bull.Content; } }
protected void btnIssuance_Click(object sender, EventArgs e) { tb_Bulletin bull = new tb_Bulletin(); bull.Title = txtTitle.Text; bull.Content = txtContainer.Text; bull.Name = txtUser.Text; if (ibb.addBulletin(bull) > 0) { Response.Write("添加成功!"); } }
public tb_Bulletin selOneBulletin(int id) { tb_Bulletin bull = new tb_Bulletin(); string sel = "select ID,Title,Date,Content,Name from tb_Bulletin where ID=@ID"; ArrayList list = sqlDal.sqlOnesDr(sel, new string[] { "@ID" }, new string[] { id.ToString() }); bull.Id = (int)list[0]; bull.Title = list[1].ToString(); bull.Date = (DateTime)list[2]; bull.Content = list[3].ToString(); bull.Name = list[4].ToString(); return(bull); }
public List <tb_Bulletin> selNewBulletin() { tb_Bulletin bull = null; string sel = "select top 5 ID,Title,Date from tb_Bulletin order by Date desc"; List <ArrayList> list = sqlDal.sqlDr(sel, null, null); List <tb_Bulletin> bullList = new List <tb_Bulletin>(); foreach (ArrayList obj in list) { bull = new tb_Bulletin(); bull.Id = (int)obj[0]; bull.Title = obj[1].ToString(); bull.Date = (DateTime)obj[2]; bullList.Add(bull); } return(bullList); }
public int addBulletin(tb_Bulletin bull) { return(sqlDal.sqlUpdate("insert into tb_Bulletin(Title,Content,Name) values(@Title,@Content,@Name)", new string[] { "@Title", "@Content", "@Name" }, new string[] { bull.Title, bull.Content, bull.Name })); }
public int addBulletin(tb_Bulletin bull) { return(ibd.addBulletin(bull)); }