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

📄 st_main.aspx.cs

📁 选课系统 不可多得的好东西 代码加数据库
💻 CS
字号:
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;

namespace STGROUP.ST_WebCourse.SP_Common
{
	/// <summary>
	/// SP_Main 的摘要说明。
	/// </summary>
	public partial class SP_Main : System.Web.UI.Page
	{
		protected string leftJS="";
		protected void Page_Load(object sender, System.EventArgs e)
		{
			// 在此处放置用户代码以初始化页面
			if(!IsPostBack)
			{
                //判断用户是否已经登录,否则重定位到登录界面
				if(Context.User.Identity.Name == null || Context.User.Identity.Name == "")
				{
					Response.Redirect("../ST_Login.aspx");
				}
				else
				{
                    //下面两行是通过创建数据访问层中ST_Auth类的一个对象,然后调用其方法来获取用户的类型
					STGROUP.ST_CourseBiz.ST_Auth st_auth = new STGROUP.ST_CourseBiz.ST_Auth();
					int st_type = st_auth.ST_LoginType(Context.User.Identity.Name);
					if(st_type==-1)
						Response.Redirect("../ST_Login.aspx");
					else
					{
						switch(st_type)
						{
							case 1:
                                //此js文件负责向浏览器写出管理员的相关链接
								leftJS = "ST_Admin.js";
								break;
							case 2:
                                //此js文件负责向浏览器写出教师的相关链接
								//leftJS = "ST_Teacher.js";
                                leftJS = "ST_Teacher.js";
								break;
							case 3:
                                //此js文件负责向浏览器写出学生的相关链接
								leftJS = "ST_Student.js";
								break;
						}
                        //根据登录名再次通过数据访问层的方法来获取用户的ID
						int st_id = st_auth.ST_LoginID(Context.User.Identity.Name);
						Session["ST_ID"] = st_id;

					}
				}
			}
		}

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

		}
		#endregion
	}
}

⌨️ 快捷键说明

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