Beispiel #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            cid   = RequestData.Get <string>("cid", String.Empty);
            type  = RequestData.Get <string>("type", String.Empty).ToLower();
            ctype = RequestData.Get <string>("ctype", "role").ToLower();

            if (!String.IsNullOrEmpty(cid))
            {
                try
                {
                    int icid = Convert.ToInt32(cid);

                    SearchCriterion.AddSearch("Type", icid);

                    ents = SysRoleRule.FindAll(SearchCriterion);
                }
                catch { }
            }
            else
            {
                ents = SysRoleRule.FindAll(SearchCriterion);
            }

            this.PageState.Add("DtList", ents);
        }
Beispiel #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            cid   = RequestData.Get <string>("cid", String.Empty);
            type  = RequestData.Get <string>("type", String.Empty).ToLower();
            ctype = RequestData.Get <string>("ctype", "role").ToLower();

            if (RequestActionString == "getData")
            {
                string filedVal = this.RequestData.Get("filedVal") + "";
                string sql      = @"select top 200 A.RoleID,A.Code,A.Description,A.Type,A.SortIndex,
                                   A.Name +' ['+ case when B.name is not null then B.Name+'/' else '' end +
                                   C.Name + ']'  AS Name
                                from Sysrole AS A
                                 left join SysGroup As B 
                                    on A.Pk_corp=B.GroupID
                                left join SysGroup As C
                                    on A.pk_deptdoc=C.GroupID
                                where A.Isabort='N' and len(A.Pk_corp)>0  and  len(A.pk_deptdoc)>0 and A.Name like '%{0}%' ";

                sql = sql.Replace("FL_PortalHR", Global.AimPortalDB);
                sql = string.Format(sql, filedVal);
                this.PageState.Add("DataList", DataHelper.QueryDictList(sql));
            }
            if (!String.IsNullOrEmpty(cid))
            {
                try
                {
                    int icid = Convert.ToInt32(cid);

                    SearchCriterion.AddSearch("Type", icid);

                    ents = SysRoleRule.FindAll(SearchCriterion);
                    this.PageState.Add("DtList", ents);
                }
                catch { }
            }
            else
            {
                string sql = @" select top 100 A.RoleID,A.Code,A.Description,A.Type,A.SortIndex,
                                    A.Name+' ['+ case when B.name is not null then B.Name+'/' else '' end +
                                    C.Name + ']'  AS Name
                                from Sysrole AS A
                                 left join SysGroup As B 
                                    on A.Pk_corp=B.GroupID
                                left join SysGroup As C
                                    on A.pk_deptdoc=C.GroupID
                                where A.Isabort='N' and len(A.Pk_corp)>0  and  len(A.pk_deptdoc)>0";
                ents = SysRoleRule.FindAll(SearchCriterion);
                this.PageState.Add("DtList", DataHelper.QueryDictList(sql));
            }
        }
Beispiel #3
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);
        }
Beispiel #4
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);
            }
        }
Beispiel #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);
        }