Exemplo n.º 1
0
        /// <summary>
        /// Initialises the stat ticker.
        /// </summary>
        /// <param name="statListener">The stat listener.</param>
        public void InitialiseStatTicker()
        {
            try
            {
                Pointel.Statistics.Core.Utility.OutputValues Output = new Pointel.Statistics.Core.Utility.OutputValues();

                if (((_configContainer.AllKeys.Contains("statistics.enable-mystat-aid") &&
                      ((string)_configContainer.GetValue("statistics.enable-mystat-aid")).ToLower().Equals("true")) ||
                     (_configContainer.AllKeys.Contains("statistics.enable-ccstat-aid") &&
                      ((string)_configContainer.GetValue("statistics.enable-ccstat-aid")).ToLower().Equals("true"))))
                {
                    _logger.Debug("Window_Loaded : StatTicker Plugin Subscription Started");
                    statTickerListener = this;
                    statSubscribe.Subscribe("AID", statTickerListener);
                    _logger.Debug("Window_Loaded : StatTicker Plugin Subscriptn Completed");

                    List <CfgAgentGroup> agentGroup = new List <CfgAgentGroup>();
                    if (_configContainer.AllKeys.Contains("CfgAgentGroup"))
                    {
                        agentGroup = _configContainer.GetValue("CfgAgentGroup");
                    }
                    Output = statSubscribe.ConfigConnectionEstablish(_dataContext.ApplicationName, _configContainer.ConfServiceObject, _dataContext.UserName, _dataContext.UserName, "StatServer", agentGroup);

                    if (Output.MessageCode == "200")
                    {
                        statSubscribe.StartStatistics(_dataContext.UserName, _dataContext.ApplicationName, 0, 0, true, false);
                    }
                }
            }
            catch (Exception commonException)
            {
                _logger.Error("InitialiseStatTicker : " + commonException.Message.ToString());
            }
        }
