コード例 #1
0
        public static List <DepartmentMember> GetUniqueByPosition(Position position)
        {
            List <DepartmentMember> nonUniqueMembers = new List <DepartmentMember>();
            List <DepartmentMember> uniqueMembers    = new List <DepartmentMember>();

            List <string> departmentFISList = new List <string>();

            //Get a list of all departments assocaited with this position
            foreach (Department d in position.Departments)
            {
                departmentFISList.Add(d.DepartmentFIS);
            }

            //Get all DepartmentMembers for the current position (aka: in the list of positions departments) of the proper type
            nonUniqueMembers = DepartmentMemberBLL.GetMembersByDepartment(departmentFISList.ToArray());

            //Add external members
            foreach (CommitteeMember m in position.CommitteeMembers)
            {
                //Make sure the member is in the FRAC department
                if (m.DepartmentMember.DepartmentFIS == "FRAC")
                {
                    nonUniqueMembers.Add(m.DepartmentMember);
                }
            }

            //Now go through and make sure the member as unique
            foreach (DepartmentMember member in nonUniqueMembers)
            {
                if (!uniqueMembers.Contains(member))
                {
                    uniqueMembers.Add(member);
                }
            }

            return(uniqueMembers);
            //uniqueMembers.Sort(new DepartmentMemberComparer(sortExpression, sortDirection));
        }
コード例 #2
0
        public static void UpdateAccess(DepartmentMember member, Position position, bool committee, bool faculty, bool reviewer)
        {
            //Now get all committee roles for this member
            List <CommitteeMember> memberAccess = CommitteeMemberBLL.GetByAssociationsPosition(position, member);

            CommitteeMember currentMember = new CommitteeMember();

            currentMember.DepartmentMember   = member;
            currentMember.AssociatedPosition = position;

            //First check for Committee Member access
            CommitteeMember currentMemberAccess = DepartmentMemberBLL.MemberInCommitteeListOfType(memberAccess, MemberTypes.CommitteeMember);

            if (currentMemberAccess == null)
            {
                //member is not in the committee list.  If the box is checked, add them to the committee list
                if (committee)
                {
                    CommitteeMember newMemberAccess = new CommitteeMember();
                    newMemberAccess.DepartmentMember   = member;
                    newMemberAccess.AssociatedPosition = position;
                    newMemberAccess.MemberType         = MemberTypeBLL.GetByID((int)MemberTypes.CommitteeMember);

                    position.CommitteeMembers.Add(newMemberAccess);
                }
            }
            else
            {
                //member is in the committee list.  Remove if the box is unchecked
                if (!committee)
                {
                    position.CommitteeMembers.Remove(currentMemberAccess);
                }
            }

            //Now check for Faculty Member access
            currentMemberAccess = DepartmentMemberBLL.MemberInCommitteeListOfType(memberAccess, MemberTypes.FacultyMember);

            if (currentMemberAccess == null)
            {
                //member is not in the faculty list.  If the box is checked, add them
                if (faculty)
                {
                    CommitteeMember newMemberAccess = new CommitteeMember();
                    newMemberAccess.DepartmentMember   = member;
                    newMemberAccess.AssociatedPosition = position;
                    newMemberAccess.MemberType         = MemberTypeBLL.GetByID((int)MemberTypes.FacultyMember);

                    position.CommitteeMembers.Add(newMemberAccess);
                }
            }
            else
            {
                //member is in the committee list.  Remove if the box is unchecked
                if (!faculty)
                {
                    position.CommitteeMembers.Remove(currentMemberAccess);
                }
            }

            //Finally check for review member access
            currentMemberAccess = DepartmentMemberBLL.MemberInCommitteeListOfType(memberAccess, MemberTypes.Reviewer);

            if (currentMemberAccess == null)
            {
                //member is not in the reviewer list.  If the box is checked, add them
                if (reviewer)
                {
                    CommitteeMember newMemberAccess = new CommitteeMember();
                    newMemberAccess.DepartmentMember   = member;
                    newMemberAccess.AssociatedPosition = position;
                    newMemberAccess.MemberType         = MemberTypeBLL.GetByID((int)MemberTypes.Reviewer);

                    position.CommitteeMembers.Add(newMemberAccess);
                }
            }
            else
            {
                //member is in the committee list.  Remove if the box is unchecked
                if (!reviewer)
                {
                    position.CommitteeMembers.Remove(currentMemberAccess);
                }
            }

            //Position position = position;
            PositionBLL.EnsurePersistent(position);
        }