public virtual bool IsAssociatedWithAggregation(Party party) { return(party != null && AggregationParties != null && AggregationParties.Count() > 0 && AggregationParties.Where(aggregationParty => aggregationParty.ConversationAccount.Id == party.ConversationAccount.Id && aggregationParty.ServiceUrl == party.ServiceUrl && aggregationParty.ChannelId == party.ChannelId).Count() > 0); }
public override void DeleteAll() { base.DeleteAll(); AggregationParties.Clear(); UserParties.Clear(); BotParties.Clear(); PendingRequests.Clear(); ConnectedParties.Clear(); }
public virtual void DeleteAll() { AggregationParties.Clear(); UserParties.Clear(); BotParties.Clear(); PendingRequests.Clear(); ConnectedParties.Clear(); #if DEBUG LastMessageRouterResults.Clear(); #endif }
public virtual bool AddAggregationParty(Party party) { if (party != null) { if (party.ChannelAccount != null) { throw new ArgumentException("Aggregation party cannot contain a channel account"); } if (!AggregationParties.Contains(party)) { AggregationParties.Add(party); return(true); } } return(false); }
public virtual MessageRouterResult AddPendingRequest(Party party) { MessageRouterResult result = new MessageRouterResult() { ConversationClientParty = party }; if (party != null) { if (PendingRequests.Contains(party)) { result.Type = MessageRouterResultType.ConnectionAlreadyRequested; } else { if (!AggregationParties.Any() && Convert.ToBoolean(ConfigurationManager.AppSettings[MessageRouterManager.RejectPendingRequestIfNoAggregationChannelAppSetting])) { result.Type = MessageRouterResultType.NoAgentsAvailable; } else { if (party is PartyWithTimestamps) { (party as PartyWithTimestamps).ConnectionRequestTime = DateTime.UtcNow; } PendingRequests.Add(party); result.Type = MessageRouterResultType.ConnectionRequested; } } } else { result.Type = MessageRouterResultType.Error; result.ErrorMessage = "The given party instance is null"; } return(result); }
public virtual bool RemoveAggregationParty(Party party) { return(AggregationParties.Remove(party)); }
protected override bool ExecuteRemoveAggregationParty(Party aggregationPartyToRemove) { return(AggregationParties.Remove(aggregationPartyToRemove)); }
protected override bool ExecuteAddAggregationParty(Party aggregationPartyToAdd) { AggregationParties.Add(aggregationPartyToAdd); return(true); }