Ejemplo n.º 1
0
        public static AttendeeListViewModel Create(Seminar seminar, IPersonService personService, string siteId)
        {
            Check.Require(seminar != null, "seminar is required.");
            Check.Require(personService != null, "personService is required.");

            var viewModel = new AttendeeListViewModel()
            {
                Seminar = seminar,
            };

            // pull the invitation list
            var invitations = viewModel.Seminar.Invitations.Where(a => a.Seminar.Site.Id == siteId).Select(a => a.Person).ToList();
            // pull applications
            var applications = viewModel.Seminar.Applications.Where(a => a.Seminar.Site.Id == siteId).ToList();
            // pull seminar people
            var seminarPeople = viewModel.Seminar.SeminarPeople;

            var people = new List <DisplayPerson>();

            people.AddRange(DetermineParticipation(personService, seminarPeople.Where(a => a.Paid).Select(a => a.Person).ToList(), siteId, registered: true));
            people.AddRange(DetermineParticipation(personService, seminarPeople.Where(a => !a.Paid).Select(a => a.Person).ToList(), siteId, accepted: true));
            people.AddRange(DetermineParticipation(personService, applications.Where(a => !a.IsPending && !a.IsApproved).Select(a => a.User.Person).ToList(), siteId, denied: true));
            people.AddRange(DetermineParticipation(personService, applications.Where(a => a.IsPending).Select(a => a.User.Person).ToList(), siteId, applied: true));
            people.AddRange(DetermineParticipation(personService, invitations.Where(a => !people.Select(b => b.Person).Contains(a)).ToList(), siteId, invite: true));

            viewModel.SeminarPeople = people;

            return(viewModel);
        }
Ejemplo n.º 2
0
        public static AttendeeListViewModel Create(Seminar seminar, IPersonService personService, string siteId)
        {
            Check.Require(seminar != null, "seminar is required.");
            Check.Require(personService != null, "personService is required.");

            var viewModel = new AttendeeListViewModel()
                                {
                                    Seminar = seminar,
                                };

            // pull the invitation list
            var invitations = viewModel.Seminar.Invitations.Where(a => a.Seminar.Site.Id == siteId).Select(a => a.Person).ToList();
            // pull applications
            var applications = viewModel.Seminar.Applications.Where(a => a.Seminar.Site.Id == siteId).ToList();
            // pull seminar people
            var seminarPeople = viewModel.Seminar.SeminarPeople;

            var people = new List<DisplayPerson>();

            people.AddRange(DetermineParticipation(personService, seminarPeople.Where(a => a.Paid).Select(a => a.Person).ToList(), siteId, registered: true));
            people.AddRange(DetermineParticipation(personService, seminarPeople.Where(a => !a.Paid).Select(a => a.Person).ToList(), siteId, accepted: true));
            people.AddRange(DetermineParticipation(personService, applications.Where(a => !a.IsPending && !a.IsApproved).Select(a => a.User.Person).ToList(), siteId, denied: true));
            people.AddRange(DetermineParticipation(personService, applications.Where(a => a.IsPending).Select(a => a.User.Person).ToList(), siteId, applied: true));
            people.AddRange(DetermineParticipation(personService, invitations.Where(a => !people.Select(b => b.Person).Contains(a)).ToList(), siteId, invite: true));

            viewModel.SeminarPeople = people;

            return viewModel;
        }