Exemple #1
0
    static void Main()
    {
        StudentInfo si = new StudentInfo();

        si.GetStudentInfo();
        si.PrintStudentInfo();
    }
Exemple #2
0
        public ActionResult Index(string Faculty, String Session, int?Semester, int?key)
        {
            if (!HasSession())
            {
                return(RedirectToAction("Index", "Home"));
            }

            if (Faculty == null || Session == null || Semester == 0)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            ViewBag.faculties   = db.Faculty.ToList();
            ViewBag.all_session = db.AllSession.ToList();
            ViewBag.Faculty     = Faculty;
            ViewBag.Session     = Session;
            ViewBag.Semester    = Semester;
            List <Result> AllResults = new List <Result>();

            if (Convert.ToInt32(key) == 0)
            {
                AllResults = Result.GetResults(Session, Convert.ToInt32(Semester));
            }
            else
            {
                List <Course>          Courses = new List <Course>();
                List <CurrentSemester> CS      = new List <CurrentSemester>();
                Courses = GetEnrollment.GetEnrollCourses(Faculty, Session, Convert.ToInt32(Semester));
                CS      = CurrentSemester.GetCurrentSemesterStudents(Faculty, Session, Convert.ToInt32(Semester));
                string msg = "";
                if (Courses != null)
                {
                    foreach (Course Course in Courses)
                    {
                        if (!CourseStatus.IsMarkSubmitted(Course, Session))
                        {
                            msg += "Mark is not submitted for Course: " + Course.Course_code + "\n";
                        }
                    }

                    if (msg == "")
                    {
                        List <StudentInfo> Students = StudentInfo.GetStudentInfo(CS);
                        if (Students != null)
                        {
                            Boolean IsCalculated = Result.CalculateResult(Students, Convert.ToInt32(Semester), Courses);
                            if (IsCalculated)
                            {
                                ViewBag.Message = "Results are calculated successfully!";
                                AllResults      = Result.GetResults(Session, Convert.ToInt32(Semester));
                            }
                            else
                            {
                                ViewBag.Error = "Results calculation failed!";
                            }
                        }
                    }
                    else
                    {
                        ViewBag.Error = msg;
                    }
                }
                else
                {
                    ViewBag.Error = "No Courses and Marks are Found!";
                }
            }

            return(View(AllResults));
        }