示例#1
0
        /* Deprecated */
        public Affiliation AffiliateWith(Establishment establishment)
        {
            var currentAffiliations = Affiliations.ToList();

            // affiliation may already exist
            var affiliation = currentAffiliations
                              .SingleOrDefault(a => a.Establishment.Equals(establishment));

            if (affiliation != null)
            {
                return(affiliation);
            }

            // create affiliation
            affiliation = new Affiliation
            {
                // if person does not already have a default affiliation, this is it
                IsDefault     = !currentAffiliations.Any(a => a.IsDefault),
                Establishment = establishment, // affiliate with establishment
                Person        = this,

                // for non-institutions, person should not be claiming student, faculty, etc
                IsClaimingEmployee = !establishment.IsInstitution,
            };

            // add & return affiliation
            Affiliations.Add(affiliation);
            return(affiliation);
        }
        private AffiliationList()
        {
            Affiliations = _readWriter.ReadFileToList(ApplicationXmlFiles.FileType.AffiliationData);

            if (Affiliations.Count <= 0)
            {
                Affiliations.Add(new Affiliation
                {
                    Name = "Player", BackgroundColor = new[] { 128, 0, 0, 255 }, ForegroundColor = new[] { 255, 0, 0, 0 }
                });
                Affiliations.Add(new Affiliation
                {
                    Name = "Enemy", BackgroundColor = new[] { 128, 255, 0, 0 }, ForegroundColor = new[] { 255, 0, 0, 0 }
                });
            }
        }
示例#3
0
        public async void QueryDatabase()
        {
            var getAffiliations = await _database.RefreshAffiliations().ConfigureAwait(true);

            Affiliations.Clear();

            foreach (Affiliation affiliation in getAffiliations)
            {
                Affiliations.Add(affiliation);
            }
            Affiliations = new ObservableCollection <Affiliation>(getAffiliations);

            var getParticipants = await _database.RefreshParticipants().ConfigureAwait(true);

            Participants.Clear();

            foreach (Participant participant in getParticipants)
            {
                Participants.Add(participant);
            }
        }