private Control GenerateOneCandidateVideoContent(string electionKey, string officeKey, string politicianKey) { var container = new PlaceHolder(); _IssuesDataManager.GetCandidateVideoData(electionKey, officeKey, politicianKey); // for older elections show all responese var electionDate = Elections.GetElectionDateFromKey(electionKey); var oldAnswerCutoff = electionDate > DateTime.UtcNow.AddMonths(-6) ? ElectionsOffices.GetOldAnswerCutoffDate(electionKey, officeKey) : DateTime.MinValue; var issuesData = _IssuesDataManager.GetDataSubset() .Where(r => r.YouTubeDate() >= oldAnswerCutoff); //var isRunningMateOffice = Offices.GetIsRunningMateOffice(officeKey, false) && // !Elections.IsPrimaryElection(electionKey); var isRunningMateOffice = Offices.IsRunningMateOfficeInElection(electionKey, officeKey); var politician = Politicians.GetPoliticianIntroReportData(politicianKey); DataRow runningMate = null; var name = Politicians.FormatName(politician); string runningMateKey = null; string runningMateName = null; if (isRunningMateOffice) { //var cache = PageCache.GetTemporary(); //name = cache.Politicians.GetPoliticianName(politicianKey); runningMateKey = ElectionsPoliticians .GetRunningMateKeyByElectionKeyOfficeKeyPoliticianKey( electionKey, officeKey, politicianKey); runningMate = Politicians.GetPoliticianIntroReportData(runningMateKey); //runningMateName = cache.Politicians.GetPoliticianName(runningMateKey); runningMateName = Politicians.FormatName(runningMate); } var videos = issuesData .Where(r => r.PoliticianKey().IsEqIgnoreCase(politicianKey)).ToList(); var qas = GetQuestionAndAnswerList(videos, politician, true, true); if (qas.Any()) { ReportCandidateVideos(container, politician, qas, name, isRunningMateOffice); } if (!IsNullOrWhiteSpace(runningMateKey)) { var runningMateVideos = issuesData .Where(r => r.PoliticianKey().IsNeIgnoreCase(politicianKey)).ToList(); qas = GetQuestionAndAnswerList(runningMateVideos, runningMate, true, true); if (qas.Any()) { ReportCandidateVideos(container, runningMate, qas, runningMateName, true); } } return(container); }
private Control GenerateOneCandidateVideoContent(string electionKey, string officeKey, string politicianKey) { var container = new PlaceHolder(); _IssuesDataManager.GetCandidateVideoData(electionKey, officeKey, politicianKey); var issuesData = _IssuesDataManager.GetDataSubset(); var isRunningMateOffice = Offices.GetIsRunningMateOffice(officeKey, false) && !Elections.IsPrimaryElection(electionKey); var politician = Politicians.GetPoliticianIntroReportData(politicianKey); DataRow runningMate = null; var name = Politicians.FormatName(politician); string runningMateKey = null; string runningMateName = null; if (isRunningMateOffice) { //var cache = PageCache.GetTemporary(); //name = cache.Politicians.GetPoliticianName(politicianKey); runningMateKey = ElectionsPoliticians .GetRunningMateKeyByElectionKeyOfficeKeyPoliticianKey( electionKey, officeKey, politicianKey); runningMate = Politicians.GetPoliticianIntroReportData(runningMateKey); //runningMateName = cache.Politicians.GetPoliticianName(runningMateKey); runningMateName = Politicians.FormatName(runningMate); } var videos = issuesData .Where(r => r.PoliticianKey().IsEqIgnoreCase(politicianKey)).ToList(); var qas = GetQuestionAndAnswerList(videos, politician, true, true); if (qas.Any()) { ReportCandidateVideos(container, politician, qas, name, isRunningMateOffice); } if (!string.IsNullOrWhiteSpace(runningMateKey)) { var runningMateVideos = issuesData .Where(r => r.PoliticianKey().IsNeIgnoreCase(politicianKey)).ToList(); qas = GetQuestionAndAnswerList(runningMateVideos, runningMate, true, true); if (qas.Any()) { ReportCandidateVideos(container, runningMate, qas, runningMateName, true); } } return(container); }