コード例 #1
0
 public Node(int id, string title, string description, BeaconData beaconData, NodeType type, PointU position, int navigationId)
 {
     Id           = id;
     Title        = title;
     Description  = description;
     BeaconData   = beaconData;
     Type         = type;
     Position     = position;
     NavigationId = navigationId;
 }
コード例 #2
0
 public static void GenerateTextField(string title, string data) //Adds labels
 {
     var boxLoc = new PointU(Unit.Inch(CapLocX), Unit.Inch(CapLocY));
     MyCaptionBoxes[count] = GenerateAttributes(boxLoc, title, title, "{0}");
     HeaderSections[GroupCount].Items.Add(MyCaptionBoxes[count]);
     MyDataBoxes[count] = GenerateAttributes(boxLoc, data, title, "{0:$#,0.00}");
     Detail.Items.Add(MyDataBoxes[count]);
     CapLocX += 1.3666666507720947D;
     count++;
 }
コード例 #3
0
ファイル: ReportHelper.cs プロジェクト: mparsin/Elements
        /// <summary>
        /// Gets the charts.
        /// </summary>
        /// <param name="field">The field.</param>
        /// <param name="settingsString">The settings string.</param>
        /// <param name="valueLocation">The value location.</param>
        /// <param name="valueSize">Size of the value.</param>
        /// <returns>List{Chart}.</returns>
        private List<Chart> GetCharts(PropertyInfo field, string settingsString, PointU valueLocation, SizeU valueSize)
        {
            //TODO start and finish
            var chartsList = new List<Chart>();
            var sampleSettings = string.Empty;

            if (!string.IsNullOrEmpty(settingsString))
            {
                var spcSettings = XElement.Parse(settingsString);

                if (spcSettings.HasAttributes)
                {
                    var sampleFieldName = spcSettings.Attribute("SampleFieldName").Value;
                    if (!string.IsNullOrEmpty(sampleFieldName))
                    {
                        sampleSettings =
                            _item.GetValueByPropertyName(string.Format("{0}_SampleSettings", sampleFieldName)) as string;
                    }
                }
            }

            var spcFieldValue = field.GetValue(_item, null);
            ChartPanel chartPanel = null;
            var getSampleDataCommand = TheDynamicTypeManager.GetTypeByName(_item.ProcessName,
                                                                           string.Format(
                                                                               "Dynamic{0}.GetSampleDataCommand",
                                                                               _item.ProcessName));

            var inf = getSampleDataCommand.GetMethod("Execute",
                                                            BindingFlags.Static | BindingFlags.Public |
                                                            BindingFlags.FlattenHierarchy);
            chartPanel =
                (ChartPanel)
                inf.Invoke(getSampleDataCommand,
                           new object[] {field.Name, spcFieldValue, _item, sampleSettings, 0, chartPanel});

            valueSize = new SizeU(valueSize.Width, valueSize.Height*2);

            foreach (var chartBase in chartPanel.Charts)
            {
                var chart = new Chart
                                {
                                    BitmapResolution = 96F,
                                    ImageFormat = ImageFormat.Emf,
                                    Location = valueLocation,
                                    Size = valueSize,
                                };
                chart.ChartTitle.Visible = false;

                // Create a ChartSeries and assign its name and chart type
                var chartSeries = new ChartSeries();
                chartSeries.Name = chartBase.ChartType.Description();
                chartSeries.Type = fromChartBaseChartType(chartBase.ChartType);
                chartSeries.Appearance.LabelAppearance.LabelLocation = StyleSeriesItemLabel.ItemLabelLocation.Outside;
                foreach (var unit in chartBase.DataSource)
                {
                    chartSeries.AddItem((double) unit.SampleValue, unit.CategoryValue.LabelValue.ToString());
                }
                chart.Series.Add(chartSeries);

                valueLocation.Y += chart.Size.Height;
                chartsList.Add(chart);
            }

            return chartsList;
        }
