/// <summary> /// 编辑 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSave_Click(object sender, EventArgs e) { //更新 string addrpic = Labelpic.Text; if (fppic.HasFile) { string name = this.fppic.PostedFile.FileName; int i = name.LastIndexOf('.'); string extname = name.Substring(i); string filename = DateTime.Now.ToString("yyyyMMddhhmmssfff"); string path = filename + extname; string savePath = Server.MapPath(@"..\..\uploads\" + filename + extname); fppic.PostedFile.SaveAs(savePath); addrpic = path; } string title = txt_title.Text; string pic = addrpic; string memo = Textarea1.Value; SP.Model.equip model = new SP.Model.equip(); model.title = title; model.pic = pic; 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>"); }
//³õʼ»¯ private void ShowInfo() { if (Request.QueryString["id"] != null) { SP.BLL.equip bll = new SP.BLL.equip(); SP.Model.equip model = bll.GetModel(int.Parse(Request.QueryString["id"])); this.lbltitle.Text = model.title; imgpic.ImageUrl = "uploads/" + model.pic; this.lblmemo.Text = model.memo; this.lblatime.Text = model.atime.ToString(); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(SP.Model.equip model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(SP.Model.equip model) { return(dal.Add(model)); }