protected void Page_Load(object sender, EventArgs e)
    {
        Master.ShowLiControl(this.Page, "liFragment10");
        UserCookiesInfo UserCookiesInfo = BllOperationAboutUser.GetUserCookiesInfo();
        DalOperationAboutCourses dal = new DalOperationAboutCourses();
        if (dal.IsTeacherAtCourse(UserCookiesInfo.userNo, Master.courseNo,classID,termtag))
        {

            editTeacherAtag = "<a href=\"EditTeacherResume.aspx?keepThis=true&courseNo=" + Master.courseNo + "&classID=" + Server.UrlEncode(Master.classID )+ "&termtag=" + Master.termtag + "&fragment=9&TB_iframe=true&height=380&width=800\" title=\"编辑教师简介\" class=\"thickbox\">编辑</a>";
        }
    }
Example #2
0
 /// <summary>
 /// 判断是否有此版面的管理权限
 /// </summary>
 /// <param name="course"></param>
 /// <returns></returns>
 public bool hasControls(string course)
 {
     DalOperationAboutCourses DalOperationAboutCourses = new DalOperationAboutCourses();
     UserCookiesInfo UserCookiesInfo = BllOperationAboutUser.GetUserCookiesInfo();
     return UserCookiesInfo.userType == (int)UserType.AdminRole || DalOperationAboutCourses.IsTeacherAtCourse(UserCookiesInfo.userNo, course, classID, termTag);
 }
Example #3
0
        public static void CheckUser()
        {
            HttpContext Context = HttpContext.Current;
            //获取要访问的路径
            string path = Context.Request.Path.ToLower();

            if (Context.Session[ConfigurationManager.AppSettings["sessionKey"]] == null && (!path.StartsWith("/checkuser.aspx")))
            {
                CommonUtility.RedirectLoginUrl();
                return;
            }

            UserCookiesInfo UserCookiesInfo = BllOperationAboutUser.GetUserCookiesInfo();

            if (path.StartsWith("/administrator"))
            {
                if (UserCookiesInfo.userType != 0)
                {
                    CommonUtility.RedirectLoginUrl();
                    return;
                }
            }

            if (path.StartsWith("/teacher"))
            {
                //复用Excel导出功能,使用的角色为:管理员、教师、助教
                if (path.StartsWith("/teacher/outputenglishexamsignupexcel.ashx"))
                {
                    if (!(UserCookiesInfo.userType == 0 || UserCookiesInfo.userType == 1 || UserCookiesInfo.userType == 2))
                    {
                        CommonUtility.RedirectLoginUrl();
                        return;
                    }
                }
                else
                {
                    if (UserCookiesInfo.userType != 1 && UserCookiesInfo.userType != 2)
                    {
                        CommonUtility.RedirectLoginUrl();
                        return;
                    }
                }
            }

            if (path.StartsWith("/student"))
            {
                if (UserCookiesInfo.userType != 3)
                {
                    CommonUtility.RedirectLoginUrl();
                    return;
                }
            }

            //Context.Response.Write(Context.Request.RawUrl.ToLower().IndexOf("javascript"));

            if ((Context.Request.RawUrl.ToLower().IndexOf("/teacher") == 0 || Context.Request.RawUrl.ToLower().IndexOf("/student") == 0) && Context.Request["courseNo"] != null && Context.Request["classID"] != null && Context.Request["termTag"] != null)
            {
                //Context.Response.Write(Context.Request["courseNo"]);
                string courseNo = Context.Request["courseNo"];
                string classID = Context.Server.UrlDecode(Context.Request["classID"]);
                string termTag = Context.Request["termTag"];

                DalOperationAboutCourses DalOperationAboutCourses = new DalOperationAboutCourses();

                bool hasCourse = false;

                switch (UserCookiesInfo.userType)
                {
                    case 2:
                        //IsAssistantAtCourse有问题,需要改进,已经改进
                        hasCourse = DalOperationAboutCourses.IsAssistantAtCourse(UserCookiesInfo.userNo, courseNo, classID, termTag);
                        break;
                    case 1:
                        //IsTeacherAtCourse有问题,需要改进,已经改进
                        hasCourse = DalOperationAboutCourses.IsTeacherAtCourse(UserCookiesInfo.userNo, courseNo, classID, termTag);
                        break;
                    case 3:
                        hasCourse = DalOperationAboutCourses.IsStudentHasCourse(UserCookiesInfo.userNo, courseNo, classID, termTag);
                        break;
                    default:
                        break;
                }

                if (!hasCourse)
                {
                    CommonUtility.RedirectLoginUrl();
                    return;
                }

                if (Context.Request.RawUrl.ToLower().IndexOf("javascript:") != -1)
                {
                    //Context.Response.Write(Context.Request.RawUrl.ToLower().IndexOf("javascript:"));
                    CommonUtility.RedirectUrl();
                    return;
                }
            }
        }