Пример #1
0
        /// <summary>
        /// Rating Sheet
        /// </summary>
        /// <param name="Posse"></param>
        /// <returns></returns>
        string PrintRatingSheetToFile(int p)
        {
            var fn = tfh.get("pdf");

            using (MemoryStream myMemoryStream = new MemoryStream())
            {
                Document document = PdfPages.get();

                PdfWriter w = PdfWriter.GetInstance(document, new FileStream(fn, FileMode.Create));
                w.PageEvent = new PdfHeaderFooter($"Rating Sheet | Posse #{p} | Stage #___", Global.CurrentMatch.ToString());

                document.Open();

                Font fnt = new Font(Font.FontFamily.HELVETICA, 11f, Font.BOLD);

                PdfPTable s = new PdfPTable(11);
                s.DefaultCell.Border = 0;
                s.HeaderRows         = 1;

                s.WidthPercentage = 100;
                int[] pw2 = { 25, 15, 10, 10, 5, 5, 5, 5, 5, 5, 25 };
                s.SetWidths(pw2);

                PdfPCell[] hc = new PdfPCell[]
                {
                    new PdfPCell(new Phrase(new Chunk("Surname,First Name\nNickname", fnt)))
                    {
                        Border = 0
                    },
                    new PdfPCell(new Phrase(new Chunk("Category\nOutfit Warn.", fnt)))
                    {
                        Border = 0
                    },
                    new PdfPCell(new Phrase(new Chunk("Time", fnt)))
                    {
                        Border = 0
                    },
                    new PdfPCell(new Phrase(new Chunk("Error", fnt)))
                    {
                        Border = 0
                    },
                    new PdfPCell(new Phrase(new Chunk("Ablauff.", fnt)))
                    {
                        Border = 0
                    },
                    new PdfPCell(new Phrase(new Chunk("MSV", fnt)))
                    {
                        Border = 0
                    },
                    new PdfPCell(new Phrase(new Chunk("Bonus", fnt)))
                    {
                        Border = 0
                    },
                    new PdfPCell(new Phrase(new Chunk("Spirit", fnt)))
                    {
                        Border = 0
                    },
                    new PdfPCell(new Phrase(new Chunk("S-DQ", fnt)))
                    {
                        Border = 0
                    },
                    new PdfPCell(new Phrase(new Chunk("M-DQ", fnt)))
                    {
                        Border = 0
                    },
                    new PdfPCell(new Phrase(new Chunk("Signature", fnt)))
                    {
                        Border = 0
                    },
                };

                foreach (var c in hc)
                {
                    c.PaddingBottom = 5;
                }

                s.Rows.Add(new PdfPRow(hc));

                fnt = new Font(Font.FontFamily.HELVETICA, 12f, Font.NORMAL);

                var mp_list = _ctx.MatchParticipations.Include("Shooter").Where(x => (x.MatchID == Global.CurrentMatch.MatchID && x.Posse == p)).ToList();

                foreach (MatchParticipation mp in mp_list)
                {
                    string n = mp.Shooter.Surname + "," + mp.Shooter.FirstName + Environment.NewLine + (string.IsNullOrEmpty(mp.Shooter.Nickname) ? " " : mp.Shooter.Nickname);

                    PdfPCell[] lc = new PdfPCell[]
                    {
                        new PdfPCell(new Phrase(new Chunk(n, fnt))),
                        new PdfPCell(new Phrase(new Chunk(mp.Category, fnt))),
                        new PdfPCell(new Phrase(new Chunk("", fnt))),
                        new PdfPCell(new Phrase(new Chunk("", fnt))),
                        new PdfPCell(new Phrase(new Chunk("", fnt))),
                        new PdfPCell(new Phrase(new Chunk("", fnt))),
                        new PdfPCell(new Phrase(new Chunk("", fnt))),
                        new PdfPCell(new Phrase(new Chunk("", fnt))),
                        new PdfPCell(new Phrase(new Chunk("", fnt))),
                        new PdfPCell(new Phrase(new Chunk("", fnt))),
                        new PdfPCell(new Phrase(new Chunk("", fnt)))
                    };

                    s.Rows.Add(new PdfPRow(lc));
                }


                document.Add(s);
                document.Close();

                return(fn);
            }
        }