Exemplo n.º 2
0
        /// <summary>
        ///     Handles the BeginningEdit event of the DGAttachData control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">
        ///     The <see cref="Microsoft.Windows.Controls.DataGridBeginningEditEventArgs" /> instance containing the
        ///     event data.
        /// </param>
        private void DGAttachData_BeginningEdit(object sender, Microsoft.Windows.Controls.DataGridBeginningEditEventArgs e)
        {
            var selectedCallData = e.Row.Item as CallData;

            if (selectedCallData != null)
            {
                if (selectedCallData.Value.StartsWith("http") || selectedCallData.Value.StartsWith("www"))
                {
                    e.Cancel = true;
                    if (_configContainer.AllKeys.Contains("voice.enable.attach-data-popup-url") && ((string)_configContainer.GetValue("voice.enable.attach-data-popup-url")).ToLower().Equals("true"))
                    {
                        string urlString = selectedCallData.Value.Contains("http") ? selectedCallData.Value : "http://" + selectedCallData.Value;
                        Uri    uriResult;
                        if (Uri.TryCreate(urlString, UriKind.Absolute, out uriResult) &&
                            (uriResult.Scheme == Uri.UriSchemeHttp || uriResult.Scheme == Uri.UriSchemeHttps))
                        {
                            Process.Start(uriResult.AbsoluteUri);
                        }
                    }
                }

                //Code added - hide the editable option in above key in call data datagrid
                //Smoorthy - 07-11-2013
                else if (_configContainer.AllKeys.Contains("VoiceAttachDataKey") &&
                         _configContainer.GetValue("VoiceAttachDataKey") != null)
                {
                    //ANI CallID CallType ConnID OtherDN ThisDN
                    //if (!string.IsNullOrEmpty(selectedCallData.Value))
                    //{
                    if (_isCaseDataManualBeginEdit)
                    {
                        e.Cancel = false;
                        _isCaseDataManualBeginEdit = false;
                    }
                    else if (((List <string>)_configContainer.GetValue("VoiceAttachDataKey")).Any(
                                 x =>
                                 Regex.Replace(x, @"\s+", "").ToString().Trim().ToLower() == selectedCallData.Key.ToString().Trim().ToLower()) &&
                             (_configContainer.AllKeys.Contains("voice.enable.modify-case-data") && ((string)_configContainer.GetValue("voice.enable.modify-case-data")).ToLower().Equals("true")))
                    {
                        e.Cancel = false;
                    }
                    else
                    {
                        e.Cancel = true;
                    }
                    //}
                }
                else
                {
                    e.Cancel = true;
                }
                //End
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// Mouses the left button down.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="MouseButtonEventArgs"/> instance containing the event data.</param>
 private void MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
 {
     try
     {
         this.DragMove();
         if (!(_configContainer.AllKeys.Contains("allow.system-draggable") &&
               ((string)_configContainer.GetValue("allow.system-draggable")).ToLower().Equals("true")))
         {
             if (Left < 0)
             {
                 Left = 0;
             }
             if (Top < 0)
             {
                 Top = 0;
             }
             if (Left > SystemParameters.WorkArea.Right - Width)
             {
                 Left = SystemParameters.WorkArea.Right - Width;
             }
             if (Top > SystemParameters.WorkArea.Bottom - Height)
             {
                 Top = SystemParameters.WorkArea.Bottom - Height;
             }
             ;
         }
     }
     catch { }
 }
Exemplo n.º 4
0
 /// <summary>
 ///     Mouses the left button down.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="MouseButtonEventArgs" /> instance containing the event data.</param>
 private void MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
 {
     try
     {
         if (e.ClickCount > 1)
         {
             e.Handled = true;
         }
         DragMove();
         if (!(_configContainer.AllKeys.Contains("allow.system-draggable") &&
               ((string)_configContainer.GetValue("allow.system-draggable")).ToLower().Equals("true")))
         {
             if (Left < 0)
             {
                 Left = 0;
             }
             if (Top < 0)
             {
                 Top = 0;
             }
             if (Left > SystemParameters.WorkArea.Right - Width)
             {
                 Left = SystemParameters.WorkArea.Right - Width;
             }
             if (Top > SystemParameters.WorkArea.Bottom - Height)
             {
                 Top = SystemParameters.WorkArea.Bottom - Height;
             }
         }
     }
     catch (Exception commonException)
     {
         //_logger.Warn("Error occurred as " + commonException.Message.ToString());
     }
 }
Exemplo n.º 5
0
 internal static void GetSwitchType()
 {
     if (_configContainer.AllKeys.Contains("switch-type") && _configContainer.GetValue("switch-type") != null)
     {
         var _switchQuery = new CfgSwitchQuery();
         _switchQuery.TenantDbid = _configContainer.TenantDbId;
         _switchQuery.Name       = _configContainer.GetValue("switch-type");
         try
         {
             var _switch = _configContainer.ConfServiceObject.RetrieveObject <CfgSwitch>(_switchQuery);
             if (_switch != null)
             {
                 Datacontext.GetInstance().SwitchType = _switch;
             }
             else
             {
                 _switchQuery            = new CfgSwitchQuery();
                 _switchQuery.TenantDbid = _configContainer.TenantDbId;
                 var _switchICollection = _configContainer.ConfServiceObject.RetrieveMultipleObjects <CfgSwitch>(_switchQuery);
                 foreach (CfgSwitch item in _switchICollection)
                 {
                     Datacontext.GetInstance().SwitchType = item;
                 }
             }
         }
         catch
         {
             _switchQuery            = new CfgSwitchQuery();
             _switchQuery.TenantDbid = _configContainer.TenantDbId;
             var _switchICollection = _configContainer.ConfServiceObject.RetrieveMultipleObjects <CfgSwitch>(_switchQuery);
             foreach (CfgSwitch item in _switchICollection)
             {
                 Datacontext.GetInstance().SwitchType = item;
             }
         }
         finally
         {
             if (Datacontext.GetInstance().SwitchType != null)
             {
                 _logger.Info("T-server switch type: " + Datacontext.GetInstance().SwitchType.Type.ToString());
                 Datacontext.GetInstance().SwitchName = Datacontext.GetInstance().SwitchType.Type == CfgSwitchType.CFGLucentDefinityG3 ? "avaya" : ((Datacontext.GetInstance().SwitchType.Type == CfgSwitchType.CFGNortelDMS100 || Datacontext.GetInstance().SwitchType.Type == CfgSwitchType.CFGNortelMeridianCallCenter) ? "nortel" : "avaya");
             }
         }
     }
 }
Exemplo n.º 6
0
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     try
     {
         var hwnd = new WindowInteropHelper(this).Handle;
         SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) & ~WS_SYSMENU);
         chkbxPersonalCallback.IsEnabled = false;
         dpRescheduledate.IsEnabled      = false;
         dpRescheduletime.IsEnabled      = false;
         cmbCallResult.SelectedIndex     = 0;
         _datacontext.CallResultItemSource.Clear();
         if (_configContainer.AllKeys.Contains("OutboundCallResult") && _configContainer.GetValue("OutboundCallResult") != null)
         {
             foreach (var item in ((Dictionary <string, string>)_configContainer.GetValue("OutboundCallResult")))
             {
                 _datacontext.CallResultItemSource.Add(new OutboundCallResult(item.Key.ToString(), item.Value.ToString()));
             }
         }
     }
     catch (Exception generalException)
     {
         _logger.Error("Error occurred as Window_Loaded : " + generalException.ToString());
     }
 }
