public static ICollection <CfgPerson> RetrieveAgentListfromAgentGroup(IConfService _confService,
                                                                              int tenantid, CfgGroup group)
        {
            ICollection <CfgPerson> person = null;

            CfgAgentGroup agentgroup = null;


            CfgAgentGroupQuery qagentgroup = new CfgAgentGroupQuery(_confService);

            try
            {
                qagentgroup.TenantDbid = tenantid;
                qagentgroup.Dbid       = group.DBID;

                agentgroup = _confService
                             .RetrieveObject <CfgAgentGroup>(qagentgroup);

                person = agentgroup.Agents;
            }
            catch (Exception ex)
            {
                log.Error("获取qagentgroup列表失败   " + ex.Message);
            }


            return(person);
        }
        /// <summary>
        /// 创建外拨活动
        /// </summary>
        /// <param name="_confService"></param>
        /// <param name="campaignname"></param>
        /// <param name="tenantid"></param>
        /// <param name="switchname"></param>
        public static void CreateCampaign(IConfService _confService, string campaignname,
                                          int tenantid, string switchname)
        {
            CfgTenantQuery qTenant = new CfgTenantQuery();

            qTenant.Dbid = tenantid;
            CfgTenant      tenant  = _confService.RetrieveObject <CfgTenant>(qTenant);
            CfgSwitchQuery qSwitch = new CfgSwitchQuery();

            qSwitch.Name       = switchname;
            qSwitch.TenantDbid = tenant.DBID;
            CfgSwitch @switch = _confService
                                .RetrieveObject <CfgSwitch>(qSwitch);

            CfgCampaign campaign = new CfgCampaign(_confService);

            try
            {
                campaign.Name   = campaignname;
                campaign.Tenant = tenant;


                campaign.Save();
            }
            catch (Exception ex)
            {
                log.Error("can not create campaignname " + campaignname + ":" + ex.Message);
            }
        }
示例#3
0
        private void Connect(string appName, int addpClientTimeout, int addpServerTimeout, string addpTrace)
        {
            configServerId          = CConfServerIdentifier + Guid.NewGuid();
            confServerConfiguration = new ConfServerConfiguration(configServerId)
            {
                Uri                 = new Uri(configServerPrimaryUri),
                ClientName          = appName,
                UserName            = "",
                UserPassword        = "",
                WarmStandbyUri      = new Uri(configServerBackupUri),
                WarmStandbyAttempts = 5,
                UseAddp             = true,
                AddpClientTimeout   = addpClientTimeout,
                AddpServerTimeout   = addpServerTimeout,
                AddpTrace           = addpTrace
            };


            protocolManagementService = new ProtocolManagementService();
            protocolManagementService.ProtocolOpened += OnProtocolOpened;
            protocolManagementService.ProtocolClosed += OnProtocolClosed;
            protocolManagementService.Register(confServerConfiguration);

            eventBrokerService  = BrokerServiceFactory.CreateEventBroker(protocolManagementService.Receiver);
            confServiceContract = ConfServiceFactory.CreateConfService(protocolManagementService[configServerId], eventBrokerService);
            confServiceContract.Register(OnConfEvent);

            protocolManagementService.BeginOpen();
        }
示例#4
0
        private static void InitializePSDKApplicationBlocks()
        {
            // Setup Application Blocks:

            // Create Protocol Manager Service object
            protocolManagementService = new ProtocolManagementService();

            // Create and initialize connection configuration object for TServer.
            confServerConfiguration = new ConfServerConfiguration(CONFIGSERVER_IDENTIFIER);

            var ConfServerURI = WebConfigurationManager.AppSettings["CfgServer.URI"];
            var ClientName    = WebConfigurationManager.AppSettings["CfgServer.ClientName"];
            var UserName      = WebConfigurationManager.AppSettings["CfgServer.UserName"];
            var UserPassword  = WebConfigurationManager.AppSettings["CfgServer.UserPassword"];

            // Set required values
            try
            {
                confServerConfiguration.Uri = new Uri(ConfServerURI);
            }
            catch (Exception ex)
            {
                log.Error(ex.Message, ex);
            }

            confServerConfiguration.ClientName   = ClientName;
            confServerConfiguration.UserName     = UserName;
            confServerConfiguration.UserPassword = UserPassword;


            if (System.Web.Configuration.WebConfigurationManager.AppSettings["CfgServer.HASupport"] == "1")
            {
                var uriBakup = System.Web.Configuration.WebConfigurationManager.AppSettings["CfgServer.URI_BAKUP"];
                confServerConfiguration.WarmStandbyAttempts = 3;
                confServerConfiguration.WarmStandbyTimeout  = 3000;
                confServerConfiguration.WarmStandbyUri      = new Uri(uriBakup);
                confServerConfiguration.FaultTolerance      = FaultToleranceMode.WarmStandby;
            }

            // Register this connection configuration with Protocol Manager
            protocolManagementService.Register(confServerConfiguration);

            protocolManagementService.ProtocolOpened += new EventHandler <ProtocolEventArgs>(OnProtocolOpened);
            protocolManagementService.ProtocolClosed += new EventHandler <ProtocolEventArgs>(OnProtocolClosed);

            // Create and Initialize Message Broker Application Block
            eventBrokerService = new EventBrokerService(protocolManagementService.Receiver);

            // Activate event broker service
            eventBrokerService.Activate();

            confService = ConfServiceFactory.CreateConfService(
                protocolManagementService[CONFIGSERVER_IDENTIFIER],
                eventBrokerService);

            eventBrokerService.Register(
                eventConfServerEventsHandler,
                new MessageFilter(protocolManagementService[CONFIGSERVER_IDENTIFIER].ProtocolId));
        }
        public static void Initialize(ISFDCListener subscirber, IAgentDetails agentDetails, IConfService confService)
        {
            try
            {
                _logger = Log.GenInstance();
                _logger.Info("Initialize: Reading Configuration and Initializing Properties......");
                AgentDetails  = agentDetails;
                ConfigService = confService;
                SFDCListener  = subscirber;
                ReadAdvancedSearchOptions();// Reading Advanced Search Configurations
                foreach (string sfdcObjectName in SFDCOptions.SFDCPopupPages)
                {
                    switch (sfdcObjectName)
                    {
                    case "lead":
                        ReadLeadConfigurations(sfdcObjectName);
                        break;

                    case "contact":
                        ReadContactConfigurations(sfdcObjectName);
                        break;

                    case "account":
                        ReadAccountConfigurations(sfdcObjectName);
                        break;

                    case "case":
                        ReadCaseConfigurations(sfdcObjectName);
                        break;

                    case "opportunity":
                        ReadOpportunityConfigurations(sfdcObjectName);
                        break;

                    case "useractivity":
                        _logger.Info("Initialize: Reading User Profile Level Activity Configuration and Initializing Properties......");
                        UserActivityConfigs = ReadConfiguration.GetInstance().ReadSFDCUtilityConfig(AgentDetails.MyApplication, AgentDetails.AgentGroups, AgentDetails.Person, sfdcObjectName);
                        break;

                    default:
                        if (sfdcObjectName.Contains("customobject"))
                        {
                            ReadCustomObjectConfigurations(sfdcObjectName);
                        }
                        break;
                    }
                }
                //Read  Profile Activity/ UserActivity
                ReadProfileActivityLog();
                if (!String.IsNullOrEmpty(CommonPopupObjects))
                {
                    CommonPopupObjects = CommonPopupObjects.Substring(0, CommonPopupObjects.Length - 1);
                }
            }
            catch (Exception generalException)
            {
                _logger.Error("Initialize: Error Occurred while Reading SFDC Object configurations : " + generalException.ToString());
            }
        }
        private static CfgPersonQuery BuildExecutableQuery(IConfService service, params Action <CfgPersonQuery>[] queryBuilders)
        {
            var query = new CfgPersonQuery(service);

            foreach (var builder in queryBuilders)
            {
                builder?.Invoke(query);
            }
            return(query);
        }
        private static CfgFilterBasedQuery CreateDbidQuery(IConfService service, Type queryType, int dbid)
        {
            if (!dbidQueries.Value.Contains(queryType))
            {
                throw new InvalidOperationException($"The provided query type is not valid for filtering by DBID: {queryType.FullName}");
            }
            var query = CreateQuery(service, queryType);

            queryType.GetProperty(DbidProperty).SetValue(query, dbid);
            return(query);
        }
