Exemplo n.º 1
0
        /// <summary>
        /// Reads the name of the contact.
        /// </summary>
        public void ReadContactName()
        {
            try
            {
                string contactId = eventInvite.Interaction.InteractionUserData.Contains("ContactId") ?
                                   eventInvite.Interaction.InteractionUserData["ContactId"].ToString() : string.Empty;
                if (!string.IsNullOrEmpty(contactId) && EmailDataContext.GetInstance().IsContactServerActive)
                {
                    List <string> attributeList = new List <string>();
                    attributeList.Add("FirstName");
                    attributeList.Add("LastName");

                    EventGetAttributes eventGetAttribute = ContactServerHelper.RequestGetContactAttribute(contactId, attributeList);
                    if (eventGetAttribute != null)
                    {
                        List <AttributesHeader> attributeHeader = eventGetAttribute.Attributes.Cast <AttributesHeader>().ToList();
                        int count = attributeHeader.Count;
                        contactName = string.Empty;
                        if (attributeHeader.Where(x => x.AttrName.Equals("FirstName")).ToList().Count > 0)
                        {
                            AttributesHeader firstNameHeader = attributeHeader.Where(x => x.AttrName.Equals("FirstName")).SingleOrDefault();
                            if (firstNameHeader != null && firstNameHeader.AttributesInfoList.Count > 0)
                            {
                                contactName += FirstName = firstNameHeader.AttributesInfoList[0].AttrValue.ToString() + " ";
                            }
                        }
                        if (attributeHeader.Where(x => x.AttrName.Equals("LastName")).ToList().Count > 0)
                        {
                            AttributesHeader LastNameHeader = attributeHeader.Where(x => x.AttrName.Equals("LastName")).SingleOrDefault();
                            if (LastNameHeader != null && LastNameHeader.AttributesInfoList.Count > 0)
                            {
                                contactName += LastName = LastNameHeader.AttributesInfoList[0].AttrValue.ToString();
                            }
                        }
                    }
                }
                if (string.IsNullOrEmpty(contactName))
                {
                    contactName = getContactName(eventInvite.Interaction.InteractionUserData);
                    if (string.IsNullOrEmpty(contactName))
                    {
                        contactName = "Undefined";
                    }
                }
                emailDetails.TitleText = contactName + " - Agent Interaction Desktop";
            }
            catch (Exception ex)
            {
                logger.Error("Error occurred as " + ex.Message);
            }
        }
 /// <summary>
 /// Handles the Click event of the btnSaveNote control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param>
 private void btnSaveNote_Click(object sender, RoutedEventArgs e)
 {
     notes = txtNotes.Text;
     ContactServerHelper.UpdateInteraction(this.interactionId, ConfigContainer.Instance().PersonDbId, notes, null, 2, null);
 }