public ActionResponse AssignCourse(CourseAssign courseAssign)
        {
            ActionResponse response = new ActionResponse();

            try
            {
                bool isAlreadyAssigned = aTeacherGateway.IsAlreadyAssigned(courseAssign);
                if (isAlreadyAssigned)
                {
                    response.Class   = "danger";
                    response.Message = "This course is already assigned to another teacher.";
                    return(response);
                }

                aTeacherGateway.AssignCourse(courseAssign);
                response.Class   = "success";
                response.Message = "Course Assigned successfully.";
            }
            catch (SqlException ex)
            {
                response.Class   = "warning";
                response.Message = ex.Message;
            }
            return(response);
        }
Ejemplo n.º 2
0
 public ArrayList AssignCourse(TeacherCourse teacherCourse)
 {
     if (IsCourseAssignable(teacherCourse.CourseId))
     {
         int affectedRow = _teacherGateway.AssignCourse(teacherCourse);
         if (affectedRow > 0)
         {
             return new ArrayList {
                        true, "alert-success", "Success!", "Course assigned to the teacher."
             }
         }
         ;
         return(new ArrayList {
             false, "alert-danger", "Error!", "Course not assigned to the teacher."
         });
     }
     return(new ArrayList {
         false, "alert-danger", "Error!", "Course already assigned to a teahcer."
     });
 }
Ejemplo n.º 3
0
        internal string AssignCourse(AsignCourse asignCourse)
        {
            try
            {
                if (aTeacherGateway.IsExistCourseId(asignCourse.CourseId))
                {
                    return("Course already Assigned");
                }

                else if (aTeacherGateway.AssignCourse(asignCourse) > 0)
                {
                    return("CousreAssigned");
                }
                else
                {
                    return("Cousre Assigned Failed");
                }
            }
            catch (Exception)
            {
                return("Cousre Assigned Failed");
            }
        }
 public bool AssignCourse(Course coursesList, Teacher teachersList)
 {
     return(teacherGateway.AssignCourse(teachersList, coursesList) > 1);
 }