Пример #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                DalOperationNorm daln = new DalOperationNorm();
                DalOperationAboutTeacher dalt = new DalOperationAboutTeacher();
                DalOperationAboutUserAuth dalua = new DalOperationAboutUserAuth();
                UserAuth auth = dalua.GetUserAuth(pageName);
                DataSet ds = dalt.GetTeachers();
                DataTable dt = new DataTable();
                dt.Columns.Add("teacherNo");
                dt.Columns.Add("teacherName");
                if (auth != null)
                {
                    if (auth.userIds != null)
                    {
                        foreach (string s in auth.userIds.Split(','))
                        {
                            DataRow[] drs = ds.Tables[0].Select("teacherNo='" + s + "'");
                            if (drs.Length > 0)
                            {
                                DataRow dr = dt.NewRow();
                                dr.SetField("teacherNo", drs[0]["teacherNo"].ToString());
                                dr.SetField("teacherName", drs[0]["teacherName"].ToString());

                                dt.Rows.Add(dr);
                            }
                        }
                        dsltAuthTeacher.DataSource = dt;
                    }
                }
                dsltAuthTeacher.DataBind();
            }
        }
Пример #2
0
        protected void dlSearchTeacher_ItemCommand(object source, DataListCommandEventArgs e)
        {
            string teacherNowSelected = this.dlSearchTeacher.DataKeys[e.Item.ItemIndex].ToString(); //取选中行教师的编号
            DalOperationAboutUserAuth dalua = new DalOperationAboutUserAuth();
            UserAuth userAuth = dalua.GetUserAuth(pageName);
            if (e.CommandName == "addAuth")
            {
                if (userAuth == null)
                {
                    userAuth = new UserAuth();
                    userAuth.pageName = pageName;
                    userAuth.userIds = teacherNowSelected;
                }
                else
                {
                    if (userAuth.userIds == null || userAuth.userIds.Equals(""))
                    {
                        userAuth.userIds = teacherNowSelected;
                    }
                    else
                    {
                        userAuth.userIds = userAuth.userIds + "," + teacherNowSelected;
                    }
                }
            }
            else if (e.CommandName == "removeAuth")
            {
                if (userAuth == null) return;
                string[] ids = userAuth.userIds.Split(',');

                List<string> list = new List<string>();

                for (int i = 0; i < ids.Length; i++)
                {
                    if (!ids[i].Equals(teacherNowSelected))
                    {
                        list.Add(ids[i]);
                    }
                }
                userAuth.userIds = string.Join(",", list.ToArray());
            }

            dalua.setUserAuth(userAuth);
            Javascript.JavaScriptLocationHref("ProjectManager.aspx?fragment=1&teacherName=" + this.txtKeyword.Text.Trim(), Page);
        }
Пример #3
0
        private bool isAuth(string teacherNo)
        {
            bool isAuth = false;
            DalOperationAboutUserAuth dalua = new DalOperationAboutUserAuth();
            UserAuth userAuth = dalua.GetUserAuth(pageName);
            if (userAuth != null)
            {
                string userIds = userAuth.userIds;
                if (!(userIds == null || userIds.Trim().Length == 0))
                {
                    if (userIds.Contains(teacherNo))
                    {
                        isAuth = true;
                    }
                }
            }

            return isAuth;
        }
Пример #4
0
        protected void dsltAuthTeacher_OnItemCommand(object source, DataListCommandEventArgs e)
        {
            string teacherNoSelect = this.dsltAuthTeacher.DataKeys[e.Item.ItemIndex].ToString();//取选中行教师编号
            if (e.CommandName.Equals("remove"))
            {
                DalOperationNorm dalOperationNorm = new DalOperationNorm();
                DalOperationAboutUserAuth dalua = new DalOperationAboutUserAuth();
                UserAuth userAuth = dalua.GetUserAuth(pageName);
                string[] ids = userAuth.userIds.Split(',');

                List<string> list = new List<string>();

                for (int i = 0; i < ids.Length; i++)
                {
                    if (!ids[i].Equals(teacherNoSelect))
                    {
                        list.Add(ids[i]);
                    }
                }
                userAuth.userIds = string.Join(",", list.ToArray());
                dalua.setUserAuth(userAuth);
                Javascript.JavaScriptLocationHref("/Administrator/ViewNormAuth.aspx", Page);
            }
        }
Пример #5
0
        //绑定搜索到的教师数据
        protected void TeacherDataListBind()
        {
            DalOperationAboutUserAuth dalua = new DalOperationAboutUserAuth();
            UserAuth auth = dalua.GetUserAuth(pageName);
            if (auth != null)
            {
                string ids = auth.userIds;
                string[] _ids = ids.Split(',');
                for (int i = 0; i < _ids.Length; i++)
                {
                    authIds.Add(_ids[i]);
                }
            }
            DalOperationUsers dal = new DalOperationUsers();
            string termValue = Request["termTag"];
            string teacherName = Request["teacherName"];
            DataBindSearchTermTagList(searchTeacherTermTag.Items, termValue);
            if (termValue == "all")
            {
                termValue = "";
            }
            else if(termValue == null || termValue.Trim().Length == 0) {
                termValue = searchTeacherTermTag.SelectedValue;
            }

            if (teacherName != null) {
                teacherName = teacherName.Trim();
                this.txtKeyword.Text = teacherName;
            }

            DataView dv = dal.SearchTeacherByTermTagAndKeyword(termValue, teacherName).DefaultView;

            this.TeacherListPager.RecordCount = dv.Count;
            PagedDataSource pds = new PagedDataSource();    //定义一个PagedDataSource类来执行分页功
            pds.DataSource = dv;
            pds.AllowPaging = true;

            pds.CurrentPageIndex = pageIndex - 1;
            pds.PageSize = CommonUtility.pageSize;

            this.dlSearchTeacher.DataSource = pds;
            this.dlSearchTeacher.DataBind();

            if (pds.Count > 0)
            {
                dlSearchTeacher.ShowFooter = false;
            }
        }
