コード例 #1
0
        public string SaveRoomInfo(RoomInfo aRoomInfo)
        {
            bool isOverlapping = aRoomGateway.IsOverlapping(aRoomInfo);

            if (isOverlapping)
            {
                return("Sorry, the time you selected overlaps with another course");
            }

            List <RoomInfo> rooms = new List <RoomInfo>();

            rooms = aRoomGateway.GetAllTimes();

            foreach (RoomInfo aRoom in rooms)
            {
                isOverlapping = aRoomGateway.IsAnotherOverLapping(aRoom, aRoomInfo);

                if (isOverlapping)
                {
                    return("Sorry, the time you selected overlaps with another schedule");
                }
            }

            int rowAffected = aRoomGateway.SaveRoomInfo(aRoomInfo);

            if (rowAffected > 0)
            {
                return("Room allocation successfull");
            }

            return("An error occured");
        }