Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsAsyncRequest)
            {
                ents = SysGroupRule.FindAll(SearchCriterion);

                this.PageState.Add("GrpList", ents);
            }

            SysGroup ent = null;

            switch (this.RequestAction)
            {
            case RequestActionEnum.Query:
            case RequestActionEnum.Default:
                ent = this.GetTargetData <SysGroup>();
                this.SetFormData(ent);
                break;

            case RequestActionEnum.Update:
                ent          = this.GetMergedData <SysGroup>();
                ent.ParentID = String.IsNullOrEmpty(ent.ParentID) ? null : ent.ParentID;
                ent.DoUpdate();
                this.SetMessage("更新成功!");
                break;

            case RequestActionEnum.Create:
                ent = this.GetPostedData <SysGroup>();
                if (String.IsNullOrEmpty(ent.ParentID))
                {
                    ent.CreateAsTop();
                }
                else
                {
                    ent.CreateAsSub(ent.ParentID);
                }
                this.SetMessage("添加模块成功!");
                break;

            case RequestActionEnum.Delete:
                ent = this.GetTargetData <SysGroup>();
                ent.DoDelete();
                this.SetMessage("删除成功!");
                break;

            case RequestActionEnum.Custom:
                if (RequestActionString == "refreshsys")
                {
                    PortalService.RefreshSysModules();
                    SetMessage("操作成功!");
                }
                break;
            }

            SysGroupType[] grpTypes = SysGroupTypeRule.FindAll();
            this.PageState.Add("GrpTypeList", grpTypes);
        }
Esempio n. 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (this.IsAsyncRequest)
            {
                SearchCriterion.SetOrder("CreateDate");
                SearchCriterion.SetOrder("SortIndex");
                ents = SysRoleRule.FindAll(SearchCriterion);

                this.PageState.Add("RoleList", ents);
            }

            SysRole ent = null;

            switch (this.RequestAction)
            {
            case RequestActionEnum.Update:
                ent = this.GetMergedData <SysRole>();
                ent.SaveAndFlush();
                this.SetMessage("保存成功!");
                break;

            case RequestActionEnum.Create:
                ent = this.GetPostedData <SysRole>();
                ent.CreateAndFlush();
                this.SetMessage("新建成功!");
                break;

            case RequestActionEnum.Delete:
                ent = this.GetTargetData <SysRole>();
                ent.DeleteAndFlush();
                this.SetMessage("删除成功!");
                break;

            case RequestActionEnum.Custom:
                if (RequestActionString == "refreshsys")
                {
                    PortalService.RefreshSysModules();
                    SetMessage("操作成功!");
                }
                break;
            }

            SysRoleType[] roleTypes = SysRoleTypeRule.FindAll();
            this.PageState.Add("RoleTypeList", roleTypes);
        }
Esempio n. 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsAsyncRequest)
            {
                switch (this.RequestAction)
                {
                case RequestActionEnum.Custom:
                    if (RequestActionString == "querychildren")
                    {
                        SysModule[] mdls = null;
                        if (RequestData.ContainsKey("ModuleID") && RequestData["ModuleID"] != null)
                        {
                            mdls = SysModule.FindAll("FROM SysModule as mdl WHERE mdl.ParentID = ?", RequestData["ModuleID"]);
                        }
                        else if (RequestData.ContainsKey("ApplicationID") && RequestData["ApplicationID"] != null)
                        {
                            mdls = SysModule.FindAll("FROM SysModule as mdl WHERE mdl.ApplicationID = ? AND  mdl.ParentID is null", RequestData["ApplicationID"]);
                        }

                        mdls = mdls.OrderBy(ent => ent.SortIndex).ToArray();

                        this.PageState.Add("Mdls", mdls);
                    }
                    else if (RequestActionString == "refreshsys")
                    {
                        PortalService.RefreshSysModules();
                        SetMessage("操作成功!");
                    }
                    break;
                }
            }
            else
            {
                SysApplication[] sysApps = SysApplicationRule.FindAll();
                sysApps = sysApps.OrderBy(ent => ent.SortIndex).ToArray();
                this.PageState.Add("Apps", sysApps);

                DataEnum de = SysModuleTypeRule.GetModuleTypeEnum();
                this.PageState.Add("MdlTypeEnum", de);
            }
        }
