//初始化 private void ShowInfo() { if (Request.QueryString["id"] != null) { SP.BLL.selection bll = new SP.BLL.selection(); SP.Model.selection model = bll.GetModel(int.Parse(Request.QueryString["id"])); this.lblid.Text = model.id.ToString(); this.lbltitle.Text = model.title; this.lblmemo.Text = model.memo; this.lblatime.Text = model.atime.ToString(); } }
/// <summary> /// 编辑 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSave_Click(object sender, EventArgs e) { string title = txt_title.Text; string memo = Textarea1.Value; SP.Model.selection model = new SP.Model.selection(); model.title = title; model.memo = memo; model.id = int.Parse(Request.QueryString["id"]); bll.Update(model); Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('操作成功,请返回!');location.href='List.aspx';</script>"); }
/// <summary> /// 添加 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSave_Click(object sender, EventArgs e) { string title = txt_title.Text; string memo = Textarea1.Value; DateTime atime = DateTime.Now; SP.Model.selection model = new SP.Model.selection(); model.title = title; model.memo = memo; model.atime = atime; bll.Add(model); Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('操作成功,请返回!');location.href='Add.aspx';</script>"); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(SP.Model.selection model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(SP.Model.selection model) { return(dal.Add(model)); }