1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- 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;
- using System.Text;
- namespace Com.Jpsoft.Hospital.Web.Module.jp_druginfo
- {
- //public partial class List : System.Web.UI.Page
- public partial class List : Com.Jpsoft.Hospital.Web.Common.BasePage
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- if (!IsPostBack)
- {
- int id = 0;
- if (Request.QueryString["id"]!=null)
- {
- id = int.Parse(Request.QueryString["id"].ToString());
- this.Delete(id);
- }
- }
- BindData();
-
- }
- protected void btnselect_Click(object sender, EventArgs e)
- {
- string drugname = txtdrugname.Value.Trim();// GetSafeSql(txtdrugname.Value.Trim());
- StringBuilder strWhere = new StringBuilder();
- strWhere.Append(" where 1=1 ");
- if (drugname.Length != 0)
- {
- strWhere.Append(" and drugname like '%" + drugname + "%'");
- }
- ViewState["SearchTerms"] = strWhere.ToString();
- BindData();
- }
- protected void AspNetPager1_PageChanged(object sender, EventArgs e)
- {
- BindData();
- }
- #region
- /// <summary>
- /// 获得数据列表
- /// </summary>
- private void BindData()
- {
- int RecordCount = 0;
- string strWhere = " where 1=1 ";
- if (ViewState["SearchTerms"] != null)
- {
- strWhere = ViewState["SearchTerms"].ToString();
- }
- string strOrder = " order by id DESC";
- using (IDataReader idr = Com.Jpsoft.Hospital.DAL.jp_druginfoEx.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;
- }
- /// <summary>
- /// 删除数据
- /// </summary>
- /// <param name="id"></param>
- private void Delete(int id)
- {
- Com.Jpsoft.Hospital.BLL.jp_druginfoEx bll = new Com.Jpsoft.Hospital.BLL.jp_druginfoEx();
- bll.Delete(id);
- Response.Write("<script>alert('删除成功!');window.navigate('List.aspx');</script>");
- }
- #endregion
- }
- }
|