Esempio n. 1
0
        public override void OnStartPage(PdfWriter writer, Document document)
        {
            base.OnStartPage(writer, document);
            PdfPTable header = new PdfPTable(new float[] { 2, 8, 2 });

            header.WidthPercentage = 100;

            PdfPTable detalle = new PdfPTable(2);

            detalle.AddCell(DrawTable.DrawCell("Modulo:", 7, CellBorder.NONE, CellAlignment.Left, 0, CellFontStyle.Normal));
            detalle.AddCell(DrawTable.DrawCell("Delegación:", 7, CellBorder.NONE, CellAlignment.Right, 0, CellFontStyle.Normal));
            detalle.AddCell(DrawTable.DrawCell(Titulo, 8, CellBorder.NONE, CellAlignment.Left, 0, CellFontStyle.Bold));
            detalle.AddCell(DrawTable.DrawCell(SubTitulo, 8, CellBorder.NONE, CellAlignment.Right, 0, CellFontStyle.Bold));

            LogoIzquierda.ScaleToFit(90f, 40f);
            LogoDerecha.ScaleToFit(90f, 40f);
            PdfPCell cellImg = new PdfPCell(LogoIzquierda);

            cellImg.Border = PdfPCell.NO_BORDER;
            header.AddCell(cellImg);

            PdfPCell tc = new PdfPCell(detalle);

            tc.Border       = 0;
            tc.PaddingLeft  = 10;
            tc.PaddingRight = 10;
            header.AddCell(tc);
            cellImg        = new PdfPCell(LogoDerecha);
            cellImg.Border = PdfPCell.NO_BORDER;
            header.AddCell(cellImg);

            document.Add(header);
            //document.Add(DrawTable.LineBottom(1, BaseColor.BLACK));
            document.Add(new Paragraph("\n"));
        }
Esempio n. 2
0
        private static void SetBody(DataTable datos, string descEvento, string jornada, string fecha)
        {
            PdfPTable body = new PdfPTable(new float[] { (float)1.5, 6, 6, 5, 5 });

            body.WidthPercentage = 100;
            body.AddCell(DrawTable.DrawCell(descEvento, 14, CellBorder.NONE, CellAlignment.Center, 19, CellFontStyle.Bold));
            body.AddCell(DrawTable.DrawCell(string.Format("{0} , {1:dd MMM yyyy}", jornada, fecha), 12, CellBorder.NONE, CellAlignment.Center, 5, CellFontStyle.Bold));
            body.AddCell(DrawTable.DrawCell("Listado de Salidas y Cuartetos", 10, CellBorder.NONE, CellAlignment.Center, 5, CellFontStyle.Bold));
            body.AddCell(DrawTable.DrawCell("\n", 10, CellBorder.NONE, CellAlignment.Center, 5, CellFontStyle.Bold));

            body.AddCell(DrawTable.DrawCellHeader("Salida", 8, CellBorder.NONE, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY));
            body.AddCell(DrawTable.DrawCellHeader("Jugador 1 (HCP)", 8, CellBorder.NONE, CellAlignment.Left, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY));
            body.AddCell(DrawTable.DrawCellHeader("Jugador 2 (HCP)", 8, CellBorder.NONE, CellAlignment.Left, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY));
            body.AddCell(DrawTable.DrawCellHeader("Jugador 3 (HCP)", 8, CellBorder.NONE, CellAlignment.Left, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY));
            body.AddCell(DrawTable.DrawCellHeader("Jugador 4 (HCP)", 8, CellBorder.NONE, CellAlignment.Left, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY));
            body.AddCell(DrawTable.DrawCell("\n", 14, CellBorder.NONE, CellAlignment.Center, 5, CellFontStyle.Bold));
            body.HeaderRows = 5;
            foreach (DataRow rows in datos.Rows)
            {
                body.AddCell(DrawTable.DrawCell(rows["Grupo"].ToString(), 7, CellBorder.BOTTOM, CellAlignment.Center, CellFontStyle.Normal));
                body.AddCell(DrawTable.DrawCell(rows["1"].ToString(), 7, CellBorder.BOTTOM, CellAlignment.Left, CellFontStyle.Normal));
                body.AddCell(DrawTable.DrawCell(rows["2"].ToString(), 7, CellBorder.BOTTOM, CellAlignment.Left, CellFontStyle.Normal));
                body.AddCell(DrawTable.DrawCell(rows["3"].ToString(), 7, CellBorder.BOTTOM, CellAlignment.Left, CellFontStyle.Normal));
                body.AddCell(DrawTable.DrawCell(rows["4"].ToString(), 7, CellBorder.BOTTOM, CellAlignment.Left, CellFontStyle.Normal));
            }

            documentPdf.Add(body);
        }
