protected void Page_Load(object sender, EventArgs e) { if (null != Common.Common.NoHtml(Request.QueryString["action"])) { strAction = Common.Common.NoHtml(Request.QueryString["action"]); } if (null != Common.Common.NoHtml(Request.QueryString["id"])) { strID = Common.Common.NoHtml(Request.QueryString["id"]); } BBSGuestBookDAL dal = new BBSGuestBookDAL(); switch (strAction) { case "del": if (dal.UpdateState(strID)) { strMessage = "操作成功!"; } else { strMessage = "操作失败!"; } break; default: break; } Response.Write(strMessage); Response.End(); }
/// <summary> /// 加载数据 /// </summary> /// <param name="strWhere">条件</param> void LoadData(string strWhere) { txtTitle.Text = ""; BBSGuestBookDAL dal = new BBSGuestBookDAL(); DataSet ds = dal.GetGuestBookList(strWhere); DataView dv = ds.Tables[0].DefaultView; AspNetPager1.RecordCount = dv.Count; PagedDataSource pds = new PagedDataSource(); pds.DataSource = dv; pds.AllowPaging = true; pds.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1; pds.PageSize = AspNetPager1.PageSize; Repeater1.DataSource = pds; Repeater1.DataBind(); }
protected void btnSave_Click(object sender, EventArgs e) { if (repcontentinfo.Text.Trim() != null && repcontentinfo.Text.Trim() != "") { BBSGuestBookDAL dal = new BBSGuestBookDAL(); if (dal.SaveReplay(repcontentinfo.Text, strID)) { MessageBox.Show(this, "回复成功!"); } else { MessageBox.Show(this, "回复失败!"); } } else { MessageBox.Show(this, "请输入回复内容!"); } }
public void ShowActivityInfo(string strID) { BBSGuestBookDAL dal = new BBSGuestBookDAL(); DataSet ds = dal.GetGuestBookDetail(strID); BBS_GuestBook model = DataConvert.DataRowToModel <BBS_GuestBook>(ds.Tables[0].Rows[0]); UserName.Text = model.UserName; UserMobile.Text = model.UserMobile; Content.Text = model.Content; CreateTime.Text = model.CreateTime.ToString(); if (strAction == "show") { this.btnReset.Visible = false; this.btnSave.Visible = false; repinputdiv.Visible = false; showwddiv.Visible = true; if (model.Replay.Trim() != null && model.Replay.Trim() != "") { repbtn.Visible = false; repcontr.Visible = true; repcontent.Text = model.Replay; } else { repbtn.Visible = true; repcontr.Visible = false; } } else { this.btnReset.Visible = true; this.btnSave.Visible = true; repinputdiv.Visible = true; repcontr.Visible = false; repbtn.Visible = false; showwddiv.Visible = false; } }