protected void cfmSubmit_Click(object sender, EventArgs e)
        {
            //to do validations

            Course_elearnDAO ceDAO      = new Course_elearnDAO();
            int           courseID      = Convert.ToInt32(Request.QueryString["id"]);
            Course_elearn currentCourse = ceDAO.get_course_by_id(courseID);
            //change to MM-dd-yyyy
            string fromDate = fromDateInput.Text.Substring(3, 2) + "/" + fromDateInput.Text.Substring(0, 2) + "/" + fromDateInput.Text.Substring(6, 4);
            string toDate   = toDateInput.Text.Substring(3, 2) + "/" + toDateInput.Text.Substring(0, 2) + "/" + toDateInput.Text.Substring(6, 4);

            ceDAO.updateCourse(courseID, Convert.ToInt32(moduleType.SelectedValue), nameOfModuleInput.Text, descriptionModuleInput.Text, Convert.ToDouble(hoursInput.Text), DateTime.ParseExact(fromDate, "MM/dd/yyyy", CultureInfo.InvariantCulture), DateTime.ParseExact(toDate, "MM/dd/yyyy", CultureInfo.InvariantCulture));
            //update prerequisites
            //delete all prereq first
            ceDAO.deletePrerequisitesByCourseID(courseID);
            //insert all new prereq
            List <int> prereqIDlist = (List <int>)Session["selectedPrereq"];

            foreach (int prereqID in prereqIDlist)
            {
                ceDAO.insertPrerequisite(courseID, prereqID);
            }

            //set audit
            User currentUser = (User)Session["currentUser"];

            setAudit(currentUser, "course", "update", courseID.ToString(), "course name: " + currentCourse.getCourseName());

            Response.Redirect($"viewModuleInfo.aspx?id={courseID}");
        }
