1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- 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("<script>alert('删除成功!');window.navigate('List.aspx?curpage=" + pageindex + "');</script>");
- }
- catch (Exception ex)
- {
- Response.Write("<script>alert('错误原因:" + ex.ToString() + "');</script>");
- }
- }
- 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();
- }
- }
- }
|