コード例 #1
0
        /// <summary>
        /// Changes the properties.
        /// </summary>
        /// <param name="interactionId">The interaction identifier.</param>
        /// <param name="proxyId">The proxy identifier.</param>
        /// <param name="dispositionNotes">The disposition notes.</param>
        /// <returns></returns>
        public OutputValues ChangeProperties(string interactionId, int proxyId, KeyValueCollection addedProperties, KeyValueCollection changedProperties)
        {
            OutputValues output = OutputValues.GetInstance();

            output.Message     = string.Empty;
            output.MessageCode = string.Empty;
            output.ErrorCode   = 0;
            RequestChangeProperties requestChangeProperties = RequestChangeProperties.Create();

            try
            {
                requestChangeProperties.InteractionId = interactionId;
                requestChangeProperties.ProxyClientId = proxyId;
                if (changedProperties != null)
                {
                    requestChangeProperties.ChangedProperties = changedProperties;
                }
                if (addedProperties != null)
                {
                    requestChangeProperties.AddedProperties = addedProperties;
                }
                if (Settings.InteractionProtocol != null && Settings.InteractionProtocol.State == ChannelState.Opened)
                {
                    IMessage response = Settings.InteractionProtocol.Request(requestChangeProperties);
                    if (response.Id == EventPropertiesChanged.MessageId || response.Id == EventAck.MessageId)
                    {
                        logger.Info("------------RequestChangeProperties-------------");
                        logger.Info("InteractionId  :" + interactionId);
                        logger.Info("ProxyClientId    :" + proxyId);
                        logger.Info(" RequestChangeProperties : response :" + response.ToString());
                        logger.Info("-------------------------------------------------");
                        logger.Trace(response.ToString());
                        output.MessageCode = "200";
                        output.Message     = "Change Properties Successful";
                    }
                    else
                    {
                        output.MessageCode = "2001";
                        output.Message     = "Don't Change Properties Successful";
                    }
                }
                else
                {
                    logger.Warn("ChangeProperties() : Interaction Server Protocol is Null..");
                }
            }
            catch (ProtocolException protocolException)
            {
                logger.Error("Error occurred while change properties request " + protocolException.ToString());
                output.MessageCode = "2001";
                output.Message     = protocolException.Message;
            }
            catch (Exception generalException)
            {
                logger.Error("Error occurred while change properties request " + generalException.ToString());
                output.MessageCode = "2001";
                output.Message     = generalException.Message;
            }
            return(output);
        }
コード例 #2
0
        /// <summary>
        /// Adds the case information.
        /// </summary>
        /// <param name="interactionid">The interactionid.</param>
        /// <param name="keyvalues">The keyvalues.</param>
        /// <returns></returns>
        public OutputValues AddCaseInformation(string interactionId, int proxyClientID, KeyValueCollection keyvalues)
        {
            OutputValues output = OutputValues.GetInstance();

            output.Message     = string.Empty;
            output.MessageCode = string.Empty;
            output.ErrorCode   = 0;
            try
            {
                RequestChangeProperties addedProperties = RequestChangeProperties.Create();
                addedProperties.InteractionId = interactionId;
                addedProperties.ProxyClientId = proxyClientID;
                if (keyvalues != null)
                {
                    addedProperties.AddedProperties = keyvalues;
                }
                if (Settings.InteractionProtocol != null && Settings.InteractionProtocol.State == ChannelState.Opened)
                {
                    IMessage response = Settings.InteractionProtocol.Request(addedProperties);
                    if (response.Id == EventPropertiesChanged.MessageId || response.Id == EventAck.MessageId)
                    {
                        logger.Info("------------AddCaseInformation-------------");
                        logger.Info("InteractionId  :" + interactionId);
                        logger.Info("ProxyClientId    :" + proxyClientID);
                        logger.Info(" AddCaseInformation : response :" + response.ToString());
                        logger.Info("-----------------------------------------");
                        logger.Trace(response.ToString());
                        output.MessageCode = "200";
                        output.Message     = "Add Case Information Successful";
                    }
                    else
                    {
                        logger.Trace(response.ToString());
                        output.MessageCode = "2001";
                        output.Message     = "Add Properties UnSuccessful";
                    }
                }
                else
                {
                    logger.Warn("AddCaseInformation() : Interaction Server Protocol is Null..");
                }
            }
            catch (Exception generalException)
            {
                logger.Error("Error occurred while doing Add Case Information:" + generalException.ToString());
                output.MessageCode = "2001";
                output.Message     = generalException.Message;
            }
            return(output);
        }