Esempio n. 3
0
        private static void SetHead(string categoria, string descEvento, string lugarEvento, int eventoid)
        {
            float legalMarginWidth  = ItextUtils.CentimetersToPoints(33.02F);
            float legalMarginHeight = ItextUtils.CentimetersToPoints(21.59F);
            float marginLeft        = ItextUtils.CentimetersToPoints(1);
            float marginRight       = ItextUtils.CentimetersToPoints(1);
            float marginTop         = ItextUtils.CentimetersToPoints(1);
            float marginBottom      = ItextUtils.CentimetersToPoints(4);


            documentPdf = new Document();
            documentPdf.SetPageSize(PageSize.LETTER);
            documentPdf.SetMargins(marginLeft, marginRight, marginTop, marginBottom);

            PdfWriter writer = PdfWriter.GetInstance(documentPdf, new FileStream(path, FileMode.Create));

            HeaderGolf header = new HeaderGolf();

            header.Titulo       = lugarEvento;
            header.TituloIdioma = "Casa de campo COCHABAMBA";
            header.SubTitulo    = descEvento;
            header.Deporte      = "golf";
            header.HasLeyenda   = true;

            header.Jornada            = "todas";
            header.Categoria          = categoria;
            header.User               = "";// user.Username;
            header.NombreReporte      = "Resultados Finales.";
            header.LogoDerecha        = Image.GetInstance(string.Format(@"{0}\Golf\{1}", pathImage, "golf.png"));
            header.LogoIzquierda      = Image.GetInstance(string.Format(@"{0}\Golf\{1}", pathImage, "Federacion.png"));
            header.LogoAbajoDerecha   = Image.GetInstance(string.Format(@"{0}\Hammer\{1}", pathImage, "marcaDoble.png"));
            header.LogoAbajoIzquierda = Image.GetInstance(string.Format(@"{0}\Hammer\{1}", pathImage, "hammerLogoH.png"));
            header.Fecha              = GolfJornada.GetFechasJornadas(eventoid);

            PdfPTable leyen = new PdfPTable(new float[] { 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1 });

            leyen.AddCell(DrawTable.DrawCell("Leyenda", 6, CellBorder.NONE, CellAlignment.Left, 14, CellFontStyle.Bold));
            leyen.AddCell(DrawTable.DrawCellHeader("Hoyo en Uno", 5, CellBorder.UNDEFINED, CellAlignment.Right, CellAlignment.Center, CellFontStyle.Bold, BaseColor.WHITE));
            leyen.AddCell(DrawTable.DrawCellHeader(string.Empty, 5, CellBorder.BOX, CellAlignment.Right, CellAlignment.Center, CellFontStyle.Bold, BaseColor.YELLOW));
            leyen.AddCell(DrawTable.DrawCellHeader("Albatros", 5, CellBorder.UNDEFINED, CellAlignment.Right, CellAlignment.Center, CellFontStyle.Bold, BaseColor.WHITE));
            leyen.AddCell(DrawTable.DrawCellHeader(string.Empty, 5, CellBorder.BOX, CellAlignment.Right, CellAlignment.Center, CellFontStyle.Bold, new BaseColor(192, 119, 160)));
            leyen.AddCell(DrawTable.DrawCellHeader("Eagle", 5, CellBorder.UNDEFINED, CellAlignment.Right, CellAlignment.Center, CellFontStyle.Bold, BaseColor.WHITE));
            leyen.AddCell(DrawTable.DrawCellHeader(string.Empty, 5, CellBorder.BOX, CellAlignment.Right, CellAlignment.Center, CellFontStyle.Bold, new BaseColor(248, 177, 17)));
            leyen.AddCell(DrawTable.DrawCellHeader("Birdie", 5, CellBorder.UNDEFINED, CellAlignment.Right, CellAlignment.Center, CellFontStyle.Bold, BaseColor.WHITE));
            leyen.AddCell(DrawTable.DrawCellHeader(string.Empty, 5, CellBorder.BOX, CellAlignment.Right, CellAlignment.Center, CellFontStyle.Bold, new BaseColor(35, 190, 82)));
            leyen.AddCell(DrawTable.DrawCellHeader("PAR", 5, CellBorder.UNDEFINED, CellAlignment.Right, CellAlignment.Center, CellFontStyle.Bold, BaseColor.WHITE));
            leyen.AddCell(DrawTable.DrawCellHeader(string.Empty, 5, CellBorder.BOX, CellAlignment.Right, CellAlignment.Center, CellFontStyle.Bold, BaseColor.WHITE));
            leyen.AddCell(DrawTable.DrawCellHeader("Bogey", 5, CellBorder.UNDEFINED, CellAlignment.Right, CellAlignment.Center, CellFontStyle.Bold, BaseColor.WHITE));
            leyen.AddCell(DrawTable.DrawCellHeader(string.Empty, 5, CellBorder.BOX, CellAlignment.Right, CellAlignment.Center, CellFontStyle.Bold, new BaseColor(92, 119, 229)));
            leyen.AddCell(DrawTable.DrawCellHeader("Doble Bogey o más", 5, CellBorder.UNDEFINED, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.WHITE));
            leyen.AddCell(DrawTable.DrawCellHeader(string.Empty, 5, CellBorder.UNDEFINED, CellAlignment.Right, CellAlignment.Buttom, CellFontStyle.Normal, new BaseColor(237, 62, 48)));
            header.leyendas = leyen;

            writer.PageEvent = header;
            documentPdf.Open();
        }
        private static void SetBody(DataTable dtresultado, string descEvento)
        {
            int nroColumnas = dtresultado.Columns.Count;

            float [] x = new float[nroColumnas];
            x[0] = 2;
            x[1] = 6;
            x[2] = 6;
            for (int i = 3; i < nroColumnas; i++)
            {
                x[i] = 2;
            }
            PdfPTable body = new PdfPTable(x);

            body.WidthPercentage = 100;

            body.AddCell(DrawTable.DrawCell(descEvento, 14, CellBorder.NONE, CellAlignment.Center, nroColumnas, CellFontStyle.Bold));
            body.AddCell(DrawTable.DrawCell("Resultado Finales", 10, CellBorder.NONE, CellAlignment.Center, nroColumnas, CellFontStyle.Bold));
            body.AddCell(DrawTable.DrawCell("\n", 10, CellBorder.NONE, CellAlignment.Center, nroColumnas, CellFontStyle.Bold));

            foreach (DataColumn dc in dtresultado.Columns)
            {
                body.AddCell(DrawTable.DrawCellHeader(dc.ColumnName, 8, CellBorder.BOTTOM, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY));
            }

            body.AddCell(DrawTable.DrawCell("\n", 14, CellBorder.NONE, CellAlignment.Center, nroColumnas, CellFontStyle.Bold));

            foreach (DataRow rows in dtresultado.Rows)
            {
                foreach (DataColumn dc in dtresultado.Columns)
                {
                    if (dc.ColumnName == "Score")
                    {
                        int score = Convert.ToInt32(rows[dc.ColumnName]);
                        if (score > 0)
                        {
                            body.AddCell(DrawTable.DrawCell(string.Format("+{0}", score), 7, CellBorder.BOTTOM, CellAlignment.Center, CellFontStyle.Normal));
                        }
                        else
                        {
                            body.AddCell(DrawTable.DrawCell(rows[dc.ColumnName].ToString(), 7, CellBorder.BOTTOM, CellAlignment.Center, CellFontStyle.Normal));
                        }
                    }
                    else
                    {
                        body.AddCell(DrawTable.DrawCell(rows[dc.ColumnName].ToString(), 7, CellBorder.BOTTOM, CellAlignment.Center, CellFontStyle.Normal));
                    }
                }
            }
            body.HeaderRows = 5;
            documentPdf.Add(body);
        }