示例#8
0
        public KeyValueCollection ReadBusinessAttribuiteConfig(IConfService configService, int tenantDBID, string attributeName, string attributeValueName)
        {
            try
            {
                logger.Info("ReadBusinessAttribuiteConfig : Reading Business Attribute Configurations.............");
                logger.Info("ReadBusinessAttribuiteConfig : Business Attribute Name : " + attributeName);
                logger.Info("ReadBusinessAttribuiteConfig : Business Attribute Value Name : " + attributeValueName);
                logger.Info("ReadBusinessAttribuiteConfig : Tenant DBID : " + tenantDBID.ToString());

                if (configService != null)
                {
                    CfgEnumeratorQuery enumeratorQuery = new CfgEnumeratorQuery();
                    enumeratorQuery.TenantDbid = tenantDBID;
                    enumeratorQuery.Name       = attributeName;

                    CfgEnumerator _cfgEnumerator = configService.RetrieveObject <CfgEnumerator>(enumeratorQuery);

                    if (_cfgEnumerator != null)
                    {
                        CfgEnumeratorValueQuery enumeratorValueQuery = new CfgEnumeratorValueQuery();
                        enumeratorValueQuery.EnumeratorDbid = _cfgEnumerator.DBID;
                        enumeratorValueQuery.Name           = attributeValueName;
                        CfgEnumeratorValue _cfgEnumeratorValue = configService.RetrieveObject <CfgEnumeratorValue>(enumeratorValueQuery);
                        if (_cfgEnumeratorValue != null)
                        {
                            logger.Info("ReadBusinessAttribuiteConfig : Configuration Data : " + Convert.ToString(_cfgEnumeratorValue.UserProperties));
                            return(_cfgEnumeratorValue.UserProperties);
                        }
                        else
                        {
                            logger.Info("ReadBusinessAttribuiteConfig : Reading Business Attribute Value " + attributeValueName + " Failed ");
                        }
                    }
                    else
                    {
                        logger.Info("ReadBusinessAttribuiteConfig : Reading Business Attribute " + attributeName + " Failed ");
                    }
                }
                else
                {
                    logger.Info("ReadBusinessAttribuiteConfig : Can not read Business Attribute " + attributeName + ", because ConfService Object is null ");
                }
            }
            catch (Exception generalException)
            {
                this.logger.Error("ReadBusinessAttribuiteConfig : Error occurred while reading Business Attribute Configuration :" + generalException.ToString());
            }
            return(null);
        }
        /// <summary>
        /// 删除一个外拨活动
        /// </summary>
        /// <param name="_confService"></param>
        /// <param name="campaignname"></param>
        /// <param name="tenantid"></param>
        /// <param name="switchname"></param>
        public static void DeleteCampaign(IConfService _confService, string campaignname,
                                          int tenantid, string switchname)
        {
            CfgCampaignQuery qcampaign = new CfgCampaignQuery(_confService);

            try
            {
                qcampaign.Name       = campaignname;
                qcampaign.TenantDbid = tenantid;

                CfgCampaign campaign = _confService.RetrieveObject <CfgCampaign>(qcampaign);
                campaign.Delete();
            }
            catch (Exception ex)
            {
                log.Error("can not create campaignname " + campaignname + ":" + ex.Message);
            }
        }
        /// <summary>
        /// 获取Tenant
        /// </summary>
        /// <param name="_confService"></param>
        /// <param name="campaignname"></param>
        /// <param name="tenantid"></param>
        /// <param name="switchname"></param>
        public static CfgTenant RetrieveTenant(IConfService _confService,
                                               int tenantid)
        {
            CfgTenant tenant = null;

            CfgTenantQuery qtenant = new CfgTenantQuery(_confService);

            try
            {
                qtenant.Dbid = tenantid;

                tenant = _confService
                         .RetrieveObject <CfgTenant>(qtenant);
            }
            catch (Exception ex)
            {
                log.Error("获取tenant列表失败   " + ex.Message);
            }

            return(tenant);
        }
        /// <summary>
        /// 获取座席列表
        /// </summary>
        /// <param name="_confService"></param>
        /// <param name="campaignname"></param>
        /// <param name="tenantid"></param>
        /// <param name="switchname"></param>
        public static ICollection <CfgPerson> RetrieveAgentList(IConfService _confService,
                                                                int tenantid)
        {
            ICollection <CfgPerson> person = null;

            CfgPersonQuery qperson = new CfgPersonQuery(_confService);

            try
            {
                qperson.TenantDbid = tenantid;


                person = _confService
                         .RetrieveMultipleObjects <CfgPerson>(qperson);
            }
            catch (Exception ex)
            {
                log.Error("获取qperson列表失败   " + ex.Message);
            }

            return(person);
        }
        /// <summary>
        /// 获取座席组
        /// </summary>
        /// <param name="_confService"></param>
        /// <param name="campaignname"></param>
        /// <param name="tenantid"></param>
        /// <param name="switchname"></param>
        public static CfgAgentGroup RetrieveAgentGroup(IConfService _confService, int dbid,
                                                       int tenantid)
        {
            CfgAgentGroup agentgroup = null;

            CfgAgentGroupQuery qagentgroup = new CfgAgentGroupQuery(_confService);

            try
            {
                qagentgroup.TenantDbid = tenantid;
                qagentgroup.Dbid       = dbid;

                agentgroup = _confService
                             .RetrieveObject <CfgAgentGroup>(qagentgroup);
            }
            catch (Exception ex)
            {
                log.Error("获取qagentgroup列表失败   " + ex.Message);
            }

            return(agentgroup);
        }
        /// <summary>
        /// 获取座席组列表
        /// </summary>
        /// <param name="_confService"></param>
        /// <param name="campaignname"></param>
        /// <param name="tenantid"></param>
        /// <param name="switchname"></param>
        public static ICollection <CfgAgentGroup> RetrieveAgentGroupList(IConfService _confService,
                                                                         int tenantid)
        {
            ICollection <CfgAgentGroup> agentgroup = null;

            CfgAgentGroupQuery qagentgroup = new CfgAgentGroupQuery(_confService);

            try
            {
                qagentgroup.TenantDbid = tenantid;


                agentgroup = _confService
                             .RetrieveMultipleObjects <CfgAgentGroup>(qagentgroup);
            }
            catch (Exception ex)
            {
                log.Error("获取qagentgroup列表失败   " + ex.Message);
            }

            return(agentgroup);
        }
        /// <summary>
        /// 获取CfgTableAccess列表
        /// </summary>
        /// <param name="_confService"></param>
        /// <param name="campaignname"></param>
        /// <param name="tenantid"></param>
        /// <param name="switchname"></param>
        public static ICollection <CfgTableAccess> RetrieveTableAccessList(IConfService _confService,
                                                                           int tenantid)
        {
            ICollection <CfgTableAccess> dn = null;

            CfgTableAccessQuery qdn = new CfgTableAccessQuery(_confService);

            try
            {
                qdn.TenantDbid = tenantid;
                qdn.Type       = CfgTableType.CFGTTCallingList;

                dn = _confService
                     .RetrieveMultipleObjects <CfgTableAccess>(qdn);
            }
            catch (Exception ex)
            {
                log.Error("获取CfgTableAccess列表失败   " + ex.Message);
            }

            return(dn);
        }
        /// <summary>
        /// 获取外拨活动list
        /// </summary>
        /// <param name="_confService"></param>
        /// <param name="campaignname"></param>
        /// <param name="tenantid"></param>
        /// <param name="switchname"></param>
        public static ICollection <CfgCampaign> RetrieveCampaignList(IConfService _confService,
                                                                     int tenantid)
        {
            ICollection <CfgCampaign> campaign = null;

            CfgCampaignQuery qcampaign = new CfgCampaignQuery(_confService);

            try
            {
                qcampaign.TenantDbid = tenantid;


                campaign = _confService
                           .RetrieveMultipleObjects <CfgCampaign>(qcampaign);
            }
            catch (Exception ex)
            {
                log.Error("获取campaign列表失败   " + ex.Message);
            }

            return(campaign);
        }
        /// <summary>
        /// 获取外拨群组列表
        /// </summary>
        /// <param name="_confService"></param>
        /// <param name="campaignname"></param>
        /// <param name="tenantid"></param>
        /// <param name="switchname"></param>
        public static ICollection <CfgCampaignGroup> RetrieveCampaignGroupList(IConfService _confService, CfgCampaign campaign,
                                                                               int tenantid)
        {
            ICollection <CfgCampaignGroup> campaigngroup = null;

            CfgCampaignGroupQuery qcampaigngroup = new CfgCampaignGroupQuery(_confService);

            try
            {
                qcampaigngroup.TenantDbid   = tenantid;
                qcampaigngroup.CampaignDbid = campaign.DBID;


                campaigngroup = _confService
                                .RetrieveMultipleObjects <CfgCampaignGroup>(qcampaigngroup);
            }
            catch (Exception ex)
            {
                log.Error("获取CfgCampaignGroup列表失败   " + ex.Message);
            }

            return(campaigngroup);
        }
        /// <summary>
        /// 获取DN列表
        /// </summary>
        /// <param name="_confService"></param>
        /// <param name="campaignname"></param>
        /// <param name="tenantid"></param>
        /// <param name="switchname"></param>
        public static ICollection <CfgDN> RetrieveDNList(IConfService _confService,
                                                         CfgDNType dntype,
                                                         int tenantid)
        {
            ICollection <CfgDN> dn = null;

            CfgDNQuery qdn = new CfgDNQuery(_confService);

            try
            {
                qdn.TenantDbid = tenantid;
                qdn.DnType     = dntype;

                dn = _confService
                     .RetrieveMultipleObjects <CfgDN>(qdn);
            }
            catch (Exception ex)
            {
                log.Error("获取CfgDN列表失败   " + ex.Message);
            }

            return(dn);
        }