Пример #2
0
        /// <summary>
        /// Print one Speed Ticket Rating Sheet
        /// </summary>
        /// <param name="mp_id"></param>
        /// <returns></returns>
        string PrintSpeedTicket(MatchParticipation mp)
        {
            var fn = tfh.get("pdf");

            using (MemoryStream myMemoryStream = new MemoryStream())
            {
                Document document = PdfPages.get();

                PdfWriter w = PdfWriter.GetInstance(document, new FileStream(fn, FileMode.Create));
                w.PageEvent = new PdfHeaderFooter($"Speed Ticket Rating Sheet\n{mp.Shooter.ToString()}", Global.CurrentMatch.ToString());

                document.Open();

                Font fnt = new Font(Font.FontFamily.HELVETICA, 11f, Font.BOLD);

                PdfPTable s = new PdfPTable(10);
                s.DefaultCell.Border = 0;
                s.HeaderRows         = 1;

                s.WidthPercentage = 100;
                int[] pw2 = { 10, 10, 10, 5, 5, 5, 5, 5, 5, 25 };
                s.SetWidths(pw2);

                PdfPCell[] hc = new PdfPCell[]
                {
                    new PdfPCell(new Phrase(new Chunk("Stage #\n ", fnt)))
                    {
                        Border = 0
                    },
                    new PdfPCell(new Phrase(new Chunk("Time", fnt)))
                    {
                        Border = 0
                    },
                    new PdfPCell(new Phrase(new Chunk("Error", fnt)))
                    {
                        Border = 0
                    },
                    new PdfPCell(new Phrase(new Chunk("Ablauff.", fnt)))
                    {
                        Border = 0
                    },
                    new PdfPCell(new Phrase(new Chunk("MSV", fnt)))
                    {
                        Border = 0
                    },
                    new PdfPCell(new Phrase(new Chunk("Bonus", fnt)))
                    {
                        Border = 0
                    },
                    new PdfPCell(new Phrase(new Chunk("Spirit", fnt)))
                    {
                        Border = 0
                    },
                    new PdfPCell(new Phrase(new Chunk("S-DQ", fnt)))
                    {
                        Border = 0
                    },
                    new PdfPCell(new Phrase(new Chunk("M-DQ", fnt)))
                    {
                        Border = 0
                    },
                    new PdfPCell(new Phrase(new Chunk("Signature", fnt)))
                    {
                        Border = 0
                    },
                };

                foreach (var c in hc)
                {
                    c.PaddingBottom = 5;
                }

                s.Rows.Add(new PdfPRow(hc));

                fnt = new Font(Font.FontFamily.HELVETICA, 12f, Font.NORMAL);

                for (int i = 1; i <= Global.CurrentMatch.NumberOfStages; i++)
                {
                    PdfPCell[] lc = new PdfPCell[]
                    {
                        new PdfPCell(new Phrase(new Chunk(i.ToString(), fnt))),
                        new PdfPCell(new Phrase(new Chunk("", fnt))),
                        new PdfPCell(new Phrase(new Chunk("", fnt))),
                        new PdfPCell(new Phrase(new Chunk("", fnt))),
                        new PdfPCell(new Phrase(new Chunk("", fnt))),
                        new PdfPCell(new Phrase(new Chunk("", fnt))),
                        new PdfPCell(new Phrase(new Chunk("", fnt))),
                        new PdfPCell(new Phrase(new Chunk("", fnt))),
                        new PdfPCell(new Phrase(new Chunk("", fnt))),
                        new PdfPCell(new Phrase(new Chunk("", fnt)))
                    };

                    s.Rows.Add(new PdfPRow(lc));
                }

                document.Add(s);
                document.Close();

                return(fn);
            }
        }
Пример #3
0
        private string PrintPosseListToFile(int p)
        {
            var fn = tfh.get("pdf");

            using (MemoryStream myMemoryStream = new MemoryStream())
            {
                Document document = PdfPages.get();

                PdfWriter w = PdfWriter.GetInstance(document, new FileStream(fn, FileMode.Create));
                w.PageEvent = new PdfHeaderFooter($"Posse #{p}", Global.CurrentMatch.ToString());

                document.Open();

                Font fnt = new Font(Font.FontFamily.HELVETICA, 12f, Font.BOLD);

                PdfPTable s = new PdfPTable(6);
                s.DefaultCell.Border = 0;
                s.HeaderRows         = 1;

                s.WidthPercentage = 100;
                int[] pw2 = { 10, 10, 20, 20, 20, 20 };
                s.SetWidths(pw2);

                PdfPCell[] hc = new PdfPCell[]
                {
                    new PdfPCell(new Phrase(new Chunk("RO-CH", fnt)))
                    {
                        Border = 0
                    },
                    new PdfPCell(new Phrase(new Chunk("RO-DEP", fnt)))
                    {
                        Border = 0
                    },
                    new PdfPCell(new Phrase(new Chunk("Surname", fnt)))
                    {
                        Border = 0
                    },
                    new PdfPCell(new Phrase(new Chunk("First Name", fnt)))
                    {
                        Border = 0
                    },
                    new PdfPCell(new Phrase(new Chunk("Nick name", fnt)))
                    {
                        Border = 0
                    },
                    new PdfPCell(new Phrase(new Chunk("Weapon class", fnt)))
                    {
                        Border = 0
                    }
                };

                s.Rows.Add(new PdfPRow(hc));

                fnt = new Font(Font.FontFamily.HELVETICA, 12f, Font.NORMAL);

                var mp_list = _ctx.MatchParticipations.Include("Shooter").Where(x => (x.MatchID == Global.CurrentMatch.MatchID && x.Posse == p)).ToList();

                foreach (MatchParticipation mp in mp_list)
                {
                    PdfPCell[] lc = new PdfPCell[]
                    {
                        new PdfPCell(new Phrase(new Chunk("", fnt))),
                        new PdfPCell(new Phrase(new Chunk("", fnt))),
                        new PdfPCell(new Phrase(new Chunk(mp.Shooter.Surname, fnt))),
                        new PdfPCell(new Phrase(new Chunk(mp.Shooter.FirstName, fnt))),
                        new PdfPCell(new Phrase(new Chunk(mp.Shooter.Nickname, fnt))),
                        new PdfPCell(new Phrase(new Chunk(mp.Category, fnt)))
                    };

                    s.Rows.Add(new PdfPRow(lc));
                }


                document.Add(s);
                document.Close();

                return(fn);
            }
        }