コード例 #3
0
        public OutputValues TransferInteractiontoQueue(int proxyClientId, string interactionID, string queueName)
        {
            OutputValues output = OutputValues.GetInstance();

            try
            {
                RequestChangeProperties requestChangeProperties = RequestChangeProperties.Create();
                RequestPlaceInQueue     requestPlaceInQueue     = RequestPlaceInQueue.Create();

                KeyValueCollection attachData = new KeyValueCollection();
                attachData.Add("EmailSkills", queueName);

                requestChangeProperties.ChangedProperties = attachData;
                requestChangeProperties.InteractionId     = interactionID;
                requestChangeProperties.ProxyClientId     = proxyClientId;

                requestPlaceInQueue.InteractionId   = interactionID;
                requestPlaceInQueue.Queue           = queueName;
                requestPlaceInQueue.ProxyClientId   = proxyClientId;
                requestPlaceInQueue.AddedProperties = attachData;

                if (Settings.InteractionProtocol != null && Settings.InteractionProtocol.State == ChannelState.Opened)
                {
                    IMessage message = Settings.InteractionProtocol.Request(requestPlaceInQueue);
                    if (message != null)
                    {
                        switch (message.Id)
                        {
                        case EventAck.MessageId:
                            EventAck eventAck = (EventAck)message;
                            logger.Info("------------Transfer Interaction By Queue-------------");
                            logger.Info("InteractionId  :" + interactionID);
                            logger.Info("ProxyClientId    :" + proxyClientId);
                            logger.Info("QueueName    :" + queueName);
                            logger.Info("--------------------------------------------");
                            logger.Trace(eventAck.ToString());
                            output.MessageCode = "200";
                            output.Message     = "Transfer interaction Successful";
                            break;

                        case EventError.MessageId:
                            EventError eventError = (EventError)message;
                            logger.Info("------------Error on Transfer Interaction By Queue-------------");
                            logger.Info("InteractionId  :" + interactionID);
                            logger.Info("ProxyClientId    :" + proxyClientId);
                            logger.Info("QueueName    :" + queueName);
                            logger.Info("--------------------------------------------");
                            logger.Trace(eventError.ToString());
                            output.MessageCode = "2001";
                            output.Message     = Convert.ToString(eventError.ErrorDescription);
                            logger.Error("Error occurred while transferring  interaction : " + Convert.ToString(eventError.ErrorDescription));
                            break;
                        }
                    }
                    else
                    {
                        output.MessageCode = "2001";
                        output.Message     = "Transfer Interaction UnSuccessful";
                    }
                    Settings.InteractionProtocol.Send(requestPlaceInQueue);
                    logger.Info("------------Transfer Interaction By Queue-------------");
                    logger.Info("InteractionId  :" + interactionID);
                    logger.Info("ProxyClientId    :" + proxyClientId);
                    logger.Info("QueueName    :" + queueName);
                    logger.Info("--------------------------------------------");
                    logger.Info(requestChangeProperties.ToString());
                    logger.Info(requestPlaceInQueue.ToString());
                }
                else
                {
                    logger.Warn("TransferInteractiontoQueue() : Interaction Server protocol is Null..");
                }
            }
            catch (Exception generalException)
            {
                logger.Error("Error occurred while transfer the interaction" + generalException.ToString());
                output.MessageCode = "2001";
                output.Message     = generalException.Message;
            }
            return(output);
        }