示例#1
0
        private static CommunicationPartyDetails MapCommunicationPartyDetails(CommunicationParty communicationParty)
        {
            var details = new CommunicationPartyDetails
            {
                Name        = !string.IsNullOrEmpty(communicationParty.DisplayName) ? communicationParty.DisplayName : communicationParty.Name,
                HerId       = communicationParty.HerId,
                ParentHerId = communicationParty.ParentHerId,
                ParentName  = communicationParty.ParentName
            };

            foreach (var address in communicationParty.ElectronicAddresses)
            {
                switch (address.Type.CodeValue)
                {
                case "E_SB_ASYNC":
                    details.AsynchronousQueueName = address.Address;
                    break;

                case "E_SB_SYNC":
                    details.SynchronousQueueName = address.Address;
                    break;

                case "E_SB_ERROR":
                    details.ErrorQueueName = address.Address;
                    break;
                }
            }
            return(details);
        }
        /// <summary>
        /// Utilty method that helps us determine the name of specific queue
        /// </summary>
        /// <param name="action"></param>
        /// <returns></returns>
        protected string ResolveQueueName(Func <CommunicationPartyDetails, string> action)
        {
            if (_myDetails == null)
            {
                try
                {
                    _myDetails = Core.AddressRegistry.FindCommunicationPartyDetailsAsync(Logger, Core.Settings.MyHerId).Result;
                }
                catch (Exception ex)
                {
                    Logger.LogException("Fetching my details from address registry", ex);
                }
            }
            if (_myDetails == null)
            {
                return(null);
            }

            var queueName = action(_myDetails);

            return(string.IsNullOrEmpty(queueName) == false?Core.ExtractQueueName(queueName) : null);
        }