List.aspx.cs 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Data;
  4. using System.Web;
  5. using System.Web.UI;
  6. using System.Web.UI.WebControls;
  7. namespace Com.Jpsoft.Hospital.Web.Module.MsgRecord
  8. {
  9. public partial class List : Com.Jpsoft.Hospital.Web.Common.BasePage
  10. {
  11. protected void Page_Load(object sender, EventArgs e)
  12. {
  13. if (!IsPostBack)
  14. {
  15. int pageindex = 1;
  16. AspNetPager1.RecordCount = pageindex * AspNetPager1.PageSize;
  17. AspNetPager1.CurrentPageIndex = pageindex;
  18. BindData();
  19. SetCount();
  20. }
  21. }
  22. private void SetCount()
  23. {
  24. string strWhere = " 1=1 ";
  25. if (ViewState["SearchTerms"] != null)
  26. {
  27. strWhere = ViewState["SearchTerms"].ToString();
  28. }
  29. Com.Jpsoft.Hospital.DAL.jp_msg_sendrecordEx bll = new DAL.jp_msg_sendrecordEx();
  30. lblCount.Text = bll.GetOKMsgCount(strWhere);
  31. }
  32. private void BindData()
  33. {
  34. int RecordCount = 0;
  35. string strWhere = " where 1=1";
  36. if (ViewState["SearchTerms"] != null)
  37. {
  38. strWhere = ViewState["SearchTerms"].ToString();
  39. }
  40. string strOrder = " order by r_createdate DESC";
  41. using (IDataReader idr = Com.Jpsoft.Hospital.DAL.jp_msg_sendrecordEx.SelectPage(AspNetPager1.CurrentPageIndex, AspNetPager1.PageSize, strWhere, strOrder))
  42. {
  43. if (idr.Read())
  44. {
  45. RecordCount = Convert.ToInt32(idr["RecordCount"]);
  46. }
  47. idr.NextResult();
  48. GridView1.DataSource = idr;
  49. GridView1.DataBind();
  50. }
  51. this.AspNetPager1.RecordCount = RecordCount;
  52. }
  53. protected void btnSearch_Click(object sender, EventArgs e)
  54. {
  55. System.Text.StringBuilder strWhere = new System.Text.StringBuilder();
  56. strWhere.Append(" where 1=1 ");
  57. if (txtstart.Text.Trim().Length > 0)
  58. {
  59. strWhere.Append(" and r_createdate>='" + txtstart.Text.Trim() + "'");
  60. }
  61. if (txtEnd.Text.Trim().Length > 0)
  62. {
  63. strWhere.Append(" and r_createdate<'" + txtEnd.Text.Trim() + "'");
  64. }
  65. if (ddltype.SelectedValue != "")
  66. {
  67. strWhere.Append(" and r_type='" + ddltype.SelectedValue + "'");
  68. }
  69. ViewState["SearchTerms"] = strWhere.ToString();
  70. BindData();
  71. }
  72. protected void AspNetPager1_PageChanged(object sender, EventArgs e)
  73. {
  74. BindData();
  75. }
  76. public string GetBoolCN(object obj)
  77. {
  78. bool bl;
  79. if (bool.TryParse(obj.ToString(), out bl))
  80. {
  81. if (bl)
  82. return "<font color='green'>成功</font>";
  83. else
  84. return "<font color='red'>失败</font>";
  85. }
  86. return "未知";
  87. }
  88. public string GetTypeName(object obj)
  89. {
  90. string type = string.Empty;
  91. switch (obj.ToString())
  92. {
  93. case "1":
  94. type = "住院随访";
  95. break;
  96. case "2":
  97. type = "门诊随访";
  98. break;
  99. case "3":
  100. type = "科研随访";
  101. break;
  102. case "4":
  103. type = "表扬回复";
  104. break;
  105. case "5":
  106. type = "投诉";
  107. break;
  108. case "6":
  109. type = "入院问候";
  110. break;
  111. case "7":
  112. type = "出院问候";
  113. break;
  114. case "8":
  115. type = "化验提醒";
  116. break;
  117. }
  118. return type;
  119. }
  120. }
  121. }