public Event CreateEvent(Event evnt) { List <EventParticipant> UnregisteredUserList = new List <EventParticipant>(); List <EventParticipant> RegisteredTempUserList = new List <EventParticipant>(); List <EventParticipant> additionalRegisteredUsers = new List <EventParticipant>(); evnt = ParseUserList(evnt, ref UnregisteredUserList, ref additionalRegisteredUsers, ref RegisteredTempUserList); evnt.ParticipantUpdateAction = 1; //Setting action to sync. string eventId = Context.AddEvent(Serializer.Serialize(evnt)).SingleOrDefault().ToString().ToUpper(); if (String.IsNullOrEmpty(eventId)) { throw new Exception("Failed to create event."); } Event createdEvent = GetEventsInternal(new EventRequest() { EventId = eventId, RequestorId = evnt.RequestorId.ToString() }).FirstOrDefault(); pushNotifier = new DefaultNotificationManager(); //send notification to registered users pushNotifier.NotifyEventCreation(createdEvent); //send notification to initiator regarding additional registered users pushNotifier.NotifyAdditionalRegisteredUserInfoToHost(additionalRegisteredUsers, createdEvent); //send sms to unregistered users smsNotifier = new DefaultSMSNotification(); smsNotifier.sendEventInviteSMSToMultipleContactsAsync(RegisteredTempUserList, createdEvent.Name, createdEvent.InitiatorName); return(ClientDataHelper.suppressSensitiveData(createdEvent)); }
public Event RemoveParticipants(Event evnt) { List <EventParticipant> UnregisteredUserList = new List <EventParticipant>(); List <EventParticipant> RegisteredTempUserList = new List <EventParticipant>(); List <EventParticipant> additionalRegisteredUsers = new List <EventParticipant>(); evnt = ParseUserList(evnt, ref UnregisteredUserList, ref additionalRegisteredUsers, ref RegisteredTempUserList); evnt.UpdateParticipantsOnly = true; evnt.ParticipantUpdateAction = 3; //setting update participant action to Remove if (Context.UpdateEvent(Serializer.Serialize(evnt)).SingleOrDefault().Value == 0) { throw new Exception("Failed to remove event particpants."); } List <string> removedParticipantGcms = GetGcmList(evnt); Event updatedEvent = GetEventsInternal(new EventRequest() { EventId = evnt.EventId.ToString(), RequestorId = evnt.RequestorId.ToString() }).FirstOrDefault(); pushNotifier = new DefaultNotificationManager(); //send notification to registered users pushNotifier.NotifyRemoveParticipantFromEvent(updatedEvent, removedParticipantGcms); //send notification to initiator regarding additional registered users pushNotifier.NotifyAdditionalRegisteredUserInfoToHost(additionalRegisteredUsers, updatedEvent); //send sms to unregistered users //smsNotifier = new DefaultSMSNotification(); //smsNotifier.sendEventInviteSMSToMultipleContacts(RegisteredTempUserList, updatedEvent.Name, updatedEvent.InitiatorName); return(ClientDataHelper.suppressSensitiveData(updatedEvent)); }
// TODO: Cleanup as this is reliance on my existing record in the Data API public DataAPIClient_Tests() { _appSettings = new AppSettings(); _restClient = new DataAPIClient(); _testReference = "165992"; _testAccountno = "B5040182438 F[6CPLia"; _dataAPITestPersonId = "1"; _clientDataHelper = new ClientDataHelper(); }
public Event EditEvent(Event evnt, Boolean updateParticipantsOnly) { Event currentEvent = GetEventsInternal(new EventRequest() { EventId = evnt.EventId.ToString(), RequestorId = evnt.RequestorId.ToString() }).FirstOrDefault(); if (currentEvent == null) { throw new Exception("EventId not active."); } evnt.UpdateParticipantsOnly = updateParticipantsOnly; List <EventParticipant> UnregisteredUserList = new List <EventParticipant>(); List <EventParticipant> RegisteredTempUserList = new List <EventParticipant>(); List <EventParticipant> additionalRegisteredUsers = new List <EventParticipant>(); evnt = ParseUserList(evnt, ref UnregisteredUserList, ref additionalRegisteredUsers, ref RegisteredTempUserList); if (!evnt.UserList.Any(x => x.UserId.ToString().ToLower() == currentEvent.InitiatorId.ToString().ToLower())) { evnt.UserList.Add(new EventParticipant() { UserId = currentEvent.InitiatorId.ToString() }); } List <string> addedUserGcmList = GetAddedUserGcmList(evnt, currentEvent); List <string> removedUserGcmList = GetRemovedUserGcmList(evnt, currentEvent); List <EventParticipant> NewlyAddedTempUserList = GetAddedTempUserList(evnt, currentEvent); evnt.ParticipantUpdateAction = 1; //Setting action to Sync. if (Context.UpdateEvent(Serializer.Serialize(evnt)).SingleOrDefault().Value == 0) { throw new Exception("Failed to update event/particpants."); } Event updatedEvent = GetEventsInternal(new EventRequest() { EventId = evnt.EventId.ToString(), RequestorId = evnt.RequestorId.ToString() }).FirstOrDefault(); pushNotifier = new DefaultNotificationManager(); //send notification to registered users pushNotifier.NotifyEventUpdate(updatedEvent, removedUserGcmList); pushNotifier.NotifyAddParticipantToEvent(currentEvent, addedUserGcmList); pushNotifier.NotifyRemoveParticipantFromEvent(currentEvent, removedUserGcmList); //send notification to initiator regarding additional registered users pushNotifier.NotifyAdditionalRegisteredUserInfoToHost(additionalRegisteredUsers, updatedEvent); //send sms to unregistered users smsNotifier = new DefaultSMSNotification(); smsNotifier.sendEventInviteSMSToMultipleContactsAsync(NewlyAddedTempUserList, updatedEvent.Name, updatedEvent.InitiatorName); return(ClientDataHelper.suppressSensitiveData(updatedEvent)); }
public Event EndEvent(EventRequest eventRequest) { Event currentEvent = GetEventsInternal(new EventRequest() { EventId = eventRequest.EventId.ToString(), RequestorId = eventRequest.RequestorId.ToString() }).FirstOrDefault(); if (Context.EndEvent(Serializer.Serialize(eventRequest)).SingleOrDefault().Value == 0) { throw new Exception("Failed to end event."); } //Event updatedEvent = GetEvent(new EventRequest() { EventId = eventRequest.EventId.ToString(), RequestorId = eventRequest.RequestorId.ToString() }).FirstOrDefault(); pushNotifier = new DefaultNotificationManager(); //send notification to registered users pushNotifier.NotifyEndEvent(currentEvent); return(ClientDataHelper.suppressSensitiveData(currentEvent)); }
public RequestProcessor_Tests() { _requestProcessor = new RequestProcessor(); _clientDataHelper = new ClientDataHelper(); _dataAPIClient = new DataAPIClient(); }