Пример #1
0
        protected override TableDefinition Content(ReportData reportData, Dictionary <string, string> options)
        {
            TableDefinition resultTable = null;

            string numberFormat = "N0";

            bool displayShortHeader = (options != null && options.ContainsKey("HEADER") && "SHORT" == options["HEADER"]);

            List <string> rowData = new List <string>();

            if (null != reportData &&
                null != reportData.CurrentSnapshot)
            {
                //Build Debt row
                Double?technicalDebtBuild = MeasureUtility.GetTechnicalDebtMetric(reportData.CurrentSnapshot);
                rowData.AddRange(new string[] { Labels.Name, Labels.Value });
                rowData.AddRange(new string[] {
                    displayShortHeader?Labels.Debt: Labels.TechnicalDebt + " (" + reportData.CurrencySymbol + ")",
                    technicalDebtBuild.HasValue? technicalDebtBuild.Value.ToString(numberFormat):CastReporting.Domain.Constants.No_Value,
                });


                //Build Debt added row
                Double?technicalDebtadded = MeasureUtility.SumDeltaIndicator(reportData.CurrentSnapshot, reportData.PreviousSnapshot, reportData.Application, Constants.SizingInformations.AddedViolationsTechnicalDebt);

                rowData.AddRange(new string[] {
                    displayShortHeader?Labels.DebtAdded: Labels.TechnicalDebtAdded + " (" + reportData.CurrencySymbol + ")",
                    technicalDebtadded.HasValue? technicalDebtadded.Value.ToString(numberFormat) : CastReporting.Domain.Constants.No_Value,
                });

                //Build Debt removed row
                Double?technicalDebtremoved = MeasureUtility.SumDeltaIndicator(reportData.CurrentSnapshot, reportData.PreviousSnapshot, reportData.Application, Constants.SizingInformations.RemovedViolationsTechnicalDebt);

                rowData.AddRange(new string[] {
                    displayShortHeader?Labels.DebtRemoved: Labels.TechnicalDebtRemoved + " (" + reportData.CurrencySymbol + ")",
                    technicalDebtremoved.HasValue? technicalDebtremoved.Value.ToString(numberFormat):CastReporting.Domain.Constants.No_Value,
                });
            }

            //Build Table Definition
            resultTable = new TableDefinition
            {
                HasRowHeaders    = false,
                HasColumnHeaders = true,
                NbRows           = 3,
                NbColumns        = 2,
                Data             = rowData
            };

            return(resultTable);
        }