Ejemplo n.º 1
0
 protected override string Content(ReportData reportData, Dictionary <string, string> options)
 {
     if (null != reportData &&
         null != reportData.CurrentSnapshot)
     {
         double?result = MeasureUtility.GetAfpMetricDF(reportData.CurrentSnapshot);
         return(result.HasValue ? result.Value.ToString("N0") : CastReporting.Domain.Constants.No_Value);
     }
     return(CastReporting.Domain.Constants.No_Value);
 }
Ejemplo n.º 2
0
        public override string Content(ReportData reportData, Dictionary <string, string> options)
        {
            if (reportData?.CurrentSnapshot == null)
            {
                return(Domain.Constants.No_Value);
            }
            double?result = MeasureUtility.GetAfpMetricDF(reportData.CurrentSnapshot);

            return(result?.ToString("N0") ?? Domain.Constants.No_Value);
        }
Ejemplo n.º 3
0
        protected override TableDefinition Content(ReportData reportData, Dictionary <string, string> options)
        {
            int count = 0;

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

            //var rowData = new List<String>();
            rowData.AddRange(new string[] {
                Labels.TQI,
                Labels.ViolationsCritical + "/" + Labels.kLoC,
                Labels.AutomatedFP,
                Labels.Application
            });


            #region Fetch SnapshotsPF

            if (reportData != null && reportData.Applications != null && reportData.snapshots != null)
            {
                Application[] AllApps = reportData.Applications;
                for (int j = 0; j < AllApps.Count(); j++)
                {
                    Application App = AllApps[j];

                    int nbSnapshotsEachApp = App.Snapshots.Count();
                    if (nbSnapshotsEachApp > 0)
                    {
                        foreach (Snapshot snapshot in App.Snapshots.OrderByDescending(_ => _.Annotation.Date.DateSnapShot))
                        {
                            Snapshot[] BuiltSnapshots = reportData.snapshots;

                            foreach (Snapshot BuiltSnapshot in BuiltSnapshots)
                            {
                                if (snapshot == BuiltSnapshot)
                                {
                                    string currSnapshotLabel = SnapshotUtility.GetSnapshotVersionNumber(BuiltSnapshot);
                                    BusinessCriteriaDTO currSnapshotBisCriDTO = BusinessCriteriaUtility.GetBusinessCriteriaGradesSnapshot(BuiltSnapshot, false);
                                    double?strCurrentTQI = currSnapshotBisCriDTO.TQI.HasValue ? MathUtility.GetRound(currSnapshotBisCriDTO.TQI.Value) : 0;

                                    double?numCritPerKLOC = MeasureUtility.GetSizingMeasure(BuiltSnapshot, Constants.SizingInformations.ViolationsToCriticalQualityRulesPerKLOCNumber);

                                    //double? result = MeasureUtility.GetAddedFunctionPoint(BuiltSnapshot) + MeasureUtility.GetModifiedFunctionPoint(BuiltSnapshot) + MeasureUtility.GetDeletedFunctionPoint(BuiltSnapshot);
                                    double?result = MeasureUtility.GetAfpMetricDF(BuiltSnapshot) + MeasureUtility.GetAfpMetricTF(BuiltSnapshot);

                                    rowData.AddRange(new string[] {
                                        strCurrentTQI.GetValueOrDefault().ToString(),
                                        numCritPerKLOC.GetValueOrDefault().ToString(),
                                        result.GetValueOrDefault().ToString(),
                                        App.Name.ToString()
                                    });

                                    count++;
                                }
                            }

                            break;
                        }
                    }
                }
                if (reportData.Applications.Count() == 1)
                {
                    rowData.AddRange(new string[] { "0", "0", "0", "" });

                    count++;
                }
            }
            #endregion Fetch SnapshotsPF



            TableDefinition resultTable = new TableDefinition
            {
                HasRowHeaders    = false,
                HasColumnHeaders = true,
                NbRows           = count + 1,
                NbColumns        = 4,
                Data             = rowData
            };
            return(resultTable);
        }
        protected override string Content(ReportData reportData, Dictionary <string, string> options)
        {
            if (null != reportData && null != reportData.Applications)
            {
                Application[] AllApps           = reportData.Applications;
                double?       resultAllTechDebt = 0;
                double?       AFPAll            = 0;

                for (int j = 0; j < AllApps.Count(); j++)
                {
                    Application App = AllApps[j];

                    int nbSnapshotsEachApp = App.Snapshots.Count();
                    if (nbSnapshotsEachApp > 0)
                    {
                        foreach (Snapshot snapshot in App.Snapshots.OrderByDescending(_ => _.Annotation.Date.DateSnapShot))
                        {
                            double?result = MeasureUtility.GetTechnicalDebtMetric(snapshot);
                            if (result == null)
                            {
                                result = 0.0;
                            }

                            resultAllTechDebt = resultAllTechDebt + result;
                            break;
                        }
                    }
                }

                for (int j = 0; j < AllApps.Count(); j++)
                {
                    Application App = AllApps[j];

                    int nbSnapshotsEachApp = App.Snapshots.Count();
                    if (nbSnapshotsEachApp > 0)
                    {
                        foreach (Snapshot snapshot in App.Snapshots.OrderByDescending(_ => _.Annotation.Date.DateSnapShot))
                        {
                            double?resultAFPDF = MeasureUtility.GetAfpMetricDF(snapshot);
                            double?resultAFPTF = MeasureUtility.GetAfpMetricTF(snapshot);

                            if (resultAFPDF == null)
                            {
                                resultAFPDF = 0.0;
                            }
                            if (resultAFPTF == null)
                            {
                                resultAFPTF = 0.0;
                            }

                            double?result = resultAFPDF + resultAFPTF;

                            AFPAll = AFPAll + result;
                            break;
                        }
                    }
                }
                //handle 0 functions case
                if (resultAllTechDebt > 0 && AFPAll > 0)
                {
                    double?FinalValue    = (resultAllTechDebt / AllApps.Count()) / (AFPAll / AllApps.Count());
                    int    intFinalValue = Convert.ToInt32(FinalValue);
                    return(string.Format("{0:n0}", intFinalValue) + "$");
                }
                else
                {
                    return("NA");
                }
                //return (result.HasValue ? String.Format("{0:N0} {1}", result.Value, reportData.CurrencySymbol) : CastReporting.Domain.Constants.No_Value);
            }
            return(CastReporting.Domain.Constants.No_Value);
        }