Ejemplo 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());
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Saves the initialize parameters.
        /// </summary>
        /// <param name="applicationName">Name of the application.</param>
        /// <param name="userName">Name of the user.</param>
        /// <param name="password">The password.</param>
        /// <param name="ConfigHost">The config host.</param>
        /// <param name="ConfigPort">The config port.</param>
        /// <returns></returns>
        public bool SaveInitializeParameters(string applicationName, string userName, string password, string Place, string ConfigHost,
                                             string ConfigPort, string applicationType, string AuthenticationType)
        {
            bool          isSaved = false;
            XmlTextWriter writeUserDetails;
            XmlDocument   doc = new XmlDocument();

            try
            {
                logger.Debug("XMLStorage : SaveInitializeParameters : Method Entry");

                writeUserDetails =
                    new XmlTextWriter(
                        Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) +
                        "\\PHS\\AgentInteractionDesktop\\login_config.xml", Encoding.Default);

                writeUserDetails.WriteStartElement(rootElement);
                writeUserDetails.WriteStartElement(loginParamsElement);
                //Genesys Parameters Writing

                writeUserDetails.WriteStartElement("Initialize");


                writeUserDetails.WriteElementString("username", userName);
                writeUserDetails.WriteElementString("password", password);
                writeUserDetails.WriteElementString("place", Place);
                writeUserDetails.WriteElementString("applicationName", applicationName);
                writeUserDetails.WriteElementString("configHost", ConfigHost);
                writeUserDetails.WriteElementString("configPort", ConfigPort);
                writeUserDetails.WriteElementString("apptype", applicationType);
                writeUserDetails.WriteElementString("authenticationType", AuthenticationType);


                writeUserDetails.WriteEndElement();

                //writeUserDetails.WriteStartElement("Login");
                //writeUserDetails.WriteEndElement();


                writeUserDetails.Close();
                writeUserDetails = null;
            }
            catch (Exception generalException)
            {
                logger.Error("XML Storage Class : SaveInitialixeParameters Method : Exception caught : " +
                             generalException.Message);
            }
            finally
            {
                writeUserDetails = null;
                GC.Collect();
                logger.Debug("XMLStorage : SaveInitializeParameters : Method Exit");
            }
            return(isSaved);
        }
 /// <summary>
 /// Closes the gadget.
 /// </summary>
 public void CloseGadget()
 {
     try
     {
         logger.Debug("PluginContainer : CloseGadget : Method Exit");
         StatisticsBase.GetInstance().isGadgetClose = true;
         Settings.GetInstance().IsPluginReaded      = true;
         if (mainVm == null)
         {
             mainVm = new MainWindowViewModel();
         }
         mainVm.gadgetclose();
         //commented
         stat.ShowGadgetState(Pointel.Statistics.Core.Utility.StatisticsEnum.GadgetState.Closed);
     }
     catch (Exception GeneralException)
     {
         logger.Error("PluginContainer : CloseGadget Method : Exception Caught : " + GeneralException.Message);
     }
     finally
     {
         logger.Debug("PluginContainer : CloseGadget : Method Exit");
     }
 }
        /// <summary>
        /// Gets the content of the response.
        /// </summary>
        /// <param name="tenantID">The tenant unique identifier.</param>
        /// <returns></returns>
        public static OutputValues GetResponseContent(int tenantID)
        {
            Pointel.Logger.Core.ILog logger = Pointel.Logger.Core.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, "AID");
            OutputValues             output = OutputValues.GetInstance();

            try
            {
                logger.Debug("Getting the AllAttributes from the UCS server");
                RequestGetAllCategories getAllCategories = new RequestGetAllCategories();
                getAllCategories.TenantId = tenantID;
                getAllCategories.Language = "English";
                if (Settings.UCSProtocol != null && Settings.UCSProtocol.State == ChannelState.Opened)
                {
                    logger.Info("--------GetResponseContent---------");
                    logger.Info("TenantId    :" + tenantID);
                    logger.Info("-----------------------------------");
                    IMessage response = Settings.UCSProtocol.Request(getAllCategories);
                    if (response != null)
                    {
                        logger.Trace(response.ToString());
                        output.IContactMessage = response;
                        output.MessageCode     = "200";
                        output.Message         = "Get  All Response Content Successful";
                    }
                    else
                    {
                        output.IContactMessage = null;
                        output.MessageCode     = "2001";
                        output.Message         = "Don't Get All Response Content Successful";
                    }
                }
                else
                {
                    output.IContactMessage = null;
                    output.MessageCode     = "2001";
                    output.Message         = "Universal Contact Server protocol is Null or Closed";
                    logger.Warn("GetResponseContent() : Universal Contact Server protocol is Null..");
                }
            }
            catch (Exception ex)
            {
                output.IContactMessage = null;
                output.Message         = "Error occurred while get all standard response ";
                output.MessageCode     = "2001";
                logger.Error("GetResponseContent()" + ex.ToString());
            }
            return(output);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Gets the parsed query.
        /// </summary>
        /// <param name="searchCriterias">The search criterias.</param>
        /// <param name="matchCondition">The match condition.</param>
        /// <returns></returns>
        private Query GetParsedQuery(List <Criteria> searchCriterias, MatchCondition matchCondition)
        {
            BooleanQuery mainQuery = new BooleanQuery();

            BooleanQuery.SetMaxClauseCount(0x2710);
            _tempQuery = new BooleanQuery();
            foreach (Criteria searchCriteria in searchCriterias)
            {
                DateTime chkDate;
                if (DateTime.TryParse(searchCriteria.Value.ToString(), out chkDate))
                {
                    if (chkDate != null)
                    {
                        _logger.Debug("Search Field is DateTime value");
                        GetNumericQuery(searchCriteria, matchCondition);
                    }
                }
                else
                {
                    _logger.Debug("Search Field is String value");
                    if (searchCriteria.Field == "Status" && searchCriteria.Value == "All")
                    {
                        searchCriteria.Value = "In Progress";
                        GetStringQuery(searchCriteria, MatchCondition.MatchAny);
                        searchCriteria.Value = "Done";
                        GetStringQuery(searchCriteria, MatchCondition.MatchAny);
                    }
                    else
                    {
                        GetStringQuery(searchCriteria, matchCondition);
                    }
                }

                #region Old
                //if (searchCriteria.Field == "Status" || searchCriteria.Field == "Subject")
                //{
                //    Lucene.Net.Analysis.Token token = null;
                //    Lucene.Net.Analysis.Token token2 = null;
                //    TokenStream stream = _analyzer.TokenStream(searchCriteria.Field.ToString(), new StringReader(searchCriteria.Value));
                //    do
                //    {
                //        token2 = token;
                //        token = stream.Next();
                //        if (token2 != null)
                //        {
                //            string stoken = token2.TermText();
                //            BooleanQuery outputQuery = new BooleanQuery();
                //            this.TokenToQuery(searchCriteria.Field.ToString(), stoken, ref outputQuery);
                //            if (matchCondition == MatchCondition.MatchAll)
                //                query11.Add(outputQuery, BooleanClause.Occur.MUST);
                //            else
                //                query11.Add(outputQuery, BooleanClause.Occur.SHOULD);
                //        }
                //    }
                //    while (token != null);
                //}
                //else
                //{
                //    DateTime SearchFrom = new DateTime();
                //    DateTime SearchTo = new DateTime();
                //    if (searchCriteria.Condition == SearchCondition.Before)
                //    {
                //        SearchFrom = _leastDate;
                //        SearchTo = Convert.ToDateTime(searchCriteria.Value);
                //    }
                //    else if (searchCriteria.Condition == SearchCondition.On)
                //    {
                //        SearchFrom = Convert.ToDateTime(searchCriteria.Value);
                //        SearchTo = Convert.ToDateTime(searchCriteria.Value);
                //    }
                //    else
                //    {
                //        SearchFrom = Convert.ToDateTime(searchCriteria.Value);
                //        SearchTo = DateTime.Now;
                //    }

                //    var numericQuery = NumericRangeQuery.NewIntRange(searchCriteria.Field.ToString(), int.MaxValue, int.Parse(SearchFrom.ToString("yyyyMMddHHmmss")),
                //        int.Parse(SearchTo.ToString("yyyyMMddHHmmss")), true,
                //        (searchCriteria.Condition == SearchCondition.Before) ? true : false);//To avoid inclusive of given date for before condition in searching

                //    if (matchCondition == MatchCondition.MatchAll)
                //        query11.Add(numericQuery, BooleanClause.Occur.MUST);
                //    else
                //        query11.Add(numericQuery, BooleanClause.Occur.SHOULD);
                //}
                #endregion
            }
            if (matchCondition == MatchCondition.MatchAll)
            {
                mainQuery.Add(_tempQuery, BooleanClause.Occur.MUST);
            }
            else
            {
                mainQuery.Add(_tempQuery, BooleanClause.Occur.SHOULD);
            }

            return(mainQuery);
        }
