public static List <Application> GetByPositionID(int positionID) { if (positionID == 0) { return(null); } Position position = PositionBLL.GetByID(positionID); return(new List <Application>(position.AssociatedApplications)); }
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); }