nanzhao.aspx.cs
资源名称:yi-yuan.rar [点击查看]
上传用户:clhb88
上传日期:2009-09-26
资源大小:3468k
文件大小:8k
源码类别:
医药行业
开发平台:
C#
- using System;
- using System.Collections;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Web;
- using System.Web.SessionState;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Web.UI.HtmlControls;
- using System.Data.SqlClient;
- namespace 医院管理系统
- {
- /// <summary>
- /// nanzhao 的摘要说明。
- /// </summary>
- public class nanzhao : System.Web.UI.Page
- {
- protected System.Web.UI.WebControls.Label Label4;
- protected System.Web.UI.WebControls.Label Label3;
- protected System.Web.UI.WebControls.Label Label2;
- protected System.Web.UI.WebControls.Label Label1;
- protected System.Web.UI.WebControls.Label Label14;
- protected System.Web.UI.WebControls.Panel p1;
- protected System.Web.UI.WebControls.Button Button3;
- protected System.Web.UI.WebControls.Button Button2;
- protected System.Web.UI.WebControls.Button Button1;
- protected System.Web.UI.WebControls.TextBox TextBox1;
- protected System.Data.SqlClient.SqlConnection cnn;
- protected System.Data.SqlClient.SqlDataAdapter sda1;
- protected System.Data.SqlClient.SqlCommand sqlDeleteCommand2;
- protected System.Data.SqlClient.SqlCommand sqlInsertCommand2;
- protected System.Data.SqlClient.SqlCommand sqlSelectCommand2;
- protected System.Data.SqlClient.SqlCommand sqlUpdateCommand2;
- protected System.Data.SqlClient.SqlCommand sqlSelectCommand1;
- protected System.Data.SqlClient.SqlCommand sqlInsertCommand1;
- protected System.Data.SqlClient.SqlCommand sqlUpdateCommand1;
- protected System.Data.SqlClient.SqlCommand sqlDeleteCommand1;
- protected System.Data.SqlClient.SqlDataAdapter sda;
- protected System.Web.UI.WebControls.Label Label6;
- protected System.Web.UI.WebControls.Label Label7;
- protected System.Web.UI.WebControls.Label Label8;
- protected System.Web.UI.WebControls.Label Label5;
- protected System.Data.SqlClient.SqlCommand cmd;
- protected 医院管理系统.nan nan1;
- protected System.Web.UI.WebControls.DataGrid DataGrid1;
- private void Page_Load(object sender, System.EventArgs e)
- {
- if(!IsPostBack)
- {
- fill();
- }
- }
- private void fill()
- {
- if(cnn.State==0) cnn.Open();
- sda.SelectCommand.ExecuteNonQuery();
- nan1.Clear();
- sda.Fill(nan1);
- cnn.Close();
- DataGrid1.DataBind();
- }
- #region Web 窗体设计器生成的代码
- override protected void OnInit(EventArgs e)
- {
- //
- // CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
- //
- InitializeComponent();
- base.OnInit(e);
- }
- /// <summary>
- /// 设计器支持所需的方法 - 不要使用代码编辑器修改
- /// 此方法的内容。
- /// </summary>
- private void InitializeComponent()
- {
- this.cnn = new System.Data.SqlClient.SqlConnection();
- this.sda1 = new System.Data.SqlClient.SqlDataAdapter();
- this.sqlDeleteCommand2 = new System.Data.SqlClient.SqlCommand();
- this.sqlInsertCommand2 = new System.Data.SqlClient.SqlCommand();
- this.sqlSelectCommand2 = new System.Data.SqlClient.SqlCommand();
- this.sqlUpdateCommand2 = new System.Data.SqlClient.SqlCommand();
- this.sqlSelectCommand1 = new System.Data.SqlClient.SqlCommand();
- this.sqlInsertCommand1 = new System.Data.SqlClient.SqlCommand();
- this.sqlUpdateCommand1 = new System.Data.SqlClient.SqlCommand();
- this.sqlDeleteCommand1 = new System.Data.SqlClient.SqlCommand();
- this.sda = new System.Data.SqlClient.SqlDataAdapter();
- this.cmd = new System.Data.SqlClient.SqlCommand();
- this.nan1 = new 医院管理系统.nan();
- ((System.ComponentModel.ISupportInitialize)(this.nan1)).BeginInit();
- this.Button2.Click += new System.EventHandler(this.Button2_Click);
- this.Button1.Click += new System.EventHandler(this.Button1_Click);
- this.DataGrid1.PageIndexChanged += new System.Web.UI.WebControls.DataGridPageChangedEventHandler(this.DataGrid1_PageIndexChanged);
- this.DataGrid1.SelectedIndexChanged += new System.EventHandler(this.DataGrid1_SelectedIndexChanged);
- //
- // cnn
- //
- this.cnn.ConnectionString = "workstation id=LYJ805;packet size=4096;integrated security=SSPI;data source=".";p" +
- "ersist security info=False;initial catalog=医院管理系统";
- //
- // sda1
- //
- this.sda1.DeleteCommand = this.sqlDeleteCommand2;
- this.sda1.InsertCommand = this.sqlInsertCommand2;
- this.sda1.SelectCommand = this.sqlSelectCommand2;
- this.sda1.UpdateCommand = this.sqlUpdateCommand2;
- //
- // sqlSelectCommand2
- //
- this.sqlSelectCommand2.CommandText = "[selnan]";
- this.sqlSelectCommand2.CommandType = System.Data.CommandType.StoredProcedure;
- this.sqlSelectCommand2.Connection = this.cnn;
- this.sqlSelectCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@RETURN_VALUE", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.ReturnValue, false, ((System.Byte)(0)), ((System.Byte)(0)), "", System.Data.DataRowVersion.Current, null));
- this.sqlSelectCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@挂号号码", System.Data.SqlDbType.NVarChar, 20));
- //
- // sqlSelectCommand1
- //
- this.sqlSelectCommand1.CommandText = "[selnan1]";
- this.sqlSelectCommand1.CommandType = System.Data.CommandType.StoredProcedure;
- this.sqlSelectCommand1.Connection = this.cnn;
- this.sqlSelectCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@RETURN_VALUE", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.ReturnValue, false, ((System.Byte)(0)), ((System.Byte)(0)), "", System.Data.DataRowVersion.Current, null));
- //
- // sda
- //
- this.sda.DeleteCommand = this.sqlDeleteCommand1;
- this.sda.InsertCommand = this.sqlInsertCommand1;
- this.sda.SelectCommand = this.sqlSelectCommand1;
- this.sda.UpdateCommand = this.sqlUpdateCommand1;
- //
- // cmd
- //
- this.cmd.CommandText = "[nan2]";
- this.cmd.CommandType = System.Data.CommandType.StoredProcedure;
- this.cmd.Connection = this.cnn;
- this.cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@RETURN_VALUE", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.ReturnValue, false, ((System.Byte)(0)), ((System.Byte)(0)), "", System.Data.DataRowVersion.Current, null));
- this.cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@id", System.Data.SqlDbType.Int, 4));
- //
- // nan1
- //
- this.nan1.DataSetName = "nan";
- this.nan1.Locale = new System.Globalization.CultureInfo("zh-CN");
- this.Load += new System.EventHandler(this.Page_Load);
- ((System.ComponentModel.ISupportInitialize)(this.nan1)).EndInit();
- }
- #endregion
- private void Button1_Click(object sender, System.EventArgs e)
- {
- if(cnn.State==0) cnn.Open();
- sda1.SelectCommand.Parameters["@挂号号码"].Value=TextBox1.Text;
- sda1.SelectCommand.ExecuteNonQuery ();
- nan1.Clear();
- sda1.Fill(nan1);
- this.DataGrid1.DataBind();
- cnn.Close();
- }
- private void Button2_Click(object sender, System.EventArgs e)
- {
- if(DataGrid1.SelectedIndex==-1)
- {
- Response.Write("<script language=javascript>alert('你还没选择!');</script>") ;
- }
- else
- {
- if(cnn.State==0) cnn.Open();
- p1.Visible =true;
- cmd.Parameters["@id"].Value=Convert.ToInt32(DataGrid1.SelectedItem.Cells[0].Text);
- Label14.Text=DataGrid1.SelectedItem.Cells[1].Text+"——详细信息";
- SqlDataReader rd=cmd.ExecuteReader();
- while (rd.Read())
- {
- this.Label1.Text =rd.GetValue(0).ToString();
- this.Label2.Text =rd.GetValue(1).ToString();
- this.Label3.Text =rd.GetValue(2).ToString();
- this.Label4.Text =rd.GetValue(3).ToString();
- this.Label5.Text =rd.GetValue(4).ToString();
- this.Label6.Text =rd.GetValue(5).ToString();
- this.Label7.Text =rd.GetValue(6).ToString();
- this.Label8.Text =rd.GetValue(7).ToString();
- }
- }
- }
- private void DataGrid1_SelectedIndexChanged(object sender, System.EventArgs e)
- {
- p1.Visible =false;
- }
- private void DataGrid1_PageIndexChanged(object source, System.Web.UI.WebControls.DataGridPageChangedEventArgs e)
- {
- DataGrid1.CurrentPageIndex = e.NewPageIndex;
- fill();
- }
- }
- }