示例#18
0
 public void Start()
 {
     IsStart = true;
     try
     {
         confservice = ConfigAPIUtils.InitializeConfigService(Utils.cfgserverhost.ToString(), Utils.cfgserverport, Utils.username.ToString(), Utils.password.ToString());
     }
     catch (Exception ex)
     {
         log.Error(ex.Message, ex);
     }
     try
     {
         OCS_URI = System.Configuration.ConfigurationManager.AppSettings["OCS_URI"];
         InitializePSDKApplicationBlocks();
         IsStart = true;
     }
     catch (Exception ex)
     {
         log.Error(ex.Message, ex);
     }
     Connect();
 }
        public static IConfService InitializeConfigService(string cfgsrvHost,
                                                           int cfgsrvPort, string username, string password)
        {
            Endpoint           confServerUri = new Endpoint(new Uri("tcp://" + cfgsrvHost + ":" + cfgsrvPort));
            String             _clientName   = "default";
            ConfServerProtocol cfgServiceProtocol;
            EventBrokerService _eventBrokerService;


            cfgServiceProtocol                       = new ConfServerProtocol(confServerUri);
            cfgServiceProtocol.ClientName            = _clientName;
            cfgServiceProtocol.UserName              = username;
            cfgServiceProtocol.UserPassword          = password;
            cfgServiceProtocol.ClientApplicationType = (int)CfgAppType.CFGSCE;

            try
            {
                cfgServiceProtocol.Open();
            }
            catch (ProtocolException e)
            {
                log.Info(e.Message);
            }
            catch (Exception e)
            {
                log.Info(e.Message);
            }

            _eventBrokerService = BrokerServiceFactory
                                  .CreateEventBroker(cfgServiceProtocol);

            IConfService cfgService = ConfServiceFactory.CreateConfService(
                cfgServiceProtocol, _eventBrokerService);

            return(cfgService);
        }