Exemplo n.º 7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Notifier"/> class.
        /// </summary>
        public Notifier()
        {
            InitializeComponent();

            mediaPlayer             = new System.Windows.Media.MediaPlayer();
            mediaPlayer.MediaEnded += mediaPlayer_MediaEnded;

            bool isEnableCallReject = false;
            bool isEnableCallAccept = false;

            EventManager.RegisterClassHandler(typeof(UIElement), AccessKeyManager.AccessKeyPressedEvent, new AccessKeyPressedEventHandler(OnAccessKeyPressed));
            this.DataContext            = Datacontext.GetInstance();
            _dataContext.ErrorRowHeight = new GridLength(0);
            if (_configContainer.AllKeys.Contains("voice.enable.call-notify-reject") &&
                ((string)_configContainer.GetValue("voice.enable.call-notify-reject")).ToLower().Equals("true"))
            {
                isEnableCallReject = true;
            }

            if ((_configContainer.AllKeys.Contains("voice.enable.call-notify-accept") &&
                 ((string)_configContainer.GetValue("voice.enable.call-notify-accept")).ToLower().Equals("true")))
            {
                isEnableCallAccept = true;
            }

            if (!isEnableCallReject && isEnableCallAccept)
            {
                btnLeft.Visibility = System.Windows.Visibility.Hidden;
                btnRight.Content   = "_Accept";
                btnRight.Style     = (Style)FindResource("CallButton");
            }
            if (isEnableCallReject && !isEnableCallAccept)
            {
                btnLeft.Visibility = System.Windows.Visibility.Hidden;
                btnRight.Content   = "_Reject";
                btnRight.Style     = (Style)FindResource("RejectButton");
            }
            if (isEnableCallReject && isEnableCallAccept)
            {
                btnLeft.Visibility = System.Windows.Visibility.Visible;
                btnLeft.Content    = "_Accept";
                btnRight.Content   = "_Reject";
                btnRight.Style     = (Style)FindResource("RejectButton");
            }
            if (btnRight.Content == "_Reject")
            {
                if (string.IsNullOrEmpty(_dataContext.ThridpartyDN) || !_configContainer.AllKeys.Contains("voice.requeue.route-dn") ||
                    string.IsNullOrEmpty(_configContainer.GetValue("voice.requeue.route-dn")))
                {
                    btnRight.Visibility = System.Windows.Visibility.Hidden;
                }
            }
        }