コード例 #4
0
ファイル: ReportHelper.cs プロジェクト: mparsin/Elements
        //TODO: Method is too complex. Refactor!
        /// <summary>
        /// Builds the detail report.
        /// </summary>
        /// <param name="reportDocument">The report document.</param>
        public void BuildDetailReport(ICustomReport reportDocument)
        {
            var currentReport = reportDocument.Reports.First();

            var visibleSections = new List<Section>();
            var visibleFields = new List<PropertyInfo>();

            var textHeight = 0.2;
            var valueTextHeight = 0.6;
            var valueMargin = 0.1;
            var fieldMargin = 0.1;
            var sectionMargin = 0.3;

            //This report parameter holds id of the detail item
            _itemId = int.Parse(currentReport.ReportParameters["itemId"].Value.ToString());

            //This report parameter holds the current template system name.
            _processName = currentReport.ReportParameters["processName"].Value.ToString();

            GetEditableRoot(currentReport);

            var itemProperties = _item.GetAllPropertiesForInstance();
            var allItemSections = itemProperties.Where(x => x.Key.Name == "Sections").Reverse()
                                                .SelectMany(x => x.Key.GetValue(x.Value, null) as IList<ISection>)
                                                .Distinct(new SectionEqualityComparerByGuid());

            foreach (Section section in allItemSections)
            {
                var sections = currentReport.ReportParameters["sections"].Value.ToString().Split(';');
                var sectionIsVisible = false;
                var index = 0;

                while (!sectionIsVisible && index < sections.Length)
                {
                    if (sections[index] == section.Name)
                    {
                        sectionIsVisible = true;
                    }
                    index++;
                }

                if (sectionIsVisible)
                {
                    visibleSections.Add(section);
                }
            }

            _fieldAttrDict = GetFieldAttributes(itemProperties.Select(x => x.Key));
            
            var fields = _fieldAttrDict.Where(x => visibleSections.Select(s => s.Name).Contains(x.Value.SectionName))
                                       .Select(x => x.Key);

            foreach (var field in fields)
            {
                var fieldNames = currentReport.ReportParameters["fields"].Value.ToString().Split(';');
                var fieldIsVisible = false;
                var index = 0;

                while (!fieldIsVisible && index < fieldNames.Length)
                {
                    if (fieldNames[index] == field.Name)
                    {
                        fieldIsVisible = true;
                    }
                    index++;
                }

                if (fieldIsVisible)
                {
                    visibleFields.Add(field);
                }
            }

            double startY = 0;
            var availableWidth = currentReport.Width.Value;

            foreach (var section in visibleSections)
            {
                var sectionHeaderSize = new SizeU(new Unit(availableWidth, UnitType.Inch), new Unit(textHeight, UnitType.Inch));
                var headerLoc = new PointU(new Unit(0), new Unit(startY, UnitType.Inch));

                var sectionHeader = new TextBox { Value = section.Name, Location = headerLoc, Size = sectionHeaderSize, StyleName = "Section", Multiline = false, CanGrow = false };
                startY += textHeight + fieldMargin;

                currentReport.Items["detail"].Items.Add(sectionHeader);

                double percentageOfRowUsed = 0;
                var sectionFields = visibleFields.Where(x => _fieldAttrDict[x].SectionName == section.Name).OrderBy(y => _fieldAttrDict[y].FieldPosition).ToArray();

                for (var i = 0; i < sectionFields.Length; i++)
                {
                    if (percentageOfRowUsed + _fieldAttrDict[sectionFields[i]].WidthPercentage > 1.0)
                    {
                        startY += textHeight + valueMargin + valueTextHeight + fieldMargin;
                        percentageOfRowUsed = 0;
                    }

                    var location = new PointU(new Unit((availableWidth * percentageOfRowUsed), UnitType.Inch), new Unit(startY, UnitType.Inch));
                    var fieldPanel = new Panel { Location = location };

                    location = new PointU(Unit.Inch(0), Unit.Inch(0));
                    var fieldHeaderSize = new SizeU(new Unit((availableWidth * _fieldAttrDict[sectionFields[i]].WidthPercentage) - 0.1, UnitType.Inch), new Unit(textHeight, UnitType.Inch));
                    var fieldHeader = new TextBox { Location = location, Size = fieldHeaderSize, StyleName = "Field", Multiline = true, CanGrow = true };
                    fieldHeader.Value = GetDisplayName(sectionFields[i]);

                    var valueLocation = new PointU(Unit.Inch(0), Unit.Inch(textHeight + valueMargin));
                    var valueSize = new SizeU(new Unit((availableWidth * _fieldAttrDict[sectionFields[i]].WidthPercentage) - 0.1, UnitType.Inch), new Unit(valueTextHeight, UnitType.Inch));
                    var fieldValue = new TextBox { Location = valueLocation, Size = valueSize, StyleName = "Value", Multiline = true, CanGrow = true };

                    var backgroundProperty = _item.GetPropertyByName(sectionFields[i].Name + Constants.FieldBackColorPostfix);
                    if (backgroundProperty != null)
                    {
                        var colorAsLong = _item.GetValueByPropertyName(backgroundProperty.Name);

                        if (colorAsLong != 0)
                        {
                            var bytes = BitConverter.GetBytes(colorAsLong);
                            if (bytes[3] == 0) bytes[3] = 255;
                            var color = Color.FromArgb(bytes[3], bytes[2], bytes[1], bytes[0]);
                            fieldValue.Style.BackgroundColor = color;
                        }
                    }

                    var pictureBox = new PictureBox { Location = valueLocation, Size = valueSize, StyleName = "Value" };

                    List<Chart> chartsList = null;

                    Table fieldValueTable = null;

                    var displayFieldPath = string.Format("[{0}]", string.Join("].[", _item.GetFullPropertyPath(sectionFields[i].Name)));

                    if (_fieldAttrDict[sectionFields[i]].FieldEditor == "Approval")
                    {
                        fieldValue.Value = string.Format("=ApprovalEnumConverter({0}.ApprovalState)", displayFieldPath);
                    }
                    else if (_fieldAttrDict[sectionFields[i]].IsSingleCrossRef)
                    {
                        var displayField = _fieldAttrDict[sectionFields[i]].DisplayFieldList[0];
                        var crossRefMember =
                            itemProperties.FirstOrDefault(
                                x => x.Key.Name == string.Format("{0}Member", sectionFields[i].Name));

                        if (!crossRefMember.Equals(default(KeyValuePair<PropertyInfo, IDynamicObject>)))
                        {
                            var crossRefMemberValue = crossRefMember.Key.GetValue(crossRefMember.Value, null) as IDynamicObject;

                            if (crossRefMemberValue != null)
                            {
                                var infoList = TheDynamicTypeManager.GetInfoListById<IInfoList>(
                                                                        _fieldAttrDict[sectionFields[i]].CrossRefProcessName,
                                                                        ((IEditableRoot)crossRefMemberValue).Id);

                                if (infoList.Count > 0)
                                {
                                    var crossRefInfoValue = infoList[0] as IDynamicObject;
                                    var infoProps = crossRefInfoValue.GetAllPropertiesForInstance();

                                    var displayFieldProp = infoProps.FirstOrDefault(x => x.Key.Name == displayField).Key;
                                    if (displayFieldProp != null)
                                    {
                                        fieldValue.Value = displayFieldProp.GetValue(infoProps[displayFieldProp], null).ToString();
                                    }
                                }
                            }
                        }
                    }
                    else if (_fieldAttrDict[sectionFields[i]].IsMultiCrossRef)
                    {
                        var crList = _item.GetValueByPropertyName(sectionFields[i].Name) as ICrossRefItemList;
                        if (crList != null)
                        {
                            foreach (var item in crList)
                            {
                                fieldValue.Value += item + Environment.NewLine;
                            }
                        }
                    }
                    else if (_fieldAttrDict[sectionFields[i]].FieldEditor == typeof(DateTime).Name || _fieldAttrDict[sectionFields[i]].FieldEditor == "ScheduleDate")
                    {
                        fieldValue.Value = string.Format("=GetDateTimeValue({0}, \"{1}\")", displayFieldPath, _fieldAttrDict[sectionFields[i]].DateTimeFormat.Value);
                    }
                    else if (_fieldAttrDict[sectionFields[i]].FieldEditor == "Result")
                    {
                        var resultListFieldName = string.Format("{0}_ResultList", sectionFields[i].Name);
                        var resultist =
                            itemProperties.FirstOrDefault(
                                x => x.Key.Name == resultListFieldName);

                        if (!resultist.Equals(default(KeyValuePair<PropertyInfo, IDynamicObject>)))
                        {
                            var resultistValue = resultist.Key.GetValue(resultist.Value, null) as IEnumerable<ChoiceInfo>;

                            var resultistPath = string.Format("[{0}]", string.Join("].[", _item.GetFullPropertyPath(resultListFieldName)));

                            if (resultistValue != null)
                            {
                                fieldValue.Value = string.Format("=GetChoiceName({0}, {1})", resultistPath, displayFieldPath);
                            }
                        }
                        else
                            fieldValue.Value = string.Format("=Fields.{0}", displayFieldPath);
                    }
                    else if (_fieldAttrDict[sectionFields[i]].FieldEditor == "FileProcess")
                    {
                        if ((sectionFields[i].GetValue(itemProperties[sectionFields[i]], null) as IDynamicObject) != null)
                            fieldValue.Value = string.Format("=Fields.{0}.OriginalFileName", displayFieldPath);
                        else
                            fieldValue.Value = string.Format("=Fields.{0}", displayFieldPath);
                    }
                    else if (_fieldAttrDict[sectionFields[i]].FieldEditor == Constants.ChoiceFieldType)
                    {
                        var xml = sectionFields[i].GetValue(itemProperties[sectionFields[i]], null).ToString();

                        if (!string.IsNullOrEmpty(xml))
                        {
                            var choices = XElement.Parse(xml);
                            var isGlobal = choices.FirstAttribute.Value;

                            if (Convert.ToBoolean(isGlobal))
                            {
                                var id = choices.LastAttribute.Value;
                                var globalChoice = TheDynamicTypeManager.GetEditableRoot<IEditableRoot>(Constants.GlobalChoiceProcessName, Convert.ToInt32(id));

                                var newXml = (string)globalChoice.GetType().GetProperty("ChoiceDetails").GetValue(globalChoice, null);

                                if (!string.IsNullOrEmpty(newXml))
                                    choices = XElement.Parse(newXml);
                            }

                            if (choices.Descendants().Any())
                            {
                                var choiceInfoList = new List<ChoiceInfo>();

                                foreach (var element in choices.Descendants())
                                {
                                    choiceInfoList.Add(new ChoiceInfo
                                    {
                                        Choice = element.Attribute("Choice").Value,
                                        Score = double.Parse(element.Attribute("Score").Value),
                                        AcceptanceCriteria = (ChoiceInfo.AcceptanceCriterias)Enum.Parse(typeof(ChoiceInfo.AcceptanceCriterias), element.Attribute("AcceptanceCriteria").Value, false)
                                    });
                                }

                                var columns = new List<TableColumn>
                                    {
                                        new TableColumn("Choice", "Choice", fieldHeader.Size.Width * 0.5),
                                        new TableColumn("Score", "Score", fieldHeader.Size.Width * 0.2),
                                        new TableColumn("AcceptanceCriteria", "Criteria", fieldHeader.Size.Width * 0.3)
                                    };

                                fieldValueTable = CreateTable(columns);
                                fieldValueTable.Location = valueLocation;
                                fieldValueTable.DataSource = choiceInfoList;
                            }
                        }
                    }
                    else if (_fieldAttrDict[sectionFields[i]].FieldEditor == ColumnTypes.AuditTrail.ToString())
                    {
                        var columns = new List<TableColumn>
                        {
                            new TableColumn("UserName", "UserName", fieldHeader.Size.Width / 6),
                            new TableColumn("ChangeType", "Type", fieldHeader.Size.Width / 6),
                            new TableColumn("FieldName", "FieldName", fieldHeader.Size.Width / 6),
                            new TableColumn("OldValue", "OldValue", fieldHeader.Size.Width / 6),
                            new TableColumn("NewValue", "NewValue", fieldHeader.Size.Width / 6),
                            new TableColumn("UpdateDate", "UpdateDate", fieldHeader.Size.Width / 6)
                        };

                        fieldValueTable = CreateTable(columns);
                        fieldValueTable.Location = valueLocation;
                        var audits = sectionFields[i].GetValue(itemProperties[sectionFields[i]], null);

                        var auditList = ((IEnumerable)audits).Cast<AuditInfo>().ToList();
                        for (var j = 0; j < auditList.Count; j++)
                        {
                            if (!string.IsNullOrEmpty(auditList[j].FieldName))
                            {
                                foreach (var fieldParametrese in _fieldAttrDict)
                                {
                                    if (fieldParametrese.Key.Name == auditList[j].FieldName && fieldParametrese.Value.FieldEditor == "RichText")
                                    {
                                        var converter = new HtmlToText();
                                        var oldValue = converter.ConvertHtml(auditList[j].OldValue as string);
                                        var newValue = converter.ConvertHtml(auditList[j].NewValue as string);

                                        var newAudit = new AuditInfo(auditList[j].Id, auditList[j].ChangeType, auditList[j].ItemId, auditList[j].FieldName, oldValue, newValue, auditList[j].UpdateDate, auditList[j].UserName);
                                        auditList[j] = newAudit;
                                    }
                                }
                            }
                        }

                        fieldValueTable.DataSource = auditList;
                    }
                    else if (_fieldAttrDict[sectionFields[i]].IsReverseCrossRef)
                    {
                        //fieldValue.Value = string.Format("=Fields.{0}.ToString()", displayFieldPath);
                        var item = _item.GetValueByPropertyName(sectionFields[i].Name);

                        if (item != null)
                            fieldValue.Value = item.ToString();
                    }
                    else if (_fieldAttrDict[sectionFields[i]].IsMultiReverseCrossRef)
                    {
                        var list = _item.GetValueByPropertyName(sectionFields[i].Name) as IList;

                        if (list != null)
                        {
                            foreach (IReverseCrossReferenceItem item in list)
                            {
                                fieldValue.Value += item + "\n";
                            }
                        }
                    }
                    else if (_fieldAttrDict[sectionFields[i]].FieldEditor == "RichText")
                    {
                        fieldValue.Value = string.Format("=GetPlainTextValue({0})", displayFieldPath);
                    }
                    else if (_fieldAttrDict[sectionFields[i]].FieldEditor == ColumnTypes.Checklist.ToString())
                    {
                        var meta = new Dictionary<string, Type>();
                        var data = new List<object>();
                        short count = 0;

                        var checklistObject = (ChecklistEdit)sectionFields[i].GetValue(_item, null);

                        // checklist cache data
                        string resultPropertyName = null;
                        if (checklistObject.AnswerProcessList.Count > 0)
                        {
                            var tempProps = ((IEditableRoot)checklistObject.AnswerProcessList[0]).GetAllPropertiesForType();
                            foreach (var prop in tempProps)
                            {
                                var resultAttr = (FieldEditorAttribute)(from d in prop.GetCustomAttributes(typeof(FieldEditorAttribute), false) select d).FirstOrDefault();
                                if (resultAttr != null && resultAttr.DataType == Constants.ResultFieldType)
                                {
                                    resultPropertyName = prop.Name;
                                    break;
                                }
                            }
                        }
                        // end checklist cache

                        var displayFields = sectionFields[i].GetCustomAttributes<ChecklistDisplayFieldAttribute>().ToList();
                        
                        foreach (IEditableRoot editObject in checklistObject.AnswerProcessList)
                        {
                            var properties = editObject.GetAllPropertiesForType();
                            foreach (var property in properties)
                            {
                                if (displayFields.All(x => x.SystemName != property.Name))
                                {
                                    continue;
                                }

                                var csAttr = (CommonSettingsAttribute)(from d in property.GetCustomAttributes(typeof(CommonSettingsAttribute), false) select d).FirstOrDefault();
                                var feAttr = (FieldEditorAttribute)(from d in property.GetCustomAttributes(typeof(FieldEditorAttribute), false) select d).FirstOrDefault();
                                if (csAttr != null && csAttr.Section != null)
                                {
                                    if (checklistObject.AnswerProcessList.IndexOf(editObject) == 0)
                                    {
                                        var columnName = property.Name == resultPropertyName ? "Linked Item" : GetDisplayName(property);

                                        meta.Add(columnName, property.PropertyType == typeof(byte[]) ? typeof(byte[]) : typeof(string));
                                        count++;
                                    }

                                    var value = property.GetValue(editObject, null);
                                    if (value is string && string.IsNullOrWhiteSpace((string)value))
                                    {
                                        data.Add(string.Empty);
                                        continue;
                                    }

                                    //image
                                    if (property.PropertyType == typeof(byte[]))
                                    {
                                        data.Add(value);
                                        continue;
                                    }

                                    //file
                                    if (typeof(IFileProcess).IsAssignableFrom(property.PropertyType))
                                    {
                                        data.Add(((IFileProcess)value).OriginalFileName);
                                        continue;   
                                    }

                                    //sample
                                    if (typeof(ISampleList).IsAssignableFrom(property.PropertyType))
                                    {
                                        var answerList = _item.GetValueByPropertyName(string.Format("{0}List", sectionFields[i].Name));
                                        if (answerList is IEnumerable)
                                        {
                                            var sampleEdit = ((IEnumerable<IEditableRoot>)answerList).FirstOrDefault();

                                            if (sampleEdit != null)
                                            {
                                                var xml = sampleEdit.GetValueByPropertyName(string.Format("{0}{1}", property.Name, Constants.SampleSettingPostfix)) as string;
                                                if (!string.IsNullOrEmpty(xml))
                                                {
                                                    var sampleTypeFieldName = XElement.Parse(xml).Attribute("SampleTypeFieldName").Value;
                                                    var sampleTypeValue = sampleEdit.GetValueByPropertyName(sampleTypeFieldName);

                                                    if (sampleTypeValue != null)
                                                    {
                                                        var sampleType = (SampleTypes)Enum.Parse(typeof(SampleTypes), sampleTypeValue, false);

                                                        var result = new List<string>();
                                                        foreach (ISampleEdit item in (ISampleList)value)
                                                        {
                                                            switch (sampleType)
                                                            {
                                                                case SampleTypes.Boolean:
                                                                    result.Add(string.Format("{0} {1}", item.Label, item.SampleBoolean));
                                                                    break;

                                                                case SampleTypes.Number:
                                                                    result.Add(string.Format("{0} {1}", item.Label, item.SampleNumeric));
                                                                    break;

                                                                case SampleTypes.Alphanumeric:
                                                                    result.Add(string.Format("{0} {1}", item.Label, item.SampleAlphanumeric));
                                                                    break;
                                                            }
                                                        }
                                                        data.Add(string.Join(Environment.NewLine, result));
                                                        continue;
                                                    }
                                                }
                                            }
                                        }
                                    }

                                    if (feAttr != null && resultPropertyName != null && (feAttr.DataType == Constants.ChoiceFieldType || property.Name == resultPropertyName))
                                    {
                                        var choiceProperty = properties.FirstOrDefault(x => x.Name == resultPropertyName);
                                        double? choiceValue = null;
                                        if (choiceProperty != null)
                                        {
                                            choiceValue = (double?)choiceProperty.GetValue(editObject, null);
                                        }

                                        if (choiceValue.HasValue)
                                        {
                                            var resultProperty = properties.FirstOrDefault(x => x.Name == resultPropertyName + Constants.ResultListPostfix);

                                            var choiceInfoList = resultProperty.GetValue(editObject, null) as IEnumerable<ChoiceInfo>;
                                            if (choiceInfoList == null)
                                            {
                                                data.Add(string.Empty);
                                                continue;
                                            }

                                            var choiceInfo = choiceInfoList.FirstOrDefault(x => x.Score != null && x.Score == choiceValue);
                                            if (choiceInfo != null)
                                            {
                                                data.Add(property.Name == resultPropertyName ? choiceInfo.NewItemLinkContent : choiceInfo.Choice);
                                                continue;
                                            }

                                            if (choiceValue == default(double) && choiceInfo == null)
                                            {
                                                data.Add(string.Empty);
                                                continue;
                                            }
                                        }
                                    }

                                    try
                                    {
                                        data.Add(Convert.ToString(value));
                                    }
                                    catch
                                    {
                                        data.Add(string.Empty);
                                    }
                                }
                            }
                        }

                        // populate table
                        var workTable = new DataTable();
                        foreach (var column in meta)
                        {
                            workTable.Columns.Add(column.Key, column.Value);
                        }

                        for (var j = 0; j < data.Count; j += count)
                        {
                            var row = new object[count];
                            for (var k = 0; k < count; k++)
                            {
                                row[k] = data[j + k];
                            }
                            workTable.Rows.Add(row);
                        }

                        // create report table
                        var columns = meta.Select(x => new TableColumn(x.Key, x.Key, fieldHeader.Size.Width / meta.Count, x.Value)).ToList();

                        fieldValueTable = CreateTable(columns);
                        fieldValueTable.Location = valueLocation;
                        fieldValueTable.DataSource = workTable;
                    }
                    else if (_fieldAttrDict[sectionFields[i]].FieldEditor == "Image")
                    {
                        byte[] imageBytes = (byte[])sectionFields[i].GetValue(itemProperties[sectionFields[i]], null);
                        if (imageBytes != null)
                        {
                            var ms = new MemoryStream(imageBytes);

                            if (ms != null && ms.Length > 0)
                            {
                                pictureBox.Value = Image.FromStream(ms);
                                pictureBox.Height = new Unit(((Image) pictureBox.Value).Height, UnitType.Pixel);
                            }
                        }
                    }
                    else if (_fieldAttrDict[sectionFields[i]].FieldEditor == "Checkbox")
                    {
                        if ((bool)_fieldAttrDict[sectionFields[i]].IsSwitchToggle.Value)
                        {
                            fieldValue.Value = string.Format("=GetBoolValue(\"{0}\", \"{1}\", \"{2}\", {3})",
                                                             _fieldAttrDict[sectionFields[i]].UndefinedLabel.Value,
                                                             _fieldAttrDict[sectionFields[i]].TrueLabel.Value,
                                                             _fieldAttrDict[sectionFields[i]].FalseLabel.Value,
                                                             displayFieldPath);
                        }
                        else
                        {
                            fieldValue.Value = string.Format("={0}", displayFieldPath);
                        }
                    }
                    else if (_fieldAttrDict[sectionFields[i]].FieldEditor == Constants.SampleFieldType)
                    {
                        var xml = _item.GetValueByPropertyName(string.Format("{0}{1}", sectionFields[i].Name, Constants.SampleSettingPostfix)) as string;
                        if (!string.IsNullOrEmpty(xml))
                        {
                            var sampleTypeFieldName = XElement.Parse(xml).Attribute("SampleTypeFieldName").Value;
                            var sampleTypeValue = _item.GetValueByPropertyName(sampleTypeFieldName);

                            if (sampleTypeValue != null)
                            {
                                var sampleType = (SampleTypes)Enum.Parse(typeof(SampleTypes), sampleTypeValue, false);

                                var list = _item.GetValueByPropertyName(sectionFields[i].Name);

                                string sampleColumnName = null;
                                switch (sampleType)
                                {
                                    case SampleTypes.Boolean:
                                        sampleColumnName = "SampleBoolean";
                                        break;

                                    case SampleTypes.Number:
                                        sampleColumnName = "SampleNumeric";
                                        break;

                                    case SampleTypes.Alphanumeric:
                                        sampleColumnName = "SampleAlphanumeric";
                                        break;
                                }

                                var columns = new List<TableColumn>
                                    {
                                        new TableColumn("Label", "Nr", fieldHeader.Size.Width/2),
                                        new TableColumn(sampleColumnName, "Value", fieldHeader.Size.Width/2),
                                    };

                                fieldValueTable = CreateTable(columns);
                                fieldValueTable.Location = valueLocation;
                                fieldValueTable.DataSource = list;
                            }
                        }
                    }
                    else if (_fieldAttrDict[sectionFields[i]].FieldEditor == "SpcChart")
                    {
                        //var settings = sectionFields[i].GetValue(itemProperties[sectionFields[i]], null) as string;
                        //chartsList = GetCharts(sectionFields[i], settings, valueLocation, valueSize);

                        fieldValue.Value = "SPC Chart not supported on Easy Report";
                    }

                    else if (_fieldAttrDict[sectionFields[i]].FieldType.ColumnType == ColumnTypes.Numeric || 
                        _fieldAttrDict[sectionFields[i]].FieldType.ColumnType == ColumnTypes.Double || 
                        _fieldAttrDict[sectionFields[i]].FieldType.ColumnType == ColumnTypes.Integer)
                    {
                        fieldValue.Value = string.Format(@"=GetNumericValue(Fields.{0}, ""{1}"", ""{2}"")", displayFieldPath, _fieldAttrDict[sectionFields[i]].Numeric.NumericType, currentReport.ReportParameters["userCurrency"].Value );
                    }
                    else if (_fieldAttrDict[sectionFields[i]].DisplayListField != null)
                    {
                        var displayListProperty = sectionFields[i];
                        var processName = GetDeclaringProcessSystemName(displayListProperty);
                        var itemType = TheDynamicTypeManager.GetDisplayListItemType(processName, displayListProperty.Name);

                        var listOfFields = _fieldAttrDict[sectionFields[i]].DisplayListField.DisplayFieldList;
                        var displayFields = new List<string>();

                        if (!string.IsNullOrEmpty(listOfFields))
                        {
                            displayFields.AddRange(listOfFields.Split('|'));
                        }

                        // populate table
                        var workTable = new DataTable();

                        // Add table columns.
                        foreach (var propertyName in displayFields)
                        {
                            var property = itemType.GetPropertyByName(propertyName);
                            if (property == null)
                                continue;

                            var columnType = property.PropertyType;
                            if (columnType != typeof(byte[]))
                                columnType = typeof(string);

                            var column = workTable.Columns.Add(propertyName, columnType);

                            column.Caption = GetDisplayName(property);
                        }

                        // Add table rows.
                        foreach (IDynamicObject info in _item.GetValueByPropertyName(displayListProperty.Name))
                        {
                            var row = workTable.NewRow();

                            foreach (DataColumn column in workTable.Columns)
                            {
                                var value = info.GetValueByPropertyName(column.ColumnName);

                                if (value == null)
                                    continue;

                                if (value is byte[])
                                {
                                    row[column] = value;
                                }
                                else
                                {
                                    row[column] = value.ToString();
                                }
                            }

                            workTable.Rows.Add(row);
                        }

                        // create report table
                        var columns =
                            workTable.Columns.Cast<DataColumn>()
                                .Select(c => new TableColumn(c.ColumnName, c.Caption, fieldHeader.Size.Width / workTable.Columns.Count, c.DataType))
                                .ToList();

                        fieldValueTable = CreateTable(columns);
                        fieldValueTable.Location = valueLocation;
                        fieldValueTable.DataSource = workTable;
                    }
                    else
                    {
                        fieldValue.Value = string.Format("=Fields.{0}", displayFieldPath);
                    }

                    ReportItem valueItem;

                    if (fieldValueTable != null)
                        valueItem = fieldValueTable;
                    else
                        valueItem = fieldValue;

                    fieldPanel.Size = new SizeU(fieldHeaderSize.Width, Unit.Inch(textHeight + valueTextHeight));

                    if (pictureBox.Value != null)
                    {
                        fieldPanel.Items.AddRange(new ReportItemBase[] { fieldHeader, pictureBox });
                    }
                    else if (chartsList != null && chartsList.Count > 0)
                    {
                        fieldPanel.Items.Add(fieldHeader);
                        foreach (var chart in chartsList)
                            fieldPanel.Items.Add(chart);
                    }
                    else
                    {
                        fieldPanel.Items.AddRange(new[] { fieldHeader, valueItem });
                    }

                    currentReport.Items["detail"].Items.Add(fieldPanel);

                    percentageOfRowUsed += _fieldAttrDict[sectionFields[i]].WidthPercentage;
                }

                startY += sectionMargin + valueTextHeight;
            }
        }
