Example #1
0
 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);
 }
Example #2
0
        public override void DeleteAll()
        {
            base.DeleteAll();

            AggregationParties.Clear();
            UserParties.Clear();
            BotParties.Clear();
            PendingRequests.Clear();
            ConnectedParties.Clear();
        }
Example #3
0
        public virtual void DeleteAll()
        {
            AggregationParties.Clear();
            UserParties.Clear();
            BotParties.Clear();
            PendingRequests.Clear();
            ConnectedParties.Clear();
#if DEBUG
            LastMessageRouterResults.Clear();
#endif
        }
Example #4
0
        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);
        }
Example #5
0
        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);
        }
Example #6
0
 public virtual bool RemoveAggregationParty(Party party)
 {
     return(AggregationParties.Remove(party));
 }
Example #7
0
 protected override bool ExecuteRemoveAggregationParty(Party aggregationPartyToRemove)
 {
     return(AggregationParties.Remove(aggregationPartyToRemove));
 }
Example #8
0
 protected override bool ExecuteAddAggregationParty(Party aggregationPartyToAdd)
 {
     AggregationParties.Add(aggregationPartyToAdd);
     return(true);
 }