/// <summary>
 /// Gets Email interaction Content
 /// </summary>
 /// <param name="ixnId"></param>
 /// <returns></returns>
 public string GetEmailInteractionContent(string ixnId, string type)
 {
     try
     {
         this._logger.Info("Retrieving email Content for the IXN Id : " + ixnId);
         EventGetInteractionContent emailContent = Settings.SFDCListener.GetOpenMediaInteractionContent(ixnId, false);
         if (emailContent != null)
         {
             if (type.Equals("subject") && !String.IsNullOrEmpty(emailContent.InteractionContent.Text))
             {
                 return(emailContent.InteractionContent.Text);
             }
             else if (type.Equals("to") && emailContent.InteractionAttributes != null && emailContent.InteractionAttributes.AllAttributes != null && emailContent.InteractionAttributes.AllAttributes.ContainsKey("To"))
             {
                 return(emailContent.InteractionAttributes.AllAttributes.GetAsString("To"));
             }
             else if (type.Equals("type") && emailContent.InteractionAttributes != null && emailContent.InteractionAttributes.SubtypeId != null)
             {
                 return(emailContent.InteractionAttributes.SubtypeId);
             }
         }
         else
         {
             this._logger.Error("Null Response received from UCS..");
         }
     }
     catch (Exception generalException)
     {
         this._logger.Error("GetEmailInteractionContent : Error occurred at :" + generalException.ToString());
     }
     return(string.Empty);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="InboundUserControl"/> class.
 /// </summary>
 /// <param name="_eventInvite">The _event invite.</param>
 /// <param name="eventGetInteractionContent">Content of the event get interaction.</param>
 public InboundUserControl(EventInvite _eventInvite, EventGetInteractionContent eventGetInteractionContent)
 {
     try
     {
         InitializeComponent();
         dockCc.Visibility  = Visibility.Collapsed;
         dockBcc.Visibility = Visibility.Collapsed;
         if (_eventInvite.Interaction.InteractionUserData.Contains("Subject") &&
             !string.IsNullOrEmpty(_eventInvite.Interaction.InteractionUserData["Subject"].ToString()))
         {
             txtInboundSubject.ToolTip = txtInboundSubject.Text = _eventInvite.Interaction.InteractionUserData["Subject"].ToString();
         }
         else
         {
             txtInboundSubject.ToolTip = txtInboundSubject.Text = "(No Subject)";
         }
         if (_eventInvite.Interaction.InteractionUserData.Contains("To"))
         {
             txtInboundTo.Text = Pointel.Interactions.Email.Helper.EmailAddressValidation.GetEmailAddress(_eventInvite.Interaction.InteractionUserData["To"].ToString());
         }
         if (_eventInvite.Interaction.InteractionUserData.Contains("FromAddress"))
         {
             txtInboundFrom.Text = Pointel.Interactions.Email.Helper.EmailAddressValidation.GetEmailAddress(_eventInvite.Interaction.InteractionUserData["FromAddress"].ToString());
         }
         BindContent(eventGetInteractionContent);
     }
     catch (Exception ex)
     {
         logger.Error("Error occurred at InboundUserControl constructor" + ex.ToString());
     }
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="InboundUserControl"/> class.
 /// </summary>
 /// <param name="userData">The user data.</param>
 /// <param name="eventGetInteractionContent">Content of the event get interaction.</param>
 public InboundUserControl(KeyValueCollection userData, EventGetInteractionContent eventGetInteractionContent)
 {
     try
     {
         InitializeComponent();
         if (userData.Contains("Subject") && !string.IsNullOrEmpty(userData["Subject"].ToString()))
         {
             txtInboundSubject.Text = userData["Subject"].ToString();
         }
         else
         {
             txtInboundSubject.ToolTip = txtInboundSubject.Text = "(No Subject)";
         }
         if (userData.Contains("To"))
         {
             txtInboundTo.Text = Pointel.Interactions.Email.Helper.EmailAddressValidation.GetEmailAddress(userData["To"].ToString());
         }
         if (userData.Contains("FromAddress"))
         {
             txtInboundFrom.Text = Pointel.Interactions.Email.Helper.EmailAddressValidation.GetEmailAddress(userData["FromAddress"].ToString());
         }
         BindContent(eventGetInteractionContent);
     }
     catch (Exception ex)
     {
         logger.Error("Error occurred at InboundUserControl constructor" + ex.ToString());
     }
 }
Beispiel #4
0
        private void GetChatData(string ixnId, IXNCustomData chatData)
        {
            try
            {
                this._logger.Info("Retrieving UCS data for the InteractionId : " + ixnId + "\t EventName : " + chatData.EventName);
                EventGetInteractionContent chatContent = Settings.SFDCListener.GetOpenMediaInteractionContent(ixnId, false);
                if (chatContent != null)
                {
                    if (chatContent.InteractionAttributes.TypeId == "Inbound")
                    {
                        chatData.InteractionType = SFDCCallType.InboundChat;
                    }
                    else if (chatContent.InteractionAttributes.TypeId == "Consult")
                    {
                        chatData.InteractionType = SFDCCallType.ConsultChatReceived;
                    }

                    EventInvite currentEvent = null;
                    _chatIXNCollection.TryGetValue(ixnId, out currentEvent);
                    chatData.InteractionEvent    = currentEvent;
                    chatData.IXN_Attributes      = chatContent.InteractionAttributes;
                    chatData.EntityAttributes    = chatContent.EntityAttributes;
                    chatData.AttachmentLists     = chatContent.Attachments;
                    chatData.InteractionContents = chatContent.InteractionContent;
                    if (chatData.UserData == null)
                    {
                        chatData.UserData = chatContent.InteractionAttributes.AllAttributes;
                    }

                    if (chatData.InteractionNotes == null && chatContent.InteractionAttributes != null)
                    {
                        chatData.InteractionNotes = chatContent.InteractionAttributes.TheComment;
                    }

                    if (!Settings.SFDCOptions.CanUseGenesysCallDuration || string.IsNullOrWhiteSpace(chatData.Duration))
                    {
                        if (_callDurationData.ContainsKey(chatData.InteractionId))
                        {
                            TimeSpan ts = System.DateTime.Now.Subtract(_callDurationData[chatData.InteractionId]);
                            chatData.Duration = ts.Hours + "Hr " + ts.Minutes + " Mins " + ts.Seconds + "Secs";
                        }
                    }
                }
                else
                {
                    this._logger.Info("GetChatData: Null is returned from UCS for the  interaction id : " + chatData.InteractionId);
                }
            }
            catch (Exception generalException)
            {
                this._logger.Info("GetChatData: Error occurred, Exception : " + generalException.ToString());
            }
        }
        /// <summary>
        /// Gets Chat interaction Content
        /// </summary>
        /// <param name="ixnId"></param>
        /// <returns></returns>
        private string GetChatInteractionContent(string ixnId)
        {
            try
            {
                this.logger.Info("GetChatInteractionContent : Retrieving Chat Content for the IXN Id : " + ixnId);

                if (Settings.AgentDetails.UCSServer != null)
                {
                    RequestGetInteractionContent ucsRequest = RequestGetInteractionContent.Create();
                    ucsRequest.InteractionId = ixnId;
                    IMessage ucsResponse = Settings.AgentDetails.UCSServer.Request(ucsRequest);
                    if (ucsResponse is Genesyslab.Platform.Contacts.Protocols.ContactServer.Events.EventError)
                    {
                        this.logger.Error("GetChatInteractionContent : Event Error Returend while requesting Chat Interaction Data with Interaction Id : " + ixnId + "\n Error Message :" + ucsResponse.ToString());
                    }
                    else
                    {
                        EventGetInteractionContent chatContent = ucsResponse as EventGetInteractionContent;
                        if (chatContent != null)
                        {
                            if (!String.IsNullOrEmpty(chatContent.InteractionContent.StructuredText))
                            {
                                return(GetFormattedChatData(chatContent.InteractionContent.StructuredText, ixnId));
                            }
                        }
                    }
                }
                else
                {
                    this.logger.Error("GetChatInteractionContent : Could not retrieve chat content because UCS Protocol is null.");
                }
            }
            catch (Exception generalException)
            {
                this.logger.Error("GetChatInteractionContent : Error occurred at :" + generalException.ToString());
            }
            return(string.Empty);
        }
        private void GetEmailData(string ixnId, IXNCustomData emailData)
        {
            try
            {
                this._logger.Info("Retrieving UCS content for the InteractionId :" + ixnId);
                EventGetInteractionContent emailContent = Settings.SFDCListener.GetOpenMediaInteractionContent(ixnId, false);
                if (emailContent != null)
                {
                    if (emailContent.InteractionAttributes.TypeId == "Inbound")
                    {
                        emailData.InteractionType = SFDCCallType.InboundEmail;
                    }
                    else if (emailContent.InteractionAttributes.TypeId == "Outbound")
                    {
                        emailData.InteractionType = SFDCCallType.OutboundEmailSuccess;
                    }

                    emailData.IXN_Attributes      = emailContent.InteractionAttributes;
                    emailData.EntityAttributes    = emailContent.EntityAttributes;
                    emailData.AttachmentLists     = emailContent.Attachments;
                    emailData.InteractionContents = emailContent.InteractionContent;
                    if (emailData.UserData == null)
                    {
                        emailData.UserData = emailContent.InteractionAttributes.AllAttributes;
                    }
                }
                else
                {
                    this._logger.Info("Null is returned from UCS");
                }
            }
            catch (Exception generalException)
            {
                this._logger.Info("Error Occurred, Exception : " + generalException.ToString());
            }
        }
        /// <summary>
        /// Binds the content.
        /// </summary>
        /// <param name="eventGetInteractionContent">Content of the event get interaction.</param>
        public void BindContent(EventGetInteractionContent eventGetInteractionContent)
        {
            try
            {
                if (eventGetInteractionContent != null)
                {
                    if (eventGetInteractionContent.InteractionAttributes.StartDate != null && eventGetInteractionContent.InteractionAttributes.StartDate.ToString() != string.Empty)
                    {
                        lblInboundDateTime.Text = eventGetInteractionContent.InteractionAttributes.StartDate.ToString();
                        lblInboundDateTime.Text = Pointel.Interactions.Email.Helper.EmailAddressValidation.GetLocalDateTime(eventGetInteractionContent.InteractionAttributes.StartDate.ToString());
                    }
                    if (eventGetInteractionContent.EntityAttributes != null)
                    {
                        EmailInEntityAttributes emailInEntityAttributes = (EmailInEntityAttributes)eventGetInteractionContent.EntityAttributes;
                        if (!string.IsNullOrEmpty(emailInEntityAttributes.CcAddresses))
                        {
                            txtInboundCc.Text = Pointel.Interactions.Email.Helper.EmailAddressValidation.GetEmailAddress(emailInEntityAttributes.CcAddresses);
                            dockCc.Visibility = Visibility.Visible;
                        }
                        else
                        {
                            dockCc.Visibility = Visibility.Collapsed;
                        }

                        if (!string.IsNullOrEmpty(emailInEntityAttributes.BccAddresses))
                        {
                            txtInboundBcc.Text = Pointel.Interactions.Email.Helper.EmailAddressValidation.GetEmailAddress(emailInEntityAttributes.BccAddresses);
                            dockBcc.Visibility = Visibility.Visible;
                        }
                        else
                        {
                            dockBcc.Visibility = Visibility.Collapsed;
                        }
                    }
                    if (eventGetInteractionContent.Attachments != null)
                    {
                        foreach (Attachment attachementDetails in eventGetInteractionContent.Attachments)
                        {
                            wrapInboundAttachments.Children.Add(LoadAttachments(attachementDetails.TheName, Convert.ToInt64(attachementDetails.TheSize.Value.ToString()), attachementDetails.DocumentId));
                            attacScroll.ScrollToTop();
                        }
                    }

                    if (!string.IsNullOrEmpty(eventGetInteractionContent.InteractionContent.StructuredText))
                    {
                        htmlEditor = new HTMLEditor(false, true, eventGetInteractionContent.InteractionContent.StructuredText);
                        //htmlEditor.Width = dockInboundContent.ActualWidth;
                        //htmlEditor.Height = dockInboundContent.ActualHeight;
                        dockInboundContent.Children.Clear();
                        dockInboundContent.Children.Add(htmlEditor);
                    }
                    else if (!string.IsNullOrEmpty(eventGetInteractionContent.InteractionContent.Text))
                    {
                        string content = eventGetInteractionContent.InteractionContent.Text.Replace("\r\n", "<br />");
                        content    = eventGetInteractionContent.InteractionContent.Text.Replace("\n", "<br />");
                        htmlEditor = new HTMLEditor(false, false, content);
                        //htmlEditor.Width = dockInboundContent.ActualWidth;
                        //htmlEditor.Height = dockInboundContent.ActualHeight;
                        dockInboundContent.Children.Clear();
                        dockInboundContent.Children.Add(htmlEditor);
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Error("Error occurred at BindContent " + ex.ToString());
            }
        }