⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 liststudent.ascx.cs

📁 电子选课系统 电子选课系统电子选课系统电子选课系统
💻 CS
字号:
namespace Park.Member
{
	using System;
	using System.Data;
	using System.Data.SqlClient;
	using System.Drawing;
	using System.Web;
	using System.Web.UI.WebControls;
	using System.Web.UI.HtmlControls;
	using Park.Common;

	/// <summary>
	///		ListStudent 的摘要说明。
	/// </summary>
	public abstract class ListStudent : System.Web.UI.UserControl
	{
		protected Epico.Controls.DataGrid StudentList;
		protected Epico.Controls.Repeater ClassList;

		private void Page_Load(object sender, System.EventArgs e)
		{//在Page_Load之前,先看是否需要删除
			ProcessDeleted();
//显示班级列表
			LoadList();
//判断是否选择班级
			string currentclassname=Request[QueryKey.CurrentClassCame];

			if(currentclassname==null|| currentclassname.Equals("")) 
			{
				StudentList.Visible = false;
				return;
			}
//显示该班级所有学生成员
			LoadData(currentclassname);
		}
//使用MemberDB的DeleteStudent方法删除学生事件
		private void ProcessDeleted()
		{
			string id=Request["removeid"];
			//有参数,执行删除操作
			if(id != null && !id.Equals("")) 
				MemberDB.DeleteStudent( id );
		}
//调用Member_Student_GetClasses存储过程在Repeater中显示班级列表
		private void LoadList()
		{
			SqlConnection myConnection=Utils.GetConnection();

			SqlCommand myCommand = new SqlCommand("Member_Student_GetClasses", myConnection);

			// Mark the Command as a SPROC
			myCommand.CommandType = CommandType.StoredProcedure;


			myConnection.Open();

			SqlDataReader result = myCommand.ExecuteReader();

			ClassList.DataSource = result;

			ClassList.DataBind();
	
			result.Close();

			myCommand.Dispose();
			myConnection.Dispose();

		}
		//调用Member_List_Student存储过程在DataGrid中显示classname班级的学生列表
		private void LoadData(string classname)
		{
			SqlConnection myConnection=Utils.GetConnection();

			SqlCommand myCommand = new SqlCommand("Member_List_Student", myConnection);

			// Mark the Command as a SPROC
			myCommand.CommandType = CommandType.StoredProcedure;

			// Add Parameters to SPROC
			SqlParameter ClassName = new SqlParameter("@classid", SqlDbType.Int);
			ClassName.Value = classname;
			myCommand.Parameters.Add(ClassName);


			myConnection.Open();

			SqlDataReader result = myCommand.ExecuteReader();


			StudentList.DataSource = result;

			StudentList.DataBind();
	
			result.Close();

			myCommand.Dispose();
			myConnection.Dispose();

		}


		#region Web Form Designer generated code
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN:该调用是 ASP.NET Web 窗体设计器所必需的。
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		///		设计器支持所需的方法 - 不要使用
		///		代码编辑器修改此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{
			this.Load += new System.EventHandler(this.Page_Load);

		}
		#endregion
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -