public static IEnumerable <ElectionsPoliticiansRow> GetPrimaryWinnersForGeneralElection( string generalElectionKey, DateTime primaryDate, bool isRunoff = false) { var electionTypes = new List <string>(); if (isRunoff) { electionTypes.Add(Elections.ElectionTypeStatePrimaryRunoff); } else { electionTypes.Add(Elections.ElectionTypeStatePresidentialPrimary); electionTypes.Add(Elections.ElectionTypeStatePrimary); } var searchElectionKey = Elections.GetStateCodeFromKey(generalElectionKey) + primaryDate.ToString("yyyyMMdd") + //(isRunoff ? Elections.ElectionTypeStatePrimaryRunoff : Elections.ElectionTypeStatePrimary) + "__" /*any type, any party*/ + Elections.GetCountyCodeFromKey(generalElectionKey) + Elections.GetLocalCodeFromKey(generalElectionKey); var cmdText = SelectAllCommandText + " WHERE ElectionKey LIKE @ElectionKey AND IsWinner=1" + " AND SUBSTR(ElectionKey,11,1) IN ('" + string.Join("','", electionTypes) + "')"; var cmd = VoteDb.GetCommand(cmdText); VoteDb.AddCommandParameter(cmd, "ElectionKey", searchElectionKey); return(FillTable(cmd, ElectionsPoliticiansTable.ColumnSet.All)); }
public static IEnumerable <ElectionsPoliticiansRow> GetRunoffAdvancersForElection( string runoffElectionKey, DateTime electionDate) { var searchElectionKey = Elections.GetStateCodeFromKey(runoffElectionKey) + electionDate.ToString("yyyyMMdd") + Elections.GetElectionTypeForRunoff(Elections.GetElectionTypeFromKey(runoffElectionKey)) + Elections.GetNationalPartyCodeFromKey(runoffElectionKey) + Elections.GetCountyCodeFromKey(runoffElectionKey) + Elections.GetLocalCodeFromKey(runoffElectionKey); var cmdText = SelectAllCommandText + " WHERE ElectionKey=@ElectionKey AND AdvanceToRunoff=1"; var cmd = VoteDb.GetCommand(cmdText); VoteDb.AddCommandParameter(cmd, "ElectionKey", searchElectionKey); return(FillTable(cmd, ElectionsPoliticiansTable.ColumnSet.All)); }