コード例 #1
0
ファイル: AuthRole.aspx.cs プロジェクト: daowzq/SurveyProject
        protected void Page_Load(object sender, EventArgs e)
        {
            if (this.IsAsyncRequest)
            {
                switch (this.RequestAction)
                {
                case RequestActionEnum.Custom:
                    if (RequestActionString == "querychildren")
                    {
                        string id   = (RequestData.ContainsKey("ID") ? RequestData["ID"].ToString() : String.Empty);
                        string type = RequestData["Type"].ToString().ToLower();

                        if (RequestData.ContainsKey("Type"))
                        {
                            if (type == "rtype")
                            {
                                id   = (RequestData.ContainsKey("RoleTypeID") ? RequestData["RoleTypeID"].ToString() : String.Empty);
                                ents = SysRole.FindAll("FROM SysRole as ent WHERE ent.Type = ?", id);

                                this.PageState.Add("DtList", ents);
                            }
                        }
                    }
                    break;
                }
            }
            else
            {
                SysRoleType[] typeList = SysRoleTypeRule.FindAll();
                this.PageState.Add("DtList", typeList);
            }
        }
コード例 #2
0
        /// <summary>
        /// 刷新应用模块
        /// </summary>
        public void RefreshModules()
        {
            applications = new ReadOnlyCollection <SysApplication>(SysApplication.FindAll());
            modules      = new ReadOnlyCollection <SysModule>(SysModule.FindAll(Expression.Eq(SysModule.Prop_Status, 1)));

            auths  = new ReadOnlyCollection <SysAuth>(SysAuth.FindAll());
            roles  = new ReadOnlyCollection <SysRole>(SysRole.FindAll());
            groups = new ReadOnlyCollection <SysGroup>(SysGroup.FindAll());
        }
コード例 #3
0
        /// <summary>
        /// 刷新应用模块
        /// </summary>
        private void RefreshModules()
        {
            applications = new List <SysApplication>(SysApplication.FindAll());
            modules      = new List <SysModule>(SysModule.FindAll(Expression.Eq(SysModule.Prop_Status, 1)));

            auths  = new List <SysAuth>(SysAuth.FindAll());
            roles  = new List <SysRole>(SysRole.FindAll());
            groups = new List <SysGroup>(SysGroup.FindAll());
        }
コード例 #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // 若未对SortIndex和CreateTime进行排序,在这里进行排序
            if (!SearchCriterion.HasOrdered("SortIndex") && SearchCriterion.HasOrdered("CreateTime"))
            {
                SearchCriterion.SetOrder("SortIndex");
                SearchCriterion.SetOrder("CreateTime");
            }

            ents = SysRole.FindAll(SearchCriterion);

            this.PageState.Add("DtList", ents);
        }
コード例 #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ents = SysRole.FindAll(SearchCriterion);

            this.PageState.Add("DtList", ents);

            //if (!IsAsyncRequest)
            //{
            //    this.PageState.Add("CatalogEnum", SysRole.GetCatalogDict());

            //    this.PageState.Add("DataEnum", SysEnumeration.GetEnumDicts("EPC.Supplier.OpProperty", "EPC.Supplier.Qualification", "EPC.Supplier.QualificationGrade"));
            //}
        }
コード例 #6
0
ファイル: RolTree.aspx.cs プロジェクト: daowzq/SurveyProject
        string type = String.Empty; // 查询类型

        protected void Page_Load(object sender, EventArgs e)
        {
            id   = (RequestData.ContainsKey("id") ? RequestData["id"].ToString() : String.Empty);
            type = (RequestData.ContainsKey("type") ? RequestData["type"].ToString() : String.Empty).ToLower();

            if (this.IsAsyncRequest)
            {
                switch (this.RequestAction)
                {
                case RequestActionEnum.Custom:
                    if (RequestActionString == "querychildren" || RequestActionString == "querydescendant")
                    {
                        SysRole[] ents = null;

                        if (RequestActionString == "querychildren" || RequestActionString == "querydescendant")
                        {
                            string atype = String.Empty;

                            if (type == "rtype")
                            {
                                ents = SysRole.FindAll("FROM SysRole as ent WHERE ent.Type = ?", id);
                            }
                        }

                        string jsonString = JsonHelper.GetJsonString(this.ToExtTreeCollection(ents, null));
                        Response.Write(jsonString);

                        Response.End();
                    }
                    else if (RequestActionString == "savechanges")
                    {
                        ICollection authAdded   = RequestData["added"] as ICollection;
                        ICollection authRemoved = RequestData["removed"] as ICollection;

                        if (type == "user" && !String.IsNullOrEmpty(id))
                        {
                            SysRoleRule.GrantRoleToUser(authAdded, id);
                            SysRoleRule.RevokeRoleFromUser(authRemoved, id);
                        }
                        else if (type == "group" && !String.IsNullOrEmpty(id))
                        {
                            SysRoleRule.GrantRoleToGroup(authAdded, id);
                            SysRoleRule.RevokeRoleFromGroup(authRemoved, id);
                        }
                    }
                    break;
                }
            }
            else
            {
                SysRoleType[] typeList = SysRoleTypeRule.FindAll();
                this.PageState.Add("EntData", typeList);
            }

            // 获取权限列表
            if (RequestAction != RequestActionEnum.Custom)
            {
                this.PageState.Add("EntityID", id);

                IEnumerable <string> roleIDs = null;
                using (new Castle.ActiveRecord.SessionScope())
                {
                    if (type == "user" && !String.IsNullOrEmpty(id))
                    {
                        SysUser user = SysUser.Find(id);
                        roleIDs = (user.Role).Select((ent) => { return(ent.RoleID); });
                    }
                    else if (type == "group" && !String.IsNullOrEmpty(id))
                    {
                        SysGroup group = SysGroup.Find(id);
                        roleIDs = (group.Role).Select((ent) => { return(ent.RoleID); });
                    }

                    this.PageState.Add("EntList", new List <string>(roleIDs));
                }
            }
        }