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; } }
public void SaveRsvp(ChildcareRsvpDto saveRsvp) { var participant = _participantService.GetParticipant(saveRsvp.ChildContactId); try { var participantSignup = new ParticipantSignup { particpantId = participant.ParticipantId, groupRoleId = _configurationWrapper.GetConfigIntValue("Group_Role_Default_ID"), capacityNeeded = 1, EnrolledBy = saveRsvp.EnrolledBy }; _groupService.addParticipantToGroupNoEvents(saveRsvp.GroupId, participantSignup); } catch (Exception ex) { _logger.Error(string.Format("Save RSVP failed for group ({0}), contact ({1})", saveRsvp.GroupId, saveRsvp.ChildContactId), ex); throw; } }