Exemplo n.º 8
0
        /// <summary>
        /// Reads the application object.
        /// </summary>
        /// <param name="applicationName">Name of the application.</param>
        /// <returns></returns>
        public CfgApplication ReadApplicationObject(string ixnAppName)
        {
            CfgApplication application = null;

            try
            {
                string[] tServers         = ixnAppName.Split(',');
                string   primaryTserver   = string.Empty;
                string   secondaryTServer = string.Empty;
                if (tServers != null && tServers.Length > 0)
                {
                    if (!string.IsNullOrEmpty(tServers[0]))
                    {
                        Settings.PrimaryInteractionServerName = tServers[0].Trim().ToString();
                    }
                    if (tServers.Length > 1 && !string.IsNullOrEmpty(tServers[1]))
                    {
                        Settings.SecondaryInteractionServerName = tServers[1].Trim().ToString();
                    }
                }
                if (!string.IsNullOrEmpty(Settings.PrimaryInteractionServerName) && string.IsNullOrEmpty(Settings.SecondaryInteractionServerName))
                {
                    Settings.SecondaryInteractionServerName = Settings.PrimaryInteractionServerName;
                }
                else if (!string.IsNullOrEmpty(Settings.SecondaryInteractionServerName) && string.IsNullOrEmpty(Settings.PrimaryInteractionServerName))
                {
                    Settings.PrimaryInteractionServerName = Settings.SecondaryInteractionServerName;
                }

                application = new CfgApplication(ConfigContainer.Instance().ConfServiceObject);
                CfgApplicationQuery queryApp = new CfgApplicationQuery();
                queryApp.TenantDbid = WellKnownDbids.EnterpriseModeTenantDbid;
                if (!string.IsNullOrEmpty(Settings.PrimaryInteractionServerName))
                {
                    queryApp.Name = Settings.PrimaryInteractionServerName;
                }
                application = ConfigContainer.Instance().ConfServiceObject.RetrieveObject <CfgApplication>(queryApp);
                if (application != null)
                {
                    if (application.Type == CfgAppType.CFGInteractionServer)
                    {
                        Settings.PrimaryApplication           = application;
                        Settings.PrimaryInteractionServerName = Settings.PrimaryApplication.Name;
                        if (application.ServerInfo.BackupServer != null)
                        {
                            Settings.SecondaryApplication           = application.ServerInfo.BackupServer;
                            Settings.SecondaryInteractionServerName = Settings.SecondaryApplication.Name;
                        }
                        else
                        {
                            Settings.SecondaryApplication           = Settings.PrimaryApplication;
                            Settings.SecondaryInteractionServerName = Settings.PrimaryInteractionServerName;
                        }
                    }
                    else
                    {
                        Settings.PrimaryInteractionServerName   = string.Empty;
                        Settings.SecondaryInteractionServerName = string.Empty;
                        Settings.PrimaryApplication             = null;
                        Settings.SecondaryApplication           = null;
                    }

                    if (_configContainer.AllKeys.Contains("interaction.reconnect-attempts") &&
                        ((string)_configContainer.GetValue("interaction.reconnect-attempts")) != string.Empty)
                    {
                        Settings.WarmStandbyAttempts = ((string)_configContainer.GetValue("interaction.reconnect-attempts"));
                    }

                    if (_configContainer.AllKeys.Contains("interaction.reconnect-timeout") &&
                        ((string)_configContainer.GetValue("interaction.reconnect-timeout")) != string.Empty)
                    {
                        Settings.WarmStandbyTimeout = ((string)_configContainer.GetValue("interaction.reconnect-timeout"));
                    }

                    if (_configContainer.AllKeys.Contains("interaction.server-timeout") &&
                        ((string)_configContainer.GetValue("interaction.server-timeout")) != string.Empty)
                    {
                        Settings.AddpServerTimeout = ((string)_configContainer.GetValue("interaction.server-timeout"));
                    }

                    if (_configContainer.AllKeys.Contains("interaction.client-timeout") &&
                        ((string)_configContainer.GetValue("interaction.client-timeout")) != string.Empty)
                    {
                        Settings.AddpClientTimeout = ((string)_configContainer.GetValue("interaction.client-timeout"));
                    }
                }
            }
            catch (Exception commonException)
            {
                logger.Error("Error occurred while reading application object" + ixnAppName + "  =  " + commonException.ToString());
            }
            return(application);
        }
        public CfgApplication ReadApplicationObject(string tserverApplicationName, string agentLogin)
        {
            CfgApplication application = null;

            try
            {
                string[] tServers         = tserverApplicationName.Split(',');
                string   primaryTserver   = string.Empty;
                string   secondaryTServer = string.Empty;
                int      switchDBID       = 0;
                if (tServers != null && tServers.Length > 0)
                {
                    if (!string.IsNullOrEmpty(tServers[0]))
                    {
                        Settings.GetInstance().PrimaryTServerName = tServers[0].Trim().ToString();
                    }
                    if (tServers.Length > 1 && !string.IsNullOrEmpty(tServers[1]))
                    {
                        Settings.GetInstance().SecondaryTServerName = tServers[1].Trim().ToString();
                    }
                }
                if (!string.IsNullOrEmpty(Settings.GetInstance().PrimaryTServerName) && string.IsNullOrEmpty(Settings.GetInstance().SecondaryTServerName))
                {
                    Settings.GetInstance().SecondaryTServerName = Settings.GetInstance().PrimaryTServerName;
                }
                else if (!string.IsNullOrEmpty(Settings.GetInstance().SecondaryTServerName) && string.IsNullOrEmpty(Settings.GetInstance().PrimaryTServerName))
                {
                    Settings.GetInstance().PrimaryTServerName = Settings.GetInstance().SecondaryTServerName;
                }

                #region To get Correct switch
                application = new CfgApplication(_configContainer.ConfServiceObject);
                CfgApplicationQuery queryApp = new CfgApplicationQuery();
                if (!string.IsNullOrEmpty(Settings.GetInstance().PrimaryTServerName))
                {
                    queryApp.Name = Settings.GetInstance().PrimaryTServerName;
                }
                application = _configContainer.ConfServiceObject.RetrieveObject <CfgApplication>(queryApp);
                //if (application != null)
                //{
                //    var _flexibleProperties = application.FlexibleProperties;
                //    if (_flexibleProperties != null && _flexibleProperties.Count > 0)
                //    {
                //        if (_flexibleProperties.ContainsKey("CONN_INFO"))
                //        {
                //            var _connInfoCollection = _flexibleProperties["CONN_INFO"];
                //            if (_connInfoCollection != null)
                //            {
                //                var _switchCollection = (KeyValueCollection)_connInfoCollection;
                //                if (_switchCollection != null && _switchCollection.ContainsKey("CFGSwitch"))
                //                {
                //                    var _switchCollection1 = _switchCollection["CFGSwitch"];
                //                    if (_switchCollection1 != null)
                //                    {
                //                        KeyValueCollection _switchDBIds = (KeyValueCollection)_switchCollection1;
                //                        if (_switchDBIds != null && _switchDBIds.Count > 0)
                //                            foreach (string id in _switchDBIds.AllKeys)
                //                                switchDBID = Convert.ToInt32(id);
                //                    }
                //                }
                //            }
                //        }
                //    }
                //}

                //CfgAgentLoginQuery _queryAGLogin = new CfgAgentLoginQuery();
                //_queryAGLogin.LoginCode = agentLogin;
                //_queryAGLogin.TenantDbid = _configContainer.TenantDbId;
                //var agentInfo = (ICollection<CfgAgentLoginInfo>)((CfgPerson)_configContainer.GetValue("CfgPerson")).AgentInfo.AgentLogins;
                //foreach (var loginDetails in agentInfo)
                //{
                //    if (_queryAGLogin.LoginCode == loginDetails.AgentLogin.LoginCode && switchDBID == loginDetails.AgentLogin.Switch.DBID)
                //    {
                //        _queryAGLogin.Dbid = loginDetails.AgentLogin.DBID;
                //        break;
                //    }
                //}
                //CfgAgentLogin _cfgAGLogin = _configContainer.ConfServiceObject.RetrieveObject<CfgAgentLogin>(_queryAGLogin);
                //CfgApplication _cfgApplication = (_cfgAGLogin.Switch).TServer;
                //if (_cfgApplication == null)
                //    logger.Warn("The switch name " + _cfgAGLogin.Switch.Name + " does not contains T-server configurations");

                if (application != null)
                {
                    //if (application.DBID == _cfgApplication.DBID)
                    //{
                    Settings.GetInstance().PrimaryApplication = application;
                    if (Settings.GetInstance().PrimaryApplication != null)
                    {
                        Settings.GetInstance().PrimaryTServerName = Settings.GetInstance().PrimaryApplication.Name;
                    }
                    Settings.GetInstance().SecondaryApplication = application.ServerInfo.BackupServer;
                    if (Settings.GetInstance().SecondaryApplication == null)
                    {
                        Settings.GetInstance().SecondaryTServerName = Settings.GetInstance().PrimaryTServerName;
                        Settings.GetInstance().SecondaryApplication = Settings.GetInstance().PrimaryApplication;
                    }
                    else
                    {
                        Settings.GetInstance().SecondaryTServerName = Settings.GetInstance().SecondaryApplication.Name;
                    }
                    //}
                    //else
                    //{
                    //    Settings.GetInstance().PrimaryTServerName = string.Empty;
                    //    Settings.GetInstance().SecondaryTServerName = string.Empty;
                    //    Settings.GetInstance().PrimaryApplication = null;
                    //    Settings.GetInstance().SecondaryApplication = null;
                    //}

                    if (!string.IsNullOrEmpty(Settings.GetInstance().PrimaryTServerName))
                    {
                        if (Settings.GetInstance().PrimaryApplication == null)
                        {
                            Settings.GetInstance().PrimaryApplication = ReadApplicationLevelServerDetails(Settings.GetInstance().PrimaryTServerName);
                        }
                    }

                    if (!string.IsNullOrEmpty(Settings.GetInstance().SecondaryTServerName))
                    {
                        if (Settings.GetInstance().SecondaryApplication == null)
                        {
                            logger.Debug("Secondary server is retrieving from configured key");
                            Settings.GetInstance().SecondaryApplication = ReadApplicationLevelServerDetails(Settings.GetInstance().SecondaryTServerName);
                        }
                        if (Settings.GetInstance().PrimaryApplication == null && Settings.GetInstance().SecondaryApplication != null)
                        {
                            logger.Debug("Primary server is not configured, Secondary server is assigned to Primary server");
                            Settings.GetInstance().PrimaryApplication = Settings.GetInstance().SecondaryApplication;
                        }
                    }
                    else
                    {
                        logger.Debug("secondary application name is not configured");
                        if (Settings.GetInstance().SecondaryApplication == null)
                        {
                            logger.Debug("Secondary server is not configured, primary server is assigned to secondary server");
                            Settings.GetInstance().SecondaryApplication = Settings.GetInstance().PrimaryApplication;
                        }
                    }

                    if (_configContainer.AllKeys.Contains("interaction.disposition-collection.key-name") &&
                        ((string)_configContainer.GetValue("interaction.disposition-collection.key-name")) != string.Empty)
                    {
                        Settings.GetInstance().DispositionCollectionKey = ((string)_configContainer.GetValue("interaction.disposition-collection.key-name"));
                    }

                    if (_configContainer.AllKeys.Contains("interaction.disposition.key-name") &&
                        ((string)_configContainer.GetValue("interaction.disposition.key-name")) != string.Empty)
                    {
                        Settings.GetInstance().DispositionCodeKey = ((string)_configContainer.GetValue("interaction.disposition.key-name"));
                    }

                    if (_configContainer.AllKeys.Contains("login.voice.workmode") &&
                        ((string)_configContainer.GetValue("login.voice.workmode")) != string.Empty)
                    {
                        Settings.GetInstance().WorkMode = FindWorkMode((string)_configContainer.GetValue("login.voice.workmode"));
                    }

                    if (_configContainer.AllKeys.Contains("not-ready.request.attribute-name") &&
                        ((string)_configContainer.GetValue("not-ready.request.attribute-name")) != string.Empty)
                    {
                        Settings.GetInstance().NotReadyRequest = ((string)_configContainer.GetValue("not-ready.request.attribute-name"));
                    }

                    if (_configContainer.AllKeys.Contains("not-ready.code-name") &&
                        ((string)_configContainer.GetValue("not-ready.code-name")) != string.Empty)
                    {
                        Settings.GetInstance().NotReadyCodeKey = ((string)_configContainer.GetValue("not-ready.code-name"));
                    }

                    if (_configContainer.AllKeys.Contains("not-ready.key-name") &&
                        ((string)_configContainer.GetValue("not-ready.key-name")) != string.Empty)
                    {
                        Settings.GetInstance().NotReadyKey = ((string)_configContainer.GetValue("not-ready.key-name"));
                    }

                    if (_configContainer.AllKeys.Contains("attempts") &&
                        ((string)_configContainer.GetValue("attempts")) != string.Empty)
                    {
                        Settings.GetInstance().WarmStandbyAttempts = ((string)_configContainer.GetValue("attempts"));
                    }

                    if (_configContainer.AllKeys.Contains("client-timeout") &&
                        ((string)_configContainer.GetValue("client-timeout")) != string.Empty)
                    {
                        Settings.GetInstance().AddpClientTimeout = ((string)_configContainer.GetValue("client-timeout"));
                    }

                    if (_configContainer.AllKeys.Contains("log-off-enable") &&
                        ((string)_configContainer.GetValue("log-off-enable")) != string.Empty)
                    {
                        Settings.GetInstance().LogOffEnable = ((string)_configContainer.GetValue("log-off-enable")).ToLower().Equals("true") ? true : false;
                    }

                    if (_configContainer.AllKeys.Contains("server-timeout") &&
                        ((string)_configContainer.GetValue("server-timeout")) != string.Empty)
                    {
                        Settings.GetInstance().AddpServerTimeout = ((string)_configContainer.GetValue("server-timeout"));
                    }

                    if (_configContainer.AllKeys.Contains("call-control") &&
                        ((string)_configContainer.GetValue("call-control")) != string.Empty)
                    {
                        Settings.GetInstance().CallControl = ((string)_configContainer.GetValue("call-control"));
                    }

                    if (_configContainer.AllKeys.Contains("voice.enable.auto-answer") &&
                        ((string)_configContainer.GetValue("voice.enable.auto-answer")) != string.Empty)
                    {
                        Settings.GetInstance().IsAutoAnswerEnabled = ((string)_configContainer.GetValue("voice.enable.auto-answer")).ToLower().Equals("true") ? true : false;
                    }

                    if (_configContainer.AllKeys.Contains("voice.enable.delete-conf.call") &&
                        ((string)_configContainer.GetValue("voice.enable.delete-conf.call")) != string.Empty)
                    {
                        Settings.GetInstance().IsDeleteConfEnabled = ((string)_configContainer.GetValue("voice.enable.delete-conf.call")).ToLower().Equals("true") ? true : false;
                    }
                }

                #endregion
            }
            catch (Exception commonException)
            {
                logger.Error("Error occurred while reading " + tserverApplicationName + "  =  " + commonException.ToString());
            }
            return(application);
        }
        /// <summary>
        /// Handles the Click event of the btnOk 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 btnOk_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (cbQueue.Text != "" && _dataContext.LoadCollection.FindIndex(x => x.Equals(cbQueue.Text, StringComparison.OrdinalIgnoreCase)) != -1)
                {
                    OutputValues loginResponse = null;
                    _dataContext.AgentPassword = txtAgentPassword.Password.ToString();
                    string workMode   = "optional";
                    string switchtype = "avaya";
                    if (_dataContext.SwitchName.ToLower().Contains("nortel"))
                    {
                        switchtype = "nortel";
                    }
                    var softLogin = new SoftPhone();
                    if (!_dataContext.IsTserverConnected)
                    {
                        var media = (Datacontext.AvailableServerDic.Where(x => x.Value == Genesyslab.Platform.Configuration.Protocols.Types.CfgAppType.CFGTServer.ToString())).ToDictionary(x => x.Key, y => y.Value);
                        if (media == null)
                        {
                            return;
                        }
                        if (media.Count > 0)
                        {
                            if (Datacontext.TServersSwitchDic.ContainsKey(Datacontext.UsedTServerSwitchDBId) &&
                                media.Any(x => (x.Key.ToString().Split(','))[0].Trim() == Datacontext.TServersSwitchDic[Datacontext.UsedTServerSwitchDBId]))
                            {
                                var tserverName = media.Where(x => (x.Key.ToString().Split(','))[0].Trim() == Datacontext.TServersSwitchDic[Datacontext.UsedTServerSwitchDBId]).FirstOrDefault().Key;
                                loginResponse = softLogin.Initialize(_dataContext.Place, _dataContext.UserName, _configContainer.ConfServiceObject, tserverName, _dataContext.AgentLoginId, _dataContext.AgentPassword, _dataContext.SwitchType);
                                if (loginResponse.MessageCode != "200")
                                {
                                    goto End;
                                }
                            }
                        }
                        else
                        {
                            _logger.Error("LogonInfo btnOk_Click: " + "T-server not configured");
                            goto End;
                        }
                    }
                    loginResponse = softLogin.Login(_dataContext.Place, _dataContext.UserName, workMode, _dataContext.Queue, _dataContext.AgentLoginId, _dataContext.AgentPassword);
                    if (loginResponse.MessageCode == "200")
                    {
                        if (_configContainer.AllKeys.Contains("login.voice.enable.auto-ready") &&
                            ((string)_configContainer.GetValue("login.voice.enable.auto-ready")).ToLower().Equals("true"))
                        {
                            var softReady = new SoftPhone();
                            softReady.Ready();
                        }
                        _logger.Debug("Agent Login Successful");
                    }
                    else if (loginResponse.MessageCode == "2001" || loginResponse.MessageCode == "2002")
                    {
                        _logger.Error(" LogonInfo btnOk_Click:" + loginResponse.Message);
                    }
                    else if (loginResponse.MessageCode == "2004")
                    {
                        if (_view != null)
                        {
                            _view.PlaceAlreadyTaken(loginResponse);
                        }
                    }
End:
                    _logger.Debug("LogonInfo btnok_click : Login using Place : " + _dataContext.Place + " Username : "******" Queue : " + _dataContext.QueueSelectedValue + " Application : " + _dataContext.ApplicationName + " LoginID : " +
                                  _dataContext.AgentLoginId);

                    this.Close();
                    _dataContext.IsLogonInfoOpened = false;
                }
            }
            catch (Exception commonException)
            {
                _logger.Error("btnOk_Click:" + commonException.ToString());
            }
        }