private bool IsTimeScheduleValid(int roomId, int dayId, DateTime startTime, DateTime endTime) { List <ClassRoom> schedule = classRoomGateway.GetClassSchedulByStartAndEndingTime(roomId, dayId, startTime, endTime); foreach (var aSchedule in schedule) { if ((aSchedule.DayId == dayId && roomId == aSchedule.RoomId) && (startTime < aSchedule.StartTime && endTime > aSchedule.StartTime) || (startTime < aSchedule.StartTime && endTime > aSchedule.StartTime) || (startTime == aSchedule.StartTime) || (aSchedule.StartTime < startTime && aSchedule.Endtime > startTime)) { return(false); } } return(true); }
private bool IsTimeScheduleValid(int roomId, int dayId, DateTime startTime, DateTime endTime) { List <ClassRoomAllocation> schedule = classRoomGateway.GetClassSchedulByStartAndEndingTime(roomId, dayId, startTime, endTime); foreach (var sd in schedule) { if ((sd.DayId == dayId && roomId == sd.RoomId) && (startTime < sd.Fromtime && endTime > sd.Fromtime) || (startTime < sd.Fromtime && endTime > sd.Fromtime) || (startTime == sd.Fromtime) || (sd.Fromtime < startTime && sd.Totime > startTime) ) { return(true); } } return(false); }
private bool IsTimeScheduleValid(int roomId, int dayId, DateTime startTime, DateTime endTime) { List <ClassRoom> schedule = classRoomGateway.GetClassSchedulByStartAndEndingTime(roomId, dayId, startTime, endTime); foreach (var sd in schedule) { if ((sd.DayId == dayId && roomId == sd.RoomId) && (startTime < sd.StartTime && endTime > sd.StartTime) || (startTime < sd.StartTime && endTime > sd.StartTime) || (startTime == sd.StartTime) || (sd.StartTime < startTime && sd.Endtime > startTime) ) { return(true); } } return(false); //if (schedule.Count==0) //{ // return true; //} //return false; }