Update.aspx.cs 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. using System;
  2. using System.Collections.Generic;
  3. //using System.Linq;
  4. using System.Web;
  5. using System.Web.UI;
  6. using System.Web.UI.WebControls;
  7. namespace Com.Jpsoft.Hospital.Web.Module.ExamineInfo.jp_examine_obj
  8. {
  9. public partial class Update : Com.Jpsoft.Hospital.Web.Common.BasePage
  10. {
  11. Com.Jpsoft.Hospital.BLL.jp_examine_obj obj = new Com.Jpsoft.Hospital.BLL.jp_examine_obj();
  12. Com.Jpsoft.Hospital.Model.jp_examine_obj model = new Com.Jpsoft.Hospital.Model.jp_examine_obj();
  13. protected void Page_Load(object sender, EventArgs e)
  14. {
  15. if (!IsPostBack)
  16. {
  17. if (string.IsNullOrEmpty(Request.QueryString["id"].ToString()))
  18. { }
  19. else
  20. {
  21. int obj_id = 0;
  22. if (int.TryParse(Request.QueryString["id"].ToString(), out obj_id))
  23. {
  24. BindPageData(obj_id);
  25. }
  26. }
  27. }
  28. }
  29. private void BindPageData(int id)
  30. {
  31. model = obj.GetModel(id);
  32. this.obj_name.Text = model.obj_name.ToString();
  33. }
  34. /// <summary>
  35. /// 返回列表
  36. /// </summary>
  37. /// <param name="sender"></param>
  38. /// <param name="e"></param>
  39. protected void btnCancle_Click(object sender, EventArgs e)
  40. {
  41. Response.Write("<script>window.location.href='List.aspx'</script>");
  42. }
  43. /// <summary>
  44. /// 更新项目
  45. /// </summary>
  46. /// <param name="sender"></param>
  47. /// <param name="e"></param>
  48. protected void btnOK_Click(object sender, EventArgs e)
  49. {
  50. model.obj_id = int.Parse(Request.QueryString["id"].ToString());
  51. model.obj_name = this.obj_name.Text;
  52. obj.Update(model);
  53. Response.Write("<script>alert('更新成功!');window.location.href='Update.aspx?id="+model.obj_id+"';</script>");
  54. }
  55. }
  56. }