/// <summary> /// Notifies the ixn status. /// </summary> /// <param name="isConnected">if set to <c>true</c> [is connected].</param> /// <param name="proxyClientID">The proxy client identifier.</param> public void NotifyIXNStatus(bool isConnected, int?proxyClientID = null) { if (proxyClientID != null) { EmailDataContext.GetInstance().ProxyClientID = (int)proxyClientID; } }
private static void DataCallBack(IAsyncResult iasyncResult) { FromAddresses comboBoxItem; if (iasyncResult != null && iasyncResult.AsyncState == null) { var icollection = EmailDataContext.GetInstance().ConfigurationServer.EndRetrieveMultipleObjects <CfgEnumeratorValue>(iasyncResult); foreach (CfgEnumeratorValue enumerator in icollection) { if (enumerator.State == CfgObjectState.CFGEnabled) { comboBoxItem = new FromAddresses(); comboBoxItem.Content = enumerator.DisplayName; comboBoxItem.Tag = enumerator.Name; comboBoxItem.ToolTip = enumerator.Description; if (enumerator.IsDefault == CfgFlag.CFGTrue) { comboBoxItem.IsSelected = true; } else { comboBoxItem.IsSelected = false; } EmailDataContext.GetInstance().MailBox.Add(comboBoxItem); } } EmailDataContext.GetInstance().isFromAddressPopulated = true; if (OnFromAddressChanged != null) { OnFromAddressChanged.Invoke(); } } }
/// <summary> /// Handles the Click event of the btnReject 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 btnReject_Click(object sender, RoutedEventArgs e) { if (isOnHandling) { return; } isOnHandling = true; try { //EmailNotifier.needPerformAccept = false; HideWidow(); if (emailAutoAnswerThread != null) { emailAutoAnswerThread.Abort(); } InteractionService interactionService = new InteractionService(); Pointel.Interactions.Core.Common.OutputValues result = interactionService.RejectInteraction(eventInvite.TicketId, eventInvite.Interaction.InteractionId, eventInvite.ProxyClientId, eventInvite.Interaction.InteractionUserData); if (result.MessageCode == "200") { if (EmailDataContext.GetInstance().MessageToClientEmail != null) { EmailDataContext.GetInstance().MessageToClientEmail.PluginInteractionStatus(PluginType.Workbin, IXNState.Closed, false); } } } catch (Exception ex) { logger.Error("Error occurred as +" + ex.ToString()); } isOnHandling = false; }
public void NotifyVoiceMediaStatus(bool isVoiceEnabled) { EmailDataContext.GetInstance().IsVoiceMediaEnabled = isVoiceEnabled; if (EmailInteractionListener.VoiceStatusNotification != null) { EmailInteractionListener.VoiceStatusNotification.Invoke(isVoiceEnabled); } }
/// <summary> /// Hides the widow. /// </summary> private void HideWidow() { EmailDataContext.GetInstance().isNotifyShowing = false; objiNotifier = null; StopTone(); base.stayOpenTimer.Stop(); base.DisplayState = Pointel.TaskbarNotifier.TaskbarNotifier.DisplayStates.Hiding; this.Visibility = System.Windows.Visibility.Hidden; this.ForceHidden(); }
/// <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> /// Initializes the email. /// </summary> /// <param name="confObject">The conf object.</param> /// <param name="listener">The listener.</param> /// <param name="mediaPlugins">The media plugins.</param> /// <param name="agentInfo">The agent information.</param> public void InitializeEmail(Genesyslab.Platform.ApplicationBlocks.ConfigurationObjectModel.ConfService confObject, IPluginCallBack listener, Dictionary <string, string> agentInfo) { LoadNotifier(); if (agentInfo.Keys.Contains("UserName")) { EmailDataContext.GetInstance().Username = agentInfo["UserName"]; } if (agentInfo.Keys.Contains("Place")) { EmailDataContext.GetInstance().PlaceName = agentInfo["Place"]; } ; if (agentInfo.Keys.Contains("EmployeeID")) { EmailDataContext.GetInstance().AgentID = agentInfo["EmployeeID"]; } if (agentInfo.Keys.Contains("ApplicationName")) { EmailDataContext.GetInstance().ApplicationName = agentInfo["ApplicationName"]; } if (agentInfo.Keys.Contains("TenantDBID")) { EmailDataContext.GetInstance().TenantDbId = Convert.ToInt32(agentInfo["TenantDBID"]); } if (agentInfo.Keys.Contains("ProxyClientID")) { EmailDataContext.GetInstance().ProxyClientID = Convert.ToInt32(agentInfo["ProxyClientID"]); } EmailDataContext.GetInstance().MessageToClientEmail = listener; EmailDataContext.GetInstance().ConfigurationServer = confObject; //Implemented the thread call to read configuaration details. //Thread configurationThread = new Thread(new ThreadStart(ApplicationUtil.ApplicationReader.ReadConfigurationData)); //configurationThread.Start(); //Normal method call to read configuaration details. // ApplicationUtil.ApplicationReader.ReadConfigurationData(); // GetFromAddressfromPopClient(); //ThreadPool.QueueUserWorkItem(new WaitCallback(delegate(object state) { _chatListener.Chat_Session(output2.RequestJoinIMessage, interactionId, _taskbarNotifier); }), null); var thread = new Thread(() => { Pointel.Interactions.Email.Helper.EmailServerDetails.GetFromAddress(); }); thread.Start(); }
/// <summary> /// Shows the email notifier. /// </summary> /// <param name="message">The message.</param> public void ShowEmailNotifier(EventInvite message) { System.Windows.Application.Current.Dispatcher.Invoke((Action)(delegate { try { _taskbarNotifier.PlayTone(); _taskbarNotifier.BindInfo(message); _taskbarNotifier.SetInitialLocations(false); _taskbarNotifier.Notify(0, false); EmailDataContext.GetInstance().isNotifyShowing = true; } catch (Exception ex) { logger.Error("Error occurred as " + ex.Message); } })); }
/// <summary> /// Reads the application level server details. /// </summary> /// <param name="applicationName">Name of the application.</param> /// <returns>CfgApplication.</returns> private static CfgApplication ReadApplicationLevelServerDetails(string applicationName) { Pointel.Logger.Core.ILog logger = Pointel.Logger.Core.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, "AID"); CfgApplication application = null; try { application = new CfgApplication(EmailDataContext.GetInstance().ConfigurationServer); CfgApplicationQuery queryApp = new CfgApplicationQuery(); queryApp.Name = applicationName; application = EmailDataContext.GetInstance().ConfigurationServer.RetrieveObject <CfgApplication>(queryApp); } catch (Exception generalException) { logger.Error("Error Occurred while reading : ReadApplicationLevelServerDetails() " + applicationName + "=" + generalException.ToString()); } return(application); }
/// <summary> /// Notifies the state of the contact server. /// </summary> /// <param name="isOpen">if set to <c>true</c> [is open].</param> public void NotifyContactServerState(bool isOpen = false) { try { Application.Current.Dispatcher.BeginInvoke((Action)(delegate { EmailDataContext.GetInstance().IsContactServerActive = isOpen; if (EmailInteractionListener.ContactServerNotificationHandler != null) { EmailInteractionListener.ContactServerNotificationHandler.Invoke(); } }), DispatcherPriority.ContextIdle, new object[0]); } catch (Exception ex) { Thread.Sleep(1000); NotifyContactServerState(isOpen); logger.Error("Error in NotifyContactServerState :" + ex.Message); } }
/// <summary> /// Gets from address. /// </summary> /// <returns>List<System.String></returns> public static void GetFromAddress() { Pointel.Logger.Core.ILog logger = Pointel.Logger.Core.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, "AID"); try { // Get Email Server Application Name string emailServerAddress = (ConfigContainer.Instance().AllKeys.Contains("email.from-address") ? (string)ConfigContainer.Instance().GetValue("email.from-address") : string.Empty); if (string.IsNullOrEmpty(emailServerAddress) || emailServerAddress.ToLower().Trim().Equals("$emailserver$")) { getEmailIDsFromConnectionTab(EmailDataContext.GetInstance().ApplicationName); } else { getEmailIDsFromBussinessAttribute(ConfigContainer.Instance().GetAsString("email.from-address")); } logger.Info(emailServerAddress); } catch (Exception ex) { logger.Error("Error Occurred while reading : GetFromAddress() " + ex.ToString()); } }
/// <summary> /// Gets the email ids from bussiness attribute. /// </summary> /// <param name="applicationName">Name of the application.</param> private static void getEmailIDsFromBussinessAttribute(string applicationName) { Pointel.Logger.Core.ILog logger = Pointel.Logger.Core.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, "AID"); EmailDataContext.GetInstance().MailBox = new List <FromAddresses>(); try { CfgEnumeratorQuery businessAttributeQuery = new CfgEnumeratorQuery(); businessAttributeQuery.Name = applicationName; businessAttributeQuery.TenantDbid = ConfigContainer.Instance().TenantDbId; var businessAttribute = EmailDataContext.GetInstance().ConfigurationServer.RetrieveObject <CfgEnumerator>(businessAttributeQuery); if (businessAttribute != null) { CfgEnumeratorValueQuery attributeValuesQuery = new CfgEnumeratorValueQuery(); attributeValuesQuery.EnumeratorDbid = businessAttribute.DBID; EmailDataContext.GetInstance().ConfigurationServer.BeginRetrieveMultipleObjects(attributeValuesQuery, DataCallBack, null); } } catch (Exception generalException) { logger.Error("Error Occurred while reading : getEmailServerFromAIDConnectionTab() " + applicationName + "=" + generalException.ToString()); } }
/// <summary> /// Handles the RowEditEnding event of the DGCaseDataInfo control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="Microsoft.Windows.Controls.DataGridRowEditEndingEventArgs"/> instance containing the event data.</param> private void DGCaseDataInfo_RowEditEnding(object sender, Microsoft.Windows.Controls.DataGridRowEditEndingEventArgs e) { try { Microsoft.Windows.Controls.DataGridRow dgRow = e.Row; if (dgRow != null) { var selectedCallData = dgRow.Item as EmailCaseData; string key = selectedCallData.Key.ToString().Trim(); string value = selectedCallData.Value.ToString().Trim(); if (!isEditDone) { isEditDone = true; if (CurrentData.ContainsKey(key)) { string originalValue = CurrentData[key].ToString(); if (value != originalValue) { KeyValueCollection caseData = new KeyValueCollection(); caseData.Add(key, value); InteractionService interactionService = new InteractionService(); Pointel.Interactions.Core.Common.OutputValues result = interactionService.UpdateCaseDataProperties(interactionId, EmailDataContext.GetInstance().ProxyClientID, caseData); if (result.MessageCode == "200") { CurrentData[key] = value; } caseData.Clear(); } } else { KeyValueCollection caseData = new KeyValueCollection(); caseData.Add(key, value); InteractionService interactionService = new InteractionService(); Pointel.Interactions.Core.Common.OutputValues result = interactionService.AddCaseDataProperties(interactionId, EmailDataContext.GetInstance().ProxyClientID, caseData); if (result.MessageCode == "200") { CurrentData.Add(key, value); } caseData.Clear(); } return; } else { if (CurrentData.ContainsKey(key)) { string originalValue = CurrentData[key].ToString(); if (value != originalValue) { CurrentData.Remove(key); CurrentData.Add(key, value); } } else { CurrentData.Add(key, value); } } ConvertUserData(); } } catch (Exception ex) { logger.Error("dgCaseInfo_RowEditEnding: " + ex.Message); } }
public void NotifyPlace(string place) { EmailDataContext.GetInstance().PlaceName = place; }
/// <summary> /// Notifies the disposition code event. /// </summary> /// <param name="mediaType">Type of the media.</param> /// <param name="data">The data.</param> public void NotifyDispositionCodeEvent(MediaTypes mediaType, DispositionData data) { try { if (mediaType == MediaTypes.Email) { if (CurrentData.ContainsKey((ConfigContainer.Instance().AllKeys.Contains("interaction.disposition.key-name") ? (string)ConfigContainer.Instance().GetValue("interaction.disposition.key-name") : string.Empty))) { if (isFirstTimeCall) { isFirstTimeCall = false; Dictionary <string, string> dispositionCode = new Dictionary <string, string>(); dispositionCode.Add(ConfigContainer.Instance().GetValue("interaction.disposition.key-name"), CurrentData[(ConfigContainer.Instance().GetValue("interaction.disposition.key-name"))]); _dispositionUC.ReLoadDispositionCodes(dispositionCode, interactionId); } else { string originalValue = CurrentData[(ConfigContainer.Instance().AllKeys.Contains("interaction.disposition.key-name") ? (string)ConfigContainer.Instance().GetValue("interaction.disposition.key-name") : string.Empty)].ToString(); if (data.DispostionCode != originalValue) { KeyValueCollection caseData = new KeyValueCollection(); caseData.Add((ConfigContainer.Instance().AllKeys.Contains("interaction.disposition.key-name") ? (string)ConfigContainer.Instance().GetValue("interaction.disposition.key-name") : string.Empty), data.DispostionCode); InteractionService service = new InteractionService(); Pointel.Interactions.Core.Common.OutputValues result = service.UpdateCaseDataProperties(interactionId, EmailDataContext.GetInstance().ProxyClientID, caseData); if (result.MessageCode == "200") { CurrentData[(ConfigContainer.Instance().AllKeys.Contains("interaction.disposition.key-name") ? (string)ConfigContainer.Instance().GetValue("interaction.disposition.key-name") : string.Empty)] = data.DispostionCode; } caseData.Clear(); } } } else { KeyValueCollection caseData = new KeyValueCollection(); caseData.Add((ConfigContainer.Instance().AllKeys.Contains("interaction.disposition.key-name") ? (string)ConfigContainer.Instance().GetValue("interaction.disposition.key-name") : string.Empty), data.DispostionCode); InteractionService service = new InteractionService(); Pointel.Interactions.Core.Common.OutputValues result = service.AddCaseDataProperties(interactionId, EmailDataContext.GetInstance().ProxyClientID, caseData); if (result.MessageCode == "200") { CurrentData.Add((ConfigContainer.Instance().AllKeys.Contains("interaction.disposition.key-name") ? (string)ConfigContainer.Instance().GetValue("interaction.disposition.key-name") : string.Empty), data.DispostionCode); } caseData.Clear(); } if (CurrentData.ContainsKey((ConfigContainer.Instance().AllKeys.Contains("interaction.disposition-collection.key-name") ? (string)ConfigContainer.Instance().GetValue("interaction.disposition-collection.key-name") : string.Empty))) { string originalValue = CurrentData[(ConfigContainer.Instance().AllKeys.Contains("interaction.disposition-collection.key-name") ? (string)ConfigContainer.Instance().GetValue("interaction.disposition-collection.key-name") : string.Empty)].ToString(); if (data.DispostionCode != originalValue) { string result = string.Join("; ", data.DispostionCollection.Select(x => string.Format("{0}:{1}", x.Key, x.Value)).ToArray()); KeyValueCollection caseData = new KeyValueCollection(); caseData.Add((ConfigContainer.Instance().AllKeys.Contains("interaction.disposition-collection.key-name") ? (string)ConfigContainer.Instance().GetValue("interaction.disposition-collection.key-name") : string.Empty), result); InteractionService service = new InteractionService(); Pointel.Interactions.Core.Common.OutputValues output = service.UpdateCaseDataProperties(interactionId, EmailDataContext.GetInstance().ProxyClientID, caseData); if (output.MessageCode == "200") { CurrentData[(ConfigContainer.Instance().AllKeys.Contains("interaction.disposition-collection.key-name") ? (string)ConfigContainer.Instance().GetValue("interaction.disposition-collection.key-name") : string.Empty)] = result; } caseData.Clear(); } } else { KeyValueCollection caseData = new KeyValueCollection(); string result = string.Join("; ", data.DispostionCollection.Select(x => string.Format("{0}:{1}", x.Key, x.Value)).ToArray()); caseData.Add((ConfigContainer.Instance().AllKeys.Contains("interaction.disposition-collection.key-name") ? (string)ConfigContainer.Instance().GetValue("interaction.disposition-collection.key-name") : string.Empty), result); InteractionService service = new InteractionService(); Pointel.Interactions.Core.Common.OutputValues output = service.AddCaseDataProperties(interactionId, EmailDataContext.GetInstance().ProxyClientID, caseData); if (output.MessageCode == "200") { CurrentData.Add((ConfigContainer.Instance().AllKeys.Contains("interaction.disposition-collection.key-name") ? (string)ConfigContainer.Instance().GetValue("interaction.disposition-collection.key-name") : string.Empty), result); } caseData.Clear(); } ConvertUserData(); } } catch (Exception generalException) { logger.Error("Error occurred as " + generalException.ToString()); } }
/// <summary> /// Gets the email server from aid connection tab. /// </summary> /// <param name="applicationName">Name of the application.</param> /// <returns>System.String.</returns> private static void getEmailIDsFromConnectionTab(string applicationName) { Pointel.Logger.Core.ILog logger = Pointel.Logger.Core.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, "AID"); EmailDataContext.GetInstance().MailBox = new List <FromAddresses>(); FromAddresses comboBoxItem; try { CfgApplication application = ReadApplicationLevelServerDetails(applicationName); if (application != null && application.AppServers != null && application.AppServers.Count != 0) { //Get Interaction Server Name from AID connections Tab. foreach (CfgConnInfo appDetails in application.AppServers) { if (appDetails.AppServer.Type == CfgAppType.CFGInteractionServer) { CfgApplication ixnApp = ReadApplicationLevelServerDetails(appDetails.AppServer.Name.ToString()); if (ixnApp != null && ixnApp.AppServers != null && ixnApp.AppServers.Count != 0) { //Get Email Server Name from Interaction connections Tab. foreach (CfgConnInfo ixnappDetail in ixnApp.AppServers) { if (ixnappDetail.AppServer.Type == CfgAppType.CFGEmailServer) { //Read application keys and values CfgApplication applicationObject = ReadApplicationLevelServerDetails(ixnappDetail.AppServer.Name.ToString().Trim()); if (applicationObject != null && applicationObject.Options.Keys.Count > 0) { // Get sections from Email Server foreach (string section in applicationObject.Options.AllKeys) { if (section.Contains("pop-client")) { comboBoxItem = new FromAddresses(); KeyValueCollection kvpPopClient = (KeyValueCollection)applicationObject.Options[section]; if (kvpPopClient != null && kvpPopClient.Keys.Count > 0 && kvpPopClient.AllKeys.Contains("address") && !string.IsNullOrEmpty(kvpPopClient["address"].ToString())) { comboBoxItem.Tag = kvpPopClient["address"].ToString(); comboBoxItem.Content = kvpPopClient["address"].ToString(); comboBoxItem.ToolTip = kvpPopClient["address"].ToString(); comboBoxItem.IsSelected = false; var getCount = EmailDataContext.GetInstance().MailBox.Where(x => x.Tag.ToString() == kvpPopClient["address"].ToString()); if (getCount.Count() <= 0) { EmailDataContext.GetInstance().MailBox.Add(comboBoxItem); } } } } } EmailDataContext.GetInstance().isFromAddressPopulated = true; } } } } } } } catch (Exception generalException) { logger.Error("Error Occurred while reading : getEmailServerFromAIDConnectionTab() " + applicationName + "=" + generalException.ToString()); } }
/// <summary> /// Handles the Click event of the btnUpdate 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 btnUpdate_Click(object sender, RoutedEventArgs e) { try { isEditDone = true; DGCaseDataInfo.CancelEdit(); var selectedCallData = DGCaseDataInfo.SelectedItem as EmailCaseData; string key = selectedCallData.Key; string value = selectedCallData.Value; if (CurrentData.ContainsKey(key)) { string originalValue = CurrentData[key].ToString(); if (value != originalValue) { KeyValueCollection caseData = new KeyValueCollection(); caseData.Add(key, value); InteractionService interactionService = new InteractionService(); Pointel.Interactions.Core.Common.OutputValues result = interactionService.UpdateCaseDataProperties(interactionId, EmailDataContext.GetInstance().ProxyClientID, caseData); if (result.MessageCode == "200") { CurrentData[key] = value; } caseData.Clear(); } } else { KeyValueCollection caseData = new KeyValueCollection(); caseData.Add(key, value); InteractionService interactionService = new InteractionService(); Pointel.Interactions.Core.Common.OutputValues result = interactionService.AddCaseDataProperties(interactionId, EmailDataContext.GetInstance().ProxyClientID, caseData); if (result.MessageCode == "200") { CurrentData.Add(key, value); } caseData.Clear(); } editingValue = editingKey = null; // BindGrid(); } catch (Exception commonException) { logger.Error("Error ocurred as " + commonException.Message); } }