Example #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="left"></param>
        /// <param name="right"></param>
        /// <returns></returns>
        public static BusinessCriteriaDTO operator /(BusinessCriteriaDTO left, BusinessCriteriaDTO right)
        {
            BusinessCriteriaDTO GetBusinessCriteriaGradesVartiation = new BusinessCriteriaDTO();

            if (left != null && left != null)
            {
                GetBusinessCriteriaGradesVartiation.TQI             = (0 == right.TQI ? 0 : left.TQI / right.TQI);
                GetBusinessCriteriaGradesVartiation.Robustness      = (0 == right.Robustness ? 0 : left.Robustness / right.Robustness);
                GetBusinessCriteriaGradesVartiation.Performance     = (0 == right.Performance ? 0 : left.Performance / right.Performance);
                GetBusinessCriteriaGradesVartiation.Security        = (0 == right.Security ? 0 : left.Security / right.Security);
                GetBusinessCriteriaGradesVartiation.Transferability = (0 == right.Transferability ? 0 : left.Transferability / right.Transferability);
                GetBusinessCriteriaGradesVartiation.Changeability   = (0 == right.Changeability ? 0 : left.Changeability / right.Changeability);
            }
            return(GetBusinessCriteriaGradesVartiation);
        }
Example #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="left"></param>
        /// <param name="right"></param>
        /// <returns></returns>
        public static BusinessCriteriaDTO operator -(BusinessCriteriaDTO left, BusinessCriteriaDTO right)
        {
            BusinessCriteriaDTO GetBusinessCriteriaGradesVartiation = new BusinessCriteriaDTO();

            if (left != null && right != null)
            {
                GetBusinessCriteriaGradesVartiation.TQI             = (left.TQI.HasValue && right.TQI.HasValue) ? left.TQI - right.TQI : null;
                GetBusinessCriteriaGradesVartiation.Robustness      = (left.Robustness.HasValue && right.Robustness.HasValue) ? left.Robustness - right.Robustness : null;
                GetBusinessCriteriaGradesVartiation.Performance     = (left.Performance.HasValue && right.Performance.HasValue) ? left.Performance - right.Performance : null;
                GetBusinessCriteriaGradesVartiation.Security        = (left.Security.HasValue && right.Security.HasValue) ? left.Security - right.Security : null;
                GetBusinessCriteriaGradesVartiation.Transferability = (left.Transferability.HasValue && right.Transferability.HasValue) ? left.Transferability - right.Transferability : null;
                GetBusinessCriteriaGradesVartiation.Changeability   = (left.Changeability.HasValue && right.Changeability.HasValue) ? left.Changeability - right.Changeability : null;
            }
            return(GetBusinessCriteriaGradesVartiation);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="snapshot"></param>
        /// <returns></returns>
        public static BusinessCriteriaDTO GetBusinessCriteriaGradesSnapshot(Snapshot snapshot, bool Round)
        {
            if (null != snapshot)
            {
                BusinessCriteriaDTO result = new BusinessCriteriaDTO();

                result.TQI                  = GetSnapshotBusinessCriteriaGrade(snapshot, Constants.BusinessCriteria.TechnicalQualityIndex, Round);
                result.Robustness           = GetSnapshotBusinessCriteriaGrade(snapshot, Constants.BusinessCriteria.Robustness, Round);
                result.Performance          = GetSnapshotBusinessCriteriaGrade(snapshot, Constants.BusinessCriteria.Performance, Round);
                result.Security             = GetSnapshotBusinessCriteriaGrade(snapshot, Constants.BusinessCriteria.Security, Round);
                result.Transferability      = GetSnapshotBusinessCriteriaGrade(snapshot, Constants.BusinessCriteria.Transferability, Round);
                result.Changeability        = GetSnapshotBusinessCriteriaGrade(snapshot, Constants.BusinessCriteria.Changeability, Round);
                result.ProgrammingPractices = GetSnapshotBusinessCriteriaGrade(snapshot, Constants.BusinessCriteria.ProgrammingPractices, Round);
                result.ArchitecturalDesign  = GetSnapshotBusinessCriteriaGrade(snapshot, Constants.BusinessCriteria.ArchitecturalDesign, Round);
                result.Documentation        = GetSnapshotBusinessCriteriaGrade(snapshot, Constants.BusinessCriteria.Documentation, Round);
                result.SEIMaintainability   = GetSnapshotBusinessCriteriaGrade(snapshot, Constants.BusinessCriteria.SEIMaintainability, Round);

                return(result);
            }
            return(null);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="snapshot"></param>
        /// <returns></returns>
        public static BusinessCriteriaDTO GetBusinessCriteriaGradesSnapshot(Snapshot snapshot, bool Round)
        {
            if (null != snapshot)
            {
                BusinessCriteriaDTO result = new BusinessCriteriaDTO();

                result.TQI = GetSnapshotBusinessCriteriaGrade(snapshot, Constants.BusinessCriteria.TechnicalQualityIndex, Round);
                result.Robustness = GetSnapshotBusinessCriteriaGrade(snapshot, Constants.BusinessCriteria.Robustness, Round);
                result.Performance = GetSnapshotBusinessCriteriaGrade(snapshot, Constants.BusinessCriteria.Performance, Round);
                result.Security = GetSnapshotBusinessCriteriaGrade(snapshot, Constants.BusinessCriteria.Security, Round);
                result.Transferability = GetSnapshotBusinessCriteriaGrade(snapshot, Constants.BusinessCriteria.Transferability, Round);
                result.Changeability = GetSnapshotBusinessCriteriaGrade(snapshot, Constants.BusinessCriteria.Changeability, Round);
                result.ProgrammingPractices = GetSnapshotBusinessCriteriaGrade(snapshot, Constants.BusinessCriteria.ProgrammingPractices, Round);
                result.ArchitecturalDesign = GetSnapshotBusinessCriteriaGrade(snapshot, Constants.BusinessCriteria.ArchitecturalDesign, Round);
                result.Documentation = GetSnapshotBusinessCriteriaGrade(snapshot, Constants.BusinessCriteria.Documentation, Round);
                result.SEIMaintainability = GetSnapshotBusinessCriteriaGrade(snapshot, Constants.BusinessCriteria.SEIMaintainability, Round);

                return result;
            }
            return null;
        }
Example #5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="snapshot"></param>
        /// <param name="round"></param>
        /// <returns></returns>
        public static BusinessCriteriaDTO GetBusinessCriteriaGradesSnapshot(Snapshot snapshot, bool round)
        {
            if (null == snapshot)
            {
                return(null);
            }
            BusinessCriteriaDTO result = new BusinessCriteriaDTO
            {
                TQI                  = GetSnapshotBusinessCriteriaGrade(snapshot, Constants.BusinessCriteria.TechnicalQualityIndex, round),
                Robustness           = GetSnapshotBusinessCriteriaGrade(snapshot, Constants.BusinessCriteria.Robustness, round),
                Performance          = GetSnapshotBusinessCriteriaGrade(snapshot, Constants.BusinessCriteria.Performance, round),
                Security             = GetSnapshotBusinessCriteriaGrade(snapshot, Constants.BusinessCriteria.Security, round),
                Transferability      = GetSnapshotBusinessCriteriaGrade(snapshot, Constants.BusinessCriteria.Transferability, round),
                Changeability        = GetSnapshotBusinessCriteriaGrade(snapshot, Constants.BusinessCriteria.Changeability, round),
                ProgrammingPractices = GetSnapshotBusinessCriteriaGrade(snapshot, Constants.BusinessCriteria.ProgrammingPractices, round),
                ArchitecturalDesign  = GetSnapshotBusinessCriteriaGrade(snapshot, Constants.BusinessCriteria.ArchitecturalDesign, round),
                Documentation        = GetSnapshotBusinessCriteriaGrade(snapshot, Constants.BusinessCriteria.Documentation, round),
                SEIMaintainability   = GetSnapshotBusinessCriteriaGrade(snapshot, Constants.BusinessCriteria.SEIMaintainability, round)
            };

            return(result);
        }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="left"></param>
 /// <param name="right"></param>
 /// <returns></returns>
 public static BusinessCriteriaDTO operator /(BusinessCriteriaDTO left, BusinessCriteriaDTO right)
 {
     BusinessCriteriaDTO GetBusinessCriteriaGradesVartiation = new BusinessCriteriaDTO();
     if (left != null && left != null)
     {
         GetBusinessCriteriaGradesVartiation.TQI = (0 == right.TQI ? 0 : left.TQI / right.TQI);
         GetBusinessCriteriaGradesVartiation.Robustness = (0 == right.Robustness ? 0 : left.Robustness / right.Robustness);
         GetBusinessCriteriaGradesVartiation.Performance = (0 == right.Performance ? 0 : left.Performance / right.Performance);
         GetBusinessCriteriaGradesVartiation.Security = (0 == right.Security ? 0 : left.Security / right.Security);
         GetBusinessCriteriaGradesVartiation.Transferability = (0 == right.Transferability ? 0 : left.Transferability / right.Transferability);
         GetBusinessCriteriaGradesVartiation.Changeability = (0 == right.Changeability ? 0 : left.Changeability / right.Changeability);
     }
     return GetBusinessCriteriaGradesVartiation;
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="left"></param>
 /// <param name="right"></param>
 /// <returns></returns>
 public static BusinessCriteriaDTO operator -(BusinessCriteriaDTO left, BusinessCriteriaDTO right)
 {
     BusinessCriteriaDTO GetBusinessCriteriaGradesVartiation = new BusinessCriteriaDTO();
     if (left != null && right != null)
     {
         GetBusinessCriteriaGradesVartiation.TQI = (left.TQI.HasValue && right.TQI.HasValue) ? left.TQI - right.TQI : null;
         GetBusinessCriteriaGradesVartiation.Robustness = (left.Robustness.HasValue && right.Robustness.HasValue) ? left.Robustness - right.Robustness : null;
         GetBusinessCriteriaGradesVartiation.Performance = (left.Performance.HasValue && right.Performance.HasValue) ? left.Performance - right.Performance : null;
         GetBusinessCriteriaGradesVartiation.Security = (left.Security.HasValue && right.Security.HasValue) ? left.Security - right.Security : null;
         GetBusinessCriteriaGradesVartiation.Transferability = (left.Transferability.HasValue && right.Transferability.HasValue) ? left.Transferability - right.Transferability : null;
         GetBusinessCriteriaGradesVartiation.Changeability = (left.Changeability.HasValue && right.Changeability.HasValue) ? left.Changeability - right.Changeability : null;
     }
     return GetBusinessCriteriaGradesVartiation;
 }
        protected override TableDefinition Content(ReportData reportData, Dictionary<string, string> options)
        {
            double minVVal = Int16.MaxValue;
            double maxVVal = 0;
            double stepV = 0;
            int count = 0;

            bool hasVerticalZoom = options.ContainsKey("ZOOM");
            if (!options.ContainsKey("ZOOM") || !Double.TryParse(options["ZOOM"], out stepV)) {
                stepV = 1;
            }

            var rowData = new List<String>();
            rowData.AddRange(new string[] {
                " ",
                Labels.Trans,
                Labels.Chang,
                Labels.Robu,
                Labels.Efcy,
                Labels.Secu,
                Labels.LoC
            });

            #region Fetch Snapshots
            int nbSnapshots = (reportData != null && reportData.Application.Snapshots != null) ? reportData.Application.Snapshots.Count() : 0;
            if (nbSnapshots > 0) {
                foreach (Snapshot snapshot in reportData.Application.Snapshots.OrderBy(_ => _.Annotation.Date)) {
                    BusinessCriteriaDTO bcGrade = BusinessCriteriaUtility.GetBusinessCriteriaGradesSnapshot(snapshot, true);
                    double? locValue = MeasureUtility.GetCodeLineNumber(snapshot);
                    string snapshotDate = snapshot.Annotation.Date.DateSnapShot.HasValue ? snapshot.Annotation.Date.DateSnapShot.Value.ToOADate().ToString()
                                                                                                : string.Empty;
                    rowData.AddRange(new string[] {
                                                    snapshotDate,
                                                    bcGrade.Transferability.GetValueOrDefault().ToString(),
                                                    bcGrade.Changeability.GetValueOrDefault().ToString(),
                                                    bcGrade.Robustness.GetValueOrDefault().ToString(),
                                                    bcGrade.Performance.GetValueOrDefault().ToString(),
                                                    bcGrade.Security.GetValueOrDefault().ToString(),
                                                    locValue.GetValueOrDefault().ToString(),
                                                    });
                    List<double> values = new List<double>() { bcGrade.Changeability.GetValueOrDefault(),
                                                               bcGrade.Performance.GetValueOrDefault(),
                                                               bcGrade.Robustness.GetValueOrDefault(),
                                                               bcGrade.Security.GetValueOrDefault(),
                                                               bcGrade.TQI.GetValueOrDefault(),
                                                               bcGrade.Transferability.GetValueOrDefault()
                                                             };
                    minVVal = Math.Min(minVVal, values.Min());
                    maxVVal = Math.Max(maxVVal, values.Max());

                }
                count = nbSnapshots;
            }
            #endregion

            #region just 1 snapshot
            if (nbSnapshots == 1) {
                BusinessCriteriaDTO bcGrade = new BusinessCriteriaDTO();
                bcGrade = BusinessCriteriaUtility.GetBusinessCriteriaGradesSnapshot(reportData.CurrentSnapshot, true);
                double? locValue = MeasureUtility.GetCodeLineNumber(reportData.CurrentSnapshot);
                string snapshotDate = reportData.CurrentSnapshot.Annotation.Date.DateSnapShot.HasValue ? reportData.CurrentSnapshot.Annotation.Date.DateSnapShot.Value.ToOADate().ToString()
                                                                                                   : string.Empty;
                rowData.AddRange(new string[] {
                                                snapshotDate,
                                                bcGrade.Transferability.GetValueOrDefault().ToString(),
                                                bcGrade.Changeability.GetValueOrDefault().ToString(),
                                                bcGrade.Robustness.GetValueOrDefault().ToString(),
                                                bcGrade.Performance.GetValueOrDefault().ToString(),
                                                bcGrade.Security.GetValueOrDefault().ToString(),
                                                locValue.GetValueOrDefault().ToString(),

                                                });
                List<double> values = new List<double>() { bcGrade.Changeability.GetValueOrDefault(),
                                                            bcGrade.Performance.GetValueOrDefault(),
                                                            bcGrade.Robustness.GetValueOrDefault(),
                                                            bcGrade.Security.GetValueOrDefault(),
                                                            bcGrade.TQI.GetValueOrDefault(),
                                                            bcGrade.Transferability.GetValueOrDefault() };
                minVVal = Math.Min(minVVal, values.Min());
                maxVVal = Math.Max(maxVVal, values.Max());
                count = count + 1;
            }
            #endregion just 1 snapshot

            #region Graphic Options
            GraphOptions graphOptions = null;
            if (hasVerticalZoom) {
                graphOptions = new GraphOptions() { AxisConfiguration = new AxisDefinition() };
                graphOptions.AxisConfiguration.VerticalAxisMinimal = MathUtility.GetVerticalMinValue(minVVal, stepV);
                graphOptions.AxisConfiguration.VerticalAxisMaximal = MathUtility.GetVerticalMaxValue(maxVVal, stepV);
            }
            #endregion Graphic Options

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

            return resultTable;
        }