示例#20
0
        private static IConfService OpenCfg()
        {
            var ConfServerURI = WebConfigurationManager.AppSettings["CfgServer.URI"];
            var ClientName    = WebConfigurationManager.AppSettings["CfgServer.ClientName"];
            var UserName      = WebConfigurationManager.AppSettings["CfgServer.UserName"];
            var UserPassword  = WebConfigurationManager.AppSettings["CfgServer.UserPassword"];

            Endpoint           confServerUri = new Endpoint(new Uri(ConfServerURI));
            ConfServerProtocol cfgServiceProtocol;
            EventBrokerService _eventBrokerService;

            cfgServiceProtocol                       = new ConfServerProtocol(confServerUri);
            cfgServiceProtocol.ClientName            = ClientName;
            cfgServiceProtocol.UserName              = UserName;
            cfgServiceProtocol.UserPassword          = UserPassword;
            cfgServiceProtocol.ClientApplicationType = (int)CfgAppType.CFGSCE;

            try
            {
                cfgServiceProtocol.Open();
            }
            catch (ProtocolException e)
            {
                log.Error(e.Message);
            }
            catch (Exception e)
            {
                log.Error(e.Message);
            }

            _eventBrokerService = BrokerServiceFactory.CreateEventBroker(cfgServiceProtocol);

            IConfService cfgService = ConfServiceFactory.CreateConfService(cfgServiceProtocol, _eventBrokerService);

            return(cfgService);
        }
 /// <summary>
 /// Get Subscriber object
 /// </summary>
 /// <param name="subscirber"></param>
 public void SubscribeSFDCPopup(ISFDCListener subscirber, ILog _logger, IAgentDetails agentDetails, IConfService confService)
 {
     if (subscirber != null && _logger != null && agentDetails != null && confService != null)
     {
         this._logger = Log.GenInstance().CreateLogger(subscirber, _logger);
         InitializeSFDCIntegration(subscirber, agentDetails, confService);
         _logger.Info("*****************************************************************");
         this._logger.Info("SFDCController: Assembly Name    " + Assembly.GetExecutingAssembly().GetName().Name);
         this._logger.Info("SFDCController: Assembly Version " + Assembly.GetExecutingAssembly().GetName().Version);
         _logger.Info("*****************************************************************");
         _logger.Info("Subscribe : SFDCController Subscription Success");
     }
     else
     {
         throw new Exception("SFDC Popup Subscription Failed because Supplied Parameter(s) are null");
     }
 }