Пример #6
0
        //绑定搜索到的教师数据
        protected void TeacherDataListBind()
        {
            DalOperationAboutUserAuth dalua = new DalOperationAboutUserAuth();
            UserAuth auth = dalua.GetUserAuth(pageName);
            if (auth != null)
            {
                string ids = auth.userIds;
                string[] _ids = ids.Split(',');
                for (int i = 0; i < _ids.Length; i++)
                {
                    authIds.Add(_ids[i]);
                }
            }

            DalOperationUsers dal = new DalOperationUsers();

            string keyWord = "";

            if (Request["teacherName"] != null)
            {
                keyWord = Request["teacherName"].Trim();
                this.txtKeyword.Text = keyWord;
            }

            DataView dv = dal.SearchTeacherByTermTagAndKeyword(null, keyWord, 0).DefaultView;

            this.TeacherListPager.RecordCount = dv.Count;
            PagedDataSource pds = new PagedDataSource();    //定义一个PagedDataSource类来执行分页功
            pds.DataSource = dv;
            pds.AllowPaging = true;

            pds.CurrentPageIndex = pageIndex - 1;
            pds.PageSize = CommonUtility.pageSize;

            this.dlSearchTeacher.DataSource = pds;
            this.dlSearchTeacher.DataBind();

            if (pds.Count == 0)
            {
                dlSearchTeacher.ShowFooter = true;
            }
            else
            {
                dlSearchTeacher.ShowFooter = false;
            }
        }
Пример #7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        BaseConfig baseconfig = CacheCollections.GetBaseConfig();
        if (!IsPostBack)
        {

            UserCookiesInfo UserCookiesInfo = BllOperationAboutUser.GetUserCookiesInfo();

            //UserCookiesInfo UserCookiesInfo = CacheCollections.GetUserCookiesInfo();

            string nickName = string.Empty;

            switch (UserCookiesInfo.userType)
            {
                case 0:
                    ulAdmin.Visible = true;
                    nickName = "老师";

                    if (UserCookiesInfo.teacherType != null && UserCookiesInfo.teacherType == "本院")
                    {
                        drawAdminTeacher.Visible = true;
                    }

                    break;
                case 1:
                case 2:
                    ulTeacher.Visible = true;
                    nickName = "老师";
                    DalOperationNorm dalOperationNorm = new DalOperationNorm();
                    DalOperationAboutUserAuth dalua = new DalOperationAboutUserAuth();
                    UserAuth auth = dalOperationNorm.GetUserAuth(pageName);
                    UserAuth salaryAuth = dalua.GetUserAuth(salaryPageName);
                    UserAuth projectAuth = dalua.GetUserAuth(projectPageName);

                    if (auth!=null&&auth.userIds != null)
                    {
                        string[] _ids = auth.userIds.Split(',');
                        if (_ids != null)
                        {
                            norm_right = _ids.Contains(UserCookiesInfo.userNo);
                        }
                    }

                    if (salaryAuth!=null&&salaryAuth.userIds != null)
                    {
                        string[] _ids = salaryAuth.userIds.Split(',');
                        if (_ids != null)
                        {
                            if (_ids.Contains(UserCookiesInfo.userNo))
                            {
                                salary_right = true;
                            }
                        }
                    }

                    if (projectAuth != null)
                    {
                        string projectUserIds = projectAuth.userIds;
                        if (!(projectUserIds == null || projectUserIds.Trim().Length == 0))
                        {
                            if (projectUserIds.Contains(UserCookiesInfo.userNo))
                            {
                                project_right = true;
                            }
                        }
                    }

                    if (UserCookiesInfo.teacherType != null && UserCookiesInfo.teacherType == "本院")
                    {
                        drawTeacher.Visible = true;
                    }

                    break;
                case 3:
                    ulStudent.Visible = true;
                    nickName = "同学";
                    break;
                default:
                    break;
            }
            user.InnerHtml = "尊敬的" + UserCookiesInfo.userName.Trim() + nickName + "  您好!";
            //设置系统配置信息

            //DalOperationBaseConfig dobc = new DalOperationBaseConfig();
            ltlSystemVersion.Text = baseconfig.systemVersion;
            this.lblCopyRight.Text = baseconfig.systemCopyRight;
            //判断是否为班主任
            DalOperationAboutEnglishExam dalOperationAboutEnglishExam = new DalOperationAboutEnglishExam();
            if (dalOperationAboutEnglishExam.CheckIsHeadTeacherByTeacherNo(UserCookiesInfo.userNo))
            {
                englishExamManage.Visible = true;
            }
        }
        pageTitle.Text = baseconfig.systemName + " 当前系统版本号:" + baseconfig.systemVersion;
    }