public HttpResponseMessage GetRptListadoGolf(int eventoId, int jornadaId, int categoriaId, string jornada, string categoria) { DataTable dtLista = GolfJornada.GetLista(Convert.ToInt32(jornadaId), Convert.ToInt32(categoriaId)); DataTable dtHoyos = GolfHoyoPar.GetGolfHoyoPar((int)HoyoPar.Hoyo); string pathResources = WebApiApplication.ApplicationResources; string ruta = RptListadoGolf.ReporteListado(dtLista, dtHoyos, jornada, categoria, eventoId, pathResources); return(getReportePDF(ruta)); }
private static void SetBody(DataTable datosCompetidor, string descEvento, string jornadasIds, int personaId) { PdfPTable body = new PdfPTable(new float[] { 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }); body.WidthPercentage = 100; body.AddCell(DrawTable.DrawCell(descEvento, 14, CellBorder.NONE, CellAlignment.Center, 19, CellFontStyle.Bold)); body.AddCell(DrawTable.DrawCell("Resultado del Competidor", 10, CellBorder.NONE, CellAlignment.Center, 19, CellFontStyle.Bold)); body.AddCell(DrawTable.DrawCell("\n", 10, CellBorder.NONE, CellAlignment.Center, 19, CellFontStyle.Bold)); Image imgDir; string writepath = string.Format("{0}Images/erpDeportes/{1}.jpg", pathResource, personaId); if (File.Exists(writepath)) { imgDir = Image.GetInstance(Path.Combine(HttpContext.Current.Server.MapPath("/"), @writepath)); } else { imgDir = Image.GetInstance(string.Format("{0}Images/erpDeportes/User.png", pathResource)); } imgDir.ScaleToFit(115f, 120f); PdfPCell cellImg = new PdfPCell(imgDir); cellImg.Border = PdfPCell.NO_BORDER; //cellImg.PaddingTop = 10; cellImg.Colspan = 6; cellImg.Rowspan = 9; cellImg.HorizontalAlignment = PdfPCell.ALIGN_RIGHT; body.AddCell(cellImg); body.AddCell(DrawTable.DrawCell("Nombre :", 8, CellBorder.NONE, CellAlignment.Right, 4, CellFontStyle.Bold)); body.AddCell(DrawTable.DrawCell(datosCompetidor.Rows[0]["Nombres"].ToString(), 8, CellBorder.NONE, CellAlignment.Left, 9, CellFontStyle.Bold)); body.AddCell(DrawTable.DrawCell("Paterno :", 8, CellBorder.NONE, CellAlignment.Right, 4, CellFontStyle.Bold)); body.AddCell(DrawTable.DrawCell(datosCompetidor.Rows[0]["Paterno"].ToString(), 8, CellBorder.NONE, CellAlignment.Left, 9, CellFontStyle.Bold)); body.AddCell(DrawTable.DrawCell("Materno :", 8, CellBorder.NONE, CellAlignment.Right, 4, CellFontStyle.Bold)); body.AddCell(DrawTable.DrawCell(datosCompetidor.Rows[0]["Materno"].ToString(), 8, CellBorder.NONE, CellAlignment.Left, 9, CellFontStyle.Bold)); body.AddCell(DrawTable.DrawCell("Fecha de Nacimiento :", 8, CellBorder.NONE, CellAlignment.Right, 4, CellFontStyle.Bold)); DateTime?fechaAuxi = string.IsNullOrEmpty(datosCompetidor.Rows[0]["FechaNacimiento"].ToString()) ? (DateTime?)null : Convert.ToDateTime(datosCompetidor.Rows[0]["FechaNacimiento"]); body.AddCell(DrawTable.DrawCell(fechaAuxi == null ? "" : string.Format("{0:dd/MM/yyyy}", fechaAuxi), 8, CellBorder.NONE, CellAlignment.Left, 9, CellFontStyle.Bold)); body.AddCell(DrawTable.DrawCell("C.I. :", 8, CellBorder.NONE, CellAlignment.Right, 4, CellFontStyle.Bold)); body.AddCell(DrawTable.DrawCell(datosCompetidor.Rows[0]["DocumentoIdentidad"].ToString(), 8, CellBorder.NONE, CellAlignment.Left, 9, CellFontStyle.Bold)); body.AddCell(DrawTable.DrawCell("Sexo :", 8, CellBorder.NONE, CellAlignment.Right, 4, CellFontStyle.Bold)); body.AddCell(DrawTable.DrawCell(datosCompetidor.Rows[0]["Sexo"].ToString(), 8, CellBorder.NONE, CellAlignment.Left, 9, CellFontStyle.Bold)); body.AddCell(DrawTable.DrawCell("Handicap :", 8, CellBorder.NONE, CellAlignment.Right, 4, CellFontStyle.Bold)); DataTable dtAuxi = GolfCompetidor.GetHCPporciento(Convert.ToInt32(datosCompetidor.Rows[0]["CompetidorId"])); int hcpPorciento = 0; if (dtAuxi.Rows.Count > 0) { hcpPorciento = Convert.ToInt32(dtAuxi.Rows[0][0]); } body.AddCell(DrawTable.DrawCell(string.Format("{0} - {1} (80%)", datosCompetidor.Rows[0]["Handicap"], hcpPorciento), 8, CellBorder.NONE, CellAlignment.Left, 9, CellFontStyle.Bold)); body.AddCell(DrawTable.DrawCell("Categoria :", 8, CellBorder.NONE, CellAlignment.Right, 4, CellFontStyle.Bold)); body.AddCell(DrawTable.DrawCell(datosCompetidor.Rows[0]["Descripcion"].ToString(), 8, CellBorder.NONE, CellAlignment.Left, 9, CellFontStyle.Bold)); body.AddCell(DrawTable.DrawCell("Club :", 8, CellBorder.NONE, CellAlignment.Right, 4, CellFontStyle.Bold)); body.AddCell(DrawTable.DrawCell(datosCompetidor.Rows[0]["Club"].ToString(), 8, CellBorder.NONE, CellAlignment.Left, 9, CellFontStyle.Bold)); DataTable dt = new DataTable(); string[] jIDs = jornadasIds.Split(','); int nroJor = 1; int nrorow = 0; bool flag = false; foreach (string jorId in jIDs) { DataTable dtPares = GolfHoyoPar.GetGolfHoyoPar(Convert.ToInt32(HoyoPar.Hoyo)); body.AddCell(DrawTable.DrawCell("\n", 14, CellBorder.NONE, CellAlignment.Center, 19, CellFontStyle.Bold)); dt = GolfCompetidor.GetResultadoCompetidor(Convert.ToInt32(jorId), personaId); foreach (DataColumn dc in dt.Columns) { if (dc.ColumnName == "Detalle") { body.AddCell(DrawTable.DrawCellHeader(string.Format("Dia {0}", nroJor), 8, CellBorder.NONE, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY)); } else { body.AddCell(DrawTable.DrawCellHeader(dc.ColumnName, 8, CellBorder.NONE, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY)); } } body.AddCell(DrawTable.DrawCell("\n", 14, CellBorder.NONE, CellAlignment.Center, 19, CellFontStyle.Bold)); foreach (DataRow rows in dt.Rows) { nrorow = 0; foreach (DataColumn dc in dt.Columns) { if (dc.ColumnName == "Detalle") { body.AddCell(DrawTable.DrawCellHeader(rows[dc.ColumnName].ToString(), 7, CellBorder.NONE, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Normal)); } else { if (flag) { body.AddCell(DrawTable.DrawCellHeader(rows[dc.ColumnName].ToString(), 7, CellBorder.NONE, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Normal, GetColorCell(dtPares, rows[dc.ColumnName].ToString(), nrorow))); } else { body.AddCell(DrawTable.DrawCellHeader(rows[dc.ColumnName].ToString(), 7, CellBorder.NONE, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Normal)); } nrorow++; } } flag = flag == false; } nroJor++; flag = false; } documentPdf.Add(body); }
public int GetGolfParTotal() { return(GolfHoyoPar.GetParTotal()); }
public DataTable GetGolfHoyoPar(int tipoHoyoId) { return(GolfHoyoPar.GetGolfHoyoPar(tipoHoyoId)); }
private static void SetBody(DataTable jugadores, DataTable hoyos, string descEvento, string jornada) { PdfPTable colores = new PdfPTable(new float[] { 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1 }); colores.WidthPercentage = 70; colores.AddCell(DrawTable.DrawCell(descEvento, 14, CellBorder.NONE, CellAlignment.Center, 19, CellFontStyle.Bold)); colores.AddCell(DrawTable.DrawCell(HeaderGolf.FirstCharToUpper(jornada), 12, CellBorder.NONE, CellAlignment.Center, 19, CellFontStyle.Bold)); colores.AddCell(DrawTable.DrawCell("Resultados", 10, CellBorder.NONE, CellAlignment.Center, 19, CellFontStyle.Bold)); colores.AddCell(DrawTable.DrawCell("\n", 10, CellBorder.NONE, CellAlignment.Center, 19, CellFontStyle.Bold)); colores.HeaderRows = 2; documentPdf.Add(colores); if (jugadores.Columns.Count == 30) { #region boddy columnas PdfPTable body = new PdfPTable(new float[] { 1, 6, 1, 1, 1, 1, 1, 1, 1, 1, 1, (float)1.2, 1, 1, 1, 1, 1, 1, 1, 1, 1, (float)1.2, (float)1.2, (float)1.2, (float)1.2 }); body.WidthPercentage = 100; body.AddCell(DrawTable.DrawCellHeader("HCP", 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY)); body.AddCell(DrawTable.DrawCellHeader("Jugador/Hoyo", 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY)); body.AddCell(DrawTable.DrawCellHeader("1", 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY)); body.AddCell(DrawTable.DrawCellHeader("2", 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY)); body.AddCell(DrawTable.DrawCellHeader("3", 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY)); body.AddCell(DrawTable.DrawCellHeader("4", 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY)); body.AddCell(DrawTable.DrawCellHeader("5", 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY)); body.AddCell(DrawTable.DrawCellHeader("6", 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY)); body.AddCell(DrawTable.DrawCellHeader("7", 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY)); body.AddCell(DrawTable.DrawCellHeader("8", 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY)); body.AddCell(DrawTable.DrawCellHeader("9", 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY)); body.AddCell(DrawTable.DrawCellHeader("1RA", 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY)); body.AddCell(DrawTable.DrawCellHeader("10", 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY)); body.AddCell(DrawTable.DrawCellHeader("11", 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY)); body.AddCell(DrawTable.DrawCellHeader("12", 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY)); body.AddCell(DrawTable.DrawCellHeader("13", 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY)); body.AddCell(DrawTable.DrawCellHeader("14", 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY)); body.AddCell(DrawTable.DrawCellHeader("15", 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY)); body.AddCell(DrawTable.DrawCellHeader("16", 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY)); body.AddCell(DrawTable.DrawCellHeader("17", 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY)); body.AddCell(DrawTable.DrawCellHeader("18", 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY)); body.AddCell(DrawTable.DrawCellHeader("2DA", 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY)); body.AddCell(DrawTable.DrawCellHeader("Total", 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY)); body.AddCell(DrawTable.DrawCellHeader("Total Neto", 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY)); body.AddCell(DrawTable.DrawCellHeader("Score", 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY)); var data = GolfHoyoPar.GetGolfHoyoPar(""); #region PAR body.AddCell(DrawTable.DrawCellHeader(" ", 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.WHITE)); body.AddCell(DrawTable.DrawCellHeader("PAR ", 7, CellBorder.BOX, CellAlignment.Right, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY)); var dataRow = (from myRow in data.AsEnumerable() where myRow.Field <int>("HoyoParId") <= 10 select myRow).Union(from myRow in data.AsEnumerable() where myRow.Field <int>("HoyoParId") == 20 select myRow).Union(from myRow in data.AsEnumerable() where myRow.Field <int>("HoyoParId") >= 11 && myRow.Field <int>("HoyoParId") < 20 select myRow).Union(from myRow in data.AsEnumerable() where myRow.Field <int>("HoyoParId") >= 11 && myRow.Field <int>("HoyoParId") > 20 select myRow); foreach (DataRow row in dataRow) { body.AddCell(DrawTable.DrawCellHeader(row["Par"].ToString(), 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY)); } body.AddCell(DrawTable.DrawCellHeader(" ", 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.WHITE)); body.AddCell(DrawTable.DrawCellHeader(" ", 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.WHITE)); #endregion #region BLANCOS body.AddCell(DrawTable.DrawCellHeader(" ", 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.WHITE)); body.AddCell(DrawTable.DrawCellHeader("YARDAS ", 7, CellBorder.BOX, CellAlignment.Right, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY)); foreach (DataRow row in dataRow) { body.AddCell(DrawTable.DrawCellHeader(row["Blancas"].ToString(), 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY)); } body.AddCell(DrawTable.DrawCellHeader(" ", 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.WHITE)); body.AddCell(DrawTable.DrawCellHeader(" ", 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.WHITE)); #endregion foreach (DataRow row in jugadores.Rows) { body.AddCell(DrawTable.DrawCellHeader(row["Handicap"].ToString(), 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Normal)); body.AddCell(DrawTable.DrawCellHeader(row["NomCompleto"].ToString(), 7, CellBorder.BOX, CellAlignment.Left, CellAlignment.Center, CellFontStyle.Normal)); body.AddCell(DrawTable.DrawCellHeader(row["1"].ToString(), 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Middle, CellFontStyle.Normal, GetColorCell(hoyos, row["1"].ToString(), 0))); body.AddCell(DrawTable.DrawCellHeader(row["2"].ToString(), 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Middle, CellFontStyle.Normal, GetColorCell(hoyos, row["2"].ToString(), 1))); body.AddCell(DrawTable.DrawCellHeader(row["3"].ToString(), 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Middle, CellFontStyle.Normal, GetColorCell(hoyos, row["3"].ToString(), 2))); body.AddCell(DrawTable.DrawCellHeader(row["4"].ToString(), 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Middle, CellFontStyle.Normal, GetColorCell(hoyos, row["4"].ToString(), 3))); body.AddCell(DrawTable.DrawCellHeader(row["5"].ToString(), 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Middle, CellFontStyle.Normal, GetColorCell(hoyos, row["5"].ToString(), 4))); body.AddCell(DrawTable.DrawCellHeader(row["6"].ToString(), 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Middle, CellFontStyle.Normal, GetColorCell(hoyos, row["6"].ToString(), 5))); body.AddCell(DrawTable.DrawCellHeader(row["7"].ToString(), 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Middle, CellFontStyle.Normal, GetColorCell(hoyos, row["7"].ToString(), 6))); body.AddCell(DrawTable.DrawCellHeader(row["8"].ToString(), 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Middle, CellFontStyle.Normal, GetColorCell(hoyos, row["8"].ToString(), 7))); body.AddCell(DrawTable.DrawCellHeader(row["9"].ToString(), 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Middle, CellFontStyle.Normal, GetColorCell(hoyos, row["9"].ToString(), 8))); body.AddCell(DrawTable.DrawCellHeader(row["1 Vuelta"].ToString(), 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Middle, CellFontStyle.Normal, BaseColor.LIGHT_GRAY)); body.AddCell(DrawTable.DrawCellHeader(row["10"].ToString(), 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Middle, CellFontStyle.Normal, GetColorCell(hoyos, row["10"].ToString(), 9))); body.AddCell(DrawTable.DrawCellHeader(row["11"].ToString(), 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Middle, CellFontStyle.Normal, GetColorCell(hoyos, row["11"].ToString(), 10))); body.AddCell(DrawTable.DrawCellHeader(row["12"].ToString(), 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Middle, CellFontStyle.Normal, GetColorCell(hoyos, row["12"].ToString(), 11))); body.AddCell(DrawTable.DrawCellHeader(row["13"].ToString(), 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Middle, CellFontStyle.Normal, GetColorCell(hoyos, row["13"].ToString(), 12))); body.AddCell(DrawTable.DrawCellHeader(row["14"].ToString(), 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Middle, CellFontStyle.Normal, GetColorCell(hoyos, row["14"].ToString(), 13))); body.AddCell(DrawTable.DrawCellHeader(row["15"].ToString(), 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Middle, CellFontStyle.Normal, GetColorCell(hoyos, row["15"].ToString(), 14))); body.AddCell(DrawTable.DrawCellHeader(row["16"].ToString(), 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Middle, CellFontStyle.Normal, GetColorCell(hoyos, row["16"].ToString(), 15))); body.AddCell(DrawTable.DrawCellHeader(row["17"].ToString(), 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Middle, CellFontStyle.Normal, GetColorCell(hoyos, row["17"].ToString(), 16))); body.AddCell(DrawTable.DrawCellHeader(row["18"].ToString(), 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Middle, CellFontStyle.Normal, GetColorCell(hoyos, row["18"].ToString(), 17))); body.AddCell(DrawTable.DrawCellHeader(row["2 Vuelta"].ToString(), 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Middle, CellFontStyle.Normal, BaseColor.LIGHT_GRAY)); body.AddCell(DrawTable.DrawCellHeader(row["Total"].ToString(), 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Middle, CellFontStyle.Normal, BaseColor.WHITE)); body.AddCell(DrawTable.DrawCellHeader(row["TotalNeto"].ToString(), 8, CellBorder.BOX, CellAlignment.Center, CellAlignment.Middle, CellFontStyle.Bold, BaseColor.WHITE)); body.AddCell(DrawTable.DrawCellHeader(row["Score"].ToString(), 8, CellBorder.BOX, CellAlignment.Center, CellAlignment.Middle, CellFontStyle.Bold, BaseColor.WHITE)); } #endregion body.HeaderRows = 3; documentPdf.Add(body); } else { #region boddy columnas PdfPTable body = new PdfPTable(new float[] { 7, 1, 1, 1, 1, 1, 1, 1, 1, 1, (float)1.4, 1, 1, 1, 1, 1, 1, 1, 1, 1, (float)1.4, (float)1.4, (float)1.4 }); body.WidthPercentage = 100; // body.AddCell(DrawTable.DrawCellHeader("HCP", 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY)); body.AddCell(DrawTable.DrawCellHeader("Jugador/Hoyo", 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY)); body.AddCell(DrawTable.DrawCellHeader("1", 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY)); body.AddCell(DrawTable.DrawCellHeader("2", 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY)); body.AddCell(DrawTable.DrawCellHeader("3", 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY)); body.AddCell(DrawTable.DrawCellHeader("4", 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY)); body.AddCell(DrawTable.DrawCellHeader("5", 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY)); body.AddCell(DrawTable.DrawCellHeader("6", 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY)); body.AddCell(DrawTable.DrawCellHeader("7", 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY)); body.AddCell(DrawTable.DrawCellHeader("8", 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY)); body.AddCell(DrawTable.DrawCellHeader("9", 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY)); body.AddCell(DrawTable.DrawCellHeader("1RA", 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY)); body.AddCell(DrawTable.DrawCellHeader("10", 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY)); body.AddCell(DrawTable.DrawCellHeader("11", 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY)); body.AddCell(DrawTable.DrawCellHeader("12", 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY)); body.AddCell(DrawTable.DrawCellHeader("13", 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY)); body.AddCell(DrawTable.DrawCellHeader("14", 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY)); body.AddCell(DrawTable.DrawCellHeader("15", 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY)); body.AddCell(DrawTable.DrawCellHeader("16", 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY)); body.AddCell(DrawTable.DrawCellHeader("17", 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY)); body.AddCell(DrawTable.DrawCellHeader("18", 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY)); body.AddCell(DrawTable.DrawCellHeader("2DA", 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY)); body.AddCell(DrawTable.DrawCellHeader("Total", 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY)); body.AddCell(DrawTable.DrawCellHeader("Score", 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY)); var data = GolfHoyoPar.GetGolfHoyoPar(""); #region PAR //body.AddCell(DrawTable.DrawCellHeader(" ", 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.WHITE)); body.AddCell(DrawTable.DrawCellHeader("PAR ", 7, CellBorder.BOX, CellAlignment.Right, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY)); var dataRow = (from myRow in data.AsEnumerable() where myRow.Field <int>("HoyoParId") <= 10 select myRow).Union(from myRow in data.AsEnumerable() where myRow.Field <int>("HoyoParId") == 20 select myRow).Union(from myRow in data.AsEnumerable() where myRow.Field <int>("HoyoParId") >= 11 && myRow.Field <int>("HoyoParId") < 20 select myRow).Union(from myRow in data.AsEnumerable() where myRow.Field <int>("HoyoParId") >= 11 && myRow.Field <int>("HoyoParId") > 20 select myRow); foreach (DataRow row in dataRow) { body.AddCell(DrawTable.DrawCellHeader(row["Par"].ToString(), 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY)); } body.AddCell(DrawTable.DrawCellHeader(" ", 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.WHITE)); #endregion #region BLANCOS //body.AddCell(DrawTable.DrawCellHeader(" ", 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.WHITE)); body.AddCell(DrawTable.DrawCellHeader("YARDAS ", 7, CellBorder.BOX, CellAlignment.Right, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY)); foreach (DataRow row in dataRow) { body.AddCell(DrawTable.DrawCellHeader(row["Blancas"].ToString(), 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY)); } body.AddCell(DrawTable.DrawCellHeader(" ", 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.WHITE)); #endregion foreach (DataRow row in jugadores.Rows) { //body.AddCell(DrawTable.DrawCellHeader(row["Handicap"].ToString(), 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Normal)); body.AddCell(DrawTable.DrawCellHeader(row["NomCompleto"].ToString(), 7, CellBorder.BOX, CellAlignment.Left, CellAlignment.Center, CellFontStyle.Normal)); body.AddCell(DrawTable.DrawCellHeader(row["1"].ToString(), 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Middle, CellFontStyle.Normal, GetColorCell(hoyos, row["1"].ToString(), 0))); body.AddCell(DrawTable.DrawCellHeader(row["2"].ToString(), 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Middle, CellFontStyle.Normal, GetColorCell(hoyos, row["2"].ToString(), 1))); body.AddCell(DrawTable.DrawCellHeader(row["3"].ToString(), 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Middle, CellFontStyle.Normal, GetColorCell(hoyos, row["3"].ToString(), 2))); body.AddCell(DrawTable.DrawCellHeader(row["4"].ToString(), 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Middle, CellFontStyle.Normal, GetColorCell(hoyos, row["4"].ToString(), 3))); body.AddCell(DrawTable.DrawCellHeader(row["5"].ToString(), 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Middle, CellFontStyle.Normal, GetColorCell(hoyos, row["5"].ToString(), 4))); body.AddCell(DrawTable.DrawCellHeader(row["6"].ToString(), 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Middle, CellFontStyle.Normal, GetColorCell(hoyos, row["6"].ToString(), 5))); body.AddCell(DrawTable.DrawCellHeader(row["7"].ToString(), 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Middle, CellFontStyle.Normal, GetColorCell(hoyos, row["7"].ToString(), 6))); body.AddCell(DrawTable.DrawCellHeader(row["8"].ToString(), 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Middle, CellFontStyle.Normal, GetColorCell(hoyos, row["8"].ToString(), 7))); body.AddCell(DrawTable.DrawCellHeader(row["9"].ToString(), 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Middle, CellFontStyle.Normal, GetColorCell(hoyos, row["9"].ToString(), 8))); body.AddCell(DrawTable.DrawCellHeader(row["1 Vuelta"].ToString(), 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Middle, CellFontStyle.Normal, BaseColor.LIGHT_GRAY)); body.AddCell(DrawTable.DrawCellHeader(row["10"].ToString(), 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Middle, CellFontStyle.Normal, GetColorCell(hoyos, row["10"].ToString(), 9))); body.AddCell(DrawTable.DrawCellHeader(row["11"].ToString(), 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Middle, CellFontStyle.Normal, GetColorCell(hoyos, row["11"].ToString(), 10))); body.AddCell(DrawTable.DrawCellHeader(row["12"].ToString(), 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Middle, CellFontStyle.Normal, GetColorCell(hoyos, row["12"].ToString(), 11))); body.AddCell(DrawTable.DrawCellHeader(row["13"].ToString(), 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Middle, CellFontStyle.Normal, GetColorCell(hoyos, row["13"].ToString(), 12))); body.AddCell(DrawTable.DrawCellHeader(row["14"].ToString(), 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Middle, CellFontStyle.Normal, GetColorCell(hoyos, row["14"].ToString(), 13))); body.AddCell(DrawTable.DrawCellHeader(row["15"].ToString(), 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Middle, CellFontStyle.Normal, GetColorCell(hoyos, row["15"].ToString(), 14))); body.AddCell(DrawTable.DrawCellHeader(row["16"].ToString(), 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Middle, CellFontStyle.Normal, GetColorCell(hoyos, row["16"].ToString(), 15))); body.AddCell(DrawTable.DrawCellHeader(row["17"].ToString(), 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Middle, CellFontStyle.Normal, GetColorCell(hoyos, row["17"].ToString(), 16))); body.AddCell(DrawTable.DrawCellHeader(row["18"].ToString(), 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Middle, CellFontStyle.Normal, GetColorCell(hoyos, row["18"].ToString(), 17))); body.AddCell(DrawTable.DrawCellHeader(row["2 Vuelta"].ToString(), 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Middle, CellFontStyle.Normal, BaseColor.LIGHT_GRAY)); body.AddCell(DrawTable.DrawCellHeader(row["Total"].ToString(), 7, CellBorder.BOX, CellAlignment.Center, CellAlignment.Middle, CellFontStyle.Normal, BaseColor.WHITE)); body.AddCell(DrawTable.DrawCellHeader(row["Score"].ToString(), 8, CellBorder.BOX, CellAlignment.Center, CellAlignment.Middle, CellFontStyle.Bold, BaseColor.WHITE)); } #endregion //body.HeaderRows = 3; //documentPdf.Add(body); body.HeaderRows = 3; documentPdf.Add(body); } }