Insert.aspx.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. //
  8. using System.Data;
  9. using System.Text;
  10. namespace Com.Jpsoft.Hospital.Web.Module.ExamineInfo.jp_examine_obj
  11. {
  12. public partial class Insert : Com.Jpsoft.Hospital.Web.Common.BasePage
  13. {
  14. protected void Page_Load(object sender, EventArgs e)
  15. {
  16. }
  17. protected void btnOK_Click(object sender, EventArgs e)
  18. {
  19. Com.Jpsoft.Hospital.BLL.jp_examine_obj obj = new Com.Jpsoft.Hospital.BLL.jp_examine_obj();
  20. string obj_name = this.obj_name.Text;
  21. //判断是否存在
  22. string strWhere = " obj_name='" + obj_name + "'";
  23. DataTable dt = obj.GetList(strWhere).Tables[0];
  24. if (dt.Rows.Count > 0)
  25. {
  26. Response.Write("<script>alert('该项目已经存在!');</script>");
  27. }
  28. else
  29. {
  30. //添加项目
  31. Com.Jpsoft.Hospital.Model.jp_examine_obj model = new Com.Jpsoft.Hospital.Model.jp_examine_obj();
  32. model.obj_name = obj_name;
  33. obj.Add(model);
  34. Response.Write("<script>alert('添加成功!');window.location.replace(location.href);</script>");
  35. }
  36. }
  37. protected void btnCancle_Click(object sender, EventArgs e)
  38. {
  39. Response.Write("<script>window.location.href='List.aspx'</script>");
  40. }
  41. }
  42. }