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> /// 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()); } }