Esempio n. 1
0
        public AssesmentReportTO GetReport()
        {
            AssesmentReportTO report = new AssesmentReportTO();

            report.AssesmentInfo = info;
            if (report.AssesmentInfo.EmployeeId != null)
            {
                report.AssesmentInfo.Employee = GetDbEmployee((int)report.AssesmentInfo.EmployeeId);
            }
            report.Sections = new List <SectionReportTO>();

            List <SectionPointsTO> list = GetDbAssesmentPointsBySection(id);
            List <SectionPointsTO> possiblePointsList = GetDbPointsBySection(id);

            for (int i = 0; i < info.Evaluation.Sections.Count; i++)
            {
                SectionReportTO section = new SectionReportTO();
                section.Name       = info.Evaluation.Sections.ElementAt(i).Name;
                section.Percentage = 0;
                SectionPointsTO sectionPoints         = list.Find(x => x.SectionID == info.Evaluation.Sections.ElementAt(i).SectionId);
                SectionPointsTO sectionPossiblePoints = possiblePointsList.Find(x => x.SectionID == info.Evaluation.Sections.ElementAt(i).SectionId);
                if (sectionPoints != null)
                {
                    section.Percentage = Math.Round(Convert.ToDouble(sectionPoints.Points) / Convert.ToDouble(sectionPossiblePoints.Points) * 100);
                }

                report.Sections.Add(section);
            }

            report.Analysis = GetAnalysis();

            return(report);
        }
Esempio n. 2
0
        private void GenerateAndSendResults()
        {
            AssesmentReportTO report = new AssesmentReportTO();

            report.AssesmentInfo = info;
            report.Sections      = new List <SectionReportTO>();

            List <SectionPointsTO> list = AssesmentPersistence.GetAssesmentPoints(id);

            for (int i = 0; i < info.Evaluation.Sections.Count; i++)
            {
                SectionReportTO section = new SectionReportTO();
                section.Name       = info.Evaluation.Sections[i].Name;
                section.Percentage = 0;
                SectionPointsTO sectionPoints = list.Find(x => x.SectionID == info.Evaluation.Sections[i].ID);
                if (sectionPoints != null)
                {
                    section.Percentage = sectionPoints.Points;
                }

                report.Sections.Add(section);
            }

            report.Analysis = GetAnalysis();
            string savedFilePath = Pdf.GenerateSimplePdf(report);

            SendReport(savedFilePath);
        }