Update.aspx.cs 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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.Sys.Function
  8. {
  9. public partial class Update : Com.Jpsoft.Hospital.Web.Common.BasePage
  10. {
  11. Com.Jpsoft.Hospital.BLL.jp_sys_function fun = new Com.Jpsoft.Hospital.BLL.jp_sys_function();
  12. Com.Jpsoft.Hospital.Model.jp_sys_function model = new Com.Jpsoft.Hospital.Model.jp_sys_function();
  13. protected void Page_Load(object sender, EventArgs e)
  14. {
  15. if (!IsPostBack)
  16. {
  17. if (Request.QueryString["id"].ToString().Trim() != "" && Request.QueryString["id"] != null)
  18. {
  19. int id = int.Parse(Request.QueryString["id"].ToString());
  20. ShowData(id);
  21. }
  22. }
  23. }
  24. /// <summary>
  25. /// 显示数据
  26. /// </summary>
  27. /// <param name="id"></param>
  28. private void ShowData(int id)
  29. {
  30. model = fun.GetModel(id);
  31. this.fun_name.Text = model.fun_name.ToString();
  32. this.fun_pagedata.Text = model.fun_pagename.ToString();
  33. this.fun_id.Text = model.fun_id.ToString();
  34. }
  35. protected void btnBack_Click(object sender, EventArgs e)
  36. {
  37. Response.Redirect("List.aspx");
  38. }
  39. protected void btnOK_Click(object sender, EventArgs e)
  40. {
  41. model.fun_id = int.Parse(this.fun_id.Text);
  42. model.fun_name = this.fun_name.Text;
  43. model.fun_pagename = this.fun_pagedata.Text;
  44. fun.Update(model);
  45. Response.Write("<script>alert('更新成功!');</script>");
  46. }
  47. }
  48. }