protected override TableDefinition Content(ReportData reportData, Dictionary<string, string> options)
        {
            TableDefinition back = new TableDefinition();
            List<string> rowData = new List<string>();
            string numberFormat = "N0";

            if (null != reportData && null != reportData.CurrentSnapshot && reportData.CurrentSnapshot.CostComplexityResults != null)
            {

                #region Selected Snapshot

                double? nbArtifactLow = CastComplexityUtility.GetCostComplexityGrade(reportData.CurrentSnapshot,
                    Constants.QualityDistribution.CostComplexityDistribution.GetHashCode(),
                    Constants.CostComplexity.CostComplexityArtifacts_Low.GetHashCode());
                double? nbArtifactAve = CastComplexityUtility.GetCostComplexityGrade(reportData.CurrentSnapshot,
                    Constants.QualityDistribution.CostComplexityDistribution.GetHashCode(),
                    Constants.CostComplexity.CostComplexityArtifacts_Average.GetHashCode());
                double? nbArtifactHigh = CastComplexityUtility.GetCostComplexityGrade(reportData.CurrentSnapshot,
                    Constants.QualityDistribution.CostComplexityDistribution.GetHashCode(),
                    Constants.CostComplexity.CostComplexityArtifacts_High.GetHashCode());
                double? nbArtifactVeryHigh = CastComplexityUtility.GetCostComplexityGrade(reportData.CurrentSnapshot,
                    Constants.QualityDistribution.CostComplexityDistribution.GetHashCode(),
                    Constants.CostComplexity.CostComplexityArtifacts_VeryHigh.GetHashCode());

                double? nbViolationLow = CastComplexityUtility.GetCostComplexityGrade(reportData.CurrentSnapshot,
                    Constants.QualityDistribution.DistributionOfDefectsToCriticalDiagnosticBasedMetricsPerCostComplexity.GetHashCode(),
                    Constants.DefectsToCriticalDiagnosticBasedMetricsPerCostComplexity.CostComplexityDefects_Low.GetHashCode());
                double? nbViolationAve = CastComplexityUtility.GetCostComplexityGrade(reportData.CurrentSnapshot,
                    Constants.QualityDistribution.DistributionOfDefectsToCriticalDiagnosticBasedMetricsPerCostComplexity.GetHashCode(),
                    Constants.DefectsToCriticalDiagnosticBasedMetricsPerCostComplexity.CostComplexityDefects_Average.GetHashCode());
                double? nbViolationHigh = CastComplexityUtility.GetCostComplexityGrade(reportData.CurrentSnapshot,
                    Constants.QualityDistribution.DistributionOfDefectsToCriticalDiagnosticBasedMetricsPerCostComplexity.GetHashCode(),
                    Constants.DefectsToCriticalDiagnosticBasedMetricsPerCostComplexity.CostComplexityDefects_High.GetHashCode());
                double? nbViolationVeryHigh = CastComplexityUtility.GetCostComplexityGrade(reportData.CurrentSnapshot,
                    Constants.QualityDistribution.DistributionOfDefectsToCriticalDiagnosticBasedMetricsPerCostComplexity.GetHashCode(),
                    Constants.DefectsToCriticalDiagnosticBasedMetricsPerCostComplexity.CostComplexityDefects_VeryHigh.GetHashCode());

                #endregion Selected Snapshot

                #region Data

                rowData.AddRange(new string[] { Labels.Complexity, Labels.Artifacts, Labels.WithViolations });
                rowData.AddRange(new string[] { Labels.CplxExtreme, nbArtifactVeryHigh.Value.ToString(numberFormat), nbViolationVeryHigh.Value.ToString(numberFormat) });
                rowData.AddRange(new string[] { Labels.CplxHigh, nbArtifactHigh.Value.ToString(numberFormat), nbViolationHigh.Value.ToString(numberFormat) });
                rowData.AddRange(new string[] { Labels.CplxAverage, nbArtifactAve.Value.ToString(numberFormat), nbViolationAve.Value.ToString(numberFormat) });
                rowData.AddRange(new string[] { Labels.CplxLow, nbArtifactLow.Value.ToString(numberFormat), nbViolationLow.Value.ToString(numberFormat) });

                #endregion Data

                back = new TableDefinition
                {
                    Data = rowData,
                    HasRowHeaders = false,
                    HasColumnHeaders = true,
                    NbColumns = 3,
                    NbRows = 4
                };
            }
            return back;
        }