Ejemplo n.º 6
0
        public OutputValues ConnectInteractionServer(CfgApplication primaryServer, CfgApplication secondayServer, string clientName)
        {
            OutputValues output = OutputValues.GetInstance();
            var          ixnserverconfProperties = new IxnServerConfProperties();

            try
            {
                if (Settings.InteractionProtocol == null)
                {
                    _logger.Debug("ConnectInteractionServer : Connecting to the Ixn server with the details of " +
                                  primaryServer.ServerInfo.Host.IPaddress + ":" + primaryServer.ServerInfo.Port + " backup server " +
                                  secondayServer.ServerInfo.Port + ":" + secondayServer.ServerInfo.Port);

                    ProtocolManagers.Instance().DisConnectServer(ServerType.Ixnserver);
                    Settings.InteractionProtocol = null;
                    ixnserverconfProperties.Create(new Uri("tcp://" + primaryServer.ServerInfo.Host.IPaddress + ":" + primaryServer.ServerInfo.Port),
                                                   clientName, InteractionClient.Proxy, new Uri("tcp://" + secondayServer.ServerInfo.Host.IPaddress + ":" + secondayServer.ServerInfo.Port),
                                                   Convert.ToInt32(primaryServer.ServerInfo.Timeout), Convert.ToInt16(primaryServer.ServerInfo.Attempts),
                                                   Convert.ToInt32(Settings.AddpServerTimeout), Convert.ToInt32(Settings.AddpClientTimeout), Genesyslab.Platform.Commons.Connection.Configuration.AddpTraceMode.Both);

                    var ixnProtocolConfiguration = ixnserverconfProperties.Protocolconfiguration;

                    string error = "";
                    if (!ProtocolManagers.Instance().ConnectServer(ixnProtocolConfiguration, out error))
                    {
                        _logger.Error("Interaction protocol is not opened due to, " + error);
                        output.MessageCode = "2001";
                        output.Message     = error;
                        return(output);
                    }
                    Settings.InteractionProtocol           = ProtocolManagers.Instance().ProtocolManager[ixnProtocolConfiguration.Name] as InteractionServerProtocol;
                    InteractionManager.EventCreated        = false;
                    Settings.InteractionProtocol.Received += InteractionManager.InteractionEvents;

                    if (Settings.InteractionProtocol.State == ChannelState.Opened)
                    {
                        InteractionManager.isAfterConnect = true;
                        _logger.Debug("ConnectInteractionServer : Interaction protocol is opened ");
                        _logger.Info("ConnectInteractionServer : Interaction Protocol object id is " + Settings.InteractionProtocol.GetHashCode().ToString());
                        output.MessageCode = "200";
                        output.Message     = "InteractionServer Connected";
                    }
                    else
                    {
                        _logger.Warn("CreateInteractionConnection : Interaction protocol is closed ");
                    }
                }
                else
                {
                    _logger.Warn("Interaction Protocol status is " + Settings.InteractionProtocol.State.ToString());
                }
            }

            catch (Exception commonException)
            {
                Settings.InteractionProtocol = null;
                _logger.Error("ConnectInteractionServer :" + commonException.ToString());
                output.MessageCode = "2001";
                output.Message     = commonException.Message;
            }
            return(output);
        }
        public OutputValues ConnectTServer(CfgApplication primaryServer, CfgApplication secondaryServer, bool switchoverServer = true)
        {
            OutputValues output = OutputValues.GetInstance();
            var          tServerConfProperties = new TServerConfProperties();

            try
            {
                if (primaryServer != null)
                {
                    ProtocolManagers.Instance().DisConnectServer(ServerType.Tserver);
                    Settings.GetInstance().VoiceProtocol = null;
                    logger.Debug("ConnectTServer : Applied primary server properties to Voice protocol");

                    logger.Debug("ConnectTServer : Primary server uri " + "tcp://" + primaryServer.ServerInfo.Host.IPaddress
                                 + ":" + primaryServer.ServerInfo.Port);
                    if (secondaryServer != null)
                    {
                        logger.Debug("ConnectTServer : Applied secondary server properties to Voice protocol");
                        logger.Debug("ConnectTServer : Secondary server uri " + "tcp://" + secondaryServer.ServerInfo.Host.IPaddress
                                     + ":" + secondaryServer.ServerInfo.Port);
                    }
                    else
                    {
                        logger.Warn("ConnectTServer : Secondary server is not mentioned");
                        logger.Info("ConnectTServer : Application has no backup servers");
                    }

                    tServerConfProperties.Create(new Uri("tcp://" + primaryServer.ServerInfo.Host.IPaddress + ":" + primaryServer.ServerInfo.Port),
                                                 Settings.GetInstance().UserName, new Uri("tcp://" + secondaryServer.ServerInfo.Host.IPaddress + ":" + secondaryServer.ServerInfo.Port),
                                                 Convert.ToInt32(primaryServer.ServerInfo.Timeout), Convert.ToInt16(primaryServer.ServerInfo.Attempts),
                                                 Convert.ToInt32(Settings.GetInstance().AddpServerTimeout), Convert.ToInt32(Settings.GetInstance().AddpClientTimeout),
                                                 Genesyslab.Platform.Commons.Connection.Configuration.AddpTraceMode.Both);
                    var    TserverProtocolConfiguration = tServerConfProperties.Protocolconfiguration;
                    string error = "";
                    if (!ProtocolManagers.Instance().ConnectServer(TserverProtocolConfiguration, out error))
                    {
                        logger.Error("Tserver protocol is not opened due to, " + error);
                        output.MessageCode = "2001";
                        output.Message     = error;
                        return(output);
                    }
                    Settings.GetInstance().VoiceProtocol = ProtocolManagers.Instance().ProtocolManager[TserverProtocolConfiguration.Name] as TServerProtocol;
                    VoiceManager.EventCreated = false;
                    Settings.GetInstance().VoiceProtocol.Received += VoiceManager.GetInstance().ReportingVoiceMessage;

                    if (Settings.GetInstance().VoiceProtocol.State == ChannelState.Opened)
                    {
                        logger.Debug("ConnectTServer : Voice protocol is opened ");
                        logger.Info("ConnectTServer : Voice Protocol object id is "
                                    + Settings.GetInstance().VoiceProtocol.GetHashCode().ToString());
                        output.MessageCode = "200";
                        output.Message     = "TServer Connected";
                    }
                    else
                    {
                        logger.Debug("CreateVoiceConnection : Voice protocol is closed ");
                    }
                }
                else
                {
                    Settings.GetInstance().VoiceProtocol = null;
                    if (switchoverServer)
                    {
                        output = ConnectTServer(secondaryServer, primaryServer, false);
                    }
                    else
                    {
                        logger.Error("ConnectTServer : No primary server configured.");
                        output.MessageCode = "2002";
                        output.Message     = "No primary server configured. Could not able to connect T-server";
                    }
                }
            }

            catch (Exception CommonException)
            {
                Settings.GetInstance().VoiceProtocol = null;
                if (switchoverServer)
                {
                    output = ConnectTServer(secondaryServer, primaryServer, false);
                }
                else
                {
                    logger.Error("ConnectTServer :" + CommonException.ToString());
                    output.MessageCode = "2001";
                    output.Message     = CommonException.Message;
                }
            }
            return(output);
        }
        /// <summary>
        /// Opens the chat protocol.
        /// </summary>
        /// <param name="nickName">Name of the nick.</param>
        /// <param name="personId">The person identifier.</param>
        /// <param name="host">The host.</param>
        /// <param name="port">The port.</param>
        /// <returns></returns>
        public Pointel.Interactions.Chat.Core.General.OutputValues OpenChatProtocol(string nickName, string personId,
                                                                                    Genesyslab.Platform.ApplicationBlocks.ConfigurationObjectModel.CfgObjects.CfgApplication primaryServer,
                                                                                    Genesyslab.Platform.ApplicationBlocks.ConfigurationObjectModel.CfgObjects.CfgApplication secondaryServer, bool switchoverServer = true)
        {
            var output = new Pointel.Interactions.Chat.Core.General.OutputValues();

            var chatServerConfProperties = new BasicChatServerConfProperties();

            try
            {
                if (primaryServer != null)
                {
                    logger.Debug("OpenChatProtocol : Applied primary server properties to Chat protocol");
                    logger.Debug("OpenChatProtocol : Primary server uri " + "tcp://" + primaryServer.ServerInfo.Host.IPaddress
                                 + ":" + primaryServer.ServerInfo.Port);
                    if (secondaryServer != null)
                    {
                        logger.Debug("OpenChatProtocol : Applied secondary server properties to Chst protocol");
                        logger.Debug("OpenChatProtocol : Secondary server uri " + "tcp://" + secondaryServer.ServerInfo.Host.IPaddress
                                     + ":" + secondaryServer.ServerInfo.Port);
                    }
                    else
                    {
                        logger.Warn("OpenChatProtocol : Secondary server is not mentioned");
                        logger.Info("OpenChatProtocol : Application has no backup servers");
                    }
                    ProtocolManagers.Instance().DisConnectServer(ServerType.Chatserver);
                    chatServerConfProperties.Create(new Uri("tcp://" + primaryServer.ServerInfo.Host.IPaddress + ":" + primaryServer.ServerInfo.Port),
                                                    nickName, Genesyslab.Platform.WebMedia.Protocols.BasicChat.UserType.Agent, personId,
                                                    new Uri("tcp://" + secondaryServer.ServerInfo.Host.IPaddress + ":" + secondaryServer.ServerInfo.Port),
                                                    Convert.ToInt32(primaryServer.ServerInfo.Timeout), Convert.ToInt16(primaryServer.ServerInfo.Attempts),
                                                    Convert.ToInt32(Pointel.Interactions.Chat.Core.Util.Settings.AddpServerTimeout),
                                                    Convert.ToInt32(Pointel.Interactions.Chat.Core.Util.Settings.AddpClientTimeout),
                                                    Genesyslab.Platform.Commons.Connection.Configuration.AddpTraceMode.Both);
                    var    ChatserverProtocolConfiguration = chatServerConfProperties.Protocolconfiguration;
                    string error = "";
                    if (!ProtocolManagers.Instance().ConnectServer(ChatserverProtocolConfiguration, out error))
                    {
                        logger.Error("Chat protocol is not opened due to, " + error);
                        output.MessageCode = "2001";
                        output.Message     = error;
                        return(output);
                    }
                    Pointel.Interactions.Chat.Core.Util.Settings.ChatProtocol =
                        ProtocolManagers.Instance().ProtocolManager[ChatserverProtocolConfiguration.Name] as Genesyslab.Platform.WebMedia.Protocols.BasicChatProtocol;

                    Pointel.Interactions.Chat.Core.Util.Settings.ChatProtocol.Received += Pointel.Interactions.Chat.Core.Listener.BasicChatListener.GetInstance().BasicExtractor;
                    #region Old code
                    //if (Pointel.Interactions.Chat.Core.Util.Settings.ChatProtocol == null)
                    //{
                    //    logger.Debug("ConnectBasicChatServer : Applied primary server properties to Basic Chat protocol");

                    //    //Primary Server settings
                    //    logger.Debug("OpenChatProtocol : Primary server uri " + "tcp://" + primaryServer.ServerInfo.Host.IPaddress
                    //                                                              + ":" + primaryServer.ServerInfo.Port);
                    //    ChatConnectionSettings.GetInstance().ChatProtocolProperties.Uri = new Uri("tcp://" + primaryServer.ServerInfo.Host.IPaddress
                    //                                                              + ":" + primaryServer.ServerInfo.Port);

                    //    if (secondaryServer != null)
                    //    {
                    //        logger.Debug("OpenChatProtocol : Applied secondary server properties to Basic Chat protocol");
                    //        //Backup Server settings
                    //        ChatConnectionSettings.GetInstance().ChatProtocolProperties.FaultTolerance = Genesyslab.Platform.ApplicationBlocks.Commons.Protocols.FaultToleranceMode.WarmStandby;
                    //        //HardCoded Values
                    //        ChatConnectionSettings.GetInstance().ChatProtocolProperties.WarmStandbyTimeout = Convert.ToInt32(primaryServer.ServerInfo.Timeout);
                    //        ChatConnectionSettings.GetInstance().ChatProtocolProperties.WarmStandbyAttempts = Convert.ToInt16(primaryServer.ServerInfo.Attempts);
                    //        //End

                    //        ChatConnectionSettings.GetInstance().ChatProtocolProperties.WarmStandbyUri = new Uri("tcp://" + secondaryServer.ServerInfo.Host.IPaddress +
                    //                                                                            ":" + secondaryServer.ServerInfo.Port);
                    //        logger.Debug("OpenChatProtocol : Secondary server uri " + "tcp://" + secondaryServer.ServerInfo.Host.IPaddress
                    //                                                                  + ":" + secondaryServer.ServerInfo.Port);
                    //    }
                    //    else
                    //    {
                    //        logger.Warn("OpenChatProtocol : Secondary server is not mentioned");
                    //        logger.Warn("OpenChatProtocol : Application has no backup servers");
                    //    }
                    //    //Set ADDP
                    //    ChatConnectionSettings.GetInstance().ChatProtocolProperties.UseAddp = true;

                    //    ChatConnectionSettings.GetInstance().ChatProtocolProperties.AddpServerTimeout = Convert.ToInt32(Pointel.Interactions.Chat.Core.Util.Settings.AddpServerTimeout);
                    //    ChatConnectionSettings.GetInstance().ChatProtocolProperties.AddpClientTimeout = Convert.ToInt32(Pointel.Interactions.Chat.Core.Util.Settings.AddpClientTimeout);

                    //    ChatConnectionSettings.GetInstance().ChatProtocolProperties.AddpTrace = "both";

                    //    ChatConnectionSettings.GetInstance().ChatProtocolProperties.UserNickname = nickName;
                    //    ChatConnectionSettings.GetInstance().ChatProtocolProperties.UserType = Genesyslab.Platform.WebMedia.Protocols.BasicChat.UserType.Agent;
                    //    ChatConnectionSettings.GetInstance().ChatProtocolProperties.PersonId = personId;

                    //    logger.Debug("OpenChatProtocol : Trying to register protocol manger for Basic Chat protocol");
                    //    if (ChatConnectionSettings.GetInstance().ChatProtocolManager == null)
                    //    {
                    //        ChatConnectionSettings.GetInstance().ChatProtocolManager = new Genesyslab.Platform.ApplicationBlocks.Commons.Protocols.ProtocolManagementService();
                    //        ChatConnectionSettings.GetInstance().ChatProtocolManager.Register(ChatConnectionSettings.GetInstance().ChatProtocolProperties);
                    //        logger.Debug("OpenChatProtocol : Registered protocol manager");
                    //    }
                    //    else
                    //    {
                    //        ChatConnectionSettings.GetInstance().ChatProtocolManager.Register(ChatConnectionSettings.GetInstance().ChatProtocolProperties);
                    //        logger.Debug("OpenChatProtocol : Registered protocol manager");
                    //    }
                    //    //Open the connection
                    //    ChatConnectionSettings.GetInstance().ChatProtocolManager[ChatConnectionSettings.ChatServer].Open();
                    //    Pointel.Interactions.Chat.Core.Util.Settings.ChatProtocol = (Genesyslab.Platform.WebMedia.Protocols.BasicChatProtocol)ChatConnectionSettings.GetInstance().ChatProtocolManager[ChatConnectionSettings.ChatServer];

                    //    ChatConnectionSettings.GetInstance().ChatEventBroker[0] = Genesyslab.Platform.ApplicationBlocks.Commons.Broker.BrokerServiceFactory.CreateEventBroker(ChatConnectionSettings.GetInstance().ChatProtocolManager.Receiver);
                    //    ChatConnectionSettings.GetInstance().ChatEventBroker[0].Activate();

                    //    ChatConnectionSettings.GetInstance().ChatEventBroker[0].Register(Pointel.Interactions.Chat.Core.Listener.BasicChatListener.GetInstance().BasicExtractor);

                    #endregion

                    if (Pointel.Interactions.Chat.Core.Util.Settings.ChatProtocol.State == Genesyslab.Platform.Commons.Protocols.ChannelState.Opened)
                    {
                        Pointel.Interactions.Chat.Core.Util.Settings.ChatProtocol.Opened += new EventHandler(ChatConnectionManager_Opened);
                        Pointel.Interactions.Chat.Core.Util.Settings.ChatProtocol.Closed += new EventHandler(ChatConnectionManager_Closed);
                        logger.Debug("OpenChatProtocol : Basic Chat protocol is opened ");
                        logger.Debug("OpenChatProtocol : Basic Chat protocol object id is "
                                     + Pointel.Interactions.Chat.Core.Util.Settings.ChatProtocol.GetHashCode().ToString());
                        output.MessageCode = "200";
                        output.Message     = "Chat Server Connected";
                    }
                    else
                    {
                        logger.Warn("OpenChatProtocol : Basic Chat protocol is closed ");
                    }
                }
                else
                {
                    logger.Error("OpenChatProtocol : No primary server configured.");
                    output.MessageCode = "2002";
                    output.Message     = "No primary server configured. Could not able to connect Chat server";
                }
            }
            catch (Exception generalException)
            {
                if (switchoverServer)
                {
                    output = OpenChatProtocol(nickName, personId, secondaryServer, primaryServer, false);
                }
                else
                {
                    logger.Error("OpenChatProtocol :" + generalException.ToString());
                    output.MessageCode = "2001";
                    output.Message     = generalException.Message;
                }
            }
            return(output);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Contacts the controller.
        /// </summary>
        /// <param name="contacts">The contacts.</param>
        private void ContactController(object contacts)
        {
            try
            {
                System.Windows.Application.Current.Dispatcher.Invoke((Action)(delegate
                {
                    if (contacts != null)
                    {
                        Hashtable contact = (Hashtable)contacts;

                        if (contact.ContainsKey("type"))
                        {
                            //Add agent/application/global contact in Grid

                            if (string.Compare(contact["type"].ToString(), "11", true) == 0 ||
                                string.Compare(contact["type"].ToString(), "12", true) == 0 ||
                                string.Compare(contact["type"].ToString(), "13", true) == 0)
                            {
                                IDictionaryEnumerator keys = contact.GetEnumerator();
                                while (keys.MoveNext())
                                {
                                    if (keys.Key.ToString() != "type")
                                    {
                                        _chatUtil.Contacts.Add(new Contacts(keys.Key.ToString(), keys.Value.ToString(), contact["type"].ToString()));
                                    }
                                }
                                if (string.IsNullOrEmpty(txtContactSearch.Text))
                                {
                                    dgvContact.ItemsSource = _chatUtil.Contacts;
                                    dgvContact.UpdateLayout();
                                    if (dgvContact.Items.Count > 1)
                                    {
                                        dgvContact.ScrollIntoView(dgvContact.Items[dgvContact.Items.Count - 1]);
                                    }
                                    lblStatus.Content = dgvContact.Items.Count.ToString() + " contacts available ";
                                    _chatUtil.ContactsFilter.Clear();
                                }
                                else
                                {
                                    ContactSearch(txtContactSearch.Text);
                                }

                                if (dgvContact.Items.Count.ToString() == "0")
                                {
                                    // btnDial.IsEnabled = false;
                                }
                                else
                                {
                                    //btnDial.IsEnabled = true;
                                }
                            }
                            else if (string.Compare(contact["type"].ToString(), "21", true) == 0 ||
                                     string.Compare(contact["type"].ToString(), "22", true) == 0 ||
                                     string.Compare(contact["type"].ToString(), "23", true) == 0)
                            {
                                ObservableCollection <IContacts> temp = null;
                                ObservableCollection <IContacts> temp1 = null;
                                if (string.IsNullOrEmpty(txtContactSearch.Text))
                                {
                                    temp = _chatUtil.Contacts;
                                    temp1 = _chatUtil.ContactsFilter;
                                }
                                else
                                {
                                    temp = _chatUtil.ContactsFilter;
                                    temp1 = _chatUtil.Contacts;
                                }
                                if (temp.Count > 0)
                                {
                                    if (string.Compare(contact["type"].ToString(), "21", true) == 0)
                                    {
                                        var toRemove = temp.Where(x => x.Type == "11").ToList();
                                        foreach (var item in toRemove)
                                        {
                                            temp.Remove(item);
                                        }
                                        var toRemove1 = temp1.Where(x => x.Type == "11").ToList();
                                        foreach (var item in toRemove1)
                                        {
                                            temp1.Remove(item);
                                        }
                                    }
                                    else if (string.Compare(contact["type"].ToString(), "22", true) == 0)
                                    {
                                        var toRemove = temp.Where(x => x.Type == "12").ToList();
                                        foreach (var item in toRemove)
                                        {
                                            temp.Remove(item);
                                        }
                                        var toRemove1 = temp1.Where(x => x.Type == "12").ToList();
                                        foreach (var item in toRemove1)
                                        {
                                            temp1.Remove(item);
                                        }
                                    }
                                    else if (string.Compare(contact["type"].ToString(), "23", true) == 0)
                                    {
                                        var toRemove = temp.Where(x => x.Type == "13").ToList();
                                        foreach (var item in toRemove)
                                        {
                                            temp.Remove(item);
                                        }
                                        var toRemove1 = temp1.Where(x => x.Type == "13").ToList();
                                        foreach (var item in toRemove1)
                                        {
                                            temp1.Remove(item);
                                        }
                                    }
                                    dgvContact.ItemsSource = temp;
                                    dgvContact.UpdateLayout();
                                    if (dgvContact.Items.Count > 1)
                                    {
                                        dgvContact.ScrollIntoView(dgvContact.Items[dgvContact.Items.Count - 1]);
                                    }
                                }
                                if (string.IsNullOrEmpty(txtContactSearch.Text))
                                {
                                    lblStatus.Content = dgvContact.Items.Count.ToString() + " contacts available ";
                                }
                                else if (!string.IsNullOrEmpty(txtContactSearch.Text))
                                {
                                    lblStatus.Content = dgvContact.Items.Count.ToString() + " matches found ";
                                }

                                if (dgvContact.Items.Count.ToString() == "0")
                                {
                                    // btnDial.IsEnabled = false;
                                }
                                else
                                {
                                    // btnDial.IsEnabled = true;
                                }
                            }
                        }
                    }
                    else
                    {
                        logger.Debug("No contacts available");
                    }
                }));
            }
            catch (ThreadAbortException threadException)
            {
                logger.Error("DialPad:ContactController:" + threadException.ToString());
            }
            catch (Exception generalException)
            {
                logger.Error("Error occurred while Add/Remove contacts from grid " + generalException.ToString());
            }
            finally
            {
            }
        }
        /// <summary>
        /// Mboxes the close.
        /// </summary>
        private void MboxClose(object obj)
        {
            try
            {
                ContentControl temp = new ContentControl();

                switch (basewin)
                {
                case "LoginWindow":
                    Application.Current.Shutdown();
                    //Environment.Exit(0);
                    break;

                case "MainWindow":
                    Messagebox.DialogResult = true;
                    Messagebox.Close();
                    break;

                case "AdminConfig":
                    temp = obj as ContentControl;
                    if (temp.Content.ToString() == "Overwrite")
                    {
                        Settings.GetInstance().ToOverWrite = true;
                    }
                    else
                    {
                        Settings.GetInstance().ToOverWrite = false;
                    }

                    Messagebox.DialogResult = true;
                    Messagebox.Close();

                    break;

                case "ObjectChanged":
                    temp = obj as ContentControl;
                    if (temp.Content.ToString() == "Yes")
                    {
                        //Settings.GetInstance().isConfigNewStats = true;
                        //Settings.GetInstance().isConfigureNextStat = true;
                        //Settings.GetInstance().SaveConfigurations = true;
                        Settings.GetInstance().IsConfigureStats        = true;
                        Settings.GetInstance().IsSaveConfiguredObjs    = true;
                        Settings.GetInstance().IsConfigureLevelObjects = true;
                    }
                    else
                    {
                        //Settings.GetInstance().isConfigNewStats = false;
                        //Settings.GetInstance().isConfigureNextStat = false;
                        //Settings.GetInstance().SaveConfigurations = false;
                        Settings.GetInstance().IsConfigureStats        = false;
                        Settings.GetInstance().IsSaveConfiguredObjs    = false;
                        Settings.GetInstance().IsConfigureLevelObjects = false;
                    }
                    Messagebox.DialogResult = true;
                    Messagebox.Close();
                    break;
                }
            }
            catch (Exception ex)
            {
                logger.Error("MessageBoxViewModel : Constructor : " + ex.Message);
            }
            finally
            {
                GC.Collect();
                logger.Debug("MessageBoxViewModel : MboxClose : Method Exit");
            }
        }
Ejemplo n.º 11
0
        public OutputValues Initialize(string place, string userName, ConfService configObject, string tServerApplicationName, string agentLoginId, string agentPassword,
                                       CfgSwitch switchType)
        {
            Settings.GetInstance().AgentLoginID   = agentLoginId;
            Settings.GetInstance().Switch         = switchType;
            Settings.GetInstance().SwitchTypeName = switchType.Type == CfgSwitchType.CFGLucentDefinityG3 ?
                                                    "avaya" :
                                                    ((switchType.Type == CfgSwitchType.CFGNortelDMS100 || switchType.Type == CfgSwitchType.CFGNortelMeridianCallCenter) ? "nortel" : "avaya");
            var output  = OutputValues.GetInstance();
            var connect = new VoiceConnectionManager();
            var read    = new ReadConfigObjects();

            //Print DLL Info
            try
            {
                Assembly assemblyVersion = Assembly.LoadFrom(Environment.CurrentDirectory + @"\Pointel.Softphone.Voice.dll");
                if (assemblyVersion != null)
                {
                    logger.Debug("*********************************************");
                    logger.Debug(assemblyVersion.GetName().Name + " : " + assemblyVersion.GetName().Version);
                    logger.Debug("*********************************************");
                }
            }
            catch (Exception versionException)
            {
                logger.Error("Error occurred while getting the version of the SoftPhone library " + versionException.ToString());
            }

            try
            {
                //ConnectionSettings.comObject = configObject;
                //Get Place details
                Settings.GetInstance().PlaceName = place;
                Settings.GetInstance().UserName  = userName;
                output = read.ReadPlaceObject();
                //Read Person Details
                //output = read.ReadPersonObject(userName);
                read.ReadApplicationObject(tServerApplicationName, agentLoginId);
            }
            catch (Exception inputException)
            {
                logger.Error("Error occurred while login into SoftPhone " + inputException);
            }

            //Input Validation
            CheckException.CheckLoginValues(place, userName);
            if (output.MessageCode == "200")
            {
                //Register with TServer
                output = connect.ConnectTServer(Settings.GetInstance().PrimaryApplication, Settings.GetInstance().SecondaryApplication);

                if (output.MessageCode != "200")
                {
                    logger.Debug("Protocol is not opened, try to connect with server config keys");
                    if (Settings.GetInstance().VoiceProtocol != null && Settings.GetInstance().VoiceProtocol.State != ChannelState.Opened)
                    {
                        if (!string.IsNullOrEmpty(Settings.GetInstance().PrimaryTServerName))
                        {
                            logger.Debug("Primary TServer name : " + Settings.GetInstance().PrimaryTServerName);
                            Settings.GetInstance().PrimaryApplication = read.ReadApplicationLevelServerDetails(Settings.GetInstance().PrimaryTServerName);
                        }
                        if (!string.IsNullOrEmpty(Settings.GetInstance().SecondaryTServerName))
                        {
                            logger.Debug("Secondary TServer name : " + Settings.GetInstance().SecondaryTServerName);
                            Settings.GetInstance().SecondaryApplication = read.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;
                            }
                        }

                        //connect with server names from options tab
                        output = connect.ConnectTServer(Settings.GetInstance().PrimaryApplication, Settings.GetInstance().SecondaryApplication);
                    }
                    else
                    {
                        return(output);
                    }
                }
            }

            return(output);
        }
        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);
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Gets all values.
        /// </summary>
        public void GetAllValues()
        {
            try
            {
                logger.Debug("Get all KVP's based on the hierarchical level");

                //System Values
                if (ConfigContainer.Instance().AllKeys.Contains("image-path"))
                {
                    _chatDataContext.Imagepath = (string)ConfigContainer.Instance().GetValue("image-path");
                }

                //agent.ixn.desktop values
                if (ConfigContainer.Instance().AllKeys.Contains("chat.welcome-message"))
                {
                    _chatDataContext.ChatWelcomeMessage = (string)ConfigContainer.Instance().GetValue("chat.welcome-message");
                }

                if (ConfigContainer.Instance().AllKeys.Contains("chat.farewell-message"))
                {
                    _chatDataContext.ChatFareWellMessage = (string)ConfigContainer.Instance().GetValue("chat.farewell-message");
                }

                if (ConfigContainer.Instance().AllKeys.Contains("chat.typing-timeout"))
                {
                    _chatDataContext.ChatTypingTimout = (string)ConfigContainer.Instance().GetValue("chat.typing-timeout");
                }

                //if (ConfigContainer.Instance().AllKeys.Contains("chat.toast-information-key"))

                if (ConfigContainer.Instance().AllKeys.Contains("chat.time-stamp-format"))
                {
                    _chatDataContext.ChatTimeStampFormat = (string)ConfigContainer.Instance().GetValue("chat.time-stamp-format");
                }

                if (ConfigContainer.Instance().AllKeys.Contains("chat.system.text-color"))
                {
                    if (!string.IsNullOrEmpty((string)ConfigContainer.Instance().GetValue("chat.system.text-color")))
                    {
                        _chatDataContext.ChatSystemTextColor = Color.FromName((string)ConfigContainer.Instance().GetValue("chat.system.text-color"));
                    }
                    else
                    {
                        _chatDataContext.ChatSystemTextColor = Color.FromName("Black");
                    }
                }
                else
                {
                    _chatDataContext.ChatSystemTextColor = Color.FromName("Black");
                }

                if (ConfigContainer.Instance().AllKeys.Contains("chat.pending-response-to-customer"))
                {
                    _chatDataContext.ChatPendingResponseToCustomer = (string)ConfigContainer.Instance().GetValue("chat.pending-response-to-customer");
                }

                if (ConfigContainer.Instance().AllKeys.Contains("chat.other-agent.text-color"))
                {
                    if (!string.IsNullOrEmpty((string)ConfigContainer.Instance().GetValue("chat.other-agent.text-color")))
                    {
                        _chatDataContext.OtherAgentTextColor = Color.FromName((string)ConfigContainer.Instance().GetValue("chat.other-agent.text-color"));
                    }
                    else
                    {
                        _chatDataContext.OtherAgentTextColor = Color.FromName("Black");
                    }
                }
                else
                {
                    _chatDataContext.OtherAgentTextColor = Color.FromName("Black");
                }

                if (ConfigContainer.Instance().AllKeys.Contains("chat.other-agent.prompt-color"))
                {
                    if (!string.IsNullOrEmpty((string)ConfigContainer.Instance().GetValue("chat.other-agent.prompt-color")))
                    {
                        _chatDataContext.OtherAgentPromptColor = Color.FromName((string)ConfigContainer.Instance().GetValue("chat.other-agent.prompt-color"));
                    }
                    else
                    {
                        _chatDataContext.OtherAgentPromptColor = Color.FromName("Black");
                    }
                }
                else
                {
                    _chatDataContext.OtherAgentPromptColor = Color.FromName("Black");
                }

                if (ConfigContainer.Instance().AllKeys.Contains("chat.client.text-color"))
                {
                    if (!string.IsNullOrEmpty((string)ConfigContainer.Instance().GetValue("chat.client.text-color")))
                    {
                        _chatDataContext.ClientTextColor = Color.FromName((string)ConfigContainer.Instance().GetValue("chat.client.text-color"));
                    }
                    else
                    {
                        _chatDataContext.ClientTextColor = Color.FromName("Black");
                    }
                }
                else
                {
                    _chatDataContext.ClientTextColor = Color.FromName("Black");
                }

                if (ConfigContainer.Instance().AllKeys.Contains("chat.client.prompt-color"))
                {
                    if (!string.IsNullOrEmpty((string)ConfigContainer.Instance().GetValue("chat.client.prompt-color")))
                    {
                        _chatDataContext.ClientPromptColor = Color.FromName((string)ConfigContainer.Instance().GetValue("chat.client.prompt-color"));
                    }
                    else
                    {
                        _chatDataContext.ClientPromptColor = Color.FromName("Black");
                    }
                }
                else
                {
                    _chatDataContext.ClientPromptColor = Color.FromName("Black");
                }

                if (ConfigContainer.Instance().AllKeys.Contains("chat.agent.text-color"))
                {
                    if (!string.IsNullOrEmpty((string)ConfigContainer.Instance().GetValue("chat.agent.text-color")))
                    {
                        _chatDataContext.AgentTextColor = Color.FromName((string)ConfigContainer.Instance().GetValue("chat.agent.text-color"));
                    }
                    else
                    {
                        _chatDataContext.AgentTextColor = Color.FromName("Black");
                    }
                }
                else
                {
                    _chatDataContext.AgentTextColor = Color.FromName("Black");
                }

                if (ConfigContainer.Instance().AllKeys.Contains("chat.agent.prompt-color"))
                {
                    if (!string.IsNullOrEmpty((string)ConfigContainer.Instance().GetValue("chat.agent.prompt-color")))
                    {
                        _chatDataContext.AgentPromptColor = Color.FromName((string)ConfigContainer.Instance().GetValue("chat.agent.prompt-color"));
                    }
                    else
                    {
                        _chatDataContext.AgentPromptColor = Color.FromName("Black");
                    }
                }
                else
                {
                    _chatDataContext.AgentPromptColor = Color.FromName("Black");
                }

                if (ConfigContainer.Instance().AllKeys.Contains("chat.auto-answer.timer"))
                {
                    _chatDataContext.AutoAnswerDelay = int.Parse((string)ConfigContainer.Instance().GetValue("chat.auto-answer.timer")) * 1000;
                }

                if (ConfigContainer.Instance().AllKeys.Contains("voice.dial-pad.number-digit"))
                {
                    _chatDataContext.DialpadDigits = int.Parse((string)ConfigContainer.Instance().GetValue("voice.dial-pad.number-digit"));
                }

                if (ConfigContainer.Instance().AllKeys.Contains("interaction.disposition.key-name"))
                {
                    _chatDataContext.DisPositionKeyName = (string)ConfigContainer.Instance().GetValue("interaction.disposition.key-name");
                }

                if (ConfigContainer.Instance().AllKeys.Contains("interaction.disposition-collection.key-name"))
                {
                    _chatDataContext.DispositionCollectionKeyName = (string)ConfigContainer.Instance().GetValue("interaction.disposition-collection.key-name");
                }

                //enable.disable.channels values
                if (ConfigContainer.Instance().AllKeys.Contains("chat.enable.auto-answer.reject"))
                {
                    if ((((string)ConfigContainer.Instance().GetValue("chat.enable.auto-answer.reject")).ToLower().Equals("true")))
                    {
                        _chatDataContext.IsEnableAutoAnswerReject = true;
                    }
                    else
                    {
                        _chatDataContext.IsEnableAutoAnswerReject = false;
                    }
                }
                if (ConfigContainer.Instance().AllKeys.Contains("chat.enable.add-case-data"))
                {
                    if ((((string)ConfigContainer.Instance().GetValue("chat.enable.add-case-data")).ToLower().Equals("true")))
                    {
                        _chatDataContext.IsChatEnabledAddCaseData = Visibility.Visible;
                    }
                    else
                    {
                        _chatDataContext.IsChatEnabledAddCaseData = Visibility.Hidden;
                    }
                }
                _chatDataContext.OwnerIDorPersonDBID = ConfigContainer.Instance().PersonDbId;

                if (ConfigContainer.Instance().AllKeys.Contains("email.validate-expression"))
                {
                    _chatDataContext.EmailValidateExpression = ConfigContainer.Instance().GetAsString("email.validate-expression");
                }

                ReadCaseDataPushUrlDisposition();

                if (loadCaseDataKey.Count > 0 && loadCaseDataKey != null)
                {
                    _chatDataContext.LoadCaseDataKeys = loadCaseDataKey.ToList();
                }
                if (loadCaseDataFilterKey.Count > 0 && loadCaseDataFilterKey != null)
                {
                    _chatDataContext.LoadCaseDataFilterKeys = loadCaseDataFilterKey.ToList();
                }
                if (loadCaseDataSortingKey.Count > 0 && loadCaseDataSortingKey != null)
                {
                    _chatDataContext.LoadCaseDataSortKeys = loadCaseDataSortingKey.ToList();
                }
                if (loadAvailablePushURL.Count > 0 && loadAvailablePushURL != null)
                {
                    _chatDataContext.LoadAvailablePushURL.Clear();
                    foreach (var item in loadAvailablePushURL)
                    {
                        _chatDataContext.LoadAvailablePushURL.Add(item.Key, item.Value);
                    }
                }
                if (dispositionCodes.Count > 0 && dispositionCodes != null)
                {
                    _chatDataContext.LoadDispositionCodes.Clear();
                    foreach (var items in dispositionCodes)
                    {
                        _chatDataContext.LoadDispositionCodes.Add(items.Key, items.Value);
                    }
                }
                if (dispositionSubCodes.Count > 0 && dispositionSubCodes != null)
                {
                    _chatDataContext.LoadSubDispositionCodes.Clear();
                    _chatDataContext.LoadSubDispositionCodes = dispositionSubCodes;
                }
            }
            catch (Exception commonException)
            {
                logger.Error("Error occurred while reading GetAllValues() =  " + commonException.ToString());
            }
            finally
            {
                loadCaseDataKey.Clear();
                loadCaseDataKey = null;
                loadCaseDataFilterKey.Clear();
                loadCaseDataFilterKey = null;
                loadCaseDataSortingKey.Clear();
                loadCaseDataSortingKey = null;
                dispositionCodes.Clear();
                dispositionCodes = null;
                dispositionSubCodes.Clear();
                dispositionSubCodes = null;
                loadAvailablePushURL.Clear();
                loadAvailablePushURL = null;
            }
        }
        /// <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());
            }
        }
        public static OutputValues GetRenderFieldCodes(AgentProperties agentProperties, ContactProperties contactProperties, ContactInteractionProperties interactionProperties,
                                                       string renderText)
        {
            Pointel.Logger.Core.ILog logger = Pointel.Logger.Core.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, "AID");
            logger.Debug("RequestGetFieldCodes class GetRenderFieldCodes() : Entry");
            OutputValues output = OutputValues.GetInstance();

            try
            {
                RequestRenderFieldCodes renderFieldCodes = RequestRenderFieldCodes.Create();
                if (interactionProperties != null)
                {
                    renderFieldCodes.Interaction = interactionProperties;
                    logger.Info("Interaction Id : " + interactionProperties.Id);
                    logger.Info("From Address : " + interactionProperties.FromAddress);
                    logger.Info("To Address : " + interactionProperties.ToAddress);
                    logger.Info("Subject : " + interactionProperties.Subject);
                }
                else
                {
                    logger.Warn("Interaction properties is null");
                }
                if (agentProperties != null)
                {
                    renderFieldCodes.Agent = agentProperties;
                    logger.Info("Agent First Name : " + agentProperties.FirstName);
                    logger.Info("Agent Last Name : " + agentProperties.LastName);
                    logger.Info("Agent Full Name : " + agentProperties.FullName);
                }
                logger.Warn("Agent properties is null");
                if (contactProperties != null)
                {
                    renderFieldCodes.Contact = contactProperties;
                    logger.Info("Contact Id : " + contactProperties.Id);
                    logger.Info("Contact Title : " + contactProperties.Title);
                    logger.Info("Contact First Name : " + contactProperties.FirstName);
                    logger.Info("Contact Last Name : " + contactProperties.LastName);
                    logger.Info("Contact Full Name : " + contactProperties.FullName);
                    logger.Info("Contact Primary Phone Number : " + contactProperties.PrimaryPhoneNumber);
                    logger.Info("Contact Primary Email Address : " + contactProperties.PrimaryEmailAddress);
                }
                logger.Warn("Contact properties is null.");
                if (!string.IsNullOrEmpty(renderText))
                {
                    renderFieldCodes.Text = renderText;
                    logger.Info("Rendering Text : " + renderText);
                }
                logger.Warn("Rendering text is null or empty.");
                if (Settings.UCSProtocol != null && Settings.UCSProtocol.State == ChannelState.Opened)
                {
                    IMessage response = Settings.UCSProtocol.Request(renderFieldCodes);
                    if (response != null)
                    {
                        output.MessageCode     = "200";
                        output.Message         = "Rendering text Successful";
                        output.IContactMessage = response;
                    }
                    else
                    {
                        output.MessageCode     = "2001";
                        output.Message         = "Rendering text UnSuccessful";
                        output.IContactMessage = null;
                    }
                }
                else
                {
                    output.IContactMessage = null;
                    output.MessageCode     = "2001";
                    output.Message         = "Universal Contact Server protocol is Null or Closed";
                    logger.Warn("GetRenderFieldCodes() : Universal Contact Server protocol is Null or channel is closed");
                }
            }
            catch (Exception ex)
            {
                logger.Error("Error while getting data from standard response filed codes : " + (ex.InnerException == null ? ex.Message : ex.InnerException.ToString()));
            }
            logger.Debug("RequestGetFieldCodes class GetRenderFieldCodes() : Exit");
            return(output);
        }
