Пример #1
0
 private bool IsValidQueue(string queueName)
 {
     try
     {
         CfgScriptQuery qScripts = new CfgScriptQuery();
         qScripts.ScriptType = Genesyslab.Platform.Configuration.Protocols.Types.CfgScriptType.CFGInteractionQueue;
         qScripts.Name       = queueName;
         qScripts.TenantDbid = ConfigContainer.Instance().TenantDbId;
         CfgScript interactionqueue = ((Genesyslab.Platform.ApplicationBlocks.ConfigurationObjectModel.ConfService)ConfigContainer.Instance().ConfServiceObject).RetrieveObject <CfgScript>(qScripts);
         if (interactionqueue != null)
         {
             return(true);
         }
     }
     catch (Exception generalException)
     {
         _logger.Error("Error occurred as :" + generalException.ToString());
     }
     return(false);
 }
Пример #2
0
        /// <summary>
        /// 获取所有员工(坐席)、坐席信息、坐席能力
        /// 此方法效率太慢
        /// </summary>
        /// <returns></returns>
        public static List <Person> GetPersons()
        {
            var result = new List <Person>();
            var icfg   = OpenCfg();

            try
            {
                CfgPersonQuery qPerson1 = new CfgPersonQuery(icfg);
                qPerson1.TenantDbid = 101;
                qPerson1.State      = CfgObjectState.CFGEnabled;
                qPerson1.IsAgent    = 2;
                var persons = qPerson1.Execute();
                foreach (var person1 in persons)
                {
                    var info = new Person();
                    info.DBID       = person1.DBID;
                    info.EmployeeID = person1.EmployeeID;
                    info.FirstName  = person1.FirstName;
                    info.UserName   = person1.UserName;
                    if (person1.AgentInfo != null)
                    {
                        info.AgentInfo.IsInitAgentInfo = true;
                        //坐席信息
                        foreach (var item in person1.AgentInfo.AgentLogins)
                        {
                            if (item.AgentLogin != null && item.AgentLogin.State == CfgObjectState.CFGEnabled)
                            {
                                info.AgentInfo.AgentLogins.Add(new AgentLogin()
                                {
                                    DBID      = item.AgentLogin.DBID,
                                    LoginCode = item.AgentLogin.LoginCode,
                                });
                            }
                        }

                        //队列
                        foreach (var item in person1.AgentInfo.SkillLevels)
                        {
                            if (item.Skill != null && item.Skill.State == CfgObjectState.CFGEnabled)
                            {
                                info.AgentInfo.SkillLevels.Add(new SkillLevel()
                                {
                                    DBID = item.Skill.DBID, Level = item.Level
                                });
                            }
                        }
                    }

                    //服务能力
                    if (person1.AgentInfo != null)
                    {
                        info.VOICE = 1;
                        if (person1.AgentInfo.CapacityRule != null)
                        {
                            CfgScript script = person1.AgentInfo.CapacityRule;
                            if (script != null)
                            {
                                KeyValueCollection kv = script.UserProperties;
                                if (kv != null && kv.Get("_CRWizardMediaCapacityList_") != null)
                                {
                                    KeyValueCollection kv1 = (KeyValueCollection)kv.Get("_CRWizardMediaCapacityList_");
                                    foreach (var key in kv1.AllKeys)
                                    {
                                        if (key == "chat")
                                        {
                                            info.CHAT = kv1.GetAsInt(key);
                                        }
                                        else if (key == "voice")
                                        {
                                            info.VOICE = kv1.GetAsInt(key);
                                        }
                                    }
                                }
                            }
                        }
                    }

                    result.Add(info);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                CloseCfg(icfg);
            }
            return(result);
        }
Пример #3
0
        /// <summary>
        /// 获取员工(坐席、管理员)、坐席信息、坐席能力
        /// </summary>
        /// <param name="employeeId">员工编号</param>
        public static Person GetPerson(string employeeId)
        {
            var result = new List <Person>();
            var icfg   = OpenCfg();

            try
            {
                CfgPersonQuery qPerson1 = new CfgPersonQuery(icfg);
                qPerson1.TenantDbid = 101;
                qPerson1.State      = CfgObjectState.CFGEnabled;
                qPerson1.IsAgent    = 2;//只有坐席能登录
                qPerson1.EmployeeId = employeeId;
                var persons = qPerson1.Execute();
                foreach (var person1 in persons)
                {
                    var info = new Person();
                    info.DBID       = person1.DBID;
                    info.EmployeeID = person1.EmployeeID;
                    info.FirstName  = person1.FirstName;
                    info.UserName   = person1.UserName;
                    if (person1.AgentInfo != null)
                    {
                        info.AgentInfo.IsInitAgentInfo = true;
                        //坐席信息
                        foreach (var item in person1.AgentInfo.AgentLogins)
                        {
                            if (item.AgentLogin != null && item.AgentLogin.State == CfgObjectState.CFGEnabled)
                            {
                                info.LoginCode = item.AgentLogin.LoginCode;
                                info.AgentInfo.AgentLogins.Add(new AgentLogin()
                                {
                                    DBID      = item.AgentLogin.DBID,
                                    LoginCode = item.AgentLogin.LoginCode,
                                });
                            }
                        }

                        //队列
                        foreach (var item in person1.AgentInfo.SkillLevels)
                        {
                            if (item.Skill != null && item.Skill.State == CfgObjectState.CFGEnabled)
                            {
                                info.AgentInfo.SkillLevels.Add(new SkillLevel()
                                {
                                    DBID = item.Skill.DBID, Level = item.Level
                                });
                            }
                        }
                    }

                    //服务能力
                    if (person1.AgentInfo != null)
                    {
                        info.VOICE = 1;
                        if (person1.AgentInfo.CapacityRule != null)
                        {
                            CfgScript script = person1.AgentInfo.CapacityRule;
                            if (script != null)
                            {
                                KeyValueCollection kv = script.UserProperties;
                                if (kv != null && kv.Get("_CRWizardMediaCapacityList_") != null)
                                {
                                    KeyValueCollection kv1 = (KeyValueCollection)kv.Get("_CRWizardMediaCapacityList_");
                                    foreach (var key in kv1.AllKeys)
                                    {
                                        if (key == "chat")
                                        {
                                            info.CHAT = kv1.GetAsInt(key);
                                        }
                                        //else if (key == "voice")
                                        //{
                                        //    info.VOICE = kv1.GetAsInt(key);
                                        //}
                                    }
                                }
                            }
                        }
                    }

                    if (string.IsNullOrEmpty(info.LoginCode))
                    {
                        info.LoginCode = "";
                    }
                    result.Add(info);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                CloseCfg(icfg);
            }
            if (result.Count > 0)
            {
                var person = result.First();
                var ip     = HttpContext.Current.Request.UserHostAddress;
                using (var db = new Tele.DataLibrary.SPhoneEntities())
                {
                    var ipdn = db.SPhone_IPDN.Where(x => x.PlaceIP == ip).FirstOrDefault();
                    if (ipdn != null)
                    {
                        person.DN    = ipdn.DNNo;
                        person.Place = ipdn.Place;
                    }
                }
                return(person);
            }
            return(null);
        }