コード例 #1
0
        protected int checkNumberOfCourseUserComplete(string userID)
        {
            Course_elearnDAO ceDAO                = new Course_elearnDAO();
            ArrayList        allCourses           = ceDAO.getAllCourses();
            QuizDAO          quizDAO              = new QuizDAO();
            QuizResultDAO    qrDAO                = new QuizResultDAO();
            ArrayList        allResults           = qrDAO.getAllQuizResultByUserID(userID);
            List <int>       allCompletedCourseID = new List <int>();
            double           totalLearningHours   = 0;
            int counter = 0;

            foreach (Course_elearn ce in allCourses)
            {
                List <Quiz> allQuizForCourse       = quizDAO.getAllQuizByCourseID(ce.getCourseID());
                Boolean     checkIfCompleteAllQuiz = true;
                Boolean     checkIfCourseGotQuiz   = false;
                foreach (Quiz currentQuiz in allQuizForCourse)
                {
                    checkIfCourseGotQuiz = true;
                    if (!qrDAO.checkIfUserPassQuiz(userID, currentQuiz.getQuizID()))
                    {
                        checkIfCompleteAllQuiz = false;
                    }
                }
                if (checkIfCompleteAllQuiz && checkIfCourseGotQuiz)
                {
                    counter++;
                    allCompletedCourseID.Add(ce.getCourseID());
                    totalLearningHours = totalLearningHours + ce.getHoursAwarded();
                }
            }
            Session["allCompletedCourseID"] = allCompletedCourseID;
            Session["totalLearningHours"]   = totalLearningHours;
            return(counter);
        }
コード例 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            User currentUser = (User)Session["currentUser"];

            if (currentUser == null)
            {
                Response.Redirect("Login.aspx");
            }
            else
            {
                Boolean superuser = false;
                foreach (string s in currentUser.getRoles())
                {
                    if (s.Equals("superuser"))
                    {
                        superuser = true;
                    }
                }
                if (!superuser)
                {
                    Response.Redirect("errorPage.aspx");
                }
            }
            UserDAO     userDAO  = new UserDAO();
            List <User> allUsers = userDAO.getAllUsers();

            lblUsers.Text = allUsers.Count().ToString();

            Course_elearnDAO courseDAO  = new Course_elearnDAO();
            ArrayList        allCourses = courseDAO.getAllCourses();

            lblCourses.Text = allCourses.Count.ToString();

            lblQuizAttempts.Text = GetTotalNoOfQuiz().ToString();

            lblHours.Text = GetTotalNoOfLearningHours().ToString();

            renderUserPieChart();
            renderCoursePieChart();
            renderPopularCourse();
            renderPopularCourseCategory();
            renderAuditFunction();
            renderAuditFunctionName();
            renderTopLearnersHours();
            renderTopLearnersName();
            renderTopLearnersNameByQuiz();
            renderTopLearnersQuiz();
        }
コード例 #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            UserDAO     userDAO  = new UserDAO();
            List <User> allUsers = userDAO.getAllUsers();

            lblUsers.Text = allUsers.Count().ToString();

            Course_elearnDAO courseDAO  = new Course_elearnDAO();
            ArrayList        allCourses = courseDAO.getAllCourses();

            lblCourses.Text = allCourses.Count.ToString();

            //QuizResultHistoryDAO qrhDAO = new QuizResultHistoryDAO();
            //List<QuizResultHistory> allQuiz = qrhDAO.getAll();
            //lblQuizAttempts.Text = allQuiz.Count().ToString();

            renderUserPieChart();
            renderCoursePieChart();
            renderPopularCourse();
            renderPopularCourseCategory();
        }