public IHttpActionResult SearchGroups([FromUri] int[] groupTypeIds, [FromUri(Name = "s")] string keywords = null, [FromUri(Name = "loc")] string location = null, [FromUri(Name = "id")] int?groupId = null) { try { var result = _groupToolService.SearchGroups(groupTypeIds, keywords, location, groupId); if (result == null || !result.Any()) { return(RestHttpActionResult <List <GroupDTO> > .WithStatus(HttpStatusCode.NotFound, new List <GroupDTO>())); } // Analytics call var props = new EventProperties(); props.Add("Keywords", keywords); props.Add("Location", location); _analyticsService.Track("Anonymous", "SearchedForGroup", props); return(Ok(result)); } catch (Exception ex) { var apiError = new ApiErrorDto("Error searching for group", ex); throw new HttpResponseException(apiError.HttpResponseMessage); } }
public void Track(string userId, string eventName) { EventProperties props = new EventProperties(); props.Add("Source", "CrossroadsNet"); AnalyticsAstronomer.Track(userId, eventName, props); }
public EventModel(ThingModel thing) : this() { _thing = thing; this.PartitionKey = thing.PartitionKey; this.RowKey = Guid.NewGuid().ToString("N"); EventProperties.Add("Id", thing.Id); EventProperties.Add("EventType", EventType.Change.ToString()); // Set the default type if (!string.IsNullOrWhiteSpace(thing.Agent)) { EventProperties.Add("Agent", thing.Agent); } }
private void SetProperProperty(string key, object value) { switch (key.ToLower()) { default: if (EventProperties.ContainsKey(key)) { EventProperties[key] = value as string; } else { EventProperties.Add(key, value as string); } break; } }
public EventModel(ThingModel thing, EventType type) : this(thing) { EventProperties["EventType"] = type.ToString(); switch (type) { case EventType.Change: break; case EventType.Add: break; case EventType.Delete: break; case EventType.Message: EventProperties.Add("EventMessage", string.Empty); // Add if this is a message break; default: break; } }
public void SendAllGroupLeadersEmail(string token, int groupId, GroupMessageDTO message) { var requestor = _participantRepository.GetParticipantRecord(token); var requestorContact = _contactRepository.GetContactById(requestor.ContactId); var group = _groupService.GetGroupDetails(groupId); var fromContact = new MpContact { ContactId = _defaultGroupContactEmailId, EmailAddress = "*****@*****.**" }; var replyToContact = new MpContact { ContactId = requestor.ContactId, EmailAddress = requestor.EmailAddress }; var leaders = @group.Participants. Where(groupParticipant => groupParticipant.GroupRoleId == _groupRoleLeaderId). Select(groupParticipant => new MpContact { ContactId = groupParticipant.ContactId, EmailAddress = groupParticipant.Email, LastName = groupParticipant.LastName, Nickname = groupParticipant.NickName }).ToList(); var fromString = "<p><i>This email was sent from: " + requestorContact.Nickname + " " + requestorContact.Last_Name + " (" + requestor.EmailAddress + ")</i></p>"; var toString = "<p><i>This email was sent to: "; foreach (var leader in leaders) { toString += leader.Nickname + " " + leader.LastName + " (" + leader.EmailAddress + "), "; RecordConnectInteraction(groupId, requestor.ContactId, leader.ContactId, _connectCommunicationTypeEmailSmallGroupLeader, _connectCommunicationStatusNA); } char[] trailingChars = { ',', ' ' }; toString = toString.TrimEnd(trailingChars); toString += "</i></p>"; var email = new MpCommunication { EmailBody = fromString + "<p>" + message.Body + "</p>" + toString, EmailSubject = $"Crossroads Group {@group.GroupName}: {message.Subject}", AuthorUserId = _defaultAuthorUserId, DomainId = _domainId, FromContact = fromContact, ReplyToContact = replyToContact, ToContacts = leaders }; _communicationRepository.SendMessage(email); var props = new EventProperties(); props.Add("GroupName", group.GroupName); props.Add("GroupLeaderName", leaders[0].Nickname); _analyticsService.Track(requestor.ContactId.ToString(), "GroupLeaderContacted", props); }