Esempio n. 5
0
        public override void OnStartPage(PdfWriter writer, Document document)
        {
            if (DrawHeader)
            {
                base.OnStartPage(writer, document);
                PdfPTable header = new PdfPTable(new float[] { 1, 10, 1 });
                header.WidthPercentage = 100;

                PdfPTable detalle = new PdfPTable(2);
                detalle.AddCell(DrawTable.DrawCellHeader("Nombre:", 8, CellBorder.NONE, CellAlignment.Right, CellAlignment.Center, CellFontStyle.Normal));
                detalle.AddCell(DrawTable.DrawCell(Nombre, 10, CellBorder.NONE, CellAlignment.Middle, CellFontStyle.Normal));

                detalle.AddCell(DrawTable.DrawCellHeader("Unidad:", 8, CellBorder.NONE, CellAlignment.Right, CellAlignment.Center, CellFontStyle.Normal));
                detalle.AddCell(DrawTable.DrawCell(Unidad, 10, CellBorder.NONE, CellAlignment.Left, CellFontStyle.Normal));

                detalle.AddCell(DrawTable.DrawCellHeader("Fecha:", 8, CellBorder.NONE, CellAlignment.Right, CellAlignment.Center, CellFontStyle.Normal));
                detalle.AddCell(DrawTable.DrawCell(Fecha, 10, CellBorder.NONE, CellAlignment.Left, CellFontStyle.Normal));

                detalle.AddCell(DrawTable.DrawCellHeader("Semana:", 8, CellBorder.NONE, CellAlignment.Right, CellAlignment.Center, CellFontStyle.Normal));
                detalle.AddCell(DrawTable.DrawCell(Semana, 10, CellBorder.NONE, CellAlignment.Left, CellFontStyle.Normal));
                detalle.AddCell(DrawTable.DrawCellHeader("Total Horas:", 8, CellBorder.NONE, CellAlignment.Right, CellAlignment.Center, CellFontStyle.Normal));
                detalle.AddCell(DrawTable.DrawCell(Totalhoras, 10, CellBorder.NONE, CellAlignment.Left, CellFontStyle.Normal));
                PdfPCell cellImg;


                LogoIzquierda.ScaleToFit(60f, 60f);
                cellImg        = new PdfPCell(LogoIzquierda);
                cellImg.Border = PdfPCell.NO_BORDER;
                header.AddCell(cellImg);

                PdfPCell tc = new PdfPCell(detalle);

                tc.Border = 0;
                header.AddCell(tc);

                LogoDerecha.ScaleToFit(60f, 60f);
                cellImg        = new PdfPCell(LogoDerecha);
                cellImg.Border = PdfPCell.NO_BORDER;
                header.AddCell(cellImg);

                PdfPTable tp = new PdfPTable(new float[] { 60, 40 });
                tp.AddCell(DrawTable.DrawCellHeader(Titulo, 14, CellBorder.NONE, CellAlignment.Right, CellAlignment.Middle, CellFontStyle.Bold));
                tp.AddCell(DrawTable.DrawCellHeader(Formulario, 5, CellBorder.NONE, CellAlignment.Left, CellAlignment.Bottom, CellFontStyle.Bold));
                document.Add(tp);
                document.Add(header);
                document.Add(DrawTable.Line());
                document.Add(new Paragraph("\n"));
            }
        }
