예제 #1
0
        public override void ExecuteResult(ControllerContext context)
        {
            var Response = context.HttpContext.Response;

            var list1 = ReportList().ToList();

            if (!list1.Any())
            {
                Response.Write("no data found");
                return;
            }
            Response.ContentType = "application/pdf";
            Response.AddHeader("content-disposition", "filename=OrgLeaders.pdf");

            doc = new Document(PageSize.LETTER, 36, 36, 36, 36);
            var w = PdfWriter.GetInstance(doc, Response.OutputStream);

            w.PageEvent = pageEvents;
            doc.Open();
            dc = w.DirectContent;

            foreach (var o in list1)
            {
                var t = StartPageSet(o);

                var color = BaseColor.BLACK;
                foreach (var m in RollsheetModel.FetchOrgMembers(o.OrgId, null)
                         .Where(om => om.MemberTypeId != MemberTypeCode.Member))
                {
                    if (color == BaseColor.WHITE)
                    {
                        color = new GrayColor(240);
                    }
                    else
                    {
                        color = BaseColor.WHITE;
                    }
                    AddRow(t,
                           m.PeopleId,
                           m.Name,
                           m.Email,
                           m.HomePhone,
                           m.CellPhone,
                           m.WorkPhone,
                           m.MemberType,
                           color);
                }
                doc.Add(t);
            }
            pageEvents.EndPageSet();
            doc.Close();
        }
예제 #2
0
        public override void ExecuteResult(ControllerContext context)
        {
            var Response = context.HttpContext.Response;

            var list1 = ReportList().ToList();

            if (!list1.Any())
            {
                Response.Write("no data found");
                return;
            }
            Response.ContentType = "application/pdf";
            Response.AddHeader("content-disposition", "filename=foo.pdf");

            doc = new Document(PageSize.LETTER, 36, 36, 36, 36);
            var w = PdfWriter.GetInstance(doc, Response.OutputStream);

            w.PageEvent = pageEvents;
            doc.Open();
            dc = w.DirectContent;

            var haddata = false;

            foreach (var o in list1)
            {
                var t = StartPageSet(o);

                var color = BaseColor.BLACK;
                foreach (var m in RollsheetModel.FetchOrgMembers(o.OrgId, null))
                {
                    if (color == BaseColor.WHITE)
                    {
                        color = new GrayColor(240);
                    }
                    else
                    {
                        color = BaseColor.WHITE;
                    }
                    AddRow(t, m, color);
                    haddata = true;
                }
                doc.Add(t);
            }
            if (!haddata)
            {
                doc.Add(new Phrase("\nno data"));
            }
            pageEvents.EndPageSet();
            doc.Close();
        }
예제 #3
0
        public override void ExecuteResult(ControllerContext context)
        {
            var Response = context.HttpContext.Response;

            Response.ContentType = "application/pdf";
            Response.AddHeader("content-disposition", "attachment;filename=foo.pdf");

            doc = new Document(PageSize.LETTER, 36, 36, 64, 64);
            var w = PdfWriter.GetInstance(doc, Response.OutputStream);

            w.PageEvent = pageEvents;
            doc.Open();

            dc = w.DirectContent;

            if (qid != null)
            {
                var o = ReportList().First();
                StartPageSet(o);
                var q  = DbUtil.Db.PeopleQuery(qid.Value);
                var q2 = from p in q
                         let rr = p.GetRecReg()
                                  join m in RollsheetModel.FetchOrgMembers(o.OrgId, null) on p.PeopleId equals m.PeopleId into j
                                  from m in j.DefaultIfEmpty()
                                  orderby p.Name2
                                  select new
                {
                    p.Name,
                    MembertypeCode = (m == null ? "V" : m.MemberTypeCode),
                    p.PeopleId,
                    rr.MedicalDescription
                };
                foreach (var i in q2)
                {
                    AddRow(i.MembertypeCode, i.Name, i.MedicalDescription, i.PeopleId, font);
                }
                if (t.Rows.Count > 1)
                {
                    doc.Add(t);
                }
                else
                {
                    doc.Add(new Phrase("no data"));
                }
            }
            else
            {
                foreach (var o in ReportList())
                {
                    var q = from m in RollsheetModel.FetchOrgMembers(o.OrgId, null)
                            orderby m.Name2
                            select new
                    {
                        m.Name,
                        m.MemberType,
                        m.PeopleId,
                        m.MedicalDescription
                    };
                    if (!q.Any())
                    {
                        continue;
                    }
                    StartPageSet(o);
                    foreach (var i in q)
                    {
                        AddRow(i.MemberType, i.Name, i.MedicalDescription, i.PeopleId, font);
                    }

                    if (t.Rows.Count > 1)
                    {
                        doc.Add(t);
                    }
                    else
                    {
                        doc.Add(new Phrase("no data"));
                    }
                }
            }
            if (!pagesetstarted)
            {
                w.PageEvent = null;
                doc.Add(new Phrase("no data"));
            }
            pageEvents.EndPageSet();
            doc.Close();
        }