Esempio n. 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            switch (this.RequestAction)
            {
            case RequestActionEnum.Custom:
                if (RequestActionString == "querychildren")
                {
                    string id    = (RequestData.ContainsKey("ID") ? RequestData["ID"].ToString() : String.Empty);
                    string ttype = RequestData["Type"].ToString().ToLower();

                    if (RequestData.ContainsKey("Type"))
                    {
                        SysAuth[] ents = null;
                        if (ttype == "atype")      // 1为入口权限
                        {
                            ents = SysAuth.FindAll("FROM SysAuth as ent WHERE ent.Type = ? AND  ent.ParentID is null", id);
                        }
                        else
                        {
                            ents = SysAuth.FindAll("FROM SysAuth as ent WHERE ent.ParentID = ?", id);
                        }

                        this.PageState.Add("DtList", ents.OrderBy(v => v.SortIndex).ThenBy(v => v.CreateDate));
                    }
                }
                else if (RequestActionString == "refreshsys")
                {
                    PortalService.RefreshSysModules();

                    SetMessage("操作成功!");
                }
                break;
            }

            if (!IsAsyncRequest)
            {
                SysAuthType[] authTypeList = SysAuthTypeRule.FindAll();

                this.PageState.Add("DtList", authTypeList);
            }
        }
Esempio n. 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (this.IsAsyncRequest)
            {
                SearchCriterion.SetOrder("CreateDate");
                SearchCriterion.SetOrder("SortIndex");
                ents = SysRoleRule.FindAll(SearchCriterion);

                this.PageState.Add("RoleList", ents);
            }

            SysRole ent = null;

            switch (this.RequestAction)
            {
            case RequestActionEnum.Update:
                ent = this.GetMergedData <SysRole>();
                ent.SaveAndFlush();
                this.SetMessage("保存成功!");
                break;

            case RequestActionEnum.Create:
                ent = this.GetPostedData <SysRole>();
                ent.CreateAndFlush();
                this.SetMessage("新建成功!");
                break;

            case RequestActionEnum.Delete:
                ent = this.GetTargetData <SysRole>();
                ent.DeleteAndFlush();
                this.SetMessage("删除成功!");
                break;

            case RequestActionEnum.Custom:
                if (RequestActionString == "refreshsys")
                {
                    PortalService.RefreshSysModules();
                    SetMessage("操作成功!");
                }
                else if (RequestActionString == "getusers")
                {
                    string uids  = "";
                    string names = "";
                    using (new SessionScope())
                    {
                        ent = SysRole.Find(this.RequestData.Get <string>("id"));
                        if (ent.User.Count > 0)
                        {
                            SysUser[] usrs = ent.User.ToArray();
                            foreach (SysUser usr in usrs)
                            {
                                uids  += usr.UserID + ",";
                                names += usr.Name + ",";
                            }
                        }
                    }
                    uids  = uids.TrimEnd(',');
                    names = names.TrimEnd(',');
                    this.PageState.Add("UserId", uids);
                    this.PageState.Add("UserName", names);
                }
                else if (RequestActionString == "setusers")
                {
                    string roleId  = this.RequestData.Get <string>("id");
                    string userIds = this.RequestData.Get <string>("userids");
                    DataHelper.ExecSql("delete from SysUserRole where RoleId='" + roleId + "'");
                    string   insertTpl = "insert into SysUserRole values ('{0}','" + roleId + "')";
                    string   sql       = "";
                    string[] users     = userIds.Split(',');
                    foreach (string user in users)
                    {
                        if (user != "")
                        {
                            sql += string.Format(insertTpl, user);
                        }
                    }
                    if (sql.Trim() != "")
                    {
                        DataHelper.ExecSql(sql);
                    }
                }
                break;
            }

            SysRoleType[] roleTypes = SysRoleTypeRule.FindAll();
            this.PageState.Add("RoleTypeList", roleTypes);
        }