private DateTime FindLastAppointmentForSignleRoom(int roomId) { List <DateTime> appointments = new List <DateTime>(); ((List <Examination>)_examinationRepository.GetFollowingExaminationsByRoom(roomId)).ForEach(x => appointments.Add(x.DateAndTime)); ((List <EquipmentTransfer>)_equipmentTransferRepository.GetFollowingEquipmentTransversByRoom(roomId)).ForEach(x => appointments.Add(x.DateAndTimeOfTransfer)); ((List <BaseRenovation>)_renovationRepository.GetFollowingRenovationsByRoom(roomId)).ForEach(x => appointments.Add(x.RenovationPeriod.EndDate)); return(FindLastAppointment(appointments)); }
private int CheckEquipmentAvailability(TransferEquipmentDTO transferEquipmentDTO) { int roomNumber = -1; foreach (var e in _examinationRepository.GetFollowingExaminationsByRoom(transferEquipmentDTO.StartingRoomNumber).Where(e => e.DateAndTime.CompareTo(transferEquipmentDTO.DateAndTimeOfTransfer) > 0)) { if (_equipmentInExaminationRepository.GetEquipmentInExaminationByExaminationId(e.Id).Find(eie => eie.EquipmentTypeID == transferEquipmentDTO.EquipmentTypeId) != null) { roomNumber = transferEquipmentDTO.StartingRoomNumber; } } return(roomNumber); }