Example #1
0
        private void AddRow(AttendInfo p)
        {
            if (t.Rows.Count % 2 == 0)
            {
                t.DefaultCell.BackgroundColor = new GrayColor(240);
            }
            else
            {
                t.DefaultCell.BackgroundColor = BaseColor.WHITE;
            }

            var t2 = new PdfPTable(w2);

            t2.WidthPercentage     = 100;
            t2.DefaultCell.Border  = border;
            t2.DefaultCell.Padding = 5;
            var name = new Phrase(p.Name + "\n", font);

            name.Add(new Chunk($"  ({p.PeopleId})", smallfont));
            t2.AddCell(name);
            var addr = new StringBuilder(p.Address);

            AddLine(addr, p.Address2);
            AddLine(addr, p.CSZ);
            t2.AddCell(new Phrase(addr.ToString(), font));
            var phones = new StringBuilder();

            AddPhone(phones, p.HomePhone, "h ");
            AddPhone(phones, p.CellPhone, "c ");
            AddLine(phones, p.Email);
            t2.AddCell(new Phrase(phones.ToString(), font));
            var c = new PdfPCell(t.DefaultCell);

            c.AddElement(GetAttendance(p.PeopleId));
            c.Colspan = 3;
            t2.AddCell(c);
            c         = new PdfPCell(t.DefaultCell);
            c.Padding = 0;
            c.AddElement(t2);
            t.AddCell(c);

            var t3 = new PdfPTable(w3);

            t3.WidthPercentage           = 100;
            t3.DefaultCell.Border        = border;
            t3.DefaultCell.Padding       = 5;
            t3.DefaultCell.PaddingBottom = 0;
            t3.AddCell(new Phrase(p.Birthday, font));
            t3.AddCell(new Phrase(p.MemberStatus));
            var contacts = GetContacts(p.PeopleId);

            if (contacts.Items.Count > 0)
            {
                c         = new PdfPCell(t.DefaultCell);
                c.Colspan = 2;
                c.AddElement(new Chunk("Contacts", boldfont));
                t3.AddCell(c);
                c         = new PdfPCell(t.DefaultCell);
                c.Colspan = 2;
                c.AddElement(contacts);
                t3.AddCell(c);
            }
            c         = new PdfPCell(t.DefaultCell);
            c.Padding = 0;
            c.AddElement(t3);
            t.AddCell(c);
        }
Example #2
0
        private void AddRow(AttendInfo p)
        {
            if (t.Rows.Count%2 == 0)
                t.DefaultCell.BackgroundColor = new GrayColor(240);
            else
                t.DefaultCell.BackgroundColor = BaseColor.WHITE;

            var t2 = new PdfPTable(w2);
            t2.WidthPercentage = 100;
            t2.DefaultCell.Border = border;
            t2.DefaultCell.Padding = 5;
            var name = new Phrase(p.Name + "\n", font);
            name.Add(new Chunk($"  ({p.PeopleId})", smallfont));
            t2.AddCell(name);
            var addr = new StringBuilder(p.Address);
            AddLine(addr, p.Address2);
            AddLine(addr, p.CSZ);
            t2.AddCell(new Phrase(addr.ToString(), font));
            var phones = new StringBuilder();
            AddPhone(phones, p.HomePhone, "h ");
            AddPhone(phones, p.CellPhone, "c ");
            AddLine(phones, p.Email);
            t2.AddCell(new Phrase(phones.ToString(), font));
            var c = new PdfPCell(t.DefaultCell);
            c.AddElement(GetAttendance(p.PeopleId));
            c.Colspan = 3;
            t2.AddCell(c);
            c = new PdfPCell(t.DefaultCell);
            c.Padding = 0;
            c.AddElement(t2);
            t.AddCell(c);

            var t3 = new PdfPTable(w3);
            t3.WidthPercentage = 100;
            t3.DefaultCell.Border = border;
            t3.DefaultCell.Padding = 5;
            t3.DefaultCell.PaddingBottom = 0;
            t3.AddCell(new Phrase(p.Birthday, font));
            t3.AddCell(new Phrase(p.MemberStatus));
            var contacts = GetContacts(p.PeopleId);
            if (contacts.Items.Count > 0)
            {
                c = new PdfPCell(t.DefaultCell);
                c.Colspan = 2;
                c.AddElement(new Chunk("Contacts", boldfont));
                t3.AddCell(c);
                c = new PdfPCell(t.DefaultCell);
                c.Colspan = 2;
                c.AddElement(contacts);
                t3.AddCell(c);
            }
            c = new PdfPCell(t.DefaultCell);
            c.Padding = 0;
            c.AddElement(t3);
            t.AddCell(c);
        }