public ReportsPDFCommonView(string pathContentPDFCssStyle, int groupById, PDFCell valueForPeriodCell)
 {
     PatchCssStyle = pathContentPDFCssStyle;
     PDFGrandModel = new ReportsPDFGrandGridView();
     GroupById     = groupById;
     PeriodCell    = valueForPeriodCell;
 }
Esempio n. 2
0
        private ReportsPDFGrandGridView CreateReportsGrandGridModel <T>(IReportsGrandGridView <T> groupedList)
        {
            var pdfGrandModel = new ReportsPDFGrandGridView();

            // Grand headers.
            foreach (var propGrand in PropsGrandHeaders)
            {
                if (!propGrand.PropertyType.GetTypeInfo().IsGenericType)
                {
                    var grandHeader = CreateGrandHeader(propGrand, groupedList);
                    pdfGrandModel.GrandHeaders.Add(grandHeader);
                }
            }

            foreach (var entity in groupedList.ReportsGridView.ToList())
            {
                var entityLocal = new ReportsPDFEntityView();

                foreach (var entityHeader in PropsEntityHeaders)
                {
                    if (!entityHeader.PropertyType.GetTypeInfo().IsGenericType)
                    {
                        // Total headers.
                        var totalHeader = CreateTotalHeader(entityHeader, entity);
                        entityLocal.TotalHeaders.Add(totalHeader);
                    }
                    else if (entityHeader.PropertyType == typeof(IEnumerable <ReportsGridItemsView>))
                    {
                        // Entity Headers.
                        var entityHeaders = CreateEntityHeaders();
                        entityLocal.EntityHeaders.AddRange(entityHeaders);

                        // Entity Rows.
                        var entityRows = CreateEntityRows(entityHeader, entity);
                        entityLocal.EntityRows.AddRange(entityRows);
                    }
                }

                pdfGrandModel.Entities.Add(entityLocal);
            }

            return(pdfGrandModel);
        }