예제 #4
0
        public override void ExecuteResult(ControllerContext context)
        {
            var Response = context.HttpContext.Response;

            Response.ContentType = "application/pdf";
            Response.AddHeader("content-disposition", "filename=RosterList.pdf");

            doc = new Document(PageSize.LETTER, 36, 36, 36, 36);
            var w = PdfWriter.GetInstance(doc, Response.OutputStream);

            w.PageEvent = pageEvents;
            doc.Open();
            dc = w.DirectContent;

            if (qid != null)
            {
                var color = BaseColor.BLACK;
                var o     = ReportList().First();
                var t     = StartPageSet(o);
                var q     = DbUtil.Db.PeopleQuery(qid.Value);
                var q2    = from p in q
                            let rr = p.RecRegs.FirstOrDefault()
                                     join m in RollsheetModel.FetchOrgMembers(o.OrgId, null) on p.PeopleId equals m.PeopleId into j
                                     from m in j.DefaultIfEmpty()
                                     orderby p.Name2
                                     select new MemberInfo
                {
                    ActiveOther   = rr.ActiveInAnotherChurch ?? false,
                    ThisChurch    = rr.Member ?? false,
                    Address       = p.PrimaryAddress,
                    Address2      = p.PrimaryAddress2,
                    CityStateZip  = p.CityStateZip5,
                    CellPhone     = p.CellPhone,
                    HomePhone     = p.HomePhone,
                    MemberStatus  = p.MemberStatus.Description,
                    MemberType    = m.MemberType,
                    FamMemberThis = p.Family.People.Any(f => f.PositionInFamilyId == 10 && f.MemberStatusId == MemberStatusCode.Member),
                    Name          = p.Name,
                    Medical       = rr.MedicalDescription,
                    PeopleId      = p.PeopleId,
                    Parents       = DbUtil.Db.ParentNamesAndCells(p.PeopleId),
                    Age           = p.Age
                };
                foreach (var m in q2)
                {
                    if (color.Equals(BaseColor.WHITE))
                    {
                        color = new GrayColor(240);
                    }
                    else
                    {
                        color = BaseColor.WHITE;
                    }

                    AddRow(t, m, color);
                }
                if (t.Rows.Count > 1)
                {
                    doc.Add(t);
                }
                else
                {
                    doc.Add(new Phrase("no data"));
                }
            }
            else
            {
                foreach (var o in ReportList())
                {
                    var t = StartPageSet(o);

                    var color = BaseColor.BLACK;

                    var q = from om in DbUtil.Db.OrganizationMembers
                            where om.OrganizationId == o.OrgId
                            where (om.Pending ?? false) == false
                            where om.MemberTypeId != MemberTypeCode.InActive
                            let rr = om.Person.RecRegs.FirstOrDefault()
                                     orderby om.Person.Name2
                                     select new MemberInfo
                    {
                        ActiveOther   = rr.ActiveInAnotherChurch ?? false,
                        ThisChurch    = rr.Member ?? false,
                        Address       = om.Person.PrimaryAddress,
                        Address2      = om.Person.PrimaryAddress2,
                        CityStateZip  = om.Person.CityStateZip5,
                        CellPhone     = om.Person.CellPhone,
                        HomePhone     = om.Person.HomePhone,
                        MemberStatus  = om.Person.MemberStatus.Description,
                        MemberType    = om.MemberType.Description,
                        FamMemberThis = om.Person.Family.People.Any(f => f.PositionInFamilyId == 10 && f.MemberStatusId == MemberStatusCode.Member),
                        Name          = om.Person.Name,
                        Medical       = rr.MedicalDescription,
                        PeopleId      = om.PeopleId,
                        Parents       = DbUtil.Db.ParentNamesAndCells(om.PeopleId),
                        Age           = om.Person.Age
                    };

                    foreach (var m in q)
                    {
                        if (color == BaseColor.WHITE)
                        {
                            color = new GrayColor(240);
                        }
                        else
                        {
                            color = BaseColor.WHITE;
                        }

                        AddRow(t, m, color);
                    }
                    doc.Add(t);
                }
            }

            pageEvents.EndPageSet();
            doc.Close();
        }