示例#22
0
 /// <summary>
 /// Adapter to convert from <typeparamref name="TContract"/> to <typeparamref name="TPsdk"/>.
 /// </summary>
 /// <param name="ctiObject">The CTI object to translate.</param>
 /// <param name="service">A Config Service object capable of creating and saving the PSDK Config object.</param>
 /// <returns>A PSDK Model equivalent to the provided CTI Model, bound directly to Genesys.</returns>
 protected abstract TPsdk ToPsdk(TContract ctiObject, IConfService service);
        /// <summary>
        /// Initialize SFDC Adapter
        /// </summary>
        /// <param name="agentDetails">Agent Details</param>
        /// <param name="tServer">T-Server Protocol</param>
        /// <param name="configProtocol">Config Server Protocol</param>
        private void InitializeSFDCIntegration(ISFDCListener subscirber, IAgentDetails agentDetails, IConfService confService)
        {
            try
            {
                _logger.Info("InitializeSFDCIntegration : Initializing Common Properties for SFDC Popup");

                Settings.GeneralConfigs = ReadConfiguration.GetInstance().ReadGeneralConfigurations(agentDetails.MyApplication, agentDetails.AgentGroups, agentDetails.Person);

                if (Settings.GeneralConfigs != null)
                {
                    Settings.SFDCOptions = Pointel.Salesforce.Adapter.Configurations.ReadProperties.GetInstance().GetSFDCGeneralProperties(Settings.GeneralConfigs);
                    if (Settings.SFDCOptions != null)
                    {
                        if (Settings.SFDCOptions.EnableSFDCIntegration)
                        {
                            // Initializing Common Properties in Settings
                            Settings.Initialize(subscirber, agentDetails, confService);

                            //Start SFDC Server
                            if (Settings.SFDCOptions.SFDCPopupChannels != null && Settings.SFDCOptions.SFDCConnectPort != 0)
                            {
                                SFDCHttpServer.GetInstance().StartListener(Environment.CurrentDirectory + @"\Files", Settings.SFDCOptions.SFDCConnectPort);
                                if (Settings.IsVoiceEnabled)
                                {
                                    _voicePopup = new VoiceEventHandler();
                                }
                                if (Settings.IsChatEnabled)
                                {
                                    _chatPopup = new ChatEventHandler();
                                }
                                if (Settings.IsEmailEnabled)
                                {
                                    _emailPopup = new EmailEventHandler();
                                }
                                //PopupBrowser
                                if (Settings.SFDCOptions.SFDCPopupContainer != null)
                                {
                                    if (Settings.SFDCOptions.SFDCPopupContainer.Equals("browser"))
                                    {
                                        if (Settings.SFDCOptions.SFDCLoginURL != null)
                                        {
                                            this._logger.Info("Lauching SFDC URL : " + PopupURL(Settings.SFDCOptions.SFDCLoginURL, Settings.SFDCOptions.SFDCPopupBrowserName,
                                                                                                Settings.SFDCOptions.EnableAddressbar, Settings.SFDCOptions.EnableStatusbar));
                                        }
                                        else
                                        {
                                            this._logger.Info("SFDC Login URL is null. ");
                                        }
                                    }
                                    else
                                    {
                                        Settings.SFDCListener.ReceiveSFDCWindow(new SFDCPopupWindow(Settings.SFDCOptions.SFDCLoginURL));
                                    }
                                }
                                else
                                {
                                    this._logger.Info("SFDC Popup Container is null. ");
                                }
                                if (!Settings.SFDCListener.IsSFDCConnected && Settings.SFDCOptions.AlertSFDCConnectionStatus)
                                {
                                    Settings.SFDCListener.SFDCConnectionStatus(LogMode.Error, Settings.SFDCOptions.SFDCConnectionFailureMessage);
                                }
                            }
                            else
                            {
                                this._logger.Info("SFDC Popup Aborted, because either popup channel or port number is empty ");
                                this._logger.Info("SFDC Popup Channels : " + Settings.SFDCOptions.SFDCPopupChannels);
                                this._logger.Info("SFDC Port Number : " + Settings.SFDCOptions.SFDCConnectPort);
                            }
                        }
                        else
                        {
                            _logger.Info("InitializeSFDCIntegration : SFDC Integration Disabled");
                        }
                    }
                    else
                    {
                        _logger.Info("InitializeSFDCIntegration : SFDC General Config object is null...");
                    }
                }
                else
                {
                    _logger.Info("InitializeSFDCIntegration : SFDC popup can not be started because SFDC General Configuration has is found.");
                }
            }
            catch (Exception generalException)
            {
                _logger.Error("InitializeSFDCIntegration : Error Occurred while start SFDC Popup " + generalException.ToString());
            }
        }
示例#24
0
 /// <summary>
 /// Constructs a delegate capable of retrieving all Configuration Objects of type <typeparamref name="TCfgObject"/> using the provided <paramref name="service"/>.
 /// </summary>
 /// <typeparam name="TCfgObject">The type of Configuration Object the delegate is specialized for.</typeparam>
 /// <param name="service">A valid Configuration Service object.</param>
 /// <returns>A delegate which can be invoked to retrieve all Configuration Objects of type <typeparamref name="TCfgObject"/>.</returns>
 public static Func <IEnumerable <TCfgObject> > BuildGetAllQuery <TCfgObject>(this IConfService service)
     where TCfgObject : CfgObject
 => () => BuildGetAllQuery <TCfgObject>()(service);
示例#25
0
 internal static CfgFilterBasedQuery CreateQuery(IConfService service, Type queryType)
 => queryType.GetConstructor(new[] { QueryConstructorArgument })
 .Invoke(new[] { service }) as CfgFilterBasedQuery;
 /// <summary>
 /// Constructs a delegate capable of retrieving a Config Server Person object by Last Name using the provided <paramref name="service"/>.
 /// </summary>
 /// <param name="service">A valid Configuration Service object.</param>
 /// <param name="queryBuilder">Optional delegate used to set additional filters.</param>
 /// <returns>A delegate which can be invoked to retrieve a Config Server Person object matching the provided name.</returns>
 public static Func <string, IEnumerable <CfgPerson> > GetLastNameQuery(this IConfService service, Action <CfgPersonQuery> queryBuilder = default)
 => name
 => BuildExecutableQuery(service, queryBuilder, q => q.LastName = name).Execute();
 /// <summary>
 /// Constructs a delegate capable of retrieving a Config Server Person object by Username using the provided <paramref name="service"/>.
 /// </summary>
 /// <param name="service">A valid Configuration Service object.</param>
 /// <param name="queryBuilder">Optional delegate used to set additional filters.</param>
 /// <returns>A delegate which can be invoked to retrieve a Config Server Person object matching the provided name.</returns>
 public static Func <string, CfgPerson> GetUserNameQuery(this IConfService service, Action <CfgPersonQuery> queryBuilder = default)
 => name
 => BuildExecutableQuery(service, queryBuilder, q => q.UserName = name).ExecuteSingleResult();
 /// <summary>
 /// Constructs a delegate capable of retrieving a Configuration Object of type <typeparamref name="TCfgObject"/> by its DBID.
 /// </summary>
 /// <typeparam name="TCfgObject">The type of Configuration Object to retrieve.</typeparam>
 /// <param name="service">A valid Configuration Service object.</param>
 /// <returns>A delegate which can be invoked to retrieve a Config Object with the provided DBID.</returns>
 public static Func <int, TCfgObject> BuildDbidQuery <TCfgObject>(this IConfService service)
     where TCfgObject : CfgObject
 => dbid => BuildDbidQuery <TCfgObject>()(service, dbid);
