public void NotifyEndEvent(EventSlim evt)
 {
     _taskQueue.Enqueue(new
     {
         RegistrationIds = evt.UserList.Where(user =>
                                              !_isRequester(user.UserId, evt.InitiatorId.ToString()) &&
                                              _isValidGCMId(user.GCMClientId)).Select(user => user.GCMClientId),
         NotificationData = PushMessageComposer.GetMessage(evt, "EventEnd")
     });
 }
 public void NotifyAddParticipantToEvent(EventSlim evt, List <string> adddedParticipantGcms)
 {
     if (adddedParticipantGcms.Count != 0)
     {                //Notify newly added users of event invitation
         _taskQueue.Enqueue(new
         {
             RegistrationIds  = adddedParticipantGcms.Where(user => _isValidGCMId(user)),
             NotificationData = PushMessageComposer.GetMessage(evt, "EventInvite")
         });
     }
 }
 public void NotifyRemoveParticipantFromEvent(EventSlim evt, List <string> removedParticipantGcms)
 {
     if (removedParticipantGcms.Count != 0)
     {
         _taskQueue.Enqueue(new
         {
             RegistrationIds  = removedParticipantGcms.Where(user => _isValidGCMId(user)),
             NotificationData = PushMessageComposer.GetMessage(evt, "RemovedFromEvent")
         });
     }
 }
 public static PushNotification GetMessage(EventSlim evt, string notificationType)
 {
     return(new PushNotification()
     {
         EventId = evt.EventId.ToString(),
         EventName = evt.Name,
         Type = notificationType, //"EventInvite",
         InitiatorId = evt.InitiatorId.ToString(),
         InitiatorName = evt.InitiatorName
     });
 }
 public void NotifyEventUpdateParticipants(EventSlim evt, List <string> removedParticipantsGcms)
 {
     _taskQueue.Enqueue(new
     {
         RegistrationIds = evt.UserList.Where(user =>
                                              !_isRequester(user.UserId, evt.InitiatorId.ToString()) &&
                                              !_isParticipantRemoved(removedParticipantsGcms, user.GCMClientId) &&
                                              _isValidGCMId(user.GCMClientId)).Select(user => user.GCMClientId),
         NotificationData = PushMessageComposer.GetMessage(evt, "EventUpdateParticipants")
     });
 }
 //Used for event invite, event end
 public static PushNotification GetMessageForLeaveEvent(EventSlim evt, EventRequestSlim eventRequest)
 {
     return(new PushNotification()
     {
         EventId = evt.EventId.ToString(),
         EventName = evt.Name,
         Type = "EventLeave",
         EventResponderId = eventRequest.RequestorId.ToString(),
         EventResponderName = evt.UserList.Where(x => x.UserId.ToString().ToLower() == eventRequest.RequestorId.ToString().ToLower()).ToList()[0].ProfileName.ToString()
     });
 }
 public static PushNotification GetMessageForExtend(EventSlim evt, string notificationType, int extendEventDuration)
 {
     return(new PushNotification()
     {
         EventId = evt.EventId.ToString(),
         EventName = evt.Name,
         Type = notificationType, //"EventInvite",
         InitiatorId = evt.InitiatorId.ToString(),
         InitiatorName = evt.InitiatorName,
         ExtendEventDuration = extendEventDuration
     });
 }
 //Used for update event location
 public static PushNotification GetMessageForUpdateLocation(EventSlim evt, EventRequestSlim eventRequest, string notificationType)
 {
     return(new PushNotification()
     {
         EventId = evt.EventId.ToString(),
         EventName = evt.Name,
         Type = notificationType,
         InitiatorId = evt.InitiatorId.ToString(),
         InitiatorName = evt.InitiatorName,
         DestinationName = eventRequest.DestinationName
     });
 }
 //Used for event acceptance
 public static PushNotification GetMessage(EventRequestSlim eventRequest, EventSlim evt, string notificationType)
 {
     return(new PushNotification()
     {
         EventId = evt.EventId.ToString(),
         EventName = evt.Name,
         Type = notificationType, //"EventResponse",
         InitiatorId = evt.InitiatorId.ToString(),
         EventResponderId = eventRequest.RequestorId.ToString(),
         EventResponderName = evt.UserList.First(x => x.UserId.ToString().ToLower().Equals(eventRequest.RequestorId.ToLower())).ProfileName,
         EventAcceptanceStateId = eventRequest.EventAcceptanceStateId,
         TrackingAccepted = eventRequest.TrackingAccepted
     });
 }
        public void NotifyAdditionalRegisteredUserInfoToHost(List <EventParticipantSlim> additionalRegisteredUsers, EventSlim evt)
        {
            var registrationIds = evt.UserList.Where(user =>
                                                     _isRequester(user.UserId, evt.InitiatorId.ToString()) &&
                                                     _isValidGCMId(user.GCMClientId)).Select(user => user.GCMClientId);

            additionalRegisteredUsers.ForEach(x =>
            {
                _taskQueue.Enqueue(new { RegistrationIds = registrationIds, NotificationData = PushMessageComposer.GetMessage("RegisteredUserUpdate", x.UserId, x.MobileNumberStoredInRequestorPhone) });
            });
        }