Ejemplo n.º 1
0
        /* Get Group Users of selected */
        public Entities.UserGroup GetUserSecurity(string userName)
        {
            if (!userName.ToLower().StartsWith("coned"))
            {
                userName = "******" + userName;
            }
            Entities.UserGroup userGroup = new Entities.UserGroup();
            try
            {
                var dbUserGroup = JSSESecurityManager.GetUserSecurity(userName);
                if (dbUserGroup != null)
                {
                    userGroup.User = new Entities.UserInfo();
                    userGroup.User.SecurityUserID = dbUserGroup.SecurityUser_ID;
                    userGroup.User.User_ID        = dbUserGroup.User_ID;
                    int empId = 0;
                    Int32.TryParse(dbUserGroup.EmptNo, out empId);
                    userGroup.User.Emp_Id        = empId;
                    userGroup.User.FirstName     = dbUserGroup.FirstName;
                    userGroup.User.LastName      = dbUserGroup.LastName;
                    userGroup.User.FullName      = dbUserGroup.LastName + " , " + dbUserGroup.FirstName;
                    userGroup.User.Email         = dbUserGroup.Email;
                    userGroup.User.User_ID       = dbUserGroup.User_ID;
                    userGroup.User.Org_Id        = dbUserGroup.Org_ID;
                    userGroup.User.MajorGroup_Id = dbUserGroup.MajorGroup_ID;
                    userGroup.User.Dept_Id       = dbUserGroup.Dept_Id;
                    userGroup.User.Section_Id    = dbUserGroup.SectionId;

                    List <Entities.Group> groups = new List <Entities.Group>();
                    foreach (var ugp in dbUserGroup.T_JSSE_Security_UserGroup)
                    {
                        Entities.Group group = new Entities.Group();
                        group.Group_ID  = ugp.T_JSSE_Security_Group.SecurityGroup_ID;
                        group.GroupName = ugp.T_JSSE_Security_Group.GroupName;
                        group.GroupType = new Entities.GroupType()
                        {
                            Level_Id = ugp.T_JSSE_Security_Group.GroupLevel
                        };
                        group.MajorGroup_Id = ugp.T_JSSE_Security_Group.MajorGroup_Id;
                        group.Org_Id        = ugp.T_JSSE_Security_Group.Org_Id;
                        List <Entities.Permission> perms = new List <Entities.Permission>();
                        foreach (var dbPerm in ugp.T_JSSE_Security_Group.T_JSSE_Security_GroupPermission)
                        {
                            Entities.Permission perm = new Entities.Permission();
                            perm.Permission_ID  = dbPerm.T_JSSE_Security_Permission.SecurityPermission_ID;
                            perm.PermissionName = dbPerm.T_JSSE_Security_Permission.PermissionName;
                            perms.Add(perm);
                        }
                        group.Permissions = perms.ToArray();
                        groups.Add(group);
                    }
                    userGroup.Groups = groups.ToArray();
                }
            }
            catch
            {
                throw;
            }
            return(userGroup);
        }
Ejemplo n.º 2
0
        public List <Entities.Group> GetSecurityGroups(int?levelID)
        {
            List <Entities.Group> groups = new List <Entities.Group>();

            try
            {
                var dbGroups = JSSESecurityManager.GetSecurityGroups(levelID);
                foreach (var dbGrp in dbGroups)
                {
                    Entities.Group grp = new Entities.Group();
                    grp.Group_ID  = dbGrp.SecurityGroup_ID;
                    grp.GroupName = dbGrp.GroupName;
                    grp.GroupDesc = dbGrp.GroupDesc;
                    grp.GroupType = new Entities.GroupType()
                    {
                        Level_Id = dbGrp.Level_ID, Level_Name = dbGrp.LevelName
                    };
                    grp.MajorGroup_Id = dbGrp.MajorGroup_Id;
                    grp.Org_Id        = dbGrp.Org_Id;
                    grp.ModifiedDate  = dbGrp.ModifiedDate;
                    if (dbGrp.PermIDList != null)
                    {
                        List <Entities.Permission> perms = new List <Entities.Permission>();
                        string[] permIDList   = dbGrp.PermIDList.Split(',');
                        string[] permNameList = dbGrp.PermList.Split(',');
                        for (int dbPerm = 0; dbPerm < permIDList.Length; dbPerm++)
                        {
                            Entities.Permission perm = new Entities.Permission();
                            perm.Permission_ID  = Int32.Parse(permIDList[dbPerm]);
                            perm.PermissionName = permNameList[dbPerm];
                            perms.Add(perm);
                        }
                        grp.Permissions = perms.ToArray();
                    }
                    groups.Add(grp);
                }
            }
            catch
            {
                throw;
            }
            return(groups);
        }
Ejemplo n.º 3
0
        public List <Entities.Group> GetGroupsByLevel(int levelId, string orgId, int permissionID)
        {
            List <Entities.Group> groups = new List <Entities.Group>();

            try
            {
                var dbGroups = JSSESecurityManager.GetGroupsByLevel(levelId, orgId, permissionID);
                foreach (var dbGrp in dbGroups)
                {
                    Entities.Group grp = new Entities.Group();
                    grp.Group_ID  = dbGrp.SecurityGroup_ID;
                    grp.GroupName = dbGrp.GroupName;
                    grp.GroupDesc = dbGrp.GroupDesc;
                    grp.GroupType = new Entities.GroupType()
                    {
                        Level_Id = dbGrp.GroupLevel
                    };
                    grp.MajorGroup_Id = dbGrp.MajorGroup_Id;
                    grp.Org_Id        = dbGrp.Org_Id;
                    grp.ModifiedDate  = dbGrp.ModifiedDate;
                    if (dbGrp.T_JSSE_Security_GroupPermission != null)
                    {
                        List <Entities.Permission> perms = new List <Entities.Permission>();
                        foreach (var dbPerm in dbGrp.T_JSSE_Security_GroupPermission)
                        {
                            Entities.Permission perm = new Entities.Permission();
                            perm.Permission_ID  = dbPerm.T_JSSE_Security_Permission.SecurityPermission_ID;
                            perm.PermissionName = dbPerm.T_JSSE_Security_Permission.PermissionName;
                            perms.Add(perm);
                        }
                        grp.Permissions = perms.ToArray();
                    }
                    groups.Add(grp);
                }
            }
            catch
            {
                throw;
            }
            return(groups);
        }