private static void GenerateRow(PdfPTable table, PlayerInfo player, Font font, BaseColor backgroundColor) { var jpg = Image.GetInstance(player.PictureUrl); table.AddCell(jpg); PdfPCell cell; cell = new PdfPCell(new Phrase(player.JerseyNumber, font)) {BackgroundColor = backgroundColor}; table.AddCell(cell); cell = new PdfPCell(new Phrase(player.Name, font)) {BackgroundColor = backgroundColor}; table.AddCell(cell); if (table.NumberOfColumns == NumberColsWithPosition) { cell = new PdfPCell(new Phrase(player.Position, font)) {BackgroundColor = backgroundColor}; table.AddCell(cell); } cell = new PdfPCell(new Phrase(player.Height, font)) {BackgroundColor = backgroundColor}; table.AddCell(cell); cell = new PdfPCell(new Phrase(player.Weight, font)) {BackgroundColor = backgroundColor}; table.AddCell(cell); cell = new PdfPCell(new Phrase(player.DateOfBirth, font)) {BackgroundColor = backgroundColor}; table.AddCell(cell); cell = new PdfPCell(new Phrase(player.Age, font)) {BackgroundColor = backgroundColor}; table.AddCell(cell); cell = new PdfPCell(new Phrase(player.BirthPlace, font)) {BackgroundColor = backgroundColor}; table.AddCell(cell); }
public void AddPlayerInfoRow(PlayerInfo playerInfo) { }
private PlayerInfo CreatePlayerFromRosterRow(TeamInfo loadedTeam, HtmlNode row) { var rowElements = row.SelectNodes("td"); var childNodeCount = rowElements.Count; var relElement = rowElements[1].Attributes["rel"].Value; var playerPhotoId = relElement.Split(':')[1]; var pictureUrl = "http://3.cdn.nhle.com/photos/mugs/" + playerPhotoId + ".jpg"; //var pictureUrl = "http://" + loadedTeam.TeamPageUrl + rowElements[1].SelectSingleNode("nobr/a").Attributes["href"].Value; //var picture = GetPicture(pictureUrl); var jerseyNumber = rowElements[0].SelectSingleNode("span").InnerText; var name = rowElements[1].SelectSingleNode("nobr/a").InnerText; var position = childNodeCount == 8 ? rowElements[2].InnerText : null; // Only forwards have position data, so count gets messed up var height = rowElements[childNodeCount - 5].InnerText; var weight = rowElements[childNodeCount - 4].InnerText; var dateOfBirth = rowElements[childNodeCount - 3].InnerText; var age = rowElements[childNodeCount - 2].InnerText; var birthPlace = rowElements[childNodeCount - 1].InnerText; var player = new PlayerInfo() { PictureUrl = pictureUrl, JerseyNumber = jerseyNumber, Name = name, Position = position, Height = height, Weight = weight, DateOfBirth = dateOfBirth, Age = age, BirthPlace = birthPlace }; Log.InfoFormat("picurl = {0}\njernum {1}\nname {2}\npos {3}\nheight {4}\nweight {5}\ndob {6}\nage {7}\nbp {8}\n", player.PictureUrl, player.JerseyNumber, player.Name, player.Position, player.Height, player.Weight, player.DateOfBirth, player.Age, player.BirthPlace); return player; }