Ejemplo n.º 16
0
        /// <summary>
        /// Connects the contact server.
        /// </summary>
        /// <param name="primaryServer">The primary server.</param>
        /// <param name="secondaryServer">The secondary server.</param>
        /// <returns></returns>
        public OutputValues ConnectContactServer(CfgApplication primaryServer, CfgApplication secondaryServer, bool switchoverServer = true)
        {
            OutputValues output = OutputValues.GetInstance();
            var          ucsServerConfProperties = new UcsServerConfProperties();

            try
            {
                if (Settings.UCSProtocol == null)
                {
                    logger.Debug("ConnectContactServer : Applied primary server properties to UCS protocol");
                    logger.Debug("ConnectContactServer : Primary server uri " + "tcp://" + primaryServer.ServerInfo.Host.IPaddress
                                 + ":" + primaryServer.ServerInfo.Port);
                    if (secondaryServer != null)
                    {
                        logger.Debug("ConnectContactServer : Applied secondary server properties to UCS protocol");
                        logger.Debug("ConnectContactServer : Secondary server uri " + "tcp://" + secondaryServer.ServerInfo.Host.IPaddress
                                     + ":" + secondaryServer.ServerInfo.Port);
                    }
                    else
                    {
                        logger.Warn("ConnectContactServer : Secondary server is not mentioned");
                        logger.Info("ConnectContactServer : Application has no backup servers");
                    }

                    ProtocolManagers.Instance().DisConnectServer(ServerType.Ucserver);

                    ucsServerConfProperties.Create(new Uri("tcp://" + primaryServer.ServerInfo.Host.IPaddress + ":" + primaryServer.ServerInfo.Port),
                                                   "", new Uri("tcp://" + secondaryServer.ServerInfo.Host.IPaddress + ":" + secondaryServer.ServerInfo.Port),
                                                   Convert.ToInt32(primaryServer.ServerInfo.Timeout), Convert.ToInt16(primaryServer.ServerInfo.Attempts),
                                                   Convert.ToInt32(Settings.AddpServerTimeout), Convert.ToInt32(Settings.AddpClientTimeout),
                                                   Genesyslab.Platform.Commons.Connection.Configuration.AddpTraceMode.Both);
                    var    USCserverProtocolConfiguration = ucsServerConfProperties.Protocolconfiguration;
                    string error = "";
                    if (!ProtocolManagers.Instance().ConnectServer(USCserverProtocolConfiguration, out error))
                    {
                        logger.Error("Ucs protocol is not opened due to, " + error);
                        output.MessageCode = "2001";
                        output.Message     = error;
                        return(output);
                    }
                    Settings.UCSProtocol         = ProtocolManagers.Instance().ProtocolManager[USCserverProtocolConfiguration.Name] as UniversalContactServerProtocol;
                    Settings.UCSProtocol.Opened += ContactConnectionManager_Opened;
                    Settings.UCSProtocol.Closed += ContactConnectionManager_Closed;
                    if (Settings.UCSProtocol.State == ChannelState.Opened)
                    {
                        ContactConnectionManager_Opened(null, null);
                        logger.Warn("ConnectContactServer : Contact protocol is opened ");
                        logger.Info("ConnectContactServer : Contact Protocol object id is " + Settings.UCSProtocol.GetHashCode().ToString());
                        output.MessageCode = "200";
                        output.Message     = "ConnectContactServer Connected";
                    }
                    else
                    {
                        logger.Warn("ConnectContactServer : Contact protocol is closed ");
                    }
                }
                else
                {
                    logger.Info("Contact Protocol status is " + Settings.UCSProtocol.State.ToString());
                }
            }
            catch (Exception commonException)
            {
                Settings.UCSProtocol = null;
                if (switchoverServer)
                {
                    output = ConnectContactServer(secondaryServer, primaryServer, false);
                }
                else
                {
                    logger.Error("ConnectContactServer :" + commonException.ToString());
                    output.MessageCode = "2001";
                    output.Message     = commonException.Message;
                }
            }
            return(output);
        }