Esempio n. 2
0
        protected override TableDefinition Content(ReportData reportData, Dictionary<string, string> options)
        {
            int nbResult = reportData.Parameter.NbResultDefault, tmpNb;
            if (null != options && options.ContainsKey("COUNT") && Int32.TryParse(options["COUNT"], out tmpNb) && tmpNb > 0)
            {
                nbResult = tmpNb;
            }

            if (reportData != null && reportData.CurrentSnapshot != null)
            {
                List<TechnologyResultDTO> technologyInfos = MeasureUtility.GetTechnoLoc(reportData.CurrentSnapshot, nbResult);

                List<string> rowData = new List<string>();
                rowData.AddRange(new string[] { Labels.Name, Labels.LoC });

                foreach (var elt in technologyInfos)
                {
                    rowData.AddRange(new string[] { elt.Name, Convert.ToInt32(elt.Value).ToString() });
                }

                TableDefinition resultTable = new TableDefinition
                {
                    HasRowHeaders = true,
                    HasColumnHeaders = false,
                    NbRows = technologyInfos.Count + 1,
                    NbColumns = 2,
                    Data = rowData
                };
                return resultTable;
            }

            return null ;
        }
        protected override string Content(ReportData reportData, Dictionary<string, string> options)
        {
            if (null != reportData && null != reportData.CurrentSnapshot)
                return SnapshotUtility.GetSnapshotVersionNumber(reportData.CurrentSnapshot);

            return CastReporting.Domain.Constants.No_Value;
        }
Esempio n. 4
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="reportData"></param>
        /// <param name="options"></param>
        /// <returns></returns>
        protected override TableDefinition Content(ReportData reportData, Dictionary<string, string> options)
        {
            TableDefinition resultTable = null;
            int nbTot = 0;
            bool displayShortHeader = (options != null && options.ContainsKey("HEADER") && "SHORT" == options["HEADER"]);
            List<string> rowData = new List<string>();
            Int32? metricId = (options != null && options.ContainsKey("ID")) ? Convert.ToInt32(options["ID"]) : (Int32?)null;

            if (null != reportData &&
                null != reportData.CurrentSnapshot && metricId.HasValue) {
                var result = reportData.CurrentSnapshot.BusinessCriteriaResults.FirstOrDefault(r => r.Reference.Key == metricId);

                if (result != null) {
                    string value = Text(metricId.Value);
                    rowData.AddRange(new string[] { Labels.Techno, value });
                    foreach (var res in result.TechnologyResult) {
                        rowData.AddRange(new string[] { res.Technology, res.DetailResult.Grade.ToString(_MetricFormat) });
                    }
                    nbTot = result.ModulesResult.Length;
                }
            }
            resultTable = new TableDefinition {
                HasRowHeaders = false,
                HasColumnHeaders = true,
                NbRows = nbTot + 1,
                NbColumns = 2,
                Data = rowData
            };
            return resultTable;
        }
Esempio n. 5
0
        protected override string Content(ReportData reportData, Dictionary<string, string> options)
        {
            if (reportData != null)
                return reportData.Application.AdgWebSite;

            return CastReporting.Domain.Constants.No_Value;
        }
        protected override TableDefinition Content(ReportData reportData, Dictionary<string, string> options)
        {
            int nbResult = reportData.Parameter.NbResultDefault, tmpNb;
            if (null != options && options.ContainsKey("COUNT") && Int32.TryParse(options["COUNT"], out tmpNb) && tmpNb > 0)
            {
                nbResult = tmpNb;
            }

             if (null != reportData && null != reportData.CurrentSnapshot)
             {
                 var moduleArtifacts = MeasureUtility.GetModulesMeasure(reportData.CurrentSnapshot, nbResult, Constants.SizingInformations.ArtifactNumber);

                 List<string> rowData = new List<string>();
                 rowData.AddRange(new string[] { Labels.Name, Labels.Artifacts });

                 foreach (var mod in moduleArtifacts)
                 {
                     rowData.AddRange(new string[] { mod.Name, Convert.ToInt32(mod.Value).ToString() });
                 }

                 TableDefinition resultTable = new TableDefinition
                 {
                     HasRowHeaders = true,
                     HasColumnHeaders = false,
                     NbRows = moduleArtifacts.Count + 1,
                     NbColumns = 2,
                     Data = rowData
                 };

                 return resultTable;
             }

             return null;
        }