コード例 #5
0
ファイル: ReportHelper.cs プロジェクト: mparsin/Elements
        /// <summary>
        /// Builds the report.
        /// </summary>
        /// <param name="reportDocument">The report document.</param>
        public void BuildReport(ICustomReport reportDocument)
        {
            var currentReport = reportDocument.Reports.First();

            SetIdentity(currentReport);
            //_originalPageHeaderHeight = ((PageHeaderSection) currentReport.Items["pageHeader"]).Height;

            //This report parameter holds the current template system name.
            _processName = currentReport.ReportParameters["processName"].Value.ToString();

            //This report parameter holds the currently visible columns of the grid and in what order they're in
            var cols = currentReport.ReportParameters["columns"].Value.ToString();

            var columns = cols.Split(';').ToList();
            _columns = new List<ColumnInfo>();
            foreach (var col in columns)
            {
                _columns.Add(new ColumnInfo(col));
            }

            var groupsStr = currentReport.ReportParameters["groups"].Value.ToString();
            _groups = (string.IsNullOrEmpty(groupsStr) ? new string[0] : groupsStr.Split(';')).ToList();

            //TODO: Uncomment if needed
           // _columns.AddRange(_groups);

            if (reportDocument.FitToPage)
            {
                if (currentReport.GetType().Name.ToLower().Contains("landscape"))
                {
                    FitToPageColumnWidth = Math.Min(1, 10.0 / _columns.Count);
                    FitToPageColumnCount = (short) Math.Max(10, _columns.Count);
                }

                if (currentReport.GetType().Name.ToLower().Contains("portrait"))
                {
                    FitToPageColumnWidth = Math.Min(1.1, 7.0 / _columns.Count);
                    FitToPageColumnCount = (short) Math.Max(7, _columns.Count);
                }

                currentReport.Width = new Unit(_columns.Count * FitToPageColumnWidth, UnitType.Inch);
            }

            _groupColumn = currentReport.ReportParameters["groupColumn"].Value.ToString();

            var fldList = new List<FieldInfo>(_columns.Count);

            var processProperties = new Dictionary<PropertyInfo, string>();
            var processType = TheDynamicTypeManager.GetInfoType<IInfoClass>(_processName);

            if (processType != null)
            {
                processProperties = processType.GetAllPropertiesWithPaths();
                var properties = processProperties.Where(p => _columns.Any(c=>c.SystemName == p.Value));

                foreach (var column in _columns)
                {
                    foreach (var property in properties)
                    {
                        if (property.Value == column.SystemName)
                        {
                            fldList.Add(new FieldInfo(property.Key, column));
                            break;
                        }
                    }
                }

                _fieldAttrDict = GetFieldAttributes(processProperties.Select(x => x.Key));
            }

            if (_fieldAttrDict == null)
                _fieldAttrDict = new Dictionary<PropertyInfo, FieldParametres>();

            _colDict = new SortedDictionary<int, string[]>();

            //Grouping            
            foreach (var colName in _groups)
            {
                var group = new Telerik.Reporting.Group();
                group.Name = colName;
                var groupHeaderSection = new GroupHeaderSection();
                var groupFooterSection = new GroupFooterSection();
                group.GroupHeader = groupHeaderSection;
                group.GroupFooter = groupFooterSection;

                var txt = new TextBox();
                txt.Style.Font.Size = new Unit(10, UnitType.Point);
                txt.Style.Font.Bold = true;
                txt.Style.BackgroundColor = Color.FromArgb(255, 225, 225, 225);
                txt.Style.TextAlign = HorizontalAlign.Left;
                txt.Style.VerticalAlign = VerticalAlign.Middle;
                groupHeaderSection.Items.Add(txt);
                groupHeaderSection.Height = new Unit(21);
                groupHeaderSection.Style.BorderStyle.Default = BorderType.Solid;
                groupHeaderSection.Style.BorderColor.Default = Color.White;
                groupHeaderSection.Style.BorderColor.Left = Color.Transparent;

                var panel = new Panel();
                panel.Height = new Unit(20);
                panel.Style.LineStyle = LineStyle.Solid;
                panel.Style.LineWidth = new Unit(2.0);
                panel.Style.BorderColor.Default = Color.Black;
                panel.Style.BorderWidth.Default = new Unit(2.0);
                panel.Style.BorderStyle.Default = BorderType.None;
                panel.Style.BorderStyle.Top = BorderType.Solid;
                panel.Style.BorderStyle.Bottom = BorderType.Solid;
                groupFooterSection.Items.Add(panel);
                groupFooterSection.Height = new Unit(25);
                //groupFooterSection.Style.BorderStyle.Default = BorderType.Solid;
                //groupFooterSection.Style.BorderColor.Default = Color.White;
                groupFooterSection.Style.BorderColor.Left = Color.Transparent;
                groupFooterSection.Style.Padding.Top = new Unit(2);
                groupFooterSection.Style.Padding.Bottom = new Unit(2);

                //if you need to filter the data, apply filtering
                //group1.Filters.Add(new Telerik.Reporting.Data.Filter("=Fields.ProductID", Telerik.Reporting.Data.FilterOperator.Equal, "=10"));

                currentReport.Groups.Add(group);
            }

            var aggregateData = currentReport.ReportParameters["aggregates"].Value.ToString();
            _aggregateDict = ParseAggregateData(aggregateData);

            var nextLeft = _groups.Count > 0 ? (_groups.Count - 1) * 0.15 : 0;
            var availableWidth = currentReport.Width.Value - nextLeft;
            var ctrlSize = availableWidth / (fldList.Count() - _groups.Count);

            _indentOffset = 0;

            _reportItemCounter = new Dictionary<string, int>();

            var counter = 0;
            double fitToPageFooterLocationX = 0;

            //posess fields
            foreach (var fld in fldList)
            {
                if (_reportItemCounter.ContainsKey(fld.Property.Name))
                {
                    continue;
                }

                var fieldValueMap = GetFieldValueMap(currentReport, fld.Property, processProperties[fld.Property]);

                if (_groups.Contains(processProperties[fld.Property] ?? string.Empty))
                {
                    //create group
                    var fieldGroup = currentReport.Groups.FirstOrDefault(x => x.Name == processProperties[fld.Property]);
                    if (fieldGroup != null)
                    {
                        _indentOffset = 0.15 * _groups.IndexOf(processProperties[fld.Property]);

                        fieldGroup.Groupings.Add(new Grouping(fieldValueMap));
                        ((TextBox)fieldGroup.GroupHeader.Items[0]).Value = string.Format("='  ' + {0} + '    Total: ' + Exec('{1}', Count(IsNull({0},1)))", fieldValueMap.TrimStart('='), fieldGroup.Name);
                        ((TextBox)fieldGroup.GroupHeader.Items[0]).Location = new PointU(new Unit(_indentOffset, UnitType.Inch), new Unit(0, UnitType.Inch));
                        ((TextBox)fieldGroup.GroupHeader.Items[0]).Size = new SizeU(new Unit(currentReport.Width.Value - _indentOffset, UnitType.Inch), new Unit(20, UnitType.Pixel));
                        //AddGroupLevelLines(fieldGroup.GroupHeader.Items);

                        ((Panel)fieldGroup.GroupFooter.Items[0]).Location = new PointU(new Unit(_indentOffset, UnitType.Inch), new Unit(0, UnitType.Inch));
                        ((Panel)fieldGroup.GroupFooter.Items[0]).Size = new SizeU(new Unit(currentReport.Width.Value - _indentOffset, UnitType.Inch), new Unit(20, UnitType.Pixel));
                        //AddGroupLevelLines(fieldGroup.GroupFooter.Items);                    
                    }

                    continue;
                }

                var cPoint = new PointU(new Unit(nextLeft, UnitType.Inch), new Unit(0.4, UnitType.Inch));
                var uSize = new SizeU(new Unit(ctrlSize, UnitType.Inch), new Unit(0.2, UnitType.Inch));

                var attr = fld.Property.GetCustomAttributes(false);
                var displayAttr = attr.FirstOrDefault(x => x is DisplayAttribute) as DisplayAttribute;

                string colName = "<NoName>";
                if (displayAttr == null)
                {
                    colName = fld.Column.Header;
                    //var infoInstance = Activator.CreateInstance(processType);
                    //if (infoInstance != null)
                    //{
                    //    var field = processType.GetField(fld.Name + "Property");
                    //    if (field != null)
                    //    {
                    //        var fieldValue = field.GetValue(infoInstance) as IPropertyInfo;
                    //        if (fieldValue != null)
                    //        {
                    //            colName = fieldValue.FriendlyName;
                    //        }
                    //    }
                    //}
                }
                else
                {
                    colName = displayAttr.GetName();
                }

                var headerLabel = new TextBox { Value = colName, Location = cPoint, Size = uSize, StyleName = "Caption", Multiline = true, CanGrow = true };
                headerLabel.Style.BackgroundColor = Color.Transparent;
                headerLabel.Style.Font.Size = new Unit(10, UnitType.Point);
                headerLabel.Style.VerticalAlign = VerticalAlign.Top;

                var dataTextBox = new TextBox();
                var dataTextBoxName = string.Format("{0}TextBox", processProperties[fld.Property]);
                dataTextBox.Name = dataTextBoxName;

                var propertyName = processProperties[fld.Property];
                var isExistsBackgroudColor = processProperties.Any(x => x.Key.Name == propertyName + Constants.FieldBackColorPostfix);

                dataTextBox.TextWrap = true;
                dataTextBox.Location = new PointU(new Unit(nextLeft, UnitType.Inch), new Unit(0, UnitType.Inch));
                dataTextBox.Size = uSize;
                dataTextBox.CanGrow = true;

                if (isExistsBackgroudColor)
                {
                    if (fieldValueMap.StartsWith("="))
                    {
                        fieldValueMap = fieldValueMap.Remove(0, 1);
                        fieldValueMap = string.Format("=GetValueWithBackgroundColor({0}, Fields.[{1}{2}])", fieldValueMap, processProperties[fld.Property], Constants.FieldBackColorPostfix);

                        EventHandler itemDataBoundHandler = (sender, args) =>
                            {
                                var textBox = sender as Telerik.Reporting.Processing.TextBox;
                                if (textBox == null)
                                {
                                    return;
                                }

                                var colorAsLong = ((KeyValuePair<object, long>)textBox.Value).Value;
                                if (colorAsLong != 0)
                                {
                                    var bytes = BitConverter.GetBytes(colorAsLong);
                                    if (bytes[3] == 0) bytes[3] = 255;
                                    var color = Color.FromArgb(bytes[3], bytes[2], bytes[1], bytes[0]);

                                    ((Telerik.Reporting.Processing.ProcessingElement)sender).Style.BackgroundColor = color;
                                }

                                textBox.Value = ((KeyValuePair<object, long>)textBox.Value).Key;

                            };
                        dataTextBox.ItemDataBound += itemDataBoundHandler;

                        EventHandler dataTextBoxDisposedHandler = null;
                        dataTextBoxDisposedHandler = (sender, args) =>
                        {
                            dataTextBox.ItemDataBound -= itemDataBoundHandler;
                            dataTextBox.Disposed -= dataTextBoxDisposedHandler;
                        };
                        dataTextBox.Disposed += dataTextBoxDisposedHandler;
                    }
                }

                dataTextBox.Value = fieldValueMap;

                if (!reportDocument.FitToPage)
                {
                    dataTextBox.ItemDataBound += OnItemDataBound;

                    EventHandler dataTextBoxDisposedHandler = null;
                    dataTextBoxDisposedHandler = (sender, args) =>
                    {
                        dataTextBox.ItemDataBound -= OnItemDataBound;
                        dataTextBox.Disposed -= dataTextBoxDisposedHandler;
                    };
                    dataTextBox.Disposed += dataTextBoxDisposedHandler;
                }

                var pictureBox = new PictureBox { Value = fieldValueMap };
                pictureBox.Name = string.Format("{0}TextBox", processProperties[fld.Property]);
                pictureBox.Sizing = ImageSizeMode.ScaleProportional;

                if (!reportDocument.FitToPage)
                {
                    pictureBox.ItemDataBound += OnItemDataBound;

                    EventHandler pictureBoxDisposedHandler = null;
                    pictureBoxDisposedHandler = (sender, args) =>
                        {
                            pictureBox.ItemDataBound -= OnItemDataBound;
                            pictureBox.Disposed -= pictureBoxDisposedHandler;
                        };
                    pictureBox.Disposed += pictureBoxDisposedHandler;
                }

                nextLeft = nextLeft + ctrlSize;

                if (reportDocument.FitToPage)
                {
                    currentReport.Items["labelsGroupHeaderSection"].Items.Add(headerLabel);
                }
                else
                {
                    currentReport.Items["pageHeader"].Items.Add(headerLabel);
                }

                if (_fieldAttrDict[fld.Property].FieldEditor == "Image")
                {
                    currentReport.Items["detail"].Items["rowPanel"].Items.Add(pictureBox);
                }
                else
                {
                    currentReport.Items["detail"].Items["rowPanel"].Items.Add(dataTextBox);
                }

                _reportItemCounter.Add(processProperties[fld.Property], 0);

                if (reportDocument.FitToPage)
                {
                    _colDict.Add(currentReport.Items["labelsGroupHeaderSection"].Items.Count - 1, new[] { processProperties[fld.Property], headerLabel.Value });
                }
                else
                {
                    _colDict.Add(currentReport.Items["pageHeader"].Items.Count - 1, new[] { processProperties[fld.Property], headerLabel.Value });
                }

                if (reportDocument.FitToPage)
                {
                    fitToPageFooterLocationX = counter % FitToPageColumnCount == 0 ? 0 : fitToPageFooterLocationX;

                    if (_aggregateDict.Keys.All(x => x != fld.Property.Name))
                    {
                        var footerTextBox = new TextBox
                        {
                            Name = string.Format("{0}{1}FooterTextBox", fld.Property.Name, fldList.IndexOf(fld)),
                            Location = new PointU(new Unit(fitToPageFooterLocationX, UnitType.Inch), new Unit(0, UnitType.Inch)),
                            Size = new SizeU(new Unit(FitToPageColumnWidth, UnitType.Inch), new Unit(0.15, UnitType.Inch))
                        };

                        currentReport.Items["pageFooter"].Items.Add(footerTextBox);
                    }

                    //calculate server-side aggregates
                    var aggregateDefinitions = _aggregateDict.ToList()
                        .SelectMany(i => i.Value)
                        .Where(d => !AggregateHelper.IsPageAggregateType(d.SummaryType))
                        .ToList();

                    var queryCriteria = new AggregateDataSourceQueryCriteria
                    {
                        ProcessName = _processName,
                        FilterDefinition = GetFilterDefinition(currentReport)
                    };
                    var serverAggregateResults = AggregateProcessor.CalculateAggregates(aggregateDefinitions, queryCriteria);

                    foreach (var aggregateItem in _aggregateDict)
                    {
                        if (aggregateItem.Key != fld.Property.Name)
                        {
                            continue;
                        }

                        double fitToPageFooterLocationY = 0;

                        for (var i = 0; i < aggregateItem.Value.Count; i++)
                        {
                            var footerTextBox = new TextBox
                                {
                                    Name = string.Format("{0}{1}FooterTextBox", fld.Property.Name, aggregateItem.Value[i].SummaryType), // telerik recommends set unique names for all controls
                                    Size = new SizeU(new Unit(GetWidthFitToPage(fld.Property.Name, i), UnitType.Inch), new Unit(0.15, UnitType.Inch)),
                                    Location = new PointU(new Unit(fitToPageFooterLocationX, UnitType.Inch), new Unit(fitToPageFooterLocationY, UnitType.Inch))
                                };

                            if (AggregateHelper.IsPageAggregateType(aggregateItem.Value[i].SummaryType))
                            {
                                footerTextBox.Value = string.Format(@"='{0}: ' + AfterCalculateAggregates(PageExec('{1}TextBox', {2}(BeforeCalculateAggregates(Fields.[{1}], ""{2}"", ""{3}"", ""{4}"", ""{5}"", ""{6}""))), ""{2}"", ""{3}"", ""{4}"", ""{5}"", ""{6}"")",
                                        AggregateProcessor.GetAggregateFunctionShortName(aggregateItem.Value[i].SummaryType), aggregateItem.Key, aggregateItem.Value[i].SummaryType, aggregateItem.Value[i].CustomConverter, aggregateItem.Value[i].TargetType, aggregateItem.Value[i].TypeName, aggregateItem.Value[i].ConverterParameter);
                            }
                            else
                            {
                                var result = serverAggregateResults.FirstOrDefault(r => r.ColumnName == aggregateItem.Key && r.SummaryType == aggregateItem.Value[i].SummaryType);
                                footerTextBox.Value = string.Format("{0}: {1}", AggregateHelper.GetAttribute(aggregateItem.Value[i].SummaryType).ShortName, result != null ? result.Value : Constants.Empty);
                            }

                            if (aggregateItem.Value[i].SummaryType == SummaryTypes.Count)
                            {
                                footerTextBox.Bindings.Add(new Binding("Visible", string.Format(@"=IIf(PageExec(""{0}"", Count(Fields.{1})) = 0, False, True)", dataTextBoxName, fld.Property.Name)));
                            }

                            if (aggregateItem.Value[i].SummaryType == SummaryTypes.Min || aggregateItem.Value[i].SummaryType == SummaryTypes.Max)
                            {
                                if (fld.Property.PropertyType != typeof(bool) && fld.Property.PropertyType != typeof(bool?))//VRN-5079
                                {
                                    footerTextBox.Bindings.Add(new Binding("Visible", string.Format(@"=FooterTextBoxVisibilityWithValue(PageExec(""{0}"", Min(Fields.{1})))", dataTextBoxName, fld.Property.Name)));
                                }
                            }

                            fitToPageFooterLocationY += 0.15;
                            currentReport.Items["pageFooter"].Items.Add(footerTextBox);
                        }
                    }

                    fitToPageFooterLocationX += FitToPageColumnWidth;
                    counter++;
                }
            }

            if (reportDocument.FitToPage)
            {
                var max = _aggregateDict.Count == 0 ? 0 : _aggregateDict.Max(x => x.Value.Count);
                if (max != 0)
                {
                    ((PageFooterSection) currentReport.Items["pageFooter"]).Height = new Unit(max*0.15 + 0.2, UnitType.Inch);
                }

                currentReport.Items["pageFooter"].Items["currentTimeTextBox"].Visible = false;
                currentReport.Items["pageFooter"].Items["pageInfoTextBox"].Visible = false;
            }

            _indentOffset = _groups.Count > 0 ? (_groups.Count - 1) * 0.15 : 0;

            //AddGroupLevelLines(currentReport.Items["detail"].Items["rowPanel"].Items);
        }