Exemple #1
0
        public static IList <RowData> ToRowData(this ElectionSettings settings)
        {
            var rows = new List <RowData> {
                CreateRow("StartTime".ToCellData(), GetCellData(settings.StartTime)),
                CreateRow("EndTime".ToCellData(), GetCellData(settings.EndTime)),
                CreateRow("FaqUrl".ToCellData(), GetCellData(settings.FaqUrl)),
                CreateRow("AdminEmail".ToCellData(), GetCellData(settings.AdminEmail)),
                CreateRow("SupportEmail".ToCellData(), GetCellData(settings.SupportEmail)),
                CreateRow("AuditEmail".ToCellData(), GetCellData(settings.AuditEmail)),
                CreateRow("EmailVerification".ToCellData(), GetCellData(settings.EmailVerification)),
                CreateRow("BallotUpdates".ToCellData(), GetCellData(settings.BallotUpdates)),
                CreateRow("RandomizeCandidates".ToCellData(), GetCellData(settings.RandomizeCandidates)),
                CreateRow("PublicResults".ToCellData(), GetCellData(settings.PublicResults)),
                CreateRow("VoterAuthorization".ToCellData(), GetCellData(settings.VoterAuthorization)),
            };

            return(rows);
        }
Exemple #2
0
        public static Election DefaultValue()
        {
            var settings = new ElectionSettings
            {
                StartTime           = DateTime.UtcNow,
                EndTime             = DateTime.UtcNow + new TimeSpan(7, 0, 0, 0, 0),
                FaqUrl              = "",
                AdminEmail          = "*****@*****.**",
                SupportEmail        = "*****@*****.**",
                AuditEmail          = "*****@*****.**",
                EmailVerification   = true,
                VoterAuthorization  = false,
                BallotUpdates       = false,
                PublicResults       = true,
                RandomizeCandidates = false
            };
            var races = new List <Race> {
                new Race {
                    Caption    = "Race 1",
                    Candidates = new List <string> {
                        "Candidate 1", "Candidate 2", "Candidate 3"
                    }
                },
                new Race {
                    Caption    = "Race 2",
                    Candidates = new List <string> {
                        "A", "B", "C", "D", "E"
                    }
                }
            };

            return(new Election
            {
                Title = "My Election",
                Settings = settings,
                Races = races,
                AuthorizedVoters = null
            });
        }