Ejemplo n.º 17
0
        /// <summary>
        /// Reads the file integration key collections.
        /// </summary>
        /// <param name="configProtocol">The configuration protocol.</param>
        /// <param name="applicationName">Name of the application.</param>
        /// <returns></returns>

        #region ReadFileIntegrationKeyCollections

        public iCallData ReadFileIntegrationKeyCollections(ConfService configProtocol, string applicationName)
        {
            iCallData result   = null;
            string    value    = string.Empty;
            int       paramKey = 0;

            try
            {
                result           = new CallData();
                result.FileData  = new FileIntegration();
                result.PortData  = new PortIntegration();
                result.PipeData  = new PipeIntegration();
                result.CrmDbData = new CrmDbIntegration();

                CfgApplication      application = new CfgApplication(configProtocol);
                CfgApplicationQuery queryApp    = new CfgApplicationQuery();
                //queryApp.TenantDbid = WellKnownDbids.EnterpriseModeTenantDbid;
                queryApp.Name = applicationName;
                application   = configProtocol.RetrieveObject <CfgApplication>(queryApp);
                if (application != null)
                {
                    string[] applicationKeys = application.Options.AllKeys;

                    string[] applicationUserPropertieskeys = application.UserProperties.AllKeys;

                    foreach (string section in applicationUserPropertieskeys)
                    {
                        if (string.Compare(section, "facet.user.data", true) == 0)
                        {
                            KeyValueCollection kvColl = new KeyValueCollection();
                            kvColl = (KeyValueCollection)application.UserProperties["facet.user.data"];
                            logger.Debug("Retrieving values from facet.user.data section");
                            setting.attachDataList.Clear();
                            if (kvColl != null)
                            {
                                for (int i = 1; i <= (kvColl.Count / 2); i++)
                                {
                                    if (kvColl.ContainsKey("facet.userdata.key" + i.ToString()))
                                    {
                                        if (kvColl["facet.userdata.key" + i.ToString()].ToString() != null &&
                                            kvColl["facet.userdata.key" + i.ToString()].ToString() != string.Empty)
                                        {
                                            if (kvColl.ContainsKey("facet.tag.name" + i.ToString()))
                                            {
                                                if (kvColl["facet.tag.name" + i.ToString()].ToString() != null &&
                                                    kvColl["facet.tag.name" + i.ToString()].ToString() != string.Empty)
                                                {
                                                    if (!setting.attachDataList.ContainsKey(kvColl["facet.tag.name" + i.ToString()].ToString()))
                                                    {
                                                        setting.attachDataList.Add(kvColl["facet.tag.name" + i.ToString()].ToString(),
                                                                                   kvColl["facet.userdata.key" + i.ToString()].ToString());
                                                        logger.Debug("Key : facet.tag.name" + i.ToString() + " Value : " + kvColl["facet.tag.name" + i.ToString()].ToString());
                                                        logger.Debug("Key : facet.userdata.key" + i.ToString() + " Value : " + kvColl["facet.userdata.key" + i.ToString()].ToString());
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }

                    ConfigContainer.Instance().ReadSection("file-integration");
                    if (ConfigContainer.Instance().AllKeys.Contains("file-integration"))
                    {
                        KeyValueCollection _tempcoll = ConfigContainer.Instance().GetValue("file-integration");
                    }
                    foreach (string section in applicationKeys)
                    {
                        if (string.Compare(section, "file-integration", true) == 0 && Settings.GetInstance().EnableFileCommunication)
                        {
                            KeyValueCollection getFileIntegrationCollection = (KeyValueCollection)application.Options[section];
                            //code added by vinoth for bcbs version to show calldata pop up
                            result.FileData.EnableView = true;
                            //End
                            foreach (string fileKey in getFileIntegrationCollection.AllKeys)
                            {
                                Regex re = new Regex(@"\d+");
                                Match m  = re.Match(fileKey);
                                if (m.Success)
                                {
                                    paramKey = Convert.ToInt16(m.Value);
                                }
                                if (string.Compare(fileKey, "directory", true) == 0)
                                {
                                    logger.Debug("Key : " + fileKey + " Value : " + getFileIntegrationCollection[fileKey].ToString());
                                    result.FileData.DirectoryPath = getFileIntegrationCollection[fileKey].ToString();
                                }
                                else if (string.Compare(fileKey, "file-name", true) == 0)
                                {
                                    logger.Debug("Key : " + fileKey + " Value : " + getFileIntegrationCollection[fileKey].ToString());
                                    result.FileData.FileName = getFileIntegrationCollection[fileKey].ToString();
                                }
                                else if (string.Compare(fileKey, "file-format", true) == 0)
                                {
                                    logger.Debug("Key : " + fileKey + " Value : " + getFileIntegrationCollection[fileKey].ToString());
                                    result.FileData.FileFormat = getFileIntegrationCollection[fileKey].ToString();
                                }
                                else if (string.Compare(fileKey, "file.string-delimiter", true) == 0)
                                {
                                    logger.Debug("Key : " + fileKey + " Value : " + getFileIntegrationCollection[fileKey].ToString());
                                    result.FileData.Delimiter = getFileIntegrationCollection[fileKey].ToString();
                                }
                                else if (string.Compare(fileKey, "file.event.data-type", true) == 0)
                                {
                                    logger.Debug("Key : " + fileKey + " Value : " + getFileIntegrationCollection[fileKey].ToString());
                                    result.FileData.CallDataEventFileType = getFileIntegrationCollection[fileKey].ToString().Split(new char[] { ',' });
                                }
                                else if (string.Compare(fileKey, "enable.view", true) == 0)
                                {
                                    logger.Debug("Key : " + fileKey + " Value : " + getFileIntegrationCollection[fileKey].ToString());
                                    result.FileData.EnableView = Convert.ToBoolean(getFileIntegrationCollection[fileKey].ToString());
                                }
                                else if (string.Compare(fileKey, "content-type", true) == 0)
                                {
                                    logger.Debug("Key : " + fileKey + " Value : " + getFileIntegrationCollection[fileKey].ToString());
                                    result.FileData.ContentType = getFileIntegrationCollection[fileKey].ToString();
                                }
                                //else if (string.Compare(fileKey, "file" + paramKey + ".attribute", true) == 0)
                                //{
                                //    value += getFileIntegrationCollection[fileKey].ToString() + ",";

                                //}
                                else if (string.Compare(fileKey, "file" + paramKey + ".param", true) == 0)
                                {
                                    try
                                    {
                                        if (getFileIntegrationCollection.ContainsKey("file" + paramKey + ".user-data.key"))
                                        {
                                            result.FileData.ParameterName.Add(getFileIntegrationCollection[fileKey].ToString()
                                                                              , Convert.ToString(getFileIntegrationCollection["file" + paramKey + ".user-data.key"]));
                                        }
                                    }
                                    catch (Exception paramValue)
                                    {
                                        logger.Error("No value configured for given Parameter " + getFileIntegrationCollection[fileKey].ToString() + "  " + paramValue.ToString());
                                    }
                                    // paramKey++;
                                }
                                else if (string.Compare(fileKey, "file" + paramKey + ".attribute", true) == 0)
                                {
                                    try
                                    {
                                        if (getFileIntegrationCollection.ContainsKey("file" + paramKey + ".attribute.param"))
                                        {
                                            result.FileData.ParameterValue.Add(getFileIntegrationCollection[fileKey].ToString()
                                                                               , Convert.ToString(getFileIntegrationCollection["file" + paramKey + ".attribute.param"]));
                                        }
                                    }
                                    catch (Exception paramValue)
                                    {
                                        logger.Error("No value configured for given Parameter " + getFileIntegrationCollection[fileKey].ToString() + "  " + paramValue.ToString());
                                    }
                                    // paramKey++;
                                }
                            }
                            //result.FileData.AttributeFilter= value.ToString().Split(new char[] { ',' }); ;
                            getFileIntegrationCollection.Clear();
                            value = string.Empty;
                        }
                        else if (string.Compare(section, "port-integration", true) == 0 && Settings.GetInstance().EnablePortCommunication)
                        {
                            KeyValueCollection getPortIntegrationCollection = (KeyValueCollection)application.Options[section];
                            // paramKey = 0;
                            foreach (string portKey in getPortIntegrationCollection.AllKeys)
                            {
                                switch (portKey)
                                {
                                case "ip-address":
                                    setting.PortSetting.HostName = getPortIntegrationCollection[portKey].ToString();
                                    break;

                                case "receiving.data.port":
                                    setting.PortSetting.IncomingPortNumber = int.Parse(getPortIntegrationCollection[portKey].ToString());
                                    break;

                                case "sending.data.port":
                                    setting.PortSetting.OutGoingPortNumber = int.Parse(getPortIntegrationCollection[portKey].ToString());
                                    break;

                                case "port.send.delimiter":
                                    setting.PortSetting.SendDataDelimiter = getPortIntegrationCollection[portKey].ToString();
                                    break;

                                case "port.receive.delimiter":
                                    setting.PortSetting.ReceiveDataDelimiter = getPortIntegrationCollection[portKey].ToString();
                                    break;

                                case "port.call-media":
                                    setting.PortSetting.CallMedia = new List <string>(getPortIntegrationCollection[portKey].ToString().Split(','));
                                    break;

                                case "port.listen.event":
                                    //if (!string.IsNullOrEmpty(getPortIntegrationCollection[portKey].ToString()) && !string.IsNullOrWhiteSpace(getPortIntegrationCollection[portKey].ToString()))
                                    setting.PortSetting.CallDataEventType = new List <string>(getPortIntegrationCollection[portKey].ToString().Split(','));
                                    break;

                                case "port.receive.key-name":
                                    setting.PortSetting.ReceiveDatakey = new List <string>(getPortIntegrationCollection[portKey].ToString().Split(','));
                                    break;

                                case "port.receive.connid-key-name":
                                    setting.PortSetting.ReceiveConnectionIdName = getPortIntegrationCollection[portKey].ToString();
                                    break;

                                case "port.webservicereference-url":
                                    setting.PortSetting.WebServiceURL = getPortIntegrationCollection[portKey].ToString();
                                    break;
                                }
                            }

                            //Code to get list of key names and param name
                            for (int i = 0; true; i++)
                            {
                                string keyName   = "port.attribute" + i + ".key-name";
                                string paramName = "port.attribute" + i + ".param-name";
                                if (getPortIntegrationCollection.ContainsKey(keyName) && getPortIntegrationCollection.ContainsKey(paramName))
                                {
                                    setting.PortSetting.SendAttributeKeyName.Add(getPortIntegrationCollection[keyName].ToString());
                                    setting.PortSetting.SendAttributeValue.Add(getPortIntegrationCollection[paramName].ToString());
                                }
                                else
                                {
                                    break;
                                }
                            }

                            //Code to get list of user data's key names and param name
                            for (int j = 0; true; j++)
                            {
                                string keyName   = "port.user-data" + j + ".key-name";
                                string paramName = "port.user-data" + j + ".param-name";
                                if (getPortIntegrationCollection.ContainsKey(keyName) && getPortIntegrationCollection.ContainsKey(paramName))
                                {
                                    setting.PortSetting.SendUserDataName.Add(getPortIntegrationCollection[keyName].ToString());
                                    setting.PortSetting.SendUserDataValue.Add(getPortIntegrationCollection[paramName].ToString());
                                }
                                else
                                {
                                    break;
                                }
                            }
                            getPortIntegrationCollection.Clear();
                        }
                        else if (string.Compare(section, "pipe-integration", true) == 0 && Settings.GetInstance().EnablePipeCommunication)
                        {
                            //KeyValueCollection getPipeIntegrationCollection = (KeyValueCollection)application.Options[section];
                            ////paramKey = 0;
                            //foreach (string pipeKey in getPipeIntegrationCollection.AllKeys)
                            //{
                            //    Regex re = new Regex(@"\d+");
                            //    Match m = re.Match(pipeKey);
                            //    if (m.Success)
                            //    {
                            //        paramKey = Convert.ToInt16(m.Value);
                            //    }
                            //    if (string.Compare(pipeKey, "pipe.server-first", true) == 0)
                            //    {
                            //        logger.Debug("Key : " + pipeKey + " Value : " + getPipeIntegrationCollection[pipeKey].ToString());
                            //        result.PipeData.PipeFist = Convert.ToBoolean(getPipeIntegrationCollection[pipeKey].ToString().ToLower());
                            //    }
                            //    else if (string.Compare(pipeKey, "pipe.name", true) == 0)
                            //    {
                            //        logger.Debug("Key : " + pipeKey + " Value : " + getPipeIntegrationCollection[pipeKey].ToString());
                            //        result.PipeData.PipeName = getPipeIntegrationCollection[pipeKey].ToString();
                            //    }

                            //    else if (string.Compare(pipeKey, "pipe.string-delimiter", true) == 0)
                            //    {
                            //        logger.Debug("Key : " + pipeKey + " Value : " + getPipeIntegrationCollection[pipeKey].ToString());
                            //        result.PipeData.Delimiter = getPipeIntegrationCollection[pipeKey].ToString();
                            //    }
                            //    else if (string.Compare(pipeKey, "pipe.format", true) == 0)
                            //    {
                            //        logger.Debug("Key : " + pipeKey + " Value : " + getPipeIntegrationCollection[pipeKey].ToString());
                            //        result.PipeData.FileFormat = getPipeIntegrationCollection[pipeKey].ToString();
                            //    }
                            //    else if (string.Compare(pipeKey, "pipe.event.data-type", true) == 0)
                            //    {
                            //        logger.Debug("Key : " + pipeKey + " Value : " + getPipeIntegrationCollection[pipeKey].ToString());
                            //        result.PipeData.CallDataEventPipeType = getPipeIntegrationCollection[pipeKey].ToString().Split(new char[] { ',' });
                            //    }
                            //    //else if (string.Compare(pipeKey, "pipe" + paramKey + ".attribute", true) == 0)
                            //    //{
                            //    //    value += getPipeIntegrationCollection[pipeKey].ToString() + ",";

                            //    //}
                            //    //else if (string.Compare(pipeKey, "pipe" + paramKey + ".attribute", true) == 0)
                            //    //{
                            //    //    value += getPipeIntegrationCollection[pipeKey].ToString() + ",";

                            //    //}
                            //    else if (string.Compare(pipeKey, "pipe" + paramKey + ".param", true) == 0)
                            //    {
                            //        try
                            //        {
                            //            if (getPipeIntegrationCollection.ContainsKey("pipe" + paramKey + ".user-data.key"))
                            //                result.PipeData.ParameterName.Add(getPipeIntegrationCollection[pipeKey].ToString()
                            //                    , Convert.ToString(getPipeIntegrationCollection["pipe" + paramKey + ".user-data.key"]));
                            //        }
                            //        catch (Exception paramValue)
                            //        {
                            //            logger.Error("No value configured for given Parameter " + getPipeIntegrationCollection[pipeKey].ToString() + "  " + paramValue.ToString());
                            //        }
                            //        result.PipeData.ParameterName.Add(pipeKey, getPipeIntegrationCollection[pipeKey].ToString());
                            //        // paramKey++;
                            //    }
                            //    else if (string.Compare(pipeKey, "pipe" + paramKey + ".attribute", true) == 0)
                            //    {
                            //        try
                            //        {
                            //            if (getPipeIntegrationCollection.ContainsKey("pipe" + paramKey + ".attribute.param"))
                            //                result.PipeData.ParameterValue.Add(getPipeIntegrationCollection[pipeKey].ToString()
                            //                    , Convert.ToString(getPipeIntegrationCollection["pipe" + paramKey + ".attribute.param"]));
                            //        }
                            //        catch (Exception paramValue)
                            //        {
                            //            logger.Error("No value configured for given Parameter " + getPipeIntegrationCollection[pipeKey].ToString() + "  " + paramValue.ToString());
                            //        }
                            //        // paramKey++;
                            //    }
                            //}
                            //// result.PipeData.AttributeFilter = value.ToString().Split(new char[] { ',' }); ;
                            //getPipeIntegrationCollection.Clear();
                            //value = string.Empty;
                        }
                        else if (string.Compare(section, "url-integration", true) == 0 && Settings.GetInstance().EnableURLCommunication)
                        {
                            //KeyValueCollection getUrlIntegrationCollection = (KeyValueCollection)application.Options[section];
                            //// paramKey = 0;
                            //foreach (string urlKey in getUrlIntegrationCollection.AllKeys)
                            //{
                            //    Regex re = new Regex(@"\d+");
                            //    Match m = re.Match(urlKey);
                            //    if (m.Success)
                            //    {
                            //        paramKey = Convert.ToInt16(m.Value);
                            //    }

                            //    if (string.Compare(urlKey, "enable.validate.queue-login", true) == 0)
                            //    {
                            //        logger.Debug("Key : " + urlKey + " Value : " + getUrlIntegrationCollection[urlKey].ToString());
                            //        result.URLData.IsValidateQueueLogin = Convert.ToBoolean(getUrlIntegrationCollection[urlKey].ToString());
                            //    }
                            //    else if (string.Compare(urlKey, "browser-type", true) == 0)
                            //    {
                            //        logger.Debug("Key : " + urlKey + " Value : " + getUrlIntegrationCollection[urlKey].ToString());
                            //        result.URLData.BrowserType = getUrlIntegrationCollection[urlKey].ToString();
                            //    }
                            //    else if (string.Compare(urlKey, "popup.url", true) == 0)
                            //    {
                            //        logger.Debug("Key : " + urlKey + " Value : " + getUrlIntegrationCollection[urlKey].ToString());
                            //        string[] popurl = getUrlIntegrationCollection[urlKey].ToString().Split(new char[] { ',' });
                            //        result.URLData.PopUpUrl = popurl[0];
                            //    }
                            //    else if (string.Compare(urlKey, "login.url", true) == 0)
                            //    {
                            //        logger.Debug("Key : " + urlKey + " Value : " + getUrlIntegrationCollection[urlKey].ToString());
                            //        string[] popurl = getUrlIntegrationCollection[urlKey].ToString().Split(new char[] { ',' });
                            //        result.URLData.LoginUrl = popurl[0];
                            //    }
                            //    else if (string.Compare(urlKey, "enable.login-popup-url", true) == 0)
                            //    {
                            //        logger.Debug("Key : " + urlKey + " Value : " + getUrlIntegrationCollection[urlKey].ToString());
                            //        result.URLData.IsLoginUrlEnable = Convert.ToBoolean(getUrlIntegrationCollection[urlKey].ToString());
                            //    }

                            //    else if (string.Compare(urlKey, "enable.web-page-address-bar", true) == 0)
                            //    {
                            //        logger.Debug("Key : " + urlKey + " Value : " + getUrlIntegrationCollection[urlKey].ToString());
                            //        result.URLData.IsBrowserAddress = Convert.ToBoolean(getUrlIntegrationCollection[urlKey].ToString());
                            //    }
                            //    else if (string.Compare(urlKey, "enable.web-page-status-bar", true) == 0)
                            //    {
                            //        logger.Debug("Key : " + urlKey + " Value : " + getUrlIntegrationCollection[urlKey].ToString());
                            //        result.URLData.IsBrowserStatusBar = Convert.ToBoolean(getUrlIntegrationCollection[urlKey].ToString());
                            //    }

                            //    else if (string.Compare(urlKey, "url.qs.delimiter", true) == 0)
                            //    {
                            //        logger.Debug("Key : " + urlKey + " Value : " + getUrlIntegrationCollection[urlKey].ToString());
                            //        result.URLData.Delimiter = getUrlIntegrationCollection[urlKey].ToString();
                            //    }
                            //    else if (string.Compare(urlKey, "url.event.data-type", true) == 0)
                            //    {
                            //        logger.Debug("Key : " + urlKey + " Value : " + getUrlIntegrationCollection[urlKey].ToString());
                            //        result.URLData.CallDataEventUrlType = getUrlIntegrationCollection[urlKey].ToString().Split(new char[] { ',' });
                            //    }
                            //    else if (string.Compare(urlKey, "enable.web-page-inside-aid", true) == 0)
                            //    {
                            //        logger.Debug("Key : " + urlKey + " Value : " + getUrlIntegrationCollection[urlKey].ToString());
                            //        result.URLData.IsWebPageEnabled = Convert.ToBoolean(getUrlIntegrationCollection[urlKey].ToString());
                            //    }
                            //    else if (string.Compare(urlKey, "web-page.name-aid", true) == 0)
                            //    {
                            //        logger.Debug("Key : " + urlKey + " Value : " + getUrlIntegrationCollection[urlKey].ToString());
                            //        result.URLData.WebPageName = getUrlIntegrationCollection[urlKey].ToString();
                            //    }
                            //    else if (string.Compare(urlKey, "control.popup-single-browser", true) == 0)
                            //    {
                            //        logger.Debug("Key : " + urlKey + " Value : " + getUrlIntegrationCollection[urlKey].ToString());
                            //        result.URLData.IsSingleBrowser = Convert.ToBoolean(getUrlIntegrationCollection[urlKey].ToString());
                            //    }
                            //    else if (string.Compare(urlKey, "url" + paramKey + ".param", true) == 0)
                            //    {
                            //        try
                            //        {
                            //            if (getUrlIntegrationCollection.ContainsKey("url" + paramKey + ".user-data.key"))
                            //                result.URLData.ParameterName.Add(getUrlIntegrationCollection[urlKey].ToString()
                            //                    , Convert.ToString(getUrlIntegrationCollection["url" + paramKey + ".user-data.key"]));
                            //        }
                            //        catch (Exception paramValue)
                            //        {
                            //            logger.Error("No value configured for given Paramater " + getUrlIntegrationCollection[urlKey].ToString() + "  " + paramValue.ToString());
                            //        }
                            //        //  paramKey++;
                            //    }
                            //    else if (string.Compare(urlKey, "url" + paramKey + ".attribute", true) == 0)
                            //    {
                            //        try
                            //        {
                            //            if (getUrlIntegrationCollection.ContainsKey("url" + paramKey + ".attribute.param"))
                            //                result.URLData.ParameterValue.Add(getUrlIntegrationCollection[urlKey].ToString()
                            //                    , Convert.ToString(getUrlIntegrationCollection["url" + paramKey + ".attribute.param"]));
                            //        }
                            //        catch (Exception paramValue)
                            //        {
                            //            logger.Error("No value configured for given Paramater " + getUrlIntegrationCollection[urlKey].ToString() + "  " + paramValue.ToString());
                            //        }
                            //        // paramKey++;
                            //    }
                            //}
                            ////result.URLData .AttributeFilter = value.ToString().Split(new char[] { ',' }); ;
                            //getUrlIntegrationCollection.Clear();
                            //value = string.Empty;
                        }
                        else if (string.Compare(section, "db-integration", true) == 0 && Settings.GetInstance().EnableCrmDbCommunication)
                        {
                            KeyValueCollection getCrmIntegrationCollection = (KeyValueCollection)application.Options[section];
                            //paramKey = 0;

                            foreach (string portKey in getCrmIntegrationCollection.AllKeys)
                            {
                                Regex re = new Regex(@"\d+");
                                Match m  = re.Match(portKey);
                                if (m.Success)
                                {
                                    paramKey = Convert.ToInt16(m.Value);
                                }
                                if (string.Compare(portKey, "db.sqlliteconnectionstring", true) == 0)
                                {
                                    logger.Debug("Key : " + portKey + " Value : " + getCrmIntegrationCollection[portKey].ToString());
                                    result.CrmDbData.DirectoryPath = getCrmIntegrationCollection[portKey].ToString();
                                }

                                else if (string.Compare(portKey, "db-type", true) == 0)
                                {
                                    logger.Debug("Key : " + portKey + " Value : " + getCrmIntegrationCollection[portKey].ToString());
                                    result.CrmDbData.CrmDbFormat = getCrmIntegrationCollection[portKey].ToString();
                                }
                                else if (string.Compare(portKey, "db.string-delimiter", true) == 0)
                                {
                                    logger.Debug("Key : " + portKey + " Value : " + getCrmIntegrationCollection[portKey].ToString());
                                    result.CrmDbData.Delimiter = getCrmIntegrationCollection[portKey].ToString();
                                }
                                else if (string.Compare(portKey, "db.sqlconnectionstring", true) == 0)
                                {
                                    logger.Debug("Key : " + portKey + " Value : " + getCrmIntegrationCollection[portKey].ToString());
                                    result.CrmDbData.ConnectionSqlPath = getCrmIntegrationCollection[portKey].ToString();
                                }
                                else if (string.Compare(portKey, "db.oracleconnectionstring", true) == 0)
                                {
                                    logger.Debug("Key : " + portKey + " Value : " + getCrmIntegrationCollection[portKey].ToString());
                                    result.CrmDbData.ConnectionOraclePath = getCrmIntegrationCollection[portKey].ToString();
                                }
                                else if (string.Compare(portKey, "db.event.data-type", true) == 0)
                                {
                                    logger.Debug("Key : " + portKey + " Value : " + getCrmIntegrationCollection[portKey].ToString());
                                    result.CrmDbData.CallDataEventDBType = getCrmIntegrationCollection[portKey].ToString().Split(new char[] { ',' });
                                }
                                //else if (string.Compare(portKey, "db" + paramKey + ".attribute", true) == 0)
                                //{
                                //    value += getCrmIntegrationCollection[portKey].ToString() + ",";

                                //}
                                else if (string.Compare(portKey, "db" + paramKey + ".param", true) == 0)
                                {
                                    try
                                    {
                                        if (getCrmIntegrationCollection.ContainsKey("db" + paramKey + ".user-data.key"))
                                        {
                                            result.CrmDbData.ParameterName.Add(getCrmIntegrationCollection[portKey].ToString()
                                                                               , Convert.ToString(getCrmIntegrationCollection["db" + paramKey + ".user-data.key"]));
                                        }
                                    }
                                    catch (Exception paramValue)
                                    {
                                        logger.Error("No value configured for given Parameter " + getCrmIntegrationCollection[portKey].ToString() + "  " + paramValue.ToString());
                                    }
                                    // paramKey++;
                                }
                                else if (string.Compare(portKey, "db" + paramKey + ".attribute", true) == 0)
                                {
                                    try
                                    {
                                        if (getCrmIntegrationCollection.ContainsKey("db" + paramKey + ".attribute.param"))
                                        {
                                            result.CrmDbData.ParameterValue.Add(getCrmIntegrationCollection[portKey].ToString()
                                                                                , Convert.ToString(getCrmIntegrationCollection["db" + paramKey + ".attribute.param"]));
                                        }
                                    }
                                    catch (Exception paramValue)
                                    {
                                        logger.Error("No value configured for given Parameter " + getCrmIntegrationCollection[portKey].ToString() + "  " + paramValue.ToString());
                                    }
                                    // paramKey++;
                                }
                            }
                            //result.CrmDbData.AttributeFilter = value.ToString().Split(new char[] { ',' }); ;
                            getCrmIntegrationCollection.Clear();
                            value = string.Empty;
                        }
                    }
                }
            }
            catch (Exception generalException)
            {
                logger.Error("Error occurred while reading KVP's for File Popup " + generalException.ToString());
            }
            return(result);
        }
Ejemplo n.º 18
0
        /// <summary>
        /// Prepares the user data.
        /// </summary>
        private void PrepareUserData()
        {
            string finalDateTime = string.Empty;

            try
            {
                _updateUserEventData.Clear();
                if (_datacontext.userAttachData.ContainsKey("GSW_RECORD_HANDLE"))
                {
                    if (!_updateUserEventData.ContainsKey("GSW_RECORD_HANDLE"))
                    {
                        _updateUserEventData.Add("GSW_RECORD_HANDLE", Convert.ToInt32(_datacontext.userAttachData["GSW_RECORD_HANDLE"]));
                    }
                    else
                    {
                        _logger.Debug("PrepareUserData : GSW_RECORD_HANDLE is null");
                    }
                }

                if (_datacontext.userAttachData.ContainsKey("GSW_APPLICATION_ID"))
                {
                    if (!_updateUserEventData.ContainsKey("GSW_APPLICATION_ID"))
                    {
                        _updateUserEventData.Add("GSW_APPLICATION_ID", Convert.ToInt32(_datacontext.userAttachData["GSW_APPLICATION_ID"]));
                    }
                    else
                    {
                        _logger.Debug("PrepareUserData : GSW_APPLICATION_ID is null");
                    }
                }

                if (_datacontext.userAttachData.ContainsKey("GSW_CAMPAIGN_NAME"))
                {
                    if (!_updateUserEventData.ContainsKey("GSW_CAMPAIGN_NAME"))
                    {
                        _updateUserEventData.Add("GSW_CAMPAIGN_NAME", Convert.ToInt32(_datacontext.userAttachData["GSW_CAMPAIGN_NAME"]));
                    }
                    else
                    {
                        _logger.Debug("PrepareUserData : GSW_CAMPAIGN_NAME is null");
                    }
                }

                if (chkbxPersonalCallback.IsChecked == true)
                {
                    if (!_updateUserEventData.ContainsKey("PHSPCB"))
                    {
                        _updateUserEventData.Add("PHSPCB", "1");
                    }
                }
                else
                {
                    if (!_updateUserEventData.ContainsKey("PHSPCB"))
                    {
                        _updateUserEventData.Add("PHSPCB", "0");
                    }
                }
                if (!_updateUserEventData.ContainsKey("GSW_CALLBACK_TYPE"))
                {
                    _updateUserEventData.Add("GSW_CALLBACK_TYPE", "Campaign");
                }

                if (_datacontext.userAttachData.ContainsKey("GSW_CALLING_LIST"))
                {
                    if (!_updateUserEventData.ContainsKey("GSW_CALLING_LIST"))
                    {
                        _updateUserEventData.Add("GSW_CALLING_LIST", Convert.ToInt32(_datacontext.userAttachData["GSW_CALLING_LIST"]));
                    }
                    else
                    {
                        _logger.Debug("PrepareUserData : GSW_CALLING_LIST is null");
                    }
                }

                if (chkbxRescheduleCall.IsChecked == true)
                {
                    DateTime dt = new DateTime();
                    dt = Convert.ToDateTime(dpRescheduledate.Text);
                    DateTime dtTime = new DateTime();
                    dtTime = Convert.ToDateTime(dpRescheduletime.Text);

                    if (_configContainer.AllKeys.Contains("voice.ocs.time-format") && !string.IsNullOrEmpty(_configContainer.GetAsString("voice.ocs.time-format")))
                    {
                        try
                        {
                            finalDateTime = dt.Date.ToShortDateString() + " " + dtTime.ToString(_configContainer.GetAsString("voice.ocs.time-format"), CultureInfo.InstalledUICulture);
                        }
                        catch (Exception generalException)
                        {
                            _logger.Error("Error occurred while converting time in the given format : " + _configContainer.GetAsString("voice.ocs.time-format") + " : " + generalException.ToString());
                            finalDateTime = dt.Date.ToShortDateString() + " " + dtTime.ToString("HH:mm", CultureInfo.InstalledUICulture);
                        }
                    }

                    if (!_updateUserEventData.ContainsKey("GSW_DATE_TIME"))
                    {
                        _updateUserEventData.Add("GSW_DATE_TIME", finalDateTime);
                    }
                    if (!_updateUserEventData.ContainsKey("GSW_AGENT_REQ_TYPE"))
                    {
                        _updateUserEventData.Add("GSW_AGENT_REQ_TYPE", "RecordReschedule");
                    }
                }
                if (!string.IsNullOrEmpty(cmbCallResult.Text.Trim()) && cmbCallResult.SelectedIndex >= 0)
                {
                    if (!_updateUserEventData.ContainsKey("GSW_CALL_RESULT"))
                    {
                        _updateUserEventData.Add("GSW_CALL_RESULT", Convert.ToInt32(cmbCallResult.SelectedValue.ToString()));
                    }
                }

                if (_datacontext.userAttachData.ContainsKey("GSW_PHONE"))
                {
                    if (!_updateUserEventData.ContainsKey("GSW_PHONE"))
                    {
                        _updateUserEventData.Add("GSW_PHONE", _datacontext.userAttachData["GSW_PHONE"].ToString());
                    }
                }

                if (!_updateUserEventData.ContainsKey("GSW_AGENT_REQ_TYPE"))
                {
                    _updateUserEventData.Add("GSW_AGENT_REQ_TYPE", "UpdateCallCompletionStats");
                }

                var          soft   = new SoftPhone();
                OutputValues output = soft.UpdateOCSCallData(_updateUserEventData);
                if (output.MessageCode == "200")
                {
                    _logger.Info("OCS Call Data Updated Successfully....");
                }
                SendRecordProcessed(_updateUserEventData);
            }
            catch (Exception generalException)
            {
                _logger.Error("Error occurred in PrepareUserData() : " + generalException.ToString());
            }
        }
Ejemplo n.º 19
0
        /// <summary>
        /// Starts this instance.
        /// </summary>
        public void Start()
        {
            LoginWindowViewModel objLoginVM;

            userCredentials = new Dictionary <string, string>();
            XMLStorage  objXmlReader = new XMLStorage();
            LoginWindow objLogin;


            try
            {
                logger.Debug("IndexPage : Start : Method Entry");

                objXmlReader.ReadAppSettings();
                objLoginVM      = new LoginWindowViewModel();
                objLogin        = new LoginWindow();
                userCredentials = objXmlReader.LoadParameters();

                //StatisticsBase.GetInstance().IsGenesysSupport = Settings.ReadApplicationConfigServer;

                if (userCredentials["apptype"] == StatisticsEnum.StatSource.StatServer.ToString() || userCredentials["apptype"] == StatisticsEnum.StatSource.All.ToString())
                {
                    if (userCredentials["ConfigHost"] == "" || userCredentials["userName"] == "" || userCredentials["applicationName"] == "" || userCredentials["ConfigPort"] == "" || userCredentials["place"] == "" || userCredentials["apptype"] == "")
                    {
                        Settings.GetInstance().isFirstTime = true;
                        objLogin.DataContext = objLoginVM;
                        objLogin.Show();
                        objLoginVM.SystemMenuHook(objLogin);
                    }
                    else
                    {
                        Settings.GetInstance().isFirstTime = false;
                        objLoginVM.UserName        = userCredentials["userName"];
                        objLoginVM.Password        = objXmlReader.DecodeFrom64(userCredentials["password"]);
                        objLoginVM.ApplicationName = userCredentials["applicationName"];
                        objLoginVM.Host            = userCredentials["ConfigHost"];
                        objLoginVM.Port            = userCredentials["ConfigPort"];
                        objLoginVM.Place           = userCredentials["place"];
                        Settings.GetInstance().ApplicationType       = userCredentials["apptype"];
                        Settings.GetInstance().DefaultAuthentication = userCredentials["authenticationType"];
                        //Microsoft.Windows.Controls.MessageBox.Show("Login calling1");
                        objLoginVM.Login();
                    }
                }
                else if (userCredentials["apptype"] == StatisticsEnum.StatSource.DB.ToString())
                {
                    if (userCredentials["userName"] == "" || userCredentials["apptype"] == "")
                    {
                        Settings.GetInstance().isFirstTime = true;
                        objLogin.DataContext = objLoginVM;
                        objLogin.Show();
                        objLoginVM.SystemMenuHook(objLogin);
                    }
                    else
                    {
                        Settings.GetInstance().isFirstTime = false;
                        objLoginVM.UserName = userCredentials["userName"];
                        objLoginVM.Password = objXmlReader.DecodeFrom64(userCredentials["password"]);
                        Settings.GetInstance().ApplicationType = userCredentials["apptype"];
                        //Microsoft.Windows.Controls.MessageBox.Show("Login 2");
                        objLoginVM.Login();
                    }
                }
            }
            catch (KeyNotFoundException ex)
            {
                //System.Windows.MessageBox.Show("IndexPage:  Start: " + ex.Message);
                logger.Info("IndexPage : Start Method : " + ex.Message);

                objLogin = null;
                objLogin = new LoginWindow();
                Settings.GetInstance().isFirstTime = true;
                objLoginVM           = new LoginWindowViewModel();
                objLogin.DataContext = objLoginVM;
                objLogin.Show();
                objLoginVM.SystemMenuHook(objLogin);
            }
            catch (Exception ex)
            {
                //System.Windows.MessageBox.Show("IndexPage:  Start: " + ex.Message);
                logger.Error("IndexPage : Start Method : " + ex.Message);
            }
            finally
            {
                userCredentials = null;
                objXmlReader    = null;
                objLogin        = null;
                objLoginVM      = null;
                GC.Collect();
                logger.Debug("IndexPage : Start : Method Exit");
            }
        }
        public OutputValues ConnectConfigServer(string pri_ConfigServerHost, string pri_ConfigServerPort,
                                                string applicationName, string userName, string password, string sec_ConfigServerHost,
                                                string sec_ConfigServerPort, bool switchoverServer = true)
        {
            var output = new OutputValues();
            var confServerProperties = new ConfigurationServerConfProperties();

            try
            {
                _logger.Debug("ConnectTServer : Applied primary server properties to Voice protocol");
                _logger.Debug("ConnectTServer : Primary server uri " + "tcp://" + pri_ConfigServerHost
                              + ":" + pri_ConfigServerPort);
                if (sec_ConfigServerHost != null)
                {
                    _logger.Debug("ConnectTServer : Applied secondary server properties to Voice protocol");
                    _logger.Debug("ConnectTServer : Secondary server uri " + "tcp://" + sec_ConfigServerHost
                                  + ":" + sec_ConfigServerPort);
                }
                else
                {
                    _logger.Warn("ConnectTServer : Secondary server is not mentioned");
                    _logger.Info("ConnectTServer : Application has no backup servers");
                }

                if (ConfigContainer.Instance().ConfServiceObject != null)
                {
                    ConfServiceFactory.ReleaseConfService(ConfigContainer.Instance().ConfServiceObject);
                }

                ProtocolManagers.Instance().DisConnectServer(ServerType.Configserver);

                confServerProperties.Create(new Uri("tcp://" + pri_ConfigServerHost + ":" + pri_ConfigServerPort), CfgAppType.CFGAgentDesktop, applicationName,
                                            userName, password, new Uri("tcp://" + (sec_ConfigServerHost == "optional" ? pri_ConfigServerHost : sec_ConfigServerHost) +
                                                                        ":" + (sec_ConfigServerPort == "optional" ? pri_ConfigServerPort : sec_ConfigServerPort)),
                                            10, 5, 60, 60, Genesyslab.Platform.Commons.Connection.Configuration.AddpTraceMode.Both);
                var    cfgProtocolConfiguration = confServerProperties.Protocolconfiguration;
                string error = "";
                if (!ProtocolManagers.Instance().ConnectServer(cfgProtocolConfiguration, out error))
                {
                    _logger.Error("Configuration protocol is not opened due to, " + error);
                    output.MessageCode = "2001";
                    output.Message     = error;
                    return(output);
                }
                ConfigContainer.Instance().ConfServiceObject = (ConfService)ConfServiceFactory.CreateConfService(
                    ProtocolManagers.Instance().ProtocolManager[cfgProtocolConfiguration.Name] as ConfServerProtocol);
                if (ProtocolManagers.Instance().ProtocolManager[cfgProtocolConfiguration.Name].State == ChannelState.Opened)
                {
                    _logger.Debug("getProtocol : Configuration protocol is opened ");
                    _logger.Info("getProtocol : Configuration Protocol object id is "
                                 + ProtocolManagers.Instance().ProtocolManager[cfgProtocolConfiguration.Name].GetHashCode().ToString());

                    output.MessageCode = "200";
                    output.Message     = "Config Server Protocol Opened";
                }
                else
                {
                    _logger.Debug("getProtocol : Configuration protocol is closed ");
                    output.MessageCode = "2001";
                    output.Message     = "Config Server Connection not Established";
                }

                #region Old Code
                //catch (Exception generalException)
                //{
                //    _logger.Info("Configuration protocol already opened " + generalException.ToString());
                //    output.MessageCode = "2001";
                //    output.Message = (generalException.InnerException == null ? generalException.Message : generalException.InnerException.Message);
                //    return output;
                //}

                //_logger.Debug("getProtocol : Registered protocol manager ");
                ////Open the connection
                //ConnectionSettings.protocolManager[ConnectionSettings.ConfServer].Open();

                //comEventBrokerService = new EventBrokerService(ConnectionSettings.protocolManager.Receiver);
                ////Subscription of CFGObjects
                ////    Register(new Action<ConfEvent>(ReadApplicationObject.GetInstance().ConfigServiceHandler), new MessageIdFilter(EventObjectUpdated.MessageId));
                ////comEventBrokerService.Register(ReadApplicationObject.GetInstance().OnCMEObjectUpdated, new MessageIdFilter(EventObjectUpdated.MessageId));

                ////if (ConnectionSettings.comObject != null)
                ////    ConfServiceFactory.ReleaseConfService(ConnectionSettings.comObject);
                //if (ConfigContainer.Instance().ConfServiceObject != null)
                //    ConfServiceFactory.ReleaseConfService(ConfigContainer.Instance().ConfServiceObject);

                //ConfigContainer.Instance().ConfServiceObject = (ConfService)ConfServiceFactory.CreateConfService(
                //                  ConnectionSettings.protocolManager[ConnectionSettings.ConfServer] as ConfServerProtocol,
                //                  comEventBrokerService, true);
                //comEventBrokerService.Activate();

                //_logger.Debug("Trying to open the connection");
                //if (ConnectionSettings.protocolManager[ConnectionSettings.ConfServer].State == ChannelState.Opened)
                //{
                //    _logger.Debug("getProtocol : Configuration protocol is opened ");
                //    _logger.Info("getProtocol : Configuration Protocol object id is "
                //        + ConnectionSettings.protocolManager[ConnectionSettings.ConfServer].GetHashCode().ToString());

                //    output.MessageCode = "200";
                //    output.Message = "Config Server Protocol Opened";
                //}
                //else
                //{
                //    _logger.Debug("getProtocol : Configuration protocol is closed ");
                //    output.MessageCode = "2001";
                //    output.Message = "Config Server Connection Established";
                //}
                #endregion old code
            }
            catch (Exception connectionException)
            {
                if (switchoverServer)
                {
                    output = ConnectConfigServer(sec_ConfigServerHost, sec_ConfigServerPort,
                                                 applicationName, userName, password, pri_ConfigServerHost,
                                                 pri_ConfigServerPort, false);
                }
                else
                {
                    output.MessageCode = "2001";
                    output.Message     = (connectionException.InnerException == null ? connectionException.Message : connectionException.InnerException.Message);
                }
            }
            return(output);
        }