protected void CourseAssignButton_Click(object sender, EventArgs e) { CourseAssign _CourseAssign = new CourseAssign(); _CourseAssign.CourseId = Convert.ToInt32(CourseDropDownList.SelectedValue); decimal CheckId = _CourseAssigneManager.AlreadyExitCode(_CourseAssign); if (CheckId >= 1) { ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('This Code Already Here');", true); } else { decimal RemainingCredit = Convert.ToDecimal(txtRemainingCredit.Text); if (RemainingCredit >= 1) { _CourseAssign.DepartmentId = Convert.ToInt32(DepartmentDropDownList.SelectedValue); _CourseAssign.TeacherId = Convert.ToInt32(TeacherDropDownList.SelectedValue); _CourseAssign.CourseId = Convert.ToInt32(CourseDropDownList.SelectedValue); _CourseAssign.CourseName = txtCourseName.Text; _CourseAssign.CourseCredit = Convert.ToDecimal(txtCourseCredit.Text); int successe = _CourseAssigneManager.AssigneCourse(_CourseAssign); if (successe > 0) { Courses _Course = new Courses(); _Course.Id = Convert.ToInt32(CourseDropDownList.SelectedValue); _Course.CourseAssigneTo = TeacherDropDownList.SelectedItem.ToString(); _CourseAssigneManager.UpdateAssigneTeacher(_Course); ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Succssefully Assign Course');", true); Refresh(); } else { ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Failed Course Assign');", true); } } else { Page.ClientScript.RegisterStartupScript(Page.GetType(), "alert", "alert ('Are You Sure You Want To Assign More Credit');", true); int successe = _CourseAssigneManager.AssigneCourse(_CourseAssign); if (successe > 0) { Courses _Course = new Courses(); _Course.Id = Convert.ToInt32(CourseDropDownList.SelectedValue); _Course.CourseAssigneTo = TeacherDropDownList.SelectedItem.ToString(); _CourseAssigneManager.UpdateAssigneTeacher(_Course); _CourseAssigneManager.UpdateExtraCredit(_CourseAssign); ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Succssefully Assign Course');", true); Refresh(); } else { ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Failed Course Assign');", true); } } } }