private static int MoveVideoToAnswers(PoliticiansRow politician, int count, ref int duplicate) { var youTubeId = politician.YouTubeWebAddress.GetYouTubeVideoId(); VideoInfo videoInfo = null; if (!IsNullOrWhiteSpace(youTubeId)) { videoInfo = YouTubeVideoUtility.GetVideoInfo(youTubeId, false, 1); } if (videoInfo != null && videoInfo.IsValid) { count++; // get Why I'm Running answers var answers = Answers.GetDataByPoliticianKeyQuestionKey(politician.PoliticianKey, QuestionKey); if (answers.All(row => row.YouTubeUrl.GetYouTubeVideoId() != youTubeId)) { // doesn't exist -- add to first without a YouTubeUrl var rowToUpdate = answers.FirstOrDefault(row => IsNullOrWhiteSpace(row.YouTubeUrl)); if (rowToUpdate == null) { // new to add a row { rowToUpdate = answers.NewRow(politician.PoliticianKey, QuestionKey, Answers.GetNextSequence(politician.PoliticianKey, QuestionKey), Politicians.GetStateCodeFromKey(politician.PoliticianKey), IssueKey, Empty, Empty, VotePage.DefaultDbDate, "curt", Empty, Empty, default, Empty, Empty,
private static string FormatCampaign(PoliticiansRow p) { var lines = new List <string>(); var address = FormatAddress(p.CampaignAddress, p.CampaignCityStateZip); if (!string.IsNullOrWhiteSpace(p.CampaignName)) { lines.Add("Name: " + p.CampaignName); } if (!string.IsNullOrWhiteSpace(address)) { lines.Add("Address: " + address); } if (!string.IsNullOrWhiteSpace(p.CampaignPhone)) { lines.Add("Phone: " + p.CampaignPhone); } if (!string.IsNullOrWhiteSpace(p.CampaignEmail)) { lines.Add("Email: " + p.CampaignEmail); } return(string.Join("<br />", lines)); }