Beispiel #1
0
        private string TestPCRForDebugg(Operation operation)
        {
            var operationId  = operation.OperationId;
            var averageScore = string.Empty;

            var isPCRPublished = operation.OpIsPCRCompleted();
            var pcrWorkFlow    = _pcrWorkflowStatusRepository.GetOne(x => x.OperationId == operationId);

            if (isPCRPublished == false && (pcrWorkFlow != null && pcrWorkFlow.IsRequired))
            {
                averageScore = Localization.GetText("CS.Monitoring.TBD");
            }

            if (isPCRPublished == false && (pcrWorkFlow == null || (pcrWorkFlow != null && !pcrWorkFlow.IsRequired)))
            {
                averageScore = Localization.GetText("CS.Monitoring.NotAvailable");
            }

            if (isPCRPublished == true && (pcrWorkFlow != null && !pcrWorkFlow.IsRequired))
            {
                averageScore = Localization.GetText("CS.Monitoring.NotAvailable");
            }

            if (isPCRPublished == true && (pcrWorkFlow != null && pcrWorkFlow.IsRequired))
            {
                var filteredPCRList = _pcrRepository.GetByCriteria(x => x.Operation.OperationId == operationId &&
                                                                   x.ValidateDate.HasValue).OrderByDescending(x => x.ValidateDate).ToList();

                var currentPCR = filteredPCRList.FirstOrDefault();

                if (currentPCR != null)
                {
                    if (currentPCR.PCRStage == null)
                    {
                        _pcrRepository.Reload(currentPCR, "PCRStage", "PCRValidationStage", "Operation");

                        if (filteredPCRList.Count >= 2)
                        {
                            PCRHelpers.CopyNavigationPropertyToNewPCR(filteredPCRList.ElementAt(1), currentPCR);
                        }
                    }

                    var calculateSummaryByStageDTO = _pcrCalculationService.CalculateSummaryByStage(currentPCR);

                    var category = string.Empty;

                    switch (calculateSummaryByStageDTO.Category)
                    {
                    case OperationScoreCategoryEnum.FullAchievement:
                        category = Localization.GetText("PCR.Summary.CoreCriterion.FullAchievement");
                        break;

                    case OperationScoreCategoryEnum.HighAchievement:
                        category = Localization.GetText("PCR.Summary.CoreCriterion.HighAchievement");
                        break;

                    case OperationScoreCategoryEnum.PartialAchievement:
                        category = Localization.GetText("PCR.Summary.CoreCriterion.PartialAchievement");
                        break;

                    case OperationScoreCategoryEnum.LowAchievement:
                        category = Localization.GetText("PCR.Summary.CoreCriterion.LowAchievement");
                        break;

                    case OperationScoreCategoryEnum.NoAchievement:
                        category = Localization.GetText("PCR.Summary.CoreCriterion.NoAchievement");
                        break;
                    }

                    averageScore = string.Format("{0:0.00}", calculateSummaryByStageDTO.AverageScore) +
                                   (!string.IsNullOrWhiteSpace(category) ? " - " : null) + category;

                    var isTestCaseManagerAviable = ConfigurationServiceFactory.Current.GetApplicationSettings().TestCaseManagerAviable;

                    if (isTestCaseManagerAviable)
                    {
                        averageScore = "0.72 - Partial Achievement";
                    }
                }
            }

            return(averageScore);
        }