Detail.aspx.cs 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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 Detail : Com.Jpsoft.Hospital.Web.Common.BasePage
  10. {
  11. protected void Page_Load(object sender, EventArgs e)
  12. {
  13. if(!IsPostBack)
  14. BindData();
  15. }
  16. private void BindData()
  17. {
  18. int RecordCount = 0;
  19. string strWhere = " where 1=1";
  20. if (ViewState["SearchTerms"] != null)
  21. {
  22. strWhere = ViewState["SearchTerms"].ToString();
  23. }
  24. string strOrder = " order by d_id DESC";
  25. using (IDataReader idr = Com.Jpsoft.Hospital.DAL.jp_msg_sendrecordEx.SelectPage(AspNetPager1.CurrentPageIndex, AspNetPager1.PageSize, strWhere, strOrder))
  26. {
  27. if (idr.Read())
  28. {
  29. RecordCount = Convert.ToInt32(idr["RecordCount"]);
  30. }
  31. idr.NextResult();
  32. GridView1.DataSource = idr;
  33. GridView1.DataBind();
  34. }
  35. this.AspNetPager1.RecordCount = RecordCount;
  36. }
  37. protected void AspNetPager1_PageChanged(object sender, EventArgs e)
  38. {
  39. BindData();
  40. }
  41. public string GetBoolCN(object obj)
  42. {
  43. bool bl;
  44. if (bool.TryParse(obj.ToString(), out bl))
  45. {
  46. if (bl)
  47. return "<font color='green'>成功</font>";
  48. else
  49. return "<font color='red'>失败</font>";
  50. }
  51. return "未知";
  52. }
  53. }
  54. }