123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132 |
- using System;
- using System.Collections.Generic;
- using System.Data;
- using System.Web;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- namespace Com.Jpsoft.Hospital.Web.Module.MsgRecord
- {
- public partial class List : Com.Jpsoft.Hospital.Web.Common.BasePage
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- if (!IsPostBack)
- {
- int pageindex = 1;
- AspNetPager1.RecordCount = pageindex * AspNetPager1.PageSize;
- AspNetPager1.CurrentPageIndex = pageindex;
- BindData();
- SetCount();
- }
- }
- private void SetCount()
- {
- string strWhere = " 1=1 ";
- if (ViewState["SearchTerms"] != null)
- {
- strWhere = ViewState["SearchTerms"].ToString();
- }
- Com.Jpsoft.Hospital.DAL.jp_msg_sendrecordEx bll = new DAL.jp_msg_sendrecordEx();
- lblCount.Text = bll.GetOKMsgCount(strWhere);
- }
- private void BindData()
- {
- int RecordCount = 0;
- string strWhere = " where 1=1";
- if (ViewState["SearchTerms"] != null)
- {
- strWhere = ViewState["SearchTerms"].ToString();
- }
- string strOrder = " order by r_createdate DESC";
- using (IDataReader idr = Com.Jpsoft.Hospital.DAL.jp_msg_sendrecordEx.SelectPage(AspNetPager1.CurrentPageIndex, AspNetPager1.PageSize, strWhere, strOrder))
- {
- if (idr.Read())
- {
- RecordCount = Convert.ToInt32(idr["RecordCount"]);
- }
- idr.NextResult();
- GridView1.DataSource = idr;
- GridView1.DataBind();
- }
- this.AspNetPager1.RecordCount = RecordCount;
- }
- protected void btnSearch_Click(object sender, EventArgs e)
- {
- System.Text.StringBuilder strWhere = new System.Text.StringBuilder();
- strWhere.Append(" where 1=1 ");
- if (txtstart.Text.Trim().Length > 0)
- {
- strWhere.Append(" and r_createdate>='" + txtstart.Text.Trim() + "'");
- }
- if (txtEnd.Text.Trim().Length > 0)
- {
- strWhere.Append(" and r_createdate<'" + txtEnd.Text.Trim() + "'");
- }
- if (ddltype.SelectedValue != "")
- {
- strWhere.Append(" and r_type='" + ddltype.SelectedValue + "'");
- }
- ViewState["SearchTerms"] = strWhere.ToString();
- BindData();
- }
- protected void AspNetPager1_PageChanged(object sender, EventArgs e)
- {
- BindData();
- }
- public string GetBoolCN(object obj)
- {
- bool bl;
- if (bool.TryParse(obj.ToString(), out bl))
- {
- if (bl)
- return "<font color='green'>成功</font>";
- else
- return "<font color='red'>失败</font>";
- }
- return "未知";
- }
- public string GetTypeName(object obj)
- {
- string type = string.Empty;
- switch (obj.ToString())
- {
- case "1":
- type = "住院随访";
- break;
- case "2":
- type = "门诊随访";
- break;
- case "3":
- type = "科研随访";
- break;
- case "4":
- type = "表扬回复";
- break;
- case "5":
- type = "投诉";
- break;
- case "6":
- type = "入院问候";
- break;
- case "7":
- type = "出院问候";
- break;
- case "8":
- type = "化验提醒";
- break;
- }
- return type;
- }
- }
- }
|