public void AddMembership(Int64 securityAuthorityId, String securityAuthorityName, String userAccountId, String userAccountName, String userDisplayName, Server.Application.WorkTeamRole workTeamRole)
        {
            if (!ContainsMembership(securityAuthorityId, userAccountId))
            {
                Server.Application.WorkTeamMembership newMembership = new Server.Application.WorkTeamMembership();

                newMembership.WorkTeamId = Id;

                newMembership.SecurityAuthorityId = securityAuthorityId;

                newMembership.SecurityAuthorityName = securityAuthorityName;

                newMembership.UserAccountId = userAccountId;

                newMembership.UserAccountName = userAccountName;

                newMembership.UserDisplayName = userDisplayName;

                newMembership.WorkTeamRole = workTeamRole;

                newMembership.CreateAccountInfo = this.createAccountInfo;

                newMembership.ModifiedAccountInfo = this.modifiedAccountInfo;

                membership.Add(newMembership);
            }

            return;
        }
        public Server.Application.WorkTeamMembership MembershipGetForSession()
        {
            Server.Application.WorkTeamMembership foundMembership = null;

            foreach (Server.Application.WorkTeamMembership currentMembership in membership)
            {
                if ((currentMembership.SecurityAuthorityId == application.Session.SecurityAuthorityId) && (currentMembership.UserAccountId == application.Session.UserAccountId))
                {
                    foundMembership = currentMembership;

                    break;
                }
            }

            return(foundMembership);
        }
        public Server.Application.WorkTeamMembership MembershipGet(Int64 securityAuthorityId, String userAccountId)
        {
            Server.Application.WorkTeamMembership foundMembership = null;

            foreach (Server.Application.WorkTeamMembership currentMembership in membership)
            {
                if ((currentMembership.SecurityAuthorityId == securityAuthorityId) && (currentMembership.UserAccountId == userAccountId))
                {
                    foundMembership = currentMembership;

                    break;
                }
            }

            return(foundMembership);
        }
        public Boolean IsEqual(WorkTeam compareWorkTeam)
        {
            Boolean isEqual = base.IsEqual((CoreConfigurationObject)compareWorkTeam);


            isEqual &= (workTeamType == compareWorkTeam.WorkTeamType);

            isEqual &= (membership.Count == compareWorkTeam.Membership.Count);


            if (isEqual)
            {
                // CYCLE THROUGH ALL MEMBERSHIP, COMPARING ASSIGNED PERMISSIONS

                foreach (Server.Application.WorkTeamMembership currentMembership in membership)
                {
                    if (compareWorkTeam.ContainsMembership(currentMembership.SecurityAuthorityId, currentMembership.UserAccountId))
                    {
                        Server.Application.WorkTeamMembership compareMembership = compareWorkTeam.MembershipGet(currentMembership.SecurityAuthorityId, currentMembership.UserAccountId);

                        if (compareMembership == null)
                        {
                            isEqual = false; break;
                        }


                        isEqual &= (currentMembership.WorkTeamRole == compareMembership.WorkTeamRole);

                        if (!isEqual)
                        {
                            break;
                        }
                    }

                    else
                    {
                        isEqual = false; break;
                    }
                }
            }


            return(isEqual);
        }