using System; using System.Collections; using System.Configuration; using System.Data; //using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; //using System.Xml.Linq; namespace Com.Jpsoft.Hospital.Web.Module.EmployeeGroup { public partial class List : Com.Jpsoft.Hospital.Web.Common.BasePage { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { int iCurPage = 1; int id = 0; string cmd = string.Empty; FetchQueryString("curpage", out iCurPage); FetchQueryString("cmd", out cmd); FetchQueryString("id", out id); AspNetPager1.RecordCount = iCurPage * AspNetPager1.PageSize; AspNetPager1.CurrentPageIndex = iCurPage; if (cmd == "del") { Delete(id, iCurPage); } } BindData(); } private void Delete(int id, int pageindex) { Com.Jpsoft.Hospital.BLL.jp_employee_group group = new BLL.jp_employee_group(); try { group.Delete(id); Response.Write(""); } catch (Exception ex) { Response.Write(""); } } private void BindData() { int RecordCount = 0; string strWhere = " where 1=1 "; if (!string.IsNullOrEmpty(this.txtGroupName.Text)) { strWhere += " and eg_name like '%" + this.txtGroupName.Text + "%' "; } string strOrder = " order by eg_id DESC"; Com.Jpsoft.Hospital.BLL.jp_employee_groupEx bll = new BLL.jp_employee_groupEx(); using (IDataReader idr = bll.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 Button1_Click(object sender, EventArgs e) { this.AspNetPager1.CurrentPageIndex = 0; BindData(); } protected void AspNetPager1_PageChanged(object sender, EventArgs e) { BindData(); } } }