protected void EnrollCoursesButton_Click(object sender, EventArgs e) { EnrollCourse _EnrollCourse = new EnrollCourse(); _EnrollCourse.DepartmentId = Convert.ToInt32(DepartmentDropDownList.SelectedValue); _EnrollCourse.DeptCode = DepartmentDropDownList.SelectedItem.ToString(); _EnrollCourse.StudentRegNo = StudentRegNoDropDownList.SelectedItem.ToString(); _EnrollCourse.EnrollDate = DateTime.Now.ToShortDateString(); _EnrollCourse.CourseCode = CoursesDropDownList.SelectedValue.ToString(); _EnrollCourse.CourseName = CoursesDropDownList.SelectedItem.ToString(); _EnrollCourse.StudentId = Convert.ToInt32(StudentRegNoDropDownList.SelectedValue); decimal AlreadyCourseAssign = _EnrollCourseManager.AlreadyCourseAssign(_EnrollCourse); if (AlreadyCourseAssign >= 1) { ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('This Code Already Enroll');", true); } else { int success = _EnrollCourseManager.EnrollCourse(_EnrollCourse); if (success > 0) { ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Succssefully Enroll Course');", true); } else { ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Failed Enroll ');", true); } } }
public ActionResult Enroll(Enroll enroll) { ViewBag.RegNoList = aEnrollCourseManager.GetAllStudentRegNo(); // enroll.GradeId = 14; enroll.Action = "insert"; ViewBag.Message = aEnrollCourseManager.EnrollCourse(enroll); return(View()); }
public ActionResult EnrollStudentInCourse(EnrollCourse aEnrollCourse) { List <Student> aStudents = aStudentManager.GetAllStudent(); ViewBag.StudentList = aStudents; int deptId = aDepartmentManager.GetDepatmentIdByCode(aEnrollCourse.Code); aEnrollCourse.DepartmentId = deptId; string message = aEnrollCourseManager.EnrollCourse(aEnrollCourse); ViewBag.message = message; return(View()); }
public ActionResult EnrollStudentInCourse(EnrollCourse aEnrollCourse) { if (Session["userType"] == null) { return(RedirectToAction("Login", "Account")); } if (Session["userType"].ToString() != "admin") { return(RedirectToAction("Index", "Home")); } List <Student> aStudents = aStudentManager.GetAllStudent(); ViewBag.StudentList = aStudents; int deptId = aDepartmentManager.GetDepatmentIdByCode(aEnrollCourse.Code); aEnrollCourse.DepartmentId = deptId; string message = aEnrollCourseManager.EnrollCourse(aEnrollCourse); ViewBag.message = message; return(View()); }