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 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 AddParticipants(Event evnt) { Event currentEvent = GetEventsInternal(new EventRequest() { EventId = evnt.EventId.ToString(), RequestorId = evnt.RequestorId.ToString() }).FirstOrDefault(); 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); List <EventParticipant> NewlyAddedTempUserList = GetAddedTempUserList(evnt, currentEvent); evnt.UpdateParticipantsOnly = true; evnt.ParticipantUpdateAction = 2; //setting update participant action to Add if (Context.UpdateEvent(Serializer.Serialize(evnt)).SingleOrDefault().Value == 0) { throw new Exception("Failed to Add event particpants."); } List <string> adddedParticipantGcms = 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.NotifyAddParticipantToEvent(updatedEvent, adddedParticipantGcms); //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)); }