Esempio n. 6
0
        public override void OnStartPage(PdfWriter writer, Document document)
        {
            base.OnStartPage(writer, document);
            PdfPTable header = new PdfPTable(new float[] { 1, 10, 1 });

            header.WidthPercentage = 100;

            PdfPTable detalle = new PdfPTable(2);

            detalle.AddCell(DrawTable.DrawCell(FirstCharToUpper(Titulo), 10, CellBorder.NONE, CellAlignment.Left, 0, CellFontStyle.Bold)); detalle.AddCell(DrawTable.DrawCell(FirstCharToUpper(Deporte), 12, CellBorder.NONE, CellAlignment.Right, 0, CellFontStyle.Bold));
            detalle.AddCell(DrawTable.DrawCell(FirstCharToUpper(TituloIdioma), 7, CellBorder.NONE, CellAlignment.Left, 0, CellFontStyle.Normal)); detalle.AddCell(DrawTable.DrawCell("Categoria :", 6, CellBorder.NONE, CellAlignment.Right, 0, CellFontStyle.Normal));
            detalle.AddCell(DrawTable.DrawCell(SubTitulo, 7, CellBorder.NONE, CellAlignment.Left, 0, CellFontStyle.Normal)); detalle.AddCell(DrawTable.DrawCell(FirstCharToUpper(Categoria), 8, CellBorder.NONE, CellAlignment.Right, 0, CellFontStyle.Bold));
            detalle.AddCell(DrawTable.DrawCell("Jornada :", 6, CellBorder.NONE, CellAlignment.Right, 2, CellFontStyle.Normal));
            detalle.AddCell(DrawTable.DrawCell(FirstCharToUpper(Jornada), 8, CellBorder.NONE, CellAlignment.Right, 2, CellFontStyle.Bold));
            detalle.AddCell(DrawTable.DrawCell(Fecha, 6, CellBorder.NONE, CellAlignment.Left, 2, CellFontStyle.Normal));

            LogoIzquierda.ScaleToFit(60f, 60f);
            LogoDerecha.ScaleToFit(60f, 60f);
            PdfPCell cellImg = new PdfPCell(LogoIzquierda);

            cellImg.Border = PdfPCell.NO_BORDER;
            header.AddCell(cellImg);

            PdfPCell tc = new PdfPCell(detalle);

            tc.Border       = 0;
            tc.PaddingLeft  = 10;
            tc.PaddingRight = 10;
            header.AddCell(tc);
            cellImg        = new PdfPCell(LogoDerecha);
            cellImg.Border = PdfPCell.NO_BORDER;
            header.AddCell(cellImg);

            document.Add(header);
            document.Add(DrawTable.LineBottom(1, BaseColor.BLACK));
            document.Add(new Paragraph("\n"));
        }
