Ejemplo n.º 1
0
        public static List <PromotionSituationTableAux> GetPromotionTableAux(List <int> ids)
        {
            StudentsRepository studentRepo = new StudentsRepository();

            List <PromotionSituationTableAux> promotionResults = new List <PromotionSituationTableAux>();

            foreach (var id in ids)
            {
                PromotionSituationTableAux promotionStudentRecord = new PromotionSituationTableAux();

                promotionStudentRecord.StudentId = id;

                promotionStudentRecord.StudentName = studentRepo.GetStudentFullName(id);

                promotionStudentRecord.Average = studentRepo.CalculateAvgerage(id);

                promotionStudentRecord.Credits = studentRepo.GetCreditsAcummulated(id);

                promotionStudentRecord.ExamsCount = studentRepo.GetTotalNumberOfExams(id);

                promotionStudentRecord.ExamsToRetakeCount = studentRepo.GetExamsToRetake(id).Count();

                promotionResults.Add(promotionStudentRecord);
            }

            return(promotionResults);
        }
Ejemplo n.º 2
0
        // for Student
        public static StudentSituationVM GetStudentStatistics(int id)
        {
            StudentsRepository studentRepo = new StudentsRepository();

            var situationResult = new StudentSituationVM();

            situationResult.StudentName = studentRepo.GetStudentFullName(id);

            situationResult.StudentProfile = studentRepo.GetStudentProfile(id);

            situationResult.ExamsCount = studentRepo.GetTotalNumberOfExams(id);


            if (situationResult.ExamsCount > 0)
            {
                situationResult.Average = studentRepo.CalculateAvgerage(id).ToString("F2");

                situationResult.Credits = studentRepo.GetCreditsAcummulated(id).ToString();

                situationResult.ExamsToRetake = studentRepo.GetExamsToRetake(id);

                situationResult.ExamsToRetakeCount = situationResult.ExamsToRetake.Count();

                return(situationResult);
            }


            situationResult.Average = "-";

            situationResult.Credits = "-";

            situationResult.ExamsToRetakeCount = 0;

            return(situationResult);
        }