示例#29
0
        public static void InitializeUtils(ISFDCListener _subscirber, IAgentDetails _agentDetails, IConfService _confService)
        {
            try
            {
                logger = Log.GenInstance();
                logger.Info("InitializeUtils : Reading Configuration and Initializing Properties......");
                AgentDetails  = _agentDetails;
                ConfigService = _confService;
                SFDCListener  = _subscirber;

                foreach (string sfdcObject in SFDCOptions.SFDCPopupPages)
                {
                    KeyValueCollection ConfigData = null;
                    if (sfdcObject == "lead")
                    {
                        CommonPopupObjects += "Lead,";
                        logger.Info("InitializeUtils : Reading SFDCLead Configuration and Initializing Properties......");
                        LeadConfigs = ReadConfiguration.GetInstance().ReadSFDCObjectConfig(_agentDetails.MyApplication, _agentDetails.AgentGroups, _agentDetails.Person, sfdcObject);
                        if (LeadConfigs != null)
                        {
                            LeadVoiceOptions = ReadProperties.GetInstance().GetSFDCObjectVoiceProperties(LeadConfigs, sfdcObject);
                            LeadChatOptions  = ReadProperties.GetInstance().GetSFDCObjectChatProperties(LeadConfigs, sfdcObject);

                            ConfigData = ReadConfiguration.GetInstance().ReadBusinessAttribuiteConfig(ConfigService, _agentDetails.Person.Tenant.DBID, SFDCOptions.ActivityLogBusinessAttribute, "voice." + sfdcObject);
                            if (ConfigData != null)
                            {
                                VoiceActivityLogCollection.Add(sfdcObject, ConfigData);
                            }

                            ConfigData = ReadConfiguration.GetInstance().ReadBusinessAttribuiteConfig(ConfigService, _agentDetails.Person.Tenant.DBID, SFDCOptions.ActivityLogBusinessAttribute, "chat." + sfdcObject);
                            if (ConfigData != null)
                            {
                                ChatActivityLogCollection.Add(sfdcObject, ConfigData);
                            }

                            LeadNewRecordConfigs = ReadConfiguration.GetInstance().ReadBusinessAttribuiteConfig(ConfigService, _agentDetails.Person.Tenant.DBID, SFDCOptions.NewRecordDataBusinessAttribute, sfdcObject);
                        }
                        else
                        {
                            logger.Info("InitializeUtils : No Lead Configuration Found.");
                        }
                    }
                    else if (sfdcObject == "contact")
                    {
                        CommonPopupObjects += "Contact,";
                        logger.Info("InitializeUtils : Reading SFDCContact Configuration and Initializing Properties......");
                        ContactConfigs = ReadConfiguration.GetInstance().ReadSFDCObjectConfig(_agentDetails.MyApplication, _agentDetails.AgentGroups, _agentDetails.Person, sfdcObject);
                        if (ContactConfigs != null)
                        {
                            ContactVoiceOptions = ReadProperties.GetInstance().GetSFDCObjectVoiceProperties(ContactConfigs, sfdcObject);
                            ContactChatOptions  = ReadProperties.GetInstance().GetSFDCObjectChatProperties(ContactConfigs, sfdcObject);

                            ConfigData = ReadConfiguration.GetInstance().ReadBusinessAttribuiteConfig(ConfigService, _agentDetails.Person.Tenant.DBID, SFDCOptions.ActivityLogBusinessAttribute, "voice." + sfdcObject);
                            if (ConfigData != null)
                            {
                                VoiceActivityLogCollection.Add(sfdcObject, ConfigData);
                            }

                            ConfigData = ReadConfiguration.GetInstance().ReadBusinessAttribuiteConfig(ConfigService, _agentDetails.Person.Tenant.DBID, SFDCOptions.ActivityLogBusinessAttribute, "chat." + sfdcObject);
                            if (ConfigData != null)
                            {
                                ChatActivityLogCollection.Add(sfdcObject, ConfigData);
                            }

                            ContactNewRecordConfigs = ReadConfiguration.GetInstance().ReadBusinessAttribuiteConfig(ConfigService, _agentDetails.Person.Tenant.DBID, SFDCOptions.NewRecordDataBusinessAttribute, sfdcObject);
                        }
                        else
                        {
                            logger.Info("InitializeUtils : No Contact Configuration Found.");
                        }
                    }
                    else if (sfdcObject == "account")
                    {
                        CommonPopupObjects += "Account,";
                        logger.Info("InitializeUtils : Reading SFDCAccount Configuration and Initializing Properties......");
                        AccountConfigs = ReadConfiguration.GetInstance().ReadSFDCObjectConfig(_agentDetails.MyApplication, _agentDetails.AgentGroups, _agentDetails.Person, sfdcObject);
                        if (AccountConfigs != null)
                        {
                            AccountVoiceOptions = ReadProperties.GetInstance().GetSFDCObjectVoiceProperties(AccountConfigs, sfdcObject);
                            AccountChatOptions  = ReadProperties.GetInstance().GetSFDCObjectChatProperties(AccountConfigs, sfdcObject);

                            AccountNewRecordConfigs = ReadConfiguration.GetInstance().ReadBusinessAttribuiteConfig(ConfigService, _agentDetails.Person.Tenant.DBID, SFDCOptions.NewRecordDataBusinessAttribute, sfdcObject);

                            ConfigData = ReadConfiguration.GetInstance().ReadBusinessAttribuiteConfig(ConfigService, _agentDetails.Person.Tenant.DBID, SFDCOptions.ActivityLogBusinessAttribute, "voice." + sfdcObject);
                            if (ConfigData != null)
                            {
                                VoiceActivityLogCollection.Add(sfdcObject, ConfigData);
                            }

                            ConfigData = ReadConfiguration.GetInstance().ReadBusinessAttribuiteConfig(ConfigService, _agentDetails.Person.Tenant.DBID, SFDCOptions.ActivityLogBusinessAttribute, "chat." + sfdcObject);
                            if (ConfigData != null)
                            {
                                ChatActivityLogCollection.Add(sfdcObject, ConfigData);
                            }
                        }
                        else
                        {
                            logger.Info("InitializeUtils : No Account Configuration Found.");
                        }
                    }
                    else if (sfdcObject == "case")
                    {
                        CommonPopupObjects += "Case,";
                        logger.Info("InitializeUtils : Reading SFDCCase Configuration and Initializing Properties......");
                        CaseConfigs = ReadConfiguration.GetInstance().ReadSFDCObjectConfig(_agentDetails.MyApplication, _agentDetails.AgentGroups, _agentDetails.Person, sfdcObject);
                        if (CaseConfigs != null)
                        {
                            CaseVoiceOptions     = ReadProperties.GetInstance().GetSFDCObjectVoiceProperties(CaseConfigs, sfdcObject);
                            CaseChatOptions      = ReadProperties.GetInstance().GetSFDCObjectChatProperties(CaseConfigs, sfdcObject);
                            CaseNewRecordConfigs = ReadConfiguration.GetInstance().ReadBusinessAttribuiteConfig(ConfigService, _agentDetails.Person.Tenant.DBID, SFDCOptions.NewRecordDataBusinessAttribute, sfdcObject);

                            ConfigData = ReadConfiguration.GetInstance().ReadBusinessAttribuiteConfig(ConfigService, _agentDetails.Person.Tenant.DBID, SFDCOptions.ActivityLogBusinessAttribute, "voice." + sfdcObject);
                            if (ConfigData != null)
                            {
                                VoiceActivityLogCollection.Add(sfdcObject, ConfigData);
                            }

                            ConfigData = ReadConfiguration.GetInstance().ReadBusinessAttribuiteConfig(ConfigService, _agentDetails.Person.Tenant.DBID, SFDCOptions.ActivityLogBusinessAttribute, "chat." + sfdcObject);
                            if (ConfigData != null)
                            {
                                ChatActivityLogCollection.Add(sfdcObject, ConfigData);
                            }
                        }
                        else
                        {
                            logger.Info("InitializeUtils : No Case Configuration Found.");
                        }
                    }
                    else if (sfdcObject == "opportunity")
                    {
                        CommonPopupObjects += "Opportunity,";
                        logger.Info("InitializeUtils : Reading SFDCOpportunity Configuration and Initializing Properties......");
                        OpportunityConfigs = ReadConfiguration.GetInstance().ReadSFDCObjectConfig(_agentDetails.MyApplication, _agentDetails.AgentGroups, _agentDetails.Person, sfdcObject);
                        if (OpportunityConfigs != null)
                        {
                            OpportunityVoiceOptions     = ReadProperties.GetInstance().GetSFDCObjectVoiceProperties(OpportunityConfigs, sfdcObject);
                            OpportunityChatOptions      = ReadProperties.GetInstance().GetSFDCObjectChatProperties(OpportunityConfigs, sfdcObject);
                            OpportunityNewRecordConfigs = ReadConfiguration.GetInstance().ReadBusinessAttribuiteConfig(ConfigService, _agentDetails.Person.Tenant.DBID, SFDCOptions.NewRecordDataBusinessAttribute, sfdcObject);

                            ConfigData = ReadConfiguration.GetInstance().ReadBusinessAttribuiteConfig(ConfigService, _agentDetails.Person.Tenant.DBID, SFDCOptions.ActivityLogBusinessAttribute, "voice." + sfdcObject);
                            if (ConfigData != null)
                            {
                                VoiceActivityLogCollection.Add(sfdcObject, ConfigData);
                            }

                            ConfigData = ReadConfiguration.GetInstance().ReadBusinessAttribuiteConfig(ConfigService, _agentDetails.Person.Tenant.DBID, SFDCOptions.ActivityLogBusinessAttribute, "chat." + sfdcObject);
                            if (ConfigData != null)
                            {
                                ChatActivityLogCollection.Add(sfdcObject, ConfigData);
                            }
                        }
                        else
                        {
                            logger.Info("InitializeUtils : No Opportunity Configuration Found.");
                        }
                    }
                    else if (sfdcObject.Contains("customobject"))
                    {
                        logger.Info("InitializeUtils : Reading SFDCCustomObject Configuration and Initializing Properties......");
                        logger.Info("InitializeUtils : Object Name : " + sfdcObject);
                        KeyValueCollection customConfig = ReadConfiguration.GetInstance().ReadSFDCObjectConfig(_agentDetails.MyApplication, _agentDetails.AgentGroups, _agentDetails.Person, sfdcObject);
                        if (customConfig != null)
                        {
                            CustomObjectConfigs.Add(sfdcObject, customConfig);
                            VoiceOptions voiceOptions = ReadProperties.GetInstance().GetSFDCObjectVoiceProperties(customConfig, sfdcObject);
                            if (voiceOptions != null)
                            {
                                if (voiceOptions.ObjectName != null)
                                {
                                    CommonPopupObjects += voiceOptions.ObjectName + ",";
                                    CustomObjectNames.Add(voiceOptions.ObjectName, sfdcObject);
                                }
                                CustomObjectVoiceOptions.Add(sfdcObject, voiceOptions);
                            }
                            ChatOptions chatOptions = ReadProperties.GetInstance().GetSFDCObjectChatProperties(customConfig, sfdcObject);
                            if (chatOptions != null)
                            {
                                CustomObjectChatOptions.Add(sfdcObject, chatOptions);
                            }
                            CustomObjectNewRecordConfigs.Add(sfdcObject, ReadConfiguration.GetInstance().ReadBusinessAttribuiteConfig(ConfigService, _agentDetails.Person.Tenant.DBID, SFDCOptions.NewRecordDataBusinessAttribute, sfdcObject));

                            ConfigData = ReadConfiguration.GetInstance().ReadBusinessAttribuiteConfig(ConfigService, _agentDetails.Person.Tenant.DBID, SFDCOptions.ActivityLogBusinessAttribute, "voice." + sfdcObject);
                            if (ConfigData != null)
                            {
                                VoiceActivityLogCollection.Add(sfdcObject, ConfigData);
                            }

                            ConfigData = ReadConfiguration.GetInstance().ReadBusinessAttribuiteConfig(ConfigService, _agentDetails.Person.Tenant.DBID, SFDCOptions.ActivityLogBusinessAttribute, "chat." + sfdcObject);
                            if (ConfigData != null)
                            {
                                ChatActivityLogCollection.Add(sfdcObject, ConfigData);
                            }
                        }
                        else
                        {
                            logger.Info("InitializeUtils : No Configuration Found for the CustomObject : " + sfdcObject);
                        }
                    }
                    else if (sfdcObject == "useractivity")
                    {
                        logger.Info("InitializeUtils : Reading SFDCUserActivity Configuration and Initializing Properties......");
                        UserActivityConfigs = ReadConfiguration.GetInstance().ReadSFDCObjectConfig(_agentDetails.MyApplication, _agentDetails.AgentGroups, _agentDetails.Person, sfdcObject);
                        if (UserActivityConfigs != null)
                        {
                            UserActivityVoiceOptions = ReadProperties.GetInstance().GetSFDCUserActivityVoiceProperties(UserActivityConfigs, sfdcObject);
                            KeyValueCollection voiceUserActivityLog = ReadConfiguration.GetInstance().ReadBusinessAttribuiteConfig(ConfigService, _agentDetails.Person.Tenant.DBID, SFDCOptions.ActivityLogBusinessAttribute, "voice." + sfdcObject);
                            if (voiceUserActivityLog != null)
                            {
                                VoiceActivityLogCollection.Add(sfdcObject, voiceUserActivityLog);
                            }
                            UserActivityChatOptions = ReadProperties.GetInstance().GetSFDCUserActivityChatProperties(UserActivityConfigs, sfdcObject);
                            KeyValueCollection chatuseractivitylog = ReadConfiguration.GetInstance().ReadBusinessAttribuiteConfig(ConfigService, _agentDetails.Person.Tenant.DBID, SFDCOptions.ActivityLogBusinessAttribute, "chat." + sfdcObject);
                            if (chatuseractivitylog != null)
                            {
                                ChatActivityLogCollection.Add(sfdcObject, chatuseractivitylog);
                            }
                        }
                        else
                        {
                            logger.Info("InitializeUtils : No SFDCUserActivity Configuration Found.");
                        }
                    }
                }
                if (!String.IsNullOrEmpty(CommonPopupObjects))
                {
                    CommonPopupObjects = CommonPopupObjects.Substring(0, CommonPopupObjects.Length - 1);
                }
                if (SFDCOptions.CanUseCommonSearchData)
                {
                    //Read business attribute for Profile level activity
                    if (!string.IsNullOrWhiteSpace(SFDCOptions.ProfileActivityBusinessAttributeName))
                    {
                        ProfileLevelActivity = ReadConfiguration.GetInstance().ReadBusinessAttribuiteConfig(ConfigService, _agentDetails.Person.Tenant.DBID, SFDCOptions.ProfileActivityBusinessAttributeName, "voice.useractivity");
                    }
                    else
                    {
                        logger.Info("ProfileLevel Activity Log Creation is not configured");
                    }
                }
            }
            catch (Exception generalException)
            {
                logger.Error("InitializeUtils : Error Occurred while Reading SFDC Object configurations : " + generalException.ToString());
            }
        }