Esempio n. 7
0
        protected override TableDefinition Content(ReportData reportData, Dictionary<string, string> options)
        {
            TableDefinition resultTable = null;
            List<string> rowData = new List<string>();
            int nbRows = 0;
            rowData.Add("Ignored Applications");

            if (reportData.IgnoresApplications.Count() == 0)
            {
                rowData.Add("No Ignored Applications");
                nbRows++;
            }
            else
            {
                string[] DistinctArray = reportData.IgnoresApplications.Distinct().ToArray();
                for (int i = 0; i < DistinctArray.Count(); i++)
                {
                    rowData.Add(DistinctArray[i].ToString());
                }
                nbRows = DistinctArray.Count();
            }
            resultTable = new TableDefinition
            {
                HasRowHeaders = false,
                HasColumnHeaders = true,
                NbRows = nbRows + 1,
                NbColumns = 1,
                Data = rowData
            };

            return resultTable;
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="reportData"></param>
        /// <param name="options"></param>
        /// <returns></returns>
        protected override TableDefinition Content(ReportData reportData, Dictionary<string, string> options)
        {
            string strRuleId = (options != null && options.ContainsKey("RULID")) ? options["RULID"] : null;

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

            var rule = reportData.RuleExplorer.GetSpecificRule(reportData.Application.DomainId, strRuleId);
            var currentviolation = reportData.RuleExplorer.GetRulesViolations(reportData.CurrentSnapshot.Href, strRuleId).FirstOrDefault();
            Int32? failedChecks = null;

            if (currentviolation != null && currentviolation.ApplicationResults.Any()) {
                failedChecks = currentviolation.ApplicationResults[0].DetailResult.ViolationRatio.FailedChecks;
            }

            if (rule != null) {
                rowData.AddRange(new string[] {
                                rule.Name, null,
                    Labels.Rationale, string.IsNullOrWhiteSpace(rule.Rationale) ? Constants.No_Value : rule.Rationale,
                    Labels.Description, rule.Description,
                    Labels.Remediation, string.IsNullOrWhiteSpace(rule.Remediation) ? Constants.No_Value : rule.Remediation,
                    Labels.ViolationsCount, (failedChecks != null && failedChecks.HasValue) ? failedChecks.Value.ToString("N0") : Constants.No_Value,
                            });
            }

            TableDefinition back = new TableDefinition {
                HasRowHeaders = false,
                HasColumnHeaders = true,
                NbRows = 5,
                NbColumns = 2,
                Data = rowData
            };

            return back;
        }
Esempio n. 9
0
        protected override TableDefinition Content(ReportData reportData, Dictionary<string, string> options)
        {
            TableDefinition resultTable = null;
            if (null != reportData &&
                    null != reportData.CurrentSnapshot)
            {
                double? automatedFPoints = MeasureUtility.GetAutomatedIFPUGFunction(reportData.CurrentSnapshot);
                double? decisionPoints = MeasureUtility.GetDecisionPointsNumber(reportData.CurrentSnapshot);
                double? backFiredFPoints = MeasureUtility.GetBackfiredIFPUGFunction(reportData.CurrentSnapshot);

                const string metricFormat = "N0";
                var rowData = new List<string>()
                    {  Labels.Name, Labels.Total
                    , Labels.AutomatedFP, (automatedFPoints.HasValue ?  automatedFPoints.Value.ToString(metricFormat) : CastReporting.Domain.Constants.No_Data)
                    , Labels.DecisionP,( decisionPoints.HasValue ?  (decisionPoints.Value).ToString(metricFormat) : CastReporting.Domain.Constants.No_Data)
                    , Labels.BackfiredFP, (backFiredFPoints.HasValue ?  (backFiredFPoints.Value).ToString(metricFormat) :CastReporting.Domain.Constants.No_Data)
                    };
                resultTable = new TableDefinition
                {
                    HasRowHeaders = false,
                    HasColumnHeaders = true,
                    NbRows = 6,
                    NbColumns = 2,
                    Data = rowData
                };
            }
            return resultTable;
        }
Esempio n. 10
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="reportData"></param>
        /// <param name="options"></param>
        /// <returns></returns>
        protected override TableDefinition Content(ReportData reportData, Dictionary<string, string> options)
        {
            TableDefinition resultTable = null;
            int nbTot = 0;
            bool displayShortHeader = (options != null && options.ContainsKey("HEADER") && "SHORT" == options["HEADER"]);
            List<string> rowData = new List<string>();
            rowData.AddRange(new string[] { Labels.ModuleName, Labels.LoC });

            if (null != reportData &&
                null != reportData.CurrentSnapshot &&
                null != reportData.CurrentSnapshot.Modules)
            {
               var result = reportData.CurrentSnapshot.SizingMeasuresResults.FirstOrDefault(v => v.Reference.Key == (int)Constants.SizingInformations.CodeLineNumber);

               if (result != null)
               {
                   foreach (var res in result.ModulesResult)
                   {
                       rowData.AddRange(new string[] { res.Module.Name, res.DetailResult.Value.ToString(_MetricFormat) });
                   }
                   nbTot = result.ModulesResult.Length;
               }
            }
               resultTable = new TableDefinition
            {
                HasRowHeaders = false,
                HasColumnHeaders = true,
                NbRows = nbTot + 1,
                NbColumns = 2,
                Data = rowData
            };
            return resultTable;
        }
Esempio n. 11
0
 public static void ApplyContent(ReportData client, OpenXmlPartContainer container, BlockItem block, TableDefinition content, Dictionary<string, string> options)
 {
     var contentblock = GetTableContentBlock(client, block);
     if (null != contentblock)
     {
         UpdateBlock(client, container, contentblock, content, options);
     }
 }
Esempio n. 12
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="reportData"></param>
        /// <param name="options"></param>
        /// <returns></returns>
        protected override TableDefinition Content(ReportData reportData, Dictionary<string, string> options)
        {
            string srBusinessCriterias = (options != null && options.ContainsKey("PAR")) ? options["PAR"] : null;
            int count = 0;
            if (options == null || !options.ContainsKey("COUNT") || !Int32.TryParse(options["COUNT"], out count))
            {
                count = reportData.Parameter.NbResultDefault;
            }

            if (!string.IsNullOrWhiteSpace(srBusinessCriterias))
            {
                // Parse business criterias Ids
                List<int> businessCriteriasIds = new List<int>();
                string[] parentMetrics = srBusinessCriterias.Split('|');
                foreach (var metric in parentMetrics.Distinct())
                {
                    int metricId = 0;
                    if (int.TryParse(metric, out metricId))
                    {
                        businessCriteriasIds.Add(metricId);
                    }
                }

                //Build result
                List<string> rowData = new List<string>();
                rowData.AddRange(new string[] { Labels.Criticality, Labels.Weight, Labels.Grade, Labels.TechnicalCriterion, Labels.RuleName, Labels.ViolCount, Labels.TotalOk });

                var results = RulesViolationUtility.GetNbViolationByRule(reportData.CurrentSnapshot, reportData.RuleExplorer, businessCriteriasIds, count);
                int nbRows = 0;
                foreach (var item in results)
                {

                    rowData.Add(item.Rule.Critical ? "µ" : string.Empty);
                    rowData.Add(item.Rule.CompoundedWeight.ToString());
                    rowData.Add(item.Grade.Value.ToString("N2"));
                    rowData.Add(item.TechnicalCriteraiName);
                    rowData.Add(item.Rule.Name);

                    rowData.Add(item.TotalFailed.HasValue ? item.TotalFailed.Value.ToString("N0") : Constants.No_Data);
                    rowData.Add(item.TotalChecks.HasValue ? item.TotalChecks.Value.ToString("N0") : Constants.No_Value);

                    nbRows++;
                }

                TableDefinition resultTable = new TableDefinition
                {
                    HasRowHeaders = false,
                    HasColumnHeaders = true,
                    NbRows = nbRows + 1,
                    NbColumns = 7,
                    Data = rowData
                };

                return resultTable;
            }

            return null;
        }
        protected override TableDefinition Content(ReportData reportData, Dictionary<string, string> options)
        {
            TableDefinition resultTable = null;
            int nbLimitTop = reportData.Parameter.NbResultDefault;

            // Default Options
            int businessCriteria = 0;
            if (options != null &&
                options.ContainsKey("SRC"))
            {
                var source = options["SRC"];
                switch (source)
                {
                    case "PERF": { businessCriteria = (int)CastReporting.Domain.Constants.BusinessCriteria.Performance; } break;
                    case "ROB": { businessCriteria = (int)CastReporting.Domain.Constants.BusinessCriteria.Robustness; } break;
                    case "SEC": { businessCriteria = (int)CastReporting.Domain.Constants.BusinessCriteria.Security; } break;
                }
            }
            if (options == null ||
                !options.ContainsKey("COUNT") ||
                !int.TryParse(options["COUNT"], out nbLimitTop))
            {
                nbLimitTop = 10;
            }

            var bc = reportData.CurrentSnapshot.BusinessCriteriaResults.FirstOrDefault(_ => _.Reference.Key == businessCriteria);

            bc.Transactions = reportData.SnapshotExplorer.GetTransactions(reportData.CurrentSnapshot.Href, bc.Reference.Key.ToString(), nbLimitTop);

            List<string> rowData = new List<string>(new string[] { Labels.TransactionEP, Labels.TRI });
            int nbRows = 0;

            const string metricFormat = "N0";
            if (bc.Transactions !=null && bc.Transactions.Any())
            {
                foreach (var transaction in bc.Transactions)
                {
                    rowData.Add(transaction.Name);
                    rowData.Add(transaction.TransactionRiskIndex.ToString(metricFormat));
                    nbRows += 1;
                }
            }
            else
            {
                rowData.AddRange(new string[] { Labels.NoItem, string.Empty });
            }

            resultTable = new TableDefinition
            {
                HasRowHeaders = false,
                HasColumnHeaders = true,
                NbRows = nbRows + 1,
                NbColumns = 2,
                Data = rowData
            };

            return resultTable;
        }
Esempio n. 14
0
 protected override string Content(ReportData reportData, Dictionary<string, string> options)
 {
     if (null != reportData &&
       null != reportData.CurrentSnapshot)
     {
         double? result = MeasureUtility.GetAfpMetricTF(reportData.CurrentSnapshot);
         return (result.HasValue ? result.Value.ToString("N0") : null);
     }
     return CastReporting.Domain.Constants.No_Value;
 }
        protected override string Content(ReportData reportData, Dictionary<string, string> options)
        {
            if (null != reportData && null != reportData.Applications && null != reportData.snapshots)
            {
                Application[] AllApps = reportData.Applications;

                return AllApps.Count().ToString();
            }
            return CastReporting.Domain.Constants.No_Value;
        }
Esempio n. 16
0
        protected override string Content(ReportData reportData, Dictionary<string, string> options)
        {
            var ver = GetVersion(Assembly.GetEntryAssembly());
            if (string.IsNullOrEmpty(ver))
                ver = GetVersion(Assembly.GetExecutingAssembly());
            if (string.IsNullOrEmpty(ver))
                ver = CastReporting.Domain.Constants.No_Value;

            return ver;
        }
 protected override string Content(ReportData reportData, Dictionary<string, string> options)
 {
     if (null != reportData &&
        null != reportData.CurrentSnapshot)
     {
         double? result = MeasureUtility.GetTechnicalDebtMetric(reportData.CurrentSnapshot);
         return (result.HasValue ? String.Format("{0:N0} {1}",result.Value, reportData.CurrencySymbol) : CastReporting.Domain.Constants.No_Value);
     }
     return CastReporting.Domain.Constants.No_Value;
 }
Esempio n. 18
0
 protected override string Content(ReportData reportData, Dictionary<string, string> options)
 {
     if (null != reportData &&
           null != reportData.Application)
     {
         string result = reportData.Application.Version;
         return (result !=null ? result : CastReporting.Domain.Constants.No_Value);
     }
     return CastReporting.Domain.Constants.No_Value;
 }
        protected override TableDefinition Content(ReportData reportData, Dictionary<string, string> options)
        {
            List<string> rowData = new List<string>();
            rowData.AddRange(new string[] {
                Labels.RuleName,
                Labels.ViolationsCount
            });

            int nbRows = 0;
            int nbLimitTop = 0;
            Int32? metricId = (options != null && options.ContainsKey("BC-ID")) ? Convert.ToInt32(options["BC-ID"]) : (Int32?)null;
            if (metricId == null)
            metricId = (options != null && options.ContainsKey("PAR")) ? Convert.ToInt32(options["PAR"]) : (Int32?)null;

            if (null == options || !options.ContainsKey("COUNT") || !Int32.TryParse(options["COUNT"], out nbLimitTop)) {
                nbLimitTop = reportData.Parameter.NbResultDefault;
            }

            if (reportData != null && reportData.CurrentSnapshot != null) {

                if (!metricId.HasValue)
                    metricId = 0;

                var rulesViolation = RulesViolationUtility.GetRuleViolations(reportData.CurrentSnapshot,
                                                                                     Constants.RulesViolation.CriticalRulesViolation,
                                                                                     (Constants.BusinessCriteria)metricId,
                                                                                     true,
                                                                                     nbLimitTop);

                if (null != rulesViolation) {
                    foreach (var elt in rulesViolation) {
                        rowData.AddRange(new string[] {
                            elt.Rule.Name,
                            elt.TotalFailed.Value.ToString("N0")
                        });
                    }
                } else {
                    rowData.AddRange(new string[] {
                        Labels.NoItem,
                        string.Empty
                    });
                }
                nbRows = rulesViolation.Count;
            }

            TableDefinition resultTable = new TableDefinition {
                HasRowHeaders = false,
                HasColumnHeaders = true,
                NbRows = nbRows + 1,
                NbColumns = 2,
                Data = rowData
            };

            return resultTable;
        }
        protected override string Content(ReportData reportData, Dictionary<string, string> options)
        {
            string res = string.Empty;
            if (null != reportData && null != reportData.PreviousSnapshot) {
                DateTime? d = SnapshotUtility.GetSnapshotDate(reportData.PreviousSnapshot);
                if (d.HasValue)
                    res = d.Value.ToString(Labels.FORMAT_SHORT_DATE);
            }

            return string.IsNullOrEmpty(res) ? CastReporting.Domain.Constants.No_Value : res;
        }
        protected override string Content(ReportData reportData, Dictionary<string, string> options)
        {
            if (null != reportData &&
                null != reportData.CurrentSnapshot)
            {
                Double? tqi = BusinessCriteriaUtility.GetSnapshotBusinessCriteriaGrade(reportData.CurrentSnapshot, Constants.BusinessCriteria.TechnicalQualityIndex, true);

                if (tqi.HasValue) return GetApplicationQualification(reportData, tqi.Value);
            }
            return CastReporting.Domain.Constants.No_Value;
        }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="reportData"></param>
 /// <param name="value"></param>
 /// <param name="qualifyType"></param>
 /// <returns></returns>
 private static String GetApplicationQualification(ReportData reportData, double value)
 {
     if (value < reportData.Parameter.ApplicationSizeLimitSupSmall)
         return Labels.SizeS;
     else if (value < reportData.Parameter.ApplicationSizeLimitSupMedium)
         return Labels.SizeM;
     else if (value < reportData.Parameter.ApplicationSizeLimitSupLarge)
         return Labels.SizeL;
     else
         return Labels.SizeXL;
 }
Esempio n. 23
0
        protected override string Content(ReportData reportData, Dictionary<string, string> options)
        {
            Int32? metricId = (options != null && options.ContainsKey("ID")) ? Convert.ToInt32(options["ID"]) : (Int32?)null;

            if (null != reportData &&
                null != reportData.CurrentSnapshot && metricId.HasValue)
            {
                double? result = BusinessCriteriaUtility.GetMetricValue(reportData.CurrentSnapshot, metricId.Value);
                return result.HasValue ? result.Value.ToString("N2") : Constants.No_Value;
            }
            return CastReporting.Domain.Constants.No_Value;
        }
        protected override string Content(ReportData reportData, Dictionary<string, string> options)
        {
            if (null != reportData &&
                 null != reportData.CurrentSnapshot) {

                double? codeLineNumber = MeasureUtility.GetCodeLineNumber(reportData.CurrentSnapshot);

                if (codeLineNumber.HasValue)
                    return GetApplicationQualification(reportData, codeLineNumber.Value);
            }
            return CastReporting.Domain.Constants.No_Value;
        }
Esempio n. 25
0
        protected override string Content(ReportData reportData, Dictionary<string, string> options)
        {
            if (reportData != null)
            {
                Application[] Applications = reportData.Applications;

                return "Something";
            }
            else
            {
                return CastReporting.Domain.Constants.No_Value;
            }
        }
        protected override TableDefinition Content(ReportData reportData, Dictionary<string, string> options)
        {
            Int32 rowCount = 0;
            List<string> rowData = new List<string>();
            rowData.AddRange(new string[] { Labels.TechnicalCriterionName,  Labels.ViolationsCount, Labels.TotalChecks, Labels.Grade });

            #region Options

            int nbLimitTop = 0;
            if (null == options || !options.ContainsKey("COUNT") || !Int32.TryParse(options["COUNT"], out nbLimitTop))
            {
                nbLimitTop = reportData.Parameter.NbResultDefault;
            }

            int bcCriteriaId = 0;
            if (null == options || !options.ContainsKey("PAR") || !Int32.TryParse(options["PAR"], out bcCriteriaId))
            {
                throw new ArgumentException("Impossible to build RC_IMPROVEMENT_OPPORTUNITY : Need business criterion id.");
            }
            #endregion Options

            var technicalCriticalViolation = RulesViolationUtility.GetTechnicalCriteriaViolations(reportData.CurrentSnapshot,
                                                                                                     (Constants.BusinessCriteria)bcCriteriaId,
                                                                                                     nbLimitTop);
            if(technicalCriticalViolation!=null)
            {
                foreach (var item in technicalCriticalViolation)
                {
                    rowData.AddRange(new string[]
                                    {
                                          item.Name
                                        , item.TotalFailed.HasValue ? item.TotalFailed.Value.ToString("N0") : Constants.No_Value
                                        , item.TotalChecks.HasValue ? item.TotalChecks.Value.ToString("N0") : Constants.No_Value
                                        , item.Grade.HasValue ? item.Grade.Value.ToString("N2") : Constants.No_Value
                                   }
                                   );
                }

                rowCount = technicalCriticalViolation.Count;
            }

            TableDefinition resultTable = new TableDefinition
            {
                HasRowHeaders = false,
                HasColumnHeaders = true,
                NbRows = rowCount + 1,
                NbColumns = 4,
                Data = rowData
            };
            return resultTable;
        }
Esempio n. 27
0
        protected override TableDefinition Content(ReportData reportData, Dictionary<string, string> options)
        {
            #region Required Options
                string moduleIdstr = (options != null && options.ContainsKey("M") ? options["M"] : string.Empty);
                int moduleId;
                if (string.IsNullOrWhiteSpace(moduleIdstr) || !Int32.TryParse(moduleIdstr, out moduleId))
                {
                    moduleId = -1;
                }

                #endregion Required Options

                List<String> rowData = new List<String>();
                rowData.AddRange(new string[] { Labels.TechnicalDebt + " (" + reportData.CurrencySymbol + ")", Labels.TQI, Labels.Size });

                if (reportData != null &&  reportData.CurrentSnapshot != null)
                {

                    double? TQIValue = 0;
                    double? TechDebtValue = 0;
                    double? COLValue = 0;

                    if (moduleId > 0)
                    {

                        TQIValue = BusinessCriteriaUtility.GetBusinessCriteriaModuleGrade(reportData.CurrentSnapshot, moduleId, Constants.BusinessCriteria.TechnicalQualityIndex, true);
                        TechDebtValue = MeasureUtility.GetModuleMeasureGrade(reportData.CurrentSnapshot, moduleId, Constants.SizingInformations.TechnicalDebt);
                        COLValue = MeasureUtility.GetModuleMeasureGrade(reportData.CurrentSnapshot, moduleId, Constants.SizingInformations.CodeLineNumber);
                    }
                    else
                    {
                        TQIValue = BusinessCriteriaUtility.GetSnapshotBusinessCriteriaGrade(reportData.CurrentSnapshot, Constants.BusinessCriteria.TechnicalQualityIndex, true);
                        TechDebtValue = MeasureUtility.GetSizingMeasure(reportData.CurrentSnapshot, Constants.SizingInformations.TechnicalDebt);
                        COLValue = MeasureUtility.GetSizingMeasure(reportData.CurrentSnapshot, Constants.SizingInformations.CodeLineNumber);
                    }

                    rowData.Add(TQIValue.GetValueOrDefault().ToString());
                    rowData.Add(TechDebtValue.GetValueOrDefault().ToString());
                    rowData.Add(COLValue.GetValueOrDefault().ToString());
                }

                TableDefinition resultTable = new TableDefinition
                {
                    HasRowHeaders = false,
                    HasColumnHeaders = true,
                    NbRows = 2,
                    NbColumns = 3,
                    Data = rowData
                };
                return resultTable;
        }
Esempio n. 28
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;
        }