Exemple #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //Response.Write(DateTime.Now.ToShortDateString());
            Course_elearnDAO cdao   = new Course_elearnDAO();
            string           id_str = null;

            if (Request.QueryString["id"] != null)
            {
                id_str = Request.QueryString["id"];
                int id_num = int.Parse(id_str);
                current = cdao.get_course_by_id(id_num);
                TestimonialDAO t = new TestimonialDAO();
                testimonials = t.get_testimonials_by_course(current);
            }
            else
            {
                return;
            }

            if (!IsPostBack)
            {
                int id_num = int.Parse(id_str);
                current = cdao.get_course_by_id(id_num);
                lblCourseNameHeader.Text     = current.getCourseName();
                lblBreadcrumbCourseName.Text = current.getCourseName();
                lblCourseName.Text           = current.getCourseName();
                lblCourseDescription.Text    = current.getDescription();
                hoursOutput.Text             = current.getHoursAwarded().ToString();
                if (!current.getTargetAudience().Equals(""))
                {
                    lblTargetAudience.Text = current.getTargetAudience();
                }
                else
                {
                    lblTargetAudience.Text = "-";
                }
                lblCoursePeriodStart.Text = "Start: " + current.getStartDate().ToLongDateString();
                lblCoursePeriodEnd.Text   = "End: " + current.getExpiryDate().ToLongDateString();
                DateTime currentDateTime = DateTime.Now;

                if (current.getStatus().Equals("Inactive") || !(DateTime.Compare(current.getStartDate(), currentDateTime) < 0 && DateTime.Compare(current.getExpiryDate(), currentDateTime) > 0))
                {
                    panelInactive.Visible = true;
                }
                Page.Form.Attributes.Add("enctype", "multipart/form-data");
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            User currentUser = (User)Session["currentUser"];

            if (currentUser == null)
            {
                Response.Redirect("Login.aspx");
            }
            else
            {
                Boolean superuser      = false;
                Boolean course_creator = false;
                foreach (string s in currentUser.getRoles())
                {
                    if (s.Equals("superuser"))
                    {
                        superuser = true;
                    }
                    else if (s.Equals("course creator"))
                    {
                        course_creator = true;
                    }
                }
                if (superuser || course_creator)
                {
                    if (!IsPostBack)
                    {
                        Course_elearnDAO cdao   = new Course_elearnDAO();
                        String           id_str = Request.QueryString["id"];
                        int id_num = int.Parse(id_str);
                        lblBreadcrumbCourseName.Text = cdao.get_course_by_id(id_num).getCourseName();

                        List <QuizQuestion> allQuestions = new List <QuizQuestion>();
                        Session["allQuestions"]   = allQuestions;
                        Session["questionNumber"] = 1;
                        lblQuestionNumber.Text    = "Question " + 1;
                        lblAddedMsg.Visible       = false;
                    }
                    else
                    {
                        int counter = (int)Session["questionNumber"];
                        lblQuestionNumber.Text = "Question " + counter;
                        lblAddedMsg.Visible    = false;
                    }
                }
                else
                {
                    Response.Redirect("errorPage.aspx");
                }

                /*
                 * if (Page.IsPostBack)
                 * {
                 *  // reshow
                 *  ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModal();", true);
                 * }*/
            }
        }
        protected void gvPrereq_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            List <int> prereqIDlist = (List <int>)Session["selectedPrereq"];
            int        id           = Convert.ToInt32(e.CommandArgument);

            //to get course and add any prereq related to the course
            Course_elearnDAO ceDAO          = new Course_elearnDAO();
            Course_elearn    selectedCourse = ceDAO.get_course_by_id(id);
            ArrayList        allPrereq      = getAllPrerequisites(id);
            ArrayList        allPrereqNoDup = new ArrayList();

            foreach (int prereqID in allPrereq)
            {
                if (!allPrereqNoDup.Contains(prereqID) && !prereqIDlist.Contains(prereqID))
                {
                    allPrereqNoDup.Add(prereqID);
                }
            }

            foreach (int prereqID in allPrereqNoDup)
            {
                prereqIDlist.Add(prereqID);
            }
            prereqIDlist.Add(id);
            Session["selectedPrereq"] = prereqIDlist;
            var itemIDs = string.Join(",", ((IList <int>)Session["selectedPrereq"]).ToArray());

            var sqlQueryCourseList = "";

            if (itemIDs.Length > 0)
            {
                sqlQueryCourseList = String.Format("SELECT * FROM [Elearn_course] ec INNER JOIN [Elearn_courseCategory] ecc ON ec.categoryID = ecc.categoryID WHERE ec.status='active' and ec.start_date<=getDate() and ec.expiry_date>=getDate() and ec.elearn_courseID NOT IN ({0}) and ec.courseType='Online Learning'", itemIDs);
            }
            else
            {
                sqlQueryCourseList = "SELECT * FROM [Elearn_course] ec INNER JOIN [Elearn_courseCategory] ecc ON ec.categoryID = ecc.categoryID WHERE ec.status='active' and ec.start_date<=getDate() and ec.expiry_date>=getDate() and ec.courseType='Online Learning'";
            }
            SqlDataSource1.SelectCommand = sqlQueryCourseList;
            gvPrereq.DataSource          = SqlDataSource1;
            gvPrereq.DataBind();

            gvPrereq.UseAccessibleHeader = true;

            if (gvPrereq.Rows.Count > 0)
            {
                gvPrereq.HeaderRow.TableSection = TableRowSection.TableHeader;
            }

            var sqlQuery = String.Format("SELECT * FROM [Elearn_course] WHERE [elearn_courseID] IN ({0})", itemIDs);

            SqlDataSourcePrereqCart.SelectCommand = sqlQuery;
            gvPrereqCart.DataSource = SqlDataSourcePrereqCart;
            gvPrereqCart.DataBind();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            //Response.Write(DateTime.Now.ToShortDateString());
            Course_elearnDAO cdao   = new Course_elearnDAO();
            string           id_str = null;

            if (Request.QueryString["id"] != null)
            {
                id_str = Request.QueryString["id"];
                int id_num = int.Parse(id_str);
                current = cdao.get_course_by_id(id_num);
                TestimonialDAO t = new TestimonialDAO();
                testimonials = t.get_testimonials_by_course(current);
            }
            else
            {
                return;
            }

            if (!IsPostBack)
            {
                int id_num = int.Parse(id_str);
                current = cdao.get_course_by_id(id_num);
                lblCourseNameHeader.Text     = current.getCourseName();
                lblBreadcrumbCourseName.Text = current.getCourseName();
                lblCourseName.Text           = current.getCourseName();
                lblCourseDescription.Text    = current.getDescription();
                hoursOutput.Text             = current.getHoursAwarded().ToString();
                if (!current.getTargetAudience().Equals(""))
                {
                    lblTargetAudience.Text = current.getTargetAudience();
                }
                else
                {
                    lblTargetAudience.Text = "-";
                }
                lblCoursePeriodStart.Text = "Start: " + current.getStartDate().ToLongDateString();
                lblCoursePeriodEnd.Text   = "End: " + current.getExpiryDate().ToLongDateString();
            }
        }
        protected void cfmActivate_Click(object sender, EventArgs e)
        {
            Course_elearnDAO ceDAO         = new Course_elearnDAO();
            Course_elearn    currentCourse = ceDAO.get_course_by_id(Convert.ToInt32(Request.QueryString["id"]));

            ceDAO.activateCourse(Convert.ToInt32(Request.QueryString["id"]));
            int cat = currentCourse.getCategoryID();

            //set audit
            User currentUser = (User)Session["currentUser"];

            setAudit(currentUser, "course", "activate", currentCourse.getCourseID().ToString(), "course name: " + currentCourse.getCourseName());

            Response.Redirect($"viewAllModule.aspx");
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            User currentUser = (User)Session["currentUser"];

            if (currentUser == null)
            {
                Response.Redirect("Login.aspx");
            }
            else
            {
                Boolean superuser      = false;
                Boolean course_creator = false;
                foreach (string s in currentUser.getRoles())
                {
                    if (s.Equals("superuser"))
                    {
                        superuser = true;
                    }
                    else if (s.Equals("course creator"))
                    {
                        course_creator = true;
                    }
                }
                if (superuser || course_creator)
                {
                    if (!IsPostBack)
                    {
                        Course_elearnDAO cdao   = new Course_elearnDAO();
                        string           id_str = Request.QueryString["id"];
                        int id_num = int.Parse(id_str);
                        lblBreadcrumbCourseName.Text = cdao.get_course_by_id(id_num).getCourseName();
                    }
                }
                else
                {
                    Response.Redirect("errorPage.aspx");
                }
            }
        }
