示例#1
0
        /// <summary>
        /// Returns a ComparatorResult object for the two provided systems or null if the comparison cannot be completed.
        /// </summary>
        /// <param name="systemEstimate"></param>
        /// <param name="systemReport"></param>
        /// <returns></returns>
        public ComparatorResult CompareBySystem(SystemEstimate systemEstimate, SystemReport systemReport)
        {
            //Return object
            ComparatorResult comparatorResult = new ComparatorResult();

            //If the system object names don't match, abort.
            if (systemEstimate.Name != systemReport.Name)
            {
                throw new SystemNameMismatchException();
            }
            try
            {
                comparatorResult.SystemName           = systemEstimate.Name;
                comparatorResult.IsWorkCompleted      = IsSystemComplete(systemEstimate, systemReport);
                comparatorResult.EstimatePhaseCodes   = GetEstimatedPhaseCodes(systemEstimate);
                comparatorResult.FinishedPhaseCodes   = GetFinishedPhaseCodes(systemReport);
                comparatorResult.UnfinishedPhaseCodes = GetUnfinishedPhaseCodes(systemEstimate, systemReport);
                comparatorResult.PercentComplete      = GetPercentComplete(systemEstimate, systemReport);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                return(null);
            }
            return(comparatorResult);
        }
示例#2
0
        public void GenerateReport()
        {
            SystemReport reportedSystem;

            foreach (SystemEstimate s in _estimateModel.Systems)
            {
                if (_reportDictionary.TryGetValue(s.Name, out reportedSystem))
                {
                    if (ReportedSystems is null)
                    {
                        ReportedSystems = new List <ComparatorResult>();
                    }
                    ComparatorResult systemCompare = CompareBySystem(s, reportedSystem);
                    ReportedSystems.Add(systemCompare);
                }
                else
                {
                    if (UnreportedSystems is null)
                    {
                        UnreportedSystems = new List <SystemEstimate>();
                    }

                    UnreportedSystems.Add(s);
                }
            }
        }