Ejemplo n.º 1
0
        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}");
        }