示例#1
0
        private bool findFirstorLastScan(long projectId, ScanObject scan, Dictionary <string, Teams> teams, Dictionary <long, ReportStaging> keyValuePairs, bool operation)
        {
            getScans scans = new getScans();

            string fullName = teams[scan.OwningTeamId].fullName;

            if (keyValuePairs.ContainsKey(scan.Project.Id))
            {
                bool          start         = false;
                ReportStaging reportStaging = keyValuePairs[scan.Project.Id];
                long          diff          = DateTimeOffset.Compare(reportStaging.dateTime, (DateTimeOffset)scan.DateAndTime.StartedOn);
                if (operation)
                {
                    start = (diff > 0) ? true : false;
                }
                else
                {
                    start = (diff < 0) ? true : false;
                }
                if (start)
                {
                    ScanStatistics scanStatistics = scans.getScansStatistics(scan.Id, token);
                    ReportStaging  staging        = new ReportStaging()
                    {
                        ProjectId   = scan.Project.Id,
                        ProjectName = scan.Project.Name,
                        TeamName    = fullName,
                        dateTime    = (DateTimeOffset)scan.DateAndTime.StartedOn,
                        High        = scanStatistics.HighSeverity,
                        Medium      = scanStatistics.MediumSeverity,
                        Low         = scanStatistics.LowSeverity,
                        ScanId      = scan.Id
                    };
                    keyValuePairs[scan.Project.Id] = staging;
                }
            }
            else
            {
                ScanStatistics scanStatistics = scans.getScansStatistics(scan.Id, token);
                keyValuePairs.Add(scan.Project.Id, new ReportStaging()
                {
                    ProjectId   = scan.Project.Id,
                    ProjectName = scan.Project.Name,
                    TeamName    = fullName,
                    dateTime    = (DateTimeOffset)scan.DateAndTime.StartedOn,
                    High        = scanStatistics.HighSeverity,
                    Medium      = scanStatistics.MediumSeverity,
                    Low         = scanStatistics.LowSeverity,
                    ScanId      = scan.Id
                });
            }
            return(true);
        }
示例#2
0
        /*
         *     public List<ScanObject> projectId_in_scan(List<ScanObject> scans, string project_name)
         *     {
         *         if (String.IsNullOrEmpty(project_name))
         *         {
         *             return scans;
         *         }
         *         List<ScanObject> pclass = new List<ScanObject>();
         *         foreach (ScanObject scan in scans)
         *         {
         *             if (scan.Project.Name.Contains(project_name))
         *             {
         *                 pclass.Add(scan);
         *             }
         *         }
         *         return pclass;
         *     }
         *
         */
        public bool get_result_statistics(resultClass token, long scanId)
        {
            getScans scans = new getScans();

            if (!CxSettings.ContainsKey(scanId))
            {
                ScanStatistics scanStatistics = scans.getScansStatistics(scanId, token);
                CxResultStatistics.Add(scanId, scanStatistics);
            }
            return(true);
        }