List.aspx.cs 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. using System;
  2. using System.Collections;
  3. using System.Configuration;
  4. using System.Data;
  5. //using System.Linq;
  6. using System.Web;
  7. using System.Web.Security;
  8. using System.Web.UI;
  9. using System.Web.UI.HtmlControls;
  10. using System.Web.UI.WebControls;
  11. using System.Web.UI.WebControls.WebParts;
  12. //using System.Xml.Linq;
  13. namespace Com.Jpsoft.Hospital.Web.Module.rs_ygxx
  14. {
  15. public partial class List : Com.Jpsoft.Hospital.Web.Common.BasePage
  16. {
  17. protected void Page_Load(object sender, EventArgs e)
  18. {
  19. if (!IsPostBack)
  20. {
  21. int iCurPage = 1;
  22. FetchQueryString("LCurPage", out iCurPage);
  23. AspNetPager1.RecordCount = iCurPage * AspNetPager1.PageSize;
  24. AspNetPager1.CurrentPageIndex = iCurPage;
  25. BindData();
  26. }
  27. }
  28. private void BindData()
  29. {
  30. int RecordCount = 0;
  31. string strWhere = " where 1=1 ";
  32. if (!string.IsNullOrEmpty(this.txthzxm.Text))
  33. {
  34. strWhere += " and name like '%" + this.txthzxm.Text + "%' ";
  35. }
  36. if (!string.IsNullOrEmpty(this.txtygdm.Text))
  37. {
  38. strWhere += " and gh='" + this.txtygdm.Text + "' ";
  39. }
  40. if (!string.IsNullOrEmpty(this.txtMobile.Text))
  41. {
  42. strWhere += " and mobile='" + this.txtMobile.Text + "' ";
  43. }
  44. if (!string.IsNullOrEmpty(this.txtPhone.Text))
  45. {
  46. strWhere += " and phone='" + this.txtPhone.Text + "' ";
  47. }
  48. string strOrder = " order by id DESC";
  49. Com.Jpsoft.Hospital.BLL.rs_ygxxEx bll = new Com.Jpsoft.Hospital.BLL.rs_ygxxEx();
  50. using (IDataReader idr = bll.SelectPage4rsdata(AspNetPager1.CurrentPageIndex, AspNetPager1.PageSize, strWhere, strOrder))
  51. {
  52. if (idr.Read())
  53. {
  54. RecordCount = Convert.ToInt32(idr["RecordCount"]);
  55. }
  56. idr.NextResult();
  57. GridView1.DataSource = idr;
  58. GridView1.DataBind();
  59. }
  60. this.AspNetPager1.RecordCount = RecordCount;
  61. }
  62. protected void Button1_Click(object sender, EventArgs e)
  63. {
  64. this.AspNetPager1.CurrentPageIndex = 0;
  65. BindData();
  66. }
  67. protected void AspNetPager1_PageChanged(object sender, EventArgs e)
  68. {
  69. BindData();
  70. }
  71. }
  72. }