Example #1
0
        private void UpdateEventChildcareGroup(EventToolDto oldEventDetails, EventToolDto eventReservation, int eventId, string token)
        {
            bool wasChildcare = oldEventDetails.EventTypeId == childcareEventTypeID;
            bool isChildcare  = eventReservation.EventTypeId == childcareEventTypeID;

            //if it use to be a childcare event, but isn't anymore, remove the group
            if (wasChildcare && !isChildcare)
            {
                _eventService.DeleteEventGroupsForEvent(eventId, token, childcareGroupTypeID);
                _groupService.EndDateGroup(oldEventDetails.Group.GroupId, null, null);
            }
            //now is a childcare event but was not before so add a group
            else if (!wasChildcare && isChildcare)
            {
                eventReservation.Group.CongregationId = eventReservation.CongregationId;
                var groupid = AddGroup(eventReservation.Group);
                AddEventGroup(eventId, groupid, token);
            }
            //it was and still is a childcare event
            else if (wasChildcare && isChildcare)
            {
                var group = _eventService.GetEventGroupsForEventAPILogin(eventId).FirstOrDefault(i => i.GroupTypeId == childcareGroupTypeID);

                eventReservation.Group.GroupId        = group.GroupId;
                eventReservation.Group.CongregationId = eventReservation.CongregationId;
                UpdateGroup(eventReservation.Group);
            }
        }
Example #2
0
 public void EndDateGroup(int groupId, int?reasonEndedId)
 {
     _mpGroupRepository.EndDateGroup(groupId, DateTime.Now, reasonEndedId);
 }
Example #3
0
 public void EndDateGroup(int groupId, int?reasonEndedId)
 {
     _mpGroupService.EndDateGroup(groupId, DateTime.Now, reasonEndedId);
 }