コード例 #1
0
ファイル: RPEvaluator.cs プロジェクト: CotorraProject/Cotorra
        public NOMSurveyReply ProcessFinalization(NOMSurveyReply answeredSurvey, List <NOMAnswer> answers,
                                                  List <NOMEvaluationQuestion> aTSQuestions, List <NOMEvaluationCategory> categories, List <NOMEvaluationDomain> domains)
        {
            NOMSurveyCategoryResult category1Result = new NOMSurveyCategoryResult();
            NOMSurveyCategoryResult category2Result = new NOMSurveyCategoryResult();
            NOMSurveyCategoryResult category3Result = new NOMSurveyCategoryResult();
            NOMSurveyCategoryResult category4Result = new NOMSurveyCategoryResult();

            NOMSurveyDomainResult domain1Result = new NOMSurveyDomainResult();
            NOMSurveyDomainResult domain2Result = new NOMSurveyDomainResult();
            NOMSurveyDomainResult domain3Result = new NOMSurveyDomainResult();
            NOMSurveyDomainResult domain4Result = new NOMSurveyDomainResult();
            NOMSurveyDomainResult domain5Result = new NOMSurveyDomainResult();
            NOMSurveyDomainResult domain6Result = new NOMSurveyDomainResult();
            NOMSurveyDomainResult domain7Result = new NOMSurveyDomainResult();
            NOMSurveyDomainResult domain8Result = new NOMSurveyDomainResult();


            answeredSurvey.NOMSurveyCategoryResult = new List <NOMSurveyCategoryResult>();
            answeredSurvey.NOMSurveyDomainResult   = new List <NOMSurveyDomainResult>();


            answeredSurvey.NOMSurveyCategoryResult.Add(category1Result);
            answeredSurvey.NOMSurveyCategoryResult.Add(category2Result);
            answeredSurvey.NOMSurveyCategoryResult.Add(category3Result);
            answeredSurvey.NOMSurveyCategoryResult.Add(category4Result);

            answeredSurvey.NOMSurveyDomainResult.Add(domain1Result);
            answeredSurvey.NOMSurveyDomainResult.Add(domain2Result);
            answeredSurvey.NOMSurveyDomainResult.Add(domain3Result);
            answeredSurvey.NOMSurveyDomainResult.Add(domain4Result);
            answeredSurvey.NOMSurveyDomainResult.Add(domain5Result);
            answeredSurvey.NOMSurveyDomainResult.Add(domain6Result);
            answeredSurvey.NOMSurveyDomainResult.Add(domain7Result);
            answeredSurvey.NOMSurveyDomainResult.Add(domain8Result);

            var firstCategoryID  = categories.FirstOrDefault(x => x.Number == 1).ID;
            var secondCategoryID = categories.FirstOrDefault(x => x.Number == 2).ID;
            var thirdCategoryID  = categories.FirstOrDefault(x => x.Number == 3).ID;
            var fourthCategoryID = categories.FirstOrDefault(x => x.Number == 4).ID;

            var firstDomainID   = domains.FirstOrDefault(x => x.Number == 1).ID;
            var secondDomainID  = domains.FirstOrDefault(x => x.Number == 2).ID;
            var thirdDomainID   = domains.FirstOrDefault(x => x.Number == 3).ID;
            var fourthDomainID  = domains.FirstOrDefault(x => x.Number == 4).ID;
            var fifthDomainID   = domains.FirstOrDefault(x => x.Number == 5).ID;
            var sixthDomainID   = domains.FirstOrDefault(x => x.Number == 6).ID;
            var seventhDomainID = domains.FirstOrDefault(x => x.Number == 7).ID;
            var eigthDomainID   = domains.FirstOrDefault(x => x.Number == 8).ID;

            AssignPoints(answers, aTSQuestions, firstCategoryID, secondCategoryID, thirdCategoryID,
                         fourthCategoryID, firstDomainID, secondDomainID, thirdDomainID, fourthDomainID,
                         fifthDomainID, sixthDomainID, seventhDomainID, eigthDomainID, category1Result, category2Result, category3Result, category4Result,
                         domain1Result, domain2Result, domain3Result, domain4Result, domain5Result, domain6Result,
                         domain7Result, domain8Result, answeredSurvey);

            return(answeredSurvey);
        }
コード例 #2
0
ファイル: RPEvaluator.cs プロジェクト: CotorraProject/Cotorra
        private void AssignPoints(List <NOMAnswer> answers, List <NOMEvaluationQuestion> aTSQuestions, Guid firstCategoryID, Guid secondCategoryID, Guid thirdCategoryID, Guid fourthCategoryID, Guid firstDomainID, Guid secondDomainID,
                                  Guid thirdDomainID, Guid fourthDomainID, Guid fifthDomainID, Guid sixthDomainID,
                                  Guid seventhDomainID, Guid eigthDomainID, NOMSurveyCategoryResult category1Result, NOMSurveyCategoryResult category2Result, NOMSurveyCategoryResult category3Result, NOMSurveyCategoryResult category4Result, NOMSurveyDomainResult domain1Result,
                                  NOMSurveyDomainResult domain2Result, NOMSurveyDomainResult domain3Result, NOMSurveyDomainResult domain4Result, NOMSurveyDomainResult domain5Result, NOMSurveyDomainResult domain6Result,
                                  NOMSurveyDomainResult domain7Result, NOMSurveyDomainResult domain8Result, NOMSurveyReply answeredSurvey)
        {
            var totalPoints     = 0;
            var category1Points = 0;
            var category2Points = 0;
            var category3Points = 0;
            var category4Points = 0;
            var domain1Points   = 0;
            var domain2Points   = 0;
            var domain3Points   = 0;
            var domain4Points   = 0;
            var domain5Points   = 0;
            var domain6Points   = 0;
            var domain7Points   = 0;
            var domain8Points   = 0;

            //answers.ForEach(answer =>
            Parallel.ForEach(answers, answer =>
            {
                var question       = aTSQuestions.FirstOrDefault(x => x.ID == answer.NOMEvaluationQuestionID);
                var questionPoints = GetPoints(question.Number, answer.Value);
                Interlocked.Add(ref totalPoints, questionPoints);
                if (question.NOMEvaluationCategoryID == firstCategoryID)
                {
                    Interlocked.Add(ref category1Points, questionPoints);
                }
                if (question.NOMEvaluationCategoryID == secondCategoryID)
                {
                    Interlocked.Add(ref category2Points, questionPoints);
                }
                if (question.NOMEvaluationCategoryID == thirdCategoryID)
                {
                    Interlocked.Add(ref category3Points, questionPoints);
                }
                if (question.NOMEvaluationCategoryID == fourthCategoryID)
                {
                    Interlocked.Add(ref category4Points, questionPoints);
                }
                if (question.NOMEvaluationDomainID == firstDomainID)
                {
                    Interlocked.Add(ref domain1Points, questionPoints);
                }
                if (question.NOMEvaluationDomainID == secondDomainID)
                {
                    Interlocked.Add(ref domain2Points, questionPoints);
                }
                if (question.NOMEvaluationDomainID == thirdDomainID)
                {
                    Interlocked.Add(ref domain3Points, questionPoints);
                }
                if (question.NOMEvaluationDomainID == fourthDomainID)
                {
                    Interlocked.Add(ref domain4Points, questionPoints);
                }
                if (question.NOMEvaluationDomainID == fifthDomainID)
                {
                    Interlocked.Add(ref domain5Points, questionPoints);
                }
                if (question.NOMEvaluationDomainID == sixthDomainID)
                {
                    Interlocked.Add(ref domain6Points, questionPoints);
                }
                if (question.NOMEvaluationDomainID == seventhDomainID)
                {
                    Interlocked.Add(ref domain7Points, questionPoints);
                }
                if (question.NOMEvaluationDomainID == eigthDomainID)
                {
                    Interlocked.Add(ref domain8Points, questionPoints);
                }
            });
            SetValuesForResults(firstCategoryID, secondCategoryID, thirdCategoryID, fourthCategoryID, firstDomainID, secondDomainID, thirdDomainID, fourthDomainID, fifthDomainID, sixthDomainID, seventhDomainID, eigthDomainID, category1Result, category2Result, category3Result, category4Result, domain1Result, domain2Result, domain3Result, domain4Result, domain5Result, domain6Result, domain7Result, domain8Result, category1Points, category2Points, category3Points, category4Points, domain1Points, domain2Points, domain3Points, domain4Points, domain5Points, domain6Points, domain7Points, domain8Points);

            answeredSurvey.Result = totalPoints;
        }
コード例 #3
0
ファイル: RPEvaluator.cs プロジェクト: CotorraProject/Cotorra
        private static void SetValuesForResults(Guid firstCategoryID, Guid secondCategoryID, Guid thirdCategoryID, Guid fourthCategoryID, Guid firstDomainID, Guid secondDomainID, Guid thirdDomainID, Guid fourthDomainID, Guid fifthDomainID, Guid sixthDomainID, Guid seventhDomainID, Guid eigthDomainID, NOMSurveyCategoryResult category1Result, NOMSurveyCategoryResult category2Result, NOMSurveyCategoryResult category3Result, NOMSurveyCategoryResult category4Result, NOMSurveyDomainResult domain1Result, NOMSurveyDomainResult domain2Result, NOMSurveyDomainResult domain3Result, NOMSurveyDomainResult domain4Result, NOMSurveyDomainResult domain5Result, NOMSurveyDomainResult domain6Result, NOMSurveyDomainResult domain7Result, NOMSurveyDomainResult domain8Result, int category1Points, int category2Points, int category3Points, int category4Points, int domain1Points, int domain2Points, int domain3Points, int domain4Points, int domain5Points, int domain6Points, int domain7Points, int domain8Points)
        {
            category1Result.Result = category1Points;
            category1Result.NOMEvaluationCategoryID = firstCategoryID;
            category2Result.Result = category2Points;
            category2Result.NOMEvaluationCategoryID = secondCategoryID;
            category3Result.Result = category3Points;
            category3Result.NOMEvaluationCategoryID = thirdCategoryID;
            category4Result.Result = category4Points;
            category4Result.NOMEvaluationCategoryID = fourthCategoryID;

            domain1Result.Result = domain1Points;
            domain1Result.NOMEvaluationDomainID = firstDomainID;
            domain2Result.Result = domain2Points;
            domain2Result.NOMEvaluationDomainID = secondDomainID;

            domain3Result.Result = domain3Points;
            domain3Result.NOMEvaluationDomainID = thirdDomainID;
            domain4Result.Result = domain4Points;
            domain4Result.NOMEvaluationDomainID = fourthDomainID;
            domain5Result.Result = domain5Points;
            domain5Result.NOMEvaluationDomainID = fifthDomainID;
            domain6Result.Result = domain6Points;
            domain6Result.NOMEvaluationDomainID = sixthDomainID;
            domain7Result.Result = domain7Points;
            domain7Result.NOMEvaluationDomainID = seventhDomainID;
            domain8Result.Result = domain8Points;
            domain8Result.NOMEvaluationDomainID = eigthDomainID;
        }