private bool CheckRoomAndTimeScheduleOverlap(Schedule aSchedule)
 {
     aScheduleGateway = new ScheduleGateway();
     int status = aScheduleGateway.CheckRoomAndTimeScheduleOverlap(aSchedule);
     if (status > 0)
         return true;
     return false;
 }
 private bool CheckDepartmentAndSubjectOverlap(Schedule aSchedule)
 {
     aScheduleGateway = new ScheduleGateway();
     int status = aScheduleGateway.CheckDepartmentAndSubjectOverlap(aSchedule);
     if (status > 0)
         return true;
     return false;
 }
        public string SaveClassSchedule(Schedule aSchedule)
        {
            aScheduleGateway = new ScheduleGateway();

            if (!CheckRoomAndTimeScheduleOverlap(aSchedule))
                if (!CheckDepartmentAndSubjectOverlap(aSchedule))
                    return aScheduleGateway.SaveClassSchedule(aSchedule);
                else
                    return "Violation of Department or semester ";
            else
                return "Violation of Room or Time or day or building";
        }
 private bool CheckTeacherTime(TeacherCourse aTeacherCourse)
 {
     aTeacherGateway = new TeacherGateway();
     ScheduleGateway aScheduleGateway = new ScheduleGateway();
     List<int> coursesId = new List<int>();
     coursesId = aTeacherGateway.GetTeacherAssignCoursesId(aTeacherCourse);
     List<Schedule> schedules = new List<Schedule>();
     schedules = aScheduleGateway.GetTeacherAllSchedules(coursesId);
     List<Schedule> currentScheduleList = new List<Schedule>();
     currentScheduleList = aScheduleGateway.GetCurrentCourseSchedules(aTeacherCourse);
     foreach (Schedule schedule in currentScheduleList)
     {
         foreach (Schedule aSchedule in schedules)
         {
             if (schedule.DayId == aSchedule.DayId && ((schedule.StartTime <= aSchedule.StartTime && schedule.EndingTime >= aSchedule.StartTime) || (schedule.StartTime <= aSchedule.EndingTime & schedule.EndingTime >= aSchedule.EndingTime)))
             {
                 return true;
             }
         }
     }
     return false;
 }
 public List<Room> GetAllRooms(int buildingId)
 {
     aScheduleGateway = new ScheduleGateway();
     return aScheduleGateway.GetAllRooms(buildingId);
 }
 public List<Day> GetAllDays()
 {
     aScheduleGateway = new ScheduleGateway();
     return aScheduleGateway.GetAllDays();
 }
 public List<Building> GetAllBuildings()
 {
     aScheduleGateway = new ScheduleGateway();
     return aScheduleGateway.GetAllBuildings();
 }