示例#30
0
        private void confserv()
        {
            try
            {
                IAgent agent = container.Resolve <IAgent>();
                #region ADDP settings
                PropertyConfiguration config = new PropertyConfiguration();
                config.UseAddp           = true;
                config.AddpServerTimeout = 30;
                config.AddpClientTimeout = 90;
                //config.AddpTrace = "both";
                config.AddpTraceMode = AddpTraceMode.Both;
                #endregion
                Endpoint           endpoint     = new Endpoint("10.220.57.1", 2020);
                ConfServerProtocol confProtocol = new ConfServerProtocol(endpoint);
                confProtocol.ClientApplicationType = (int)CfgAppType.CFGSCE;
                confProtocol.ClientName            = "default";
                confProtocol.UserName     = agent.UserName;
                confProtocol.UserPassword = agent.Password;
                try
                {
                    confProtocol.BeginOpen();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
                IConfService confservice = (ConfService)ConfServiceFactory.CreateConfService(confProtocol);

                CfgPersonQuery query = new CfgPersonQuery();
                query.UserName = agent.UserName;
                CfgPerson person = confservice.RetrieveObject <CfgPerson>(query);
                //MessageBox.Show(person.ToString());
                CfgAccessGroupQuery querys = new CfgAccessGroupQuery();
                querys.PersonDbid = person.DBID;
                querys.TenantDbid = 101;
                ICollection <CfgAccessGroup> accessGroups = confservice.RetrieveMultipleObjects <CfgAccessGroup>(querys);
                foreach (CfgAccessGroup accessGroup in accessGroups)
                {
                    agentProfile = accessGroup.GroupInfo.Name.ToString();
                    MessageBox.Show(agentProfile);

                    if (agentProfile.Equals("Azf_Nar"))
                    {
                        agentProfile = "Azf_Nar";
                        MessageBox.Show(agentProfile);
                        break;
                    }
                    else if (agentProfile.Equals("Azf_Fixed"))
                    {
                        agentProfile = "Azf_Fixed";
                        MessageBox.Show(agentProfile);
                        break;
                    }
                    else if (agentProfile.Equals("Backcell"))
                    {
                        agentProfile = "Backcell";
                        MessageBox.Show(agentProfile);
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }