using System; using System.Collections.Generic; //using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; // using System.Data; namespace Com.Jpsoft.Hospital.Web.Module.Sys.Function { public partial class List : Com.Jpsoft.Hospital.Web.Common.BasePage { Com.Jpsoft.Hospital.Model.jp_sys_function model= new Com.Jpsoft.Hospital.Model.jp_sys_function(); Com.Jpsoft.Hospital.BLL.jp_sys_function fun = new Com.Jpsoft.Hospital.BLL.jp_sys_function(); protected void Page_Load(object sender, EventArgs e) { int id = 0; int curpage = 1; string cmd = string.Empty; FetchQueryString("id", out id); FetchQueryString("curpage", out curpage); FetchQueryString("cmd", out cmd); AspNetPager1.RecordCount = curpage * AspNetPager1.PageSize; AspNetPager1.CurrentPageIndex = curpage; if (cmd == "del") { Delete(id, curpage); } BindData(); } /// /// delete /// /// /// private void Delete(int id, int curpage) { try { fun.Delete(id); Response.Write(""); } catch (Exception ex) { Response.Write(""); } } /// /// 绑定数据 /// private void BindData() { int recordcount = 0; string strwhere = " where 1=1 "; string order = " order by fun_id DESC"; using (IDataReader idr = Com.Jpsoft.Hospital.DAL.jp_sys_functionEx.SelectPage(AspNetPager1.CurrentPageIndex, AspNetPager1.PageSize, strwhere, order)) { if (idr.Read()) { recordcount=int.Parse(idr["RecordCount"].ToString()); this.AspNetPager1.RecordCount = recordcount; idr.NextResult(); } this.gv.DataSource = idr; this.gv.DataBind(); idr.Close(); } } ///// ///// 行绑定 ///// ///// ///// //protected void gv_RowDataBound(object sender, GridViewRowEventArgs e) //{ // if (e.Row.RowType == DataControlRowType.DataRow) // { // if (e.Row.RowState == DataControlRowState.Alternate || e.Row.RowState == DataControlRowState.Normal) // { // ((LinkButton)e.Row.Cells[2].Controls[0]).Attributes.Add("onclick", "return confirm('确定要删除吗?');"); // } // } //} ///// ///// 删除 ///// ///// ///// //protected void gv_RowDeleting(object sender, GridViewDeleteEventArgs e) //{ // int id = int.Parse(this.gv.DataKeys[e.RowIndex].Value.ToString()); // fun.Delete(id); // Response.Write(""); // BindData(); //} protected void AspNetPager1_PageChanged(object sender, EventArgs e) { BindData(); } protected void btnadd_Click(object sender, EventArgs e) { Response.Redirect("Insert.aspx"); } protected void gv_RowDeleting(object sender, GridViewDeleteEventArgs e) { } } }