private EventToolDto GetEventDetails(int eventId, bool includeEquipment, bool includeParticipants) { try { var e = GetEvent(eventId); var dto = Mapper.Map <EventToolDto>(e); dto.Rooms = PopulateRoomReservations(eventId, includeEquipment, includeParticipants); var groups = _eventService.GetEventGroupsForEventAPILogin(eventId); if (groups.Any(childcareGroups => childcareGroups.GroupTypeId == childcareGroupTypeID)) { var group = _groupService.getGroupDetails(groups.First(childcareGroup => childcareGroup.GroupTypeId == childcareGroupTypeID).GroupId); dto.Group = Mapper.Map <GroupDTO>(group); } return(dto); } catch (Exception ex) { var msg = "Event Service: CreateEventReservation"; _logger.Error(msg, ex); throw new Exception(msg, ex); } }
public void addParticipantToGroupNoEvents(int groupId, ParticipantSignup participant) { MpGroup group; try { group = _mpGroupRepository.getGroupDetails(groupId); } catch (Exception e) { var message = String.Format("Could not retrieve group details for group {0}: {1}", groupId, e.Message); _logger.Error(message, e); throw (new ApplicationException(message, e)); } checkSpaceRemaining(new List <ParticipantSignup> { participant }, group); try { var roleId = participant.groupRoleId ?? _groupRoleDefaultId; var participantId = participant.particpantId.Value; var groupParticipantId = _mpGroupRepository.addParticipantToGroup(participantId, Convert.ToInt32(groupId), roleId, participant.childCareNeeded, DateTime.Now, null, false, participant.EnrolledBy); var configuration = MpObjectAttributeConfigurationFactory.GroupParticipant(); _objectAttributeService.SaveObjectAttributes(groupParticipantId, participant.AttributeTypes, participant.SingleAttributes, configuration); if (participant.capacityNeeded > 0) { DecrementCapacity(participant.capacityNeeded, group); } } catch (Exception e) { _logger.Error("Could not add user to group", e); throw; } }