Esempio n. 29
0
 protected override string Content(ReportData reportData, Dictionary<string, string> options)
 {
     if (null != reportData &&
           null != reportData.Tag)
     {
         return reportData.Tag;
     }
     else if (null != reportData && null == reportData.Tag)
     {
         return "All";
     }
     else
     return CastReporting.Domain.Constants.No_Value;
 }
Esempio n. 30
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="reportData"></param>
        /// <param name="options"></param>
        /// <returns></returns>
        protected override TableDefinition Content(ReportData reportData, Dictionary<string, string> options)
        {
            bool isDisplayShortHeader = (options != null && options.ContainsKey("HEADER") && "SHORT" == options["HEADER"]);

            List<string> rowData = new List<string>();
            rowData.AddRange(isDisplayShortHeader
                ? new[] { " ", Labels.TQICur, Labels.TQIPrev, Labels.Var }
                : new[] { " ", Labels.TQICurrent, Labels.TQIPrevious, Labels.Variation });

            var resultCurrentSnapshot = BusinessCriteriaUtility.GetBusinessCriteriaGradesModules(reportData.CurrentSnapshot, false);
            var resultPreviousSnapshot = BusinessCriteriaUtility.GetBusinessCriteriaGradesModules(reportData.PreviousSnapshot, false);

            int count = 0;
            if (resultCurrentSnapshot != null) {

                if (resultPreviousSnapshot == null) resultPreviousSnapshot = new List<BusinessCriteriaDTO>();

                var results =  from current in resultCurrentSnapshot
                               join prev in resultPreviousSnapshot on current.Name equals prev.Name
                               into g
                               from subset in g.DefaultIfEmpty()
                               select new
                               {
                                   Name = current.Name,
                                   TqiCurrent = current.TQI.HasValue ? current.TQI : (double?)null,
                                   TqiPrevious = subset != null ? subset.TQI : (double?)null,
                                   PercentVariation =  subset != null ? MathUtility.GetVariationPercent(current.TQI, subset.TQI):null
                               };

                foreach (var result in results.OrderBy(_ => _.Name)) {
                    rowData.AddRange(new[] {
                            result.Name,
                            result.TqiCurrent.HasValue  ? result.TqiCurrent.Value.ToString(_MetricFormat) : CastReporting.Domain.Constants.No_Value,
                            result.TqiPrevious.HasValue ? result.TqiPrevious.Value.ToString(_MetricFormat) : CastReporting.Domain.Constants.No_Value,
                            result.PercentVariation.HasValue ? TableBlock.FormatPercent(result.PercentVariation):CastReporting.Domain.Constants.No_Value,
                        });
                    count++;
                }
            }

            var resultTable = new TableDefinition {
                HasRowHeaders = false,
                HasColumnHeaders = true,
                NbRows = count + 1,
                NbColumns = 4,
                Data = rowData
            };

            return resultTable;
        }