Esempio n. 7
0
        public override void OnStartPage(PdfWriter writer, Document document)
        {
            if (DrawHeader)
            {
                base.OnStartPage(writer, document);
                PdfPTable header = new PdfPTable(new float[] { 1, 10, 1 });
                header.WidthPercentage = 100;

                PdfPTable detalle = new PdfPTable(2);
                detalle.AddCell(DrawTable.DrawCellHeader("Nombre:", 8, CellBorder.NONE, CellAlignment.Right, CellAlignment.Center, CellFontStyle.Normal));
                detalle.AddCell(DrawTable.DrawCell(Nombre, 10, CellBorder.NONE, CellAlignment.Middle, CellFontStyle.Normal));

                PdfPTable tp = new PdfPTable(new float[] { 70 });
                tp.AddCell(DrawTable.DrawCellHeader(Titulo, 14, CellBorder.NONE, CellAlignment.Center, CellAlignment.Middle, CellFontStyle.Bold));
                tp.AddCell(DrawTable.DrawCellHeader(Subtitulo1, 7, CellBorder.NONE, CellAlignment.Center, CellAlignment.Top, CellFontStyle.Normal));
                tp.AddCell(DrawTable.DrawCellHeader(Subtitulo2, 9, CellBorder.NONE, CellAlignment.Center, CellAlignment.Top, CellFontStyle.Bold));

                PdfPCell cellImg;
                LogoIzquierda.ScaleToFit(60f, 60f);
                cellImg        = new PdfPCell(LogoIzquierda);
                cellImg.Border = PdfPCell.NO_BORDER;
                header.AddCell(cellImg);
                PdfPCell tc = new PdfPCell(tp);
                tc.Border = 0;
                header.AddCell(tc);

                LogoDerecha.ScaleToFit(60f, 60f);
                cellImg        = new PdfPCell(LogoDerecha);
                cellImg.Border = PdfPCell.NO_BORDER;
                header.AddCell(cellImg);

                document.Add(header);
                document.Add(DrawTable.Line());
                document.Add(new Paragraph("\n"));
            }
        }
        public static void SetBody(DataTable dtInscritos)
        {
            int nroColumnas = dtInscritos.Columns.Count;

            float[]   widthCell = { 1.5f, 3.2f, 3.5f, 3.5f, 5f, 3.2f, 3f };
            PdfPTable body      = new PdfPTable(nroColumnas);

            body.SetWidths(widthCell);
            //body.WidthPercentage = 100;

            body.AddCell(DrawTable.DrawCell("LISTA DE INSCRITOS", 10, CellBorder.NONE, CellAlignment.Center, nroColumnas, CellFontStyle.Bold));
            body.AddCell(DrawTable.DrawCell("\n", 10, CellBorder.NONE, CellAlignment.Center, nroColumnas, CellFontStyle.Bold));
            //foreach (DataColumn dc in dtInscritos.Columns)
            //{
            //    body.AddCell(DrawTable.DrawCellHeader(dc.ColumnName, 8, CellBorder.NONE, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY));
            //}
            body.AddCell(DrawTable.DrawCellHeader("Nro.", 8, CellBorder.NONE, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY));
            body.AddCell(DrawTable.DrawCellHeader("Doc. Identidad", 8, CellBorder.NONE, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY));
            body.AddCell(DrawTable.DrawCellHeader("Ap. Paterno", 8, CellBorder.NONE, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY));
            body.AddCell(DrawTable.DrawCellHeader("Ap. Materno", 8, CellBorder.NONE, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY));
            body.AddCell(DrawTable.DrawCellHeader("Nombres", 8, CellBorder.NONE, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY));
            body.AddCell(DrawTable.DrawCellHeader("Fecha Nac.", 8, CellBorder.NONE, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY));
            body.AddCell(DrawTable.DrawCellHeader("Género", 8, CellBorder.NONE, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.LIGHT_GRAY));

            body.AddCell(DrawTable.DrawCell("\n", 14, CellBorder.NONE, CellAlignment.Center, nroColumnas, CellFontStyle.Bold));

            foreach (DataRow rows in dtInscritos.Rows)
            {
                foreach (DataColumn dc in dtInscritos.Columns)
                {
                    body.AddCell(DrawTable.DrawCellHeader(rows[dc.ColumnName].ToString(), 7, CellBorder.NONE, CellAlignment.Left, CellAlignment.Center, CellFontStyle.Normal));
                }
            }

            documentPdf.Add(body);
        }
Esempio n. 9
0
        public override void OnEndPage(PdfWriter writer, Document document)
        {
            base.OnEndPage(writer, document);
            int       pageN         = writer.PageNumber;
            string    text          = string.Format("Pág. {0} / ", writer.PageNumber);
            float     len           = bf.GetWidthPoint(text, 8);
            Rectangle pageSize      = document.PageSize;
            float     altoPiepagina = document.RightMargin + 40;

            PdfPTable footer_linea = new PdfPTable(1);

            if (HasLeyenda)
            {
                footer_linea.AddCell(leyendas);
                altoPiepagina = altoPiepagina + 25;
            }

            footer_linea.AddCell(DrawTable.DrawCell("\n", 6, CellBorder.NONE, CellAlignment.Left, 0, CellFontStyle.Normal));
            footer_linea.TotalWidth = pageSize.Width - LimitBorderTop;

            footer_linea.WidthPercentage               = 100;
            footer_linea.DefaultCell.BorderWidthLeft   = 0;
            footer_linea.DefaultCell.BorderWidthRight  = 0;
            footer_linea.DefaultCell.BorderWidthTop    = 1;
            footer_linea.DefaultCell.BorderWidthBottom = 0;
            footer_linea.DefaultCell.BorderColor       = BaseColor.BLACK;
            footer_linea.AddCell("");

            PdfPTable footer_Logos = new PdfPTable(2);

            LogoAbajoIzquierda.ScaleToFit(90f, 40f);
            LogoAbajoDerecha.ScaleToFit(90f, 40f);
            PdfPCell cellImg = new PdfPCell(LogoAbajoIzquierda);

            cellImg.Border     = PdfPCell.NO_BORDER;
            cellImg.PaddingTop = 10;

            footer_Logos.AddCell(cellImg);
            cellImg = new PdfPCell(LogoAbajoDerecha);
            cellImg.HorizontalAlignment = PdfPCell.ALIGN_RIGHT;
            cellImg.Border     = PdfPCell.NO_BORDER;
            cellImg.PaddingTop = 10;
            footer_Logos.AddCell(cellImg);

            footer_linea.AddCell(footer_Logos);
            footer_linea.WriteSelectedRows(0, -1, pageSize.GetLeft(document.LeftMargin), pageSize.GetBottom(altoPiepagina), cb);

            cb.SetRGBColorFill(100, 100, 100);
            cb.BeginText();
            cb.SetFontAndSize(bf, 8);
            cb.SetTextMatrix(pageSize.GetRight(LimitBorderBottom), pageSize.GetBottom(LimitMargin + 30));
            cb.ShowText(text);
            cb.EndText();

            cb.AddTemplate(template, pageSize.GetRight(LimitBorderBottom) + len, pageSize.GetBottom(LimitMargin + 30));

            cb.BeginText();
            cb.SetFontAndSize(bf, 8);
            cb.SetTextMatrix(pageSize.GetLeft(document.LeftMargin), pageSize.GetBottom(LimitMargin + 30));
            cb.ShowText("Hammer v1.1");
            cb.EndText();

            cb.BeginText();
            cb.SetFontAndSize(bf, 6);
            string datosImpresion;

            datosImpresion = string.Format("{0} - {1:dddd,d MMMM yyyy HH:mm:ss}", User, DateTime.Now);
            cb.SetTextMatrix(((pageSize.Width / 2) - datosImpresion.Length), pageSize.GetBottom(LimitMargin + 30));
            cb.ShowText(datosImpresion);
            cb.EndText();
        }
Esempio n. 10
0
        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);
        }
Esempio n. 11
0
        private static void SetHead(string jornada, string categoria, string descEvento, string lugarEvento, int eventoId)
        {
            float legalMarginWidth  = ItextUtils.CentimetersToPoints(33.02F);
            float legalMarginHeight = ItextUtils.CentimetersToPoints(21.59F);
            float marginLeft        = ItextUtils.CentimetersToPoints(1);
            float marginRight       = ItextUtils.CentimetersToPoints(1);
            float marginTop         = ItextUtils.CentimetersToPoints(1);
            float marginBottom      = ItextUtils.CentimetersToPoints(4);


            documentPdf = new Document();
            documentPdf.SetPageSize(PageSize.LETTER.Rotate());
            documentPdf.SetMargins(marginLeft, marginRight, marginTop, marginBottom);
            //Segir buscando como cambiarl la funte de las letras de todo el doc
            //documentPdf

            PdfWriter writer = PdfWriter.GetInstance(documentPdf, new FileStream(path, FileMode.Create));

            HeaderGolf header = new HeaderGolf();

            header.Titulo       = lugarEvento;
            header.TituloIdioma = "Casa de Campo Cochabamba";
            header.SubTitulo    = descEvento;
            header.Deporte      = "golf";
            header.HasLeyenda   = true;

            header.Jornada            = jornada;
            header.Categoria          = categoria;
            header.User               = "******";
            header.NombreReporte      = "ListadoEquipos";
            header.LogoDerecha        = Image.GetInstance(string.Format(@"{0}\Golf\golf.png", pathImage));
            header.LogoIzquierda      = Image.GetInstance(string.Format(@"{0}\Golf\Federacion.png", pathImage));
            header.LogoAbajoDerecha   = Image.GetInstance(string.Format(@"{0}\Hammer\marcaDoble.png", pathImage));
            header.LogoAbajoIzquierda = Image.GetInstance(string.Format(@"{0}\Hammer\hammerLogoH.png", pathImage));

            string fechas = string.Empty;

            foreach (DateTime item in GolfJornada.GetGolfJornadasFechas(eventoId))
            {
                if (string.IsNullOrEmpty(fechas))
                {
                    fechas = string.Format(DBGlobalization.GetCultureInfo(), "{0:dd}", item);
                }
                else
                {
                    fechas = string.Format(DBGlobalization.GetCultureInfo(), "{0},{1:dd}", fechas, item);
                }
            }
            header.Fecha = fechas;

            PdfPTable leyen = new PdfPTable(new float[] { 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1 });

            leyen.AddCell(DrawTable.DrawCell("Leyenda", 6, CellBorder.NONE, CellAlignment.Left, 14, CellFontStyle.Bold));
            leyen.AddCell(DrawTable.DrawCellHeader("Hoyo en Uno", 5, CellBorder.UNDEFINED, CellAlignment.Right, CellAlignment.Center, CellFontStyle.Bold, BaseColor.WHITE));
            leyen.AddCell(DrawTable.DrawCellHeader(string.Empty, 5, CellBorder.BOX, CellAlignment.Right, CellAlignment.Center, CellFontStyle.Bold, BaseColor.YELLOW));
            leyen.AddCell(DrawTable.DrawCellHeader("Albatros", 5, CellBorder.UNDEFINED, CellAlignment.Right, CellAlignment.Center, CellFontStyle.Bold, BaseColor.WHITE));
            leyen.AddCell(DrawTable.DrawCellHeader(string.Empty, 5, CellBorder.BOX, CellAlignment.Right, CellAlignment.Center, CellFontStyle.Bold, new BaseColor(192, 119, 160)));
            leyen.AddCell(DrawTable.DrawCellHeader("Eagle", 5, CellBorder.UNDEFINED, CellAlignment.Right, CellAlignment.Center, CellFontStyle.Bold, BaseColor.WHITE));
            leyen.AddCell(DrawTable.DrawCellHeader(string.Empty, 5, CellBorder.BOX, CellAlignment.Right, CellAlignment.Center, CellFontStyle.Bold, new BaseColor(248, 177, 17)));
            leyen.AddCell(DrawTable.DrawCellHeader("Birdie", 5, CellBorder.UNDEFINED, CellAlignment.Right, CellAlignment.Center, CellFontStyle.Bold, BaseColor.WHITE));
            leyen.AddCell(DrawTable.DrawCellHeader(string.Empty, 5, CellBorder.BOX, CellAlignment.Right, CellAlignment.Center, CellFontStyle.Bold, new BaseColor(35, 190, 82)));
            leyen.AddCell(DrawTable.DrawCellHeader("PAR", 5, CellBorder.UNDEFINED, CellAlignment.Right, CellAlignment.Center, CellFontStyle.Bold, BaseColor.WHITE));
            leyen.AddCell(DrawTable.DrawCellHeader(string.Empty, 5, CellBorder.BOX, CellAlignment.Right, CellAlignment.Center, CellFontStyle.Bold, BaseColor.WHITE));
            leyen.AddCell(DrawTable.DrawCellHeader("Bogey", 5, CellBorder.UNDEFINED, CellAlignment.Right, CellAlignment.Center, CellFontStyle.Bold, BaseColor.WHITE));
            leyen.AddCell(DrawTable.DrawCellHeader(string.Empty, 5, CellBorder.BOX, CellAlignment.Right, CellAlignment.Center, CellFontStyle.Bold, new BaseColor(92, 119, 229)));
            leyen.AddCell(DrawTable.DrawCellHeader("Doble Bogey o más", 5, CellBorder.UNDEFINED, CellAlignment.Center, CellAlignment.Center, CellFontStyle.Bold, BaseColor.WHITE));
            leyen.AddCell(DrawTable.DrawCellHeader(string.Empty, 5, CellBorder.UNDEFINED, CellAlignment.Right, CellAlignment.Buttom, CellFontStyle.Normal, new BaseColor(237, 62, 48)));
            header.leyendas = leyen;

            writer.PageEvent = header;
            documentPdf.Open();
        }
Esempio n. 12
0
        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);
            }
        }