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);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            id = RequestData.Get <string>("id", String.Empty);
            // 类型标识
            cid   = RequestData.Get <string>("cid", String.Empty);
            type  = RequestData.Get <string>("type", String.Empty).ToLower();
            ctype = RequestData.Get <string>("ctype", "role").ToLower();

            if (!IsAsyncRequest)
            {
                cid = "2";  //WGM 13/4/7 默认组织结构
                if (!String.IsNullOrEmpty(cid))
                {
                    try
                    {
                        int icid = Convert.ToInt32(cid);

                        SearchCriterion.SetOrder("ParentID");
                        SearchCriterion.SetOrder("SortIndex");
                        SearchCriterion.SetOrder("CreateDate");
                        SearchCriterion.AddSearch("Type", icid);

                        ents = SysGroupRule.FindAll(SearchCriterion);
                    }
                    catch { }

                    this.PageState.Add("DtList", ents);
                }
                else
                {
                    SysGroupType[] typeList = SysGroupTypeRule.FindAll();
                    this.PageState.Add("DtList", typeList);
                }
            }
            else
            {
                switch (this.RequestAction)
                {
                case RequestActionEnum.Custom:
                    if (RequestActionString == "querychildren")
                    {
                        if (type == "gtype")
                        {
                            ents = SysGroup.FindAll("FROM SysGroup as ent WHERE ent.Type = ?", id);

                            this.PageState.Add("DtList", ents);
                        }
                    }
                    break;
                }
            }
        }
Esempio n. 3
0
        private byte[] ExecuteServiceByMsgObj(OpMessage opMsg)
        {
            try
            {
                byte[] data    = null;
                Object dataObj = null;

                if (String.IsNullOrEmpty(opMsg.Operation))
                {
                    return(null);
                }

                string label = (opMsg.Lable == null ? String.Empty : opMsg.Lable).ToLower();
                string op    = (opMsg.Operation == null ? String.Empty : opMsg.Operation).ToLower();

                if (label == "getuserdata")
                {
                    using (new SessionScope())
                    {
                        UserLogonInfo  logonInfo = Server.GetLogonInfo(opMsg.SessionID);
                        IList <string> ids       = new List <string>();

                        if (logonInfo != null)
                        {
                            if (op == "getlogoninfo")
                            {
                                dataObj = logonInfo;
                            }
                            else if (op == "getalluserauth")
                            {
                                dataObj = logonInfo.User.RetrieveAllAuth();
                            }
                            else if (op == "getallusergroup")
                            {
                                dataObj = logonInfo.User.RetrieveAllGroup();
                            }
                            else if (op == "getalluserrole")
                            {
                                dataObj = logonInfo.User.RetrieveAllRole();
                            }
                            else if (op == "getalluserauthids")
                            {
                                IList <SysAuth>      auths   = logonInfo.User.RetrieveAllAuth();
                                IEnumerable <string> authIDs = auths.Select(ent => { return(ent.AuthID); });

                                dataObj = new List <string>(authIDs);
                            }
                            else if (op == "getallusergroupids")
                            {
                                IList <SysGroup>     grps   = logonInfo.User.RetrieveAllGroup();
                                IEnumerable <string> grpIDs = grps.Select(ent => { return(ent.GroupID); });

                                dataObj = new List <string>(grpIDs);
                            }
                            else if (op == "getalluserroleids")
                            {
                                IList <SysRole>      roles   = logonInfo.User.RetrieveAllRole();
                                IEnumerable <string> roleIDs = roles.Select(ent => { return(ent.RoleID); });

                                dataObj = new List <string>(roleIDs);
                            }
                            else if (op == "getuserinfo")
                            {
                                dataObj = new SimpleUserInfo(logonInfo);
                            }
                            else if (op == "getsysuser")
                            {
                                dataObj = logonInfo.User;
                            }
                        }
                    }
                }
                else if (label == "getsystemdata")
                {
                    using (new SessionScope())
                    {
                        if (opMsg.Operation == "getallapplications")
                        {
                            dataObj = new List <SysApplication>(SysApplicationRule.FindAll());
                        }
                        else if (opMsg.Operation == "getallmodules")
                        {
                            dataObj = new List <SysModule>(SysModuleRule.FindAll());
                        }
                        else if (opMsg.Operation == "getallgroups")
                        {
                            dataObj = new List <SysGroup>(SysGroupRule.FindAll());
                        }
                        else if (opMsg.Operation == "getallusers")
                        {
                            dataObj = new List <SysUser>(SysUserRule.FindAll());
                        }
                        else if (opMsg.Operation == "getallroles")
                        {
                            dataObj = new List <SysRole>(SysRoleRule.FindAll());
                        }
                        else if (opMsg.Operation == "getallauths")
                        {
                            dataObj = new List <SysAuth>(SysAuthRule.FindAll());
                        }
                    }
                }
                else
                {
                    try
                    {
                        if (op == "checkusersession")
                        {
                            dataObj = Server.CheckUserSession(opMsg.SessionID);
                        }
                        else if (op == "releasesession")
                        {
                            dataObj = Server.ReleaseSession(opMsg.SessionID);
                        }
                        else if (op == "setpreprelease")
                        {
                            if (opMsg["logmode"].Type != TypeCode.Empty)
                            {
                                Server.SetPrepRelease(opMsg.SessionID, (LoginTypeEnum)opMsg["logmode"].Value);
                            }
                            else
                            {
                                Server.SetPrepRelease(opMsg.SessionID);
                            }

                            Server.SetPrepRelease(opMsg.SessionID);
                        }
                        else if (op == "refreshsession")
                        {
                            Server.RefreshSession(opMsg.SessionID);
                        }
                    }
                    catch (Exception ex)
                    {
                        dataObj = false;
                    }
                }

                if (dataObj != null)
                {
                    data = ServiceHelper.SerializeToBytes(dataObj);
                }

                return(data);
            }
            catch (Exception ex)
            {
                return(null);
            }
        }