Example #1
0
        public ResultForChart CalculateResilianceChartData(List <CandidateScore> rawScores)
        {
            var processed = new ResultForChart();
            var q1        = rawScores.Where(c => c.QuestionNumber == 1).FirstOrDefault().Response;
            var q2        = rawScores.Where(c => c.QuestionNumber == 2).FirstOrDefault().Response;
            var q3        = rawScores.Where(c => c.QuestionNumber == 3).FirstOrDefault().Response;
            var q4        = rawScores.Where(c => c.QuestionNumber == 4).FirstOrDefault().Response;
            var q5        = rawScores.Where(c => c.QuestionNumber == 5).FirstOrDefault().Response;
            var q6        = rawScores.Where(c => c.QuestionNumber == 6).FirstOrDefault().Response;
            var q7        = rawScores.Where(c => c.QuestionNumber == 7).FirstOrDefault().Response;
            var q8        = rawScores.Where(c => c.QuestionNumber == 8).FirstOrDefault().Response;
            var q9        = rawScores.Where(c => c.QuestionNumber == 9).FirstOrDefault().Response;
            var q10       = rawScores.Where(c => c.QuestionNumber == 10).FirstOrDefault().Response;
            var q11       = rawScores.Where(c => c.QuestionNumber == 11).FirstOrDefault().Response;
            var q12       = rawScores.Where(c => c.QuestionNumber == 12).FirstOrDefault().Response;
            var q13       = rawScores.Where(c => c.QuestionNumber == 13).FirstOrDefault().Response;
            var q14       = rawScores.Where(c => c.QuestionNumber == 14).FirstOrDefault().Response;
            var q15       = rawScores.Where(c => c.QuestionNumber == 15).FirstOrDefault().Response;
            var q16       = rawScores.Where(c => c.QuestionNumber == 16).FirstOrDefault().Response;
            var q17       = rawScores.Where(c => c.QuestionNumber == 17).FirstOrDefault().Response;
            var q18       = rawScores.Where(c => c.QuestionNumber == 18).FirstOrDefault().Response;
            var q19       = rawScores.Where(c => c.QuestionNumber == 19).FirstOrDefault().Response;
            var q20       = rawScores.Where(c => c.QuestionNumber == 20).FirstOrDefault().Response;
            var q21       = rawScores.Where(c => c.QuestionNumber == 21).FirstOrDefault().Response;
            var q22       = rawScores.Where(c => c.QuestionNumber == 22).FirstOrDefault().Response;
            var q23       = rawScores.Where(c => c.QuestionNumber == 23).FirstOrDefault().Response;
            var q24       = rawScores.Where(c => c.QuestionNumber == 24).FirstOrDefault().Response;


            processed.Adaptable = RoundtoHalf(((q16 + q14 + q24) / 3d)); //1.5

            processed.Confident = RoundtoHalf(((q1 + q20 + q18) / 3d));  //3.5

            processed.Purposeful = RoundtoHalf(((q21 + q12 + q6) / 3d)); //1

            processed.Supported = RoundtoHalf(((q10 + q3 + q8) / 3d));   //2.5

            processed.Fixed = RoundtoHalf(((q4 + q5 + q23) / 3d));       //-0.5

            processed.Fearful = RoundtoHalf(((q22 + q11 + q2) / 3d));    //-1.5

            processed.Aimless = RoundtoHalf(((q15 + q13 + q9) / 3d));    //-2

            processed.Isolated = RoundtoHalf(((q19 + q17 + q7) / 3d));   //-2.5


            return(processed);
        }
Example #2
0
        public static byte[] CreateReport()
        {
            var doc = new Document(PageSize.A4);

            using var ms = new MemoryStream();
            var writer = PdfWriter.GetInstance(doc, ms);

            doc.Open();

            var cb     = writer.DirectContent;
            var under  = writer.DirectContentUnder;
            var result = new ResultForChart();

            result = GetMockResult();

            //CreatePage1(cb);
            //CreatePage2(cb);



            CreateHeaderFooter(cb);
            CreateGrid(cb);
            AddImageBehindGrid(under);
            CreateCenterLine(cb);
            DrawBar(cb, "Supported", result.Supported);
            DrawBar(cb, "Isolated", result.Isolated);
            DrawBar(cb, "Purposeful", result.Purposeful);
            DrawBar(cb, "Aimless", result.Aimless);
            DrawBar(cb, "Confident", result.Confident);
            DrawBar(cb, "Fearful", result.Fearful);
            // DrawBar(cb, "Adaptable", result.Adaptable);
            DrawBar(cb, "Fixed", result.Fixed);
            doc.Close();

            return(ms.ToArray());
            //return ms.ToArray();
        }