/// <Summary>Only those listed</Summary> public IEnumerable <object> FrontDeskPersonLines(List <Person> people, FrontDeskSortEnum sortType = FrontDeskSortEnum.ByName) { var peopleCount = people.Count; if (peopleCount == 0) { return(new List <object>()); } var hasMultipleLocations = ContextItems.LocationModel.HasMultipleLocations; var useOnline = UserSession.CurrentElection.OnlineEnabled; var firstPersonGuid = people[0].PersonGuid; var onlineProcessed = Db.OnlineVotingInfo .Where(ovi => ovi.ElectionGuid == UserSession.CurrentElectionGuid) .Where(ovi => ovi.Status == OnlineBallotStatusEnum.Processed.Value) .Where(ovi => peopleCount != 1 || firstPersonGuid == ovi.PersonGuid) .Select(ovi => ovi.PersonGuid) .ToList(); return(people .OrderBy(p => sortType == FrontDeskSortEnum.ByArea ? p.Area : "") .ThenBy(p => p.LastName) .ThenBy(p => p.FirstName) .ThenBy(p => p.C_RowId) .Select(p => new { PersonId = p.C_RowId, p.FullName, NameLower = (p.FullName + p.BahaiId).WithoutDiacritics(true).ReplacePunctuation(' ') .Replace(" ", "").Replace("\"", "\\\""), p.Area, VotedAt = new[] { ShowRegistrationTime(p), ShowTellers(p), hasMultipleLocations ? LocationName(p.VotingLocationGuid) : "", }.JoinedAsString("; ", true) + FormatRegistrationLog(p), p.VotingMethod, InPerson = p.VotingMethod == VotingMethodEnum.InPerson, DroppedOff = p.VotingMethod == VotingMethodEnum.DroppedOff, MailedIn = p.VotingMethod == VotingMethodEnum.MailedIn, CalledIn = p.VotingMethod == VotingMethodEnum.CalledIn, Custom1 = p.VotingMethod == VotingMethodEnum.Custom1, Custom2 = p.VotingMethod == VotingMethodEnum.Custom2, Custom3 = p.VotingMethod == VotingMethodEnum.Custom3, Imported = p.VotingMethod == VotingMethodEnum.Imported, Online = useOnline && p.VotingMethod == VotingMethodEnum.Online, HasOnline = useOnline && p.HasOnlineBallot.GetValueOrDefault(), CanBeOnline = useOnline && (p.VotingMethod == VotingMethodEnum.Online || p.Email.HasContent() || p.Phone.HasContent()), // consider VotingMethod in case email/phone removed after OnlineProcessed = onlineProcessed.Contains(p.PersonGuid), Registered = p.VotingMethod == VotingMethodEnum.Registered, EnvNum = ShowEnvNum(p), p.CanVote, p.CanReceiveVotes, // for ballot entry page p.IneligibleReasonGuid, // for ballot entry page p.BahaiId })); }
/// <Summary>Only those listed</Summary> public IEnumerable <object> FrontDeskPersonLines(List <Person> people, FrontDeskSortEnum sortType = FrontDeskSortEnum.ByName) { var showLocations = Locations.Count() > 1; var timeOffset = UserSession.TimeOffsetServerAhead; return(people .OrderBy(p => sortType == FrontDeskSortEnum.ByArea ? p.Area : "") .ThenBy(p => p.LastName) .ThenBy(p => p.FirstName) .ThenBy(p => p.Id) .Select(p => new { PersonId = p.Id, p.FullName, NameLower = (p.FullName + p.BahaiId).WithoutDiacritics(true).ReplacePunctuation(' ').Replace(" ", "").Replace("\"", "\\\""), p.Area, VotedAt = new[] { ShowRegistrationTime(timeOffset, p), ShowTellers(p), showLocations ? LocationName(p.VotingLocationGuid) : "", FormatRegistrationLog(p), }.JoinedAsString("; ", true), p.VotingMethod, InPerson = p.VotingMethod == VotingMethodEnum.InPerson, DroppedOff = p.VotingMethod == VotingMethodEnum.DroppedOff, MailedIn = p.VotingMethod == VotingMethodEnum.MailedIn, CalledIn = p.VotingMethod == VotingMethodEnum.CalledIn, Registered = p.VotingMethod == VotingMethodEnum.Registered, EnvNum = ShowEnvNum(p), p.CanVote, p.CanReceiveVotes, // for ballot entry page p.IneligibleReasonGuid, // for ballot entry page p.BahaiId })); }
/// <Summary>Everyone</Summary> public IEnumerable <object> FrontDeskPersonLines(FrontDeskSortEnum sortType = FrontDeskSortEnum.ByName) { return(FrontDeskPersonLines(PeopleWhoCanVote())); }
/// <Summary>Only those listed</Summary> public IEnumerable<object> FrontDeskPersonLines(List<Person> people, FrontDeskSortEnum sortType = FrontDeskSortEnum.ByName) { var locations = Locations.ToDictionary(l => l.LocationGuid, l => l.Name); var showLocations = locations.Count > 1; var tellers = Db.Tellers.Where(t => t.ElectionGuid == CurrentElectionGuid).ToDictionary(t => t.TellerGuid, t => t.Name); var timeOffset = UserSession.TimeOffsetServerAhead; return people .OrderBy(p => sortType == FrontDeskSortEnum.ByArea ? p.Area : "") .ThenBy(p => p.LastName) .ThenBy(p => p.FirstName) .Select(p => new { PersonId = p.C_RowId, FullName = p.C_FullName, NameLower = p.C_FullName.WithoutDiacritics(true).Replace("\"", "\\\""), p.Area, VotedAt = new[] { showLocations && p.VotingLocationGuid.HasValue ? locations[p.VotingLocationGuid.Value] : "", ShowTellers(tellers, p), ShowRegistrationTime(timeOffset, p) }.JoinedAsString("; ", true), InPerson = p.VotingMethod == VotingMethodEnum.InPerson, DroppedOff = p.VotingMethod == VotingMethodEnum.DroppedOff, MailedIn = p.VotingMethod == VotingMethodEnum.MailedIn, CalledIn = p.VotingMethod == VotingMethodEnum.CalledIn, EnvNum = ShowEnvNum(p) }); }
/// <Summary>Everyone</Summary> public IEnumerable<object> FrontDeskPersonLines(FrontDeskSortEnum sortType = FrontDeskSortEnum.ByName) { return FrontDeskPersonLines(PeopleForFrontDesk()); }