Exemple #8
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;
                Boolean course_creator = false;
                foreach (string s in currentUser.getRoles())
                {
                    if (s.Equals("superuser"))
                    {
                        superuser = true;
                    }
                    else if (s.Equals("course creator"))
                    {
                        course_creator = true;
                    }
                }
                if (!superuser || !course_creator)
                {
                    Response.Redirect("errorPage.aspx");
                }
                if (!IsPostBack)
                {
                    QuizDAO          quizDAO = new QuizDAO();
                    Course_elearnDAO cdao    = new Course_elearnDAO();
                    int  quizID      = Convert.ToInt32(Request.QueryString["id"]);
                    Quiz currentQuiz = quizDAO.getQuizByID(quizID);
                    int  courseID    = currentQuiz.getMainCourse().getCourseID();
                    lblBreadcrumbCourseName.Text = cdao.get_course_by_id(courseID).getCourseName();
                }
            }
        }
Exemple #9
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;
                Boolean course_creator = false;
                foreach (string s in currentUser.getRoles())
                {
                    if (s.Equals("superuser"))
                    {
                        superuser = true;
                    }
                    else if (s.Equals("course creator"))
                    {
                        course_creator = true;
                    }
                }
                if (superuser || course_creator)
                {
                    if (!IsPostBack)
                    {
                        Course_elearnDAO cdao   = new Course_elearnDAO();
                        string           id_str = Request.QueryString["id"];
                        int id_num = int.Parse(id_str);
                        lblBreadcrumbCourseName.Text = cdao.get_course_by_id(id_num).getCourseName();

                        List <int>    prereqIDlist = new List <int>();
                        List <string> part1        = new List <string>();
                        Session["createQuiz1"]    = part1;
                        Session["selectedPrereq"] = prereqIDlist;
                        var itemIDs = string.Join(",", ((IList <int>)Session["selectedPrereq"]).ToArray());

                        //to load course list
                        var sqlQueryCourseList = "";
                        if (itemIDs.Length > 0)
                        {
                            sqlQueryCourseList = String.Format("SELECT * FROM [Quiz] WHERE status='active' and elearn_courseID='{0}' and quizID NOT IN ({1})", id_str, itemIDs);
                        }
                        else
                        {
                            sqlQueryCourseList = "SELECT * FROM [Quiz] WHERE status='active' and elearn_courseID = '" + id_str + "'";
                        }
                        SqlDataSource1.SelectCommand = sqlQueryCourseList;
                        gvPrereq.DataSource          = SqlDataSource1;
                        gvPrereq.DataBind();

                        gvPrereq.UseAccessibleHeader = true;

                        if (gvPrereq.Rows.Count > 0)
                        {
                            gvPrereq.HeaderRow.TableSection = TableRowSection.TableHeader;
                        }

                        //to load prereq cart

                        var sqlQuery = "";
                        if (itemIDs.Length > 0)
                        {
                            sqlQuery = String.Format("SELECT * FROM [Quiz] WHERE [quizID] IN ({0})", itemIDs);
                        }
                        else
                        {
                            sqlQuery = "SELECT * FROM [Quiz] WHERE [quizID] = -1";
                        }

                        SqlDataSourcePrereqCart.SelectCommand = sqlQuery;
                        gvPrereqCart.DataSource = SqlDataSourcePrereqCart;
                        gvPrereqCart.DataBind();
                    }
                }
                else
                {
                    Response.Redirect("errorPage.aspx");
                }
            }
        }
        protected void btnConfirmSubmit_Click(object sender, EventArgs e)
        {
            //to do validation
            Page.Validate("ValidateFormTwo");
            if (!Page.IsValid)
            {
            }
            else
            {
                //add the last question
                List <QuizQuestion> allQuestions = (List <QuizQuestion>)Session["allQuestions"];
                QuizQuestion        newQuestion  = new QuizQuestion();
                newQuestion.setQuestion(txtQuizQuestion.Text);

                QuizAnswer answer1 = new QuizAnswer();
                answer1.setAnswer(txtOptionOne.Text);

                QuizAnswer answer2 = new QuizAnswer();
                answer2.setAnswer(txtOptionTwo.Text);

                QuizAnswer answer3 = new QuizAnswer();
                answer3.setAnswer(txtOptionThree.Text);

                QuizAnswer answer4 = new QuizAnswer();
                answer4.setAnswer(txtOptionFour.Text);

                List <QuizAnswer> allAnswersForLastQn = new List <QuizAnswer>();
                allAnswersForLastQn.Add(answer1);
                allAnswersForLastQn.Add(answer2);
                allAnswersForLastQn.Add(answer3);
                allAnswersForLastQn.Add(answer4);

                newQuestion.setAllAnswers(allAnswersForLastQn);

                if (ddlCorrectAns.SelectedValue.Equals("1"))
                {
                    newQuestion.setQuizAnswer(answer1);
                }
                else if (ddlCorrectAns.SelectedValue.Equals("2"))
                {
                    newQuestion.setQuizAnswer(answer2);
                }
                else if (ddlCorrectAns.SelectedValue.Equals("3"))
                {
                    newQuestion.setQuizAnswer(answer3);
                }
                else
                {
                    newQuestion.setQuizAnswer(answer4);
                }

                allQuestions.Add(newQuestion);

                QuizDAO          quizDAO = new QuizDAO();
                QuizAnswerDAO    qaDAO   = new QuizAnswerDAO();
                QuizQuestionDAO  qqDAO   = new QuizQuestionDAO();
                Course_elearnDAO ceDAO   = new Course_elearnDAO();

                Course_elearn currentCourse = ceDAO.get_course_by_id(Convert.ToInt32(Request.QueryString["id"]));

                //create quiz
                List <string> part1   = (List <string>)Session["createQuiz1"];
                Quiz          newQuiz = new Quiz();
                newQuiz.setTitle(part1[0]);
                newQuiz.setDescription(part1[1]);
                newQuiz.setMainCourse(currentCourse);
                newQuiz.setPassingGrade(Convert.ToInt32(txtNumCorrectAns.Text));
                newQuiz.setStatus("active");
                if (ddlRandomize.SelectedValue.Equals("y"))
                {
                    newQuiz.setRandomOrder("y");
                }
                else
                {
                    newQuiz.setRandomOrder("n");
                }
                newQuiz.setTimeLimit(Convert.ToInt32(txtTimeLimit.Text));
                if (rdlAttempt.SelectedValue.Equals("unlimited"))
                {
                    newQuiz.setMultipleAttempts("y");
                    newQuiz.setNumberOfAttempts(0);
                }
                else
                {
                    newQuiz.setMultipleAttempts("n");
                    newQuiz.setNumberOfAttempts(Convert.ToInt32(txtNoOfAttempt.Text));
                }
                newQuiz.setDisplayAnswer(ddlDisplayAnswer.SelectedValue);

                int quizID = quizDAO.createQuiz(newQuiz);

                //add prerequisites
                List <int> prereqIDlist = (List <int>)Session["selectedPrereq"];
                foreach (int prereqID in prereqIDlist)
                {
                    quizDAO.insertPrerequisite(quizID, prereqID);
                }

                //create question and answer
                foreach (QuizQuestion question in allQuestions)
                {
                    question.setQuiz(quizDAO.getQuizByID(quizID));
                    int               questionID      = qqDAO.createQuizQuestion(question);
                    QuizQuestion      currentQuestion = qqDAO.getQuizQuestionByID(questionID);
                    List <QuizAnswer> allAnswers      = question.getAllAnswers();
                    foreach (QuizAnswer answer in allAnswers)
                    {
                        answer.setQuizQuestion(currentQuestion);
                        int answerID = qaDAO.createQuizAnswer(answer);
                        if (question.getQuizAnswer().getAnswer().Equals(answer.getAnswer()))
                        {
                            qqDAO.updateCorrectAnswerID(questionID, answerID);
                        }
                    }
                }

                //set audit
                User currentUser = (User)Session["currentUser"];
                setAudit(currentUser, "quiz", "create", quizID.ToString(), "quiz title: " + newQuiz.getTitle());

                Response.Redirect($"quizSummary.aspx?id={quizID}");
            }
        }
        protected void gvPrereqCart_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            List <int>       prereqIDlist     = (List <int>)Session["selectedPrereq"];
            int              id               = Convert.ToInt32(e.CommandArgument);
            Course_elearnDAO ceDAO            = new Course_elearnDAO();
            Course_elearn    currentCourse    = ceDAO.get_course_by_id(Convert.ToInt32(Request.QueryString["id"]));
            List <int>       allLinkedCourses = ceDAO.getAllCourseLinkedToPrerequisite(id);

            foreach (int linkedID in allLinkedCourses)
            {
                if (prereqIDlist.Contains(linkedID))
                {
                    prereqIDlist.Remove(linkedID);
                }
            }
            prereqIDlist.Remove(id);
            Session["selectedPrereq"] = prereqIDlist;
            var itemIDs = string.Join(",", ((IList <int>)Session["selectedPrereq"]).ToArray());

            var itemIDs2 = string.Join(",", ((IList <int>)Session["selectedPostreq"]).ToArray());

            var sqlQueryCourseList = "";

            if (itemIDs.Length > 0 && itemIDs2.Length > 0)
            {
                sqlQueryCourseList = String.Format("SELECT * FROM [Elearn_course] ec INNER JOIN [Elearn_courseCategory] ecc ON ec.categoryID = ecc.categoryID WHERE ec.status='active' and ec.start_date<=getDate() and ec.expiry_date>=getDate() and ec.elearn_courseID NOT IN ({0}) and ec.elearn_courseID NOT IN ({1}) and ec.courseType='Online Learning' and ec.elearn_courseID != " + currentCourse.getCourseID(), itemIDs, itemIDs2);
            }
            else if (itemIDs.Length > 0 && itemIDs2.Length < 1)
            {
                sqlQueryCourseList = String.Format("SELECT * FROM [Elearn_course] ec INNER JOIN [Elearn_courseCategory] ecc ON ec.categoryID = ecc.categoryID WHERE ec.status='active' and ec.start_date<=getDate() and ec.expiry_date>=getDate() and ec.elearn_courseID NOT IN ({0}) and ec.courseType='Online Learning' and ec.elearn_courseID != " + currentCourse.getCourseID(), itemIDs);
            }
            else if (itemIDs.Length < 1 && itemIDs2.Length > 0)
            {
                sqlQueryCourseList = String.Format("SELECT * FROM [Elearn_course] ec INNER JOIN [Elearn_courseCategory] ecc ON ec.categoryID = ecc.categoryID WHERE ec.status='active' and ec.start_date<=getDate() and ec.expiry_date>=getDate() and ec.elearn_courseID NOT IN ({0}) and ec.courseType='Online Learning' and ec.elearn_courseID != " + currentCourse.getCourseID(), itemIDs2);
            }
            else
            {
                sqlQueryCourseList = String.Format("SELECT * FROM [Elearn_course] ec INNER JOIN [Elearn_courseCategory] ecc ON ec.categoryID = ecc.categoryID WHERE ec.status='active' and ec.start_date<=getDate() and ec.expiry_date>=getDate() and ec.courseType='Online Learning' and ec.elearn_courseID != " + currentCourse.getCourseID());
            }
            SqlDataSource1.SelectCommand = sqlQueryCourseList;
            gvPrereq.DataSource          = SqlDataSource1;
            gvPrereq.DataBind();

            gvPrereq.UseAccessibleHeader = true;

            if (gvPrereq.Rows.Count > 0)
            {
                gvPrereq.HeaderRow.TableSection = TableRowSection.TableHeader;
            }

            var sqlQuery = "";

            if (itemIDs.Length > 0)
            {
                sqlQuery = String.Format("SELECT * FROM [Elearn_course] WHERE [elearn_courseID] IN ({0}) and elearn_courseID != " + currentCourse.getCourseID(), itemIDs);
            }
            else
            {
                sqlQuery = "SELECT * FROM [Elearn_course] WHERE [elearn_courseID] = -1";
            }

            SqlDataSourcePrereqCart.SelectCommand = sqlQuery;
            gvPrereqCart.DataSource = SqlDataSourcePrereqCart;
            gvPrereqCart.DataBind();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["currentUser"] == null)
            {
                Response.Redirect("Login.aspx");
            }
            else
            {
                User             currentUser    = (User)Session["currentUser"];
                Course_elearnDAO ceDAO          = new Course_elearnDAO();
                Course_elearn    currentCourse  = ceDAO.get_course_by_id(Convert.ToInt32(Request.QueryString["id"]));
                Boolean          superuser      = false;
                Boolean          course_creator = false;
                foreach (string s in currentUser.getRoles())
                {
                    if (s.Equals("superuser"))
                    {
                        superuser = true;
                    }
                    else if (s.Equals("course creator"))
                    {
                        course_creator = true;
                    }
                }
                if (currentUser.getUserID() != currentCourse.getCourseCreator().getUserID() && !(superuser || course_creator))
                {
                    Response.Redirect("errorPage.aspx");
                }
                else
                {
                    if (!IsPostBack)
                    {
                        moduleType.SelectedValue     = currentCourse.getCategoryID().ToString();
                        ddlCourseType.SelectedValue  = currentCourse.getCourseType();
                        nameOfModuleInput.Text       = currentCourse.getCourseName();
                        lblBreadcrumbCourseName.Text = currentCourse.getCourseName();
                        descriptionModuleInput.Text  = currentCourse.getDescription();
                        hoursInput.Text = currentCourse.getHoursAwarded().ToString();
                        if (currentCourse.getTargetAudience() != null)
                        {
                            txtTargetAudience.Text = currentCourse.getTargetAudience().ToString();
                        }
                        fromDateInput.Text = currentCourse.getStartDate().ToString("dd/MM/yyyy");
                        toDateInput.Text   = currentCourse.getExpiryDate().ToString("dd/MM/yyyy");

                        //prerequisites
                        ArrayList  allPrerequisites = currentCourse.getPrerequisite();
                        List <int> prereqIDlist     = new List <int>();
                        foreach (Course_elearn prereq in allPrerequisites)
                        {
                            prereqIDlist.Add(prereq.getCourseID());
                        }
                        Session["selectedPrereq"] = prereqIDlist;
                        var itemIDs = string.Join(",", ((IList <int>)Session["selectedPrereq"]).ToArray());

                        //postrequisites
                        List <int> postReqIDList      = getAllPostRequisiteCourses(currentCourse.getCourseID());
                        List <int> postReqIDListNoDup = new List <int>();
                        foreach (int postreqID in postReqIDList)
                        {
                            if (!postReqIDListNoDup.Contains(postreqID) && postReqIDList.Contains(postreqID))
                            {
                                postReqIDListNoDup.Add(postreqID);
                            }
                        }
                        Session["selectedPostreq"] = postReqIDListNoDup;
                        var itemIDs2 = string.Join(",", ((IList <int>)Session["selectedPostreq"]).ToArray());

                        //to load course list
                        var sqlQueryCourseList = "";
                        if (itemIDs.Length > 0 && itemIDs2.Length > 0)
                        {
                            sqlQueryCourseList = String.Format("SELECT * FROM [Elearn_course] ec INNER JOIN [Elearn_courseCategory] ecc ON ec.categoryID = ecc.categoryID WHERE ec.status='active' and ec.start_date<=getDate() and ec.expiry_date>=getDate() and ec.elearn_courseID NOT IN ({0}) and ec.elearn_courseID NOT IN ({1}) and ec.courseType='Online Learning' and ec.elearn_courseID != " + currentCourse.getCourseID(), itemIDs, itemIDs2);
                        }
                        else if (itemIDs.Length > 0 && itemIDs2.Length < 1)
                        {
                            sqlQueryCourseList = String.Format("SELECT * FROM [Elearn_course] ec INNER JOIN [Elearn_courseCategory] ecc ON ec.categoryID = ecc.categoryID WHERE ec.status='active' and ec.start_date<=getDate() and ec.expiry_date>=getDate() and ec.elearn_courseID NOT IN ({0}) and ec.courseType='Online Learning' and ec.elearn_courseID != " + currentCourse.getCourseID(), itemIDs);
                        }
                        else if (itemIDs.Length < 1 && itemIDs2.Length > 0)
                        {
                            sqlQueryCourseList = String.Format("SELECT * FROM [Elearn_course] ec INNER JOIN [Elearn_courseCategory] ecc ON ec.categoryID = ecc.categoryID WHERE ec.status='active' and ec.start_date<=getDate() and ec.expiry_date>=getDate() and ec.elearn_courseID NOT IN ({0}) and ec.courseType='Online Learning' and ec.elearn_courseID != " + currentCourse.getCourseID(), itemIDs2);
                        }
                        else
                        {
                            sqlQueryCourseList = String.Format("SELECT * FROM [Elearn_course] ec INNER JOIN [Elearn_courseCategory] ecc ON ec.categoryID = ecc.categoryID WHERE ec.status='active' and ec.start_date<=getDate() and ec.expiry_date>=getDate() and ec.courseType='Online Learning' and ec.elearn_courseID != " + currentCourse.getCourseID());
                        }
                        SqlDataSource1.SelectCommand = sqlQueryCourseList;
                        gvPrereq.DataSource          = SqlDataSource1;
                        gvPrereq.DataBind();

                        gvPrereq.UseAccessibleHeader = true;

                        if (gvPrereq.Rows.Count > 0)
                        {
                            gvPrereq.HeaderRow.TableSection = TableRowSection.TableHeader;
                        }

                        //to load prereq cart

                        var sqlQuery = "";
                        if (itemIDs.Length > 0)
                        {
                            sqlQuery = String.Format("SELECT * FROM [Elearn_course] WHERE [elearn_courseID] IN ({0}) and elearn_courseID != " + currentCourse.getCourseID(), itemIDs);
                        }
                        else
                        {
                            sqlQuery = "SELECT * FROM [Elearn_course] WHERE [elearn_courseID] = -1";
                        }

                        SqlDataSourcePrereqCart.SelectCommand = sqlQuery;
                        gvPrereqCart.DataSource = SqlDataSourcePrereqCart;
                        gvPrereqCart.DataBind();
                        Session["currentMod"] = nameOfModuleInput.Text;
                    }
                }
            }
        }