コード例 #1
0
 public ContactServiceQueueInformationClient(String UCCXNode, String UCCXApplicationPort, String UCCXRealtimePrefix)
 {
     _UCCXNode            = UCCXNode;
     _UCCXApplicationPort = UCCXApplicationPort;
     _UCCXRealtimePrefix  = UCCXRealtimePrefix;
     sResponse            = String.Empty;
     _Information         = null;
 }
コード例 #2
0
        public bool Analyse(ContactServiceQueueInformation Information, CallbackContactServiceQueueSettingsProfile Profile, CallbackRecordManager RecordManager)
        {
            Trace.TraceInformation("Enter.");

            try
            {
                if (Information == null)
                {
                    _Description = "Information is null.";
                    Trace.TraceWarning("Information is null.");
                    return(false);
                }

                if (Profile == null)
                {
                    _Description = "Profile is null.";
                    Trace.TraceWarning("Profile is null.");
                    return(false);
                }

                if (RecordManager == null)
                {
                    _Description = "RecordManager is null.";
                    Trace.TraceWarning("RecordManager is null.");
                    return(false);
                }

                bool bResult = true;

                foreach (CallbackAlgorithmFilter filter in Profile.OfferedAlgorithmFilters)
                {
                    if (filter.Enabled)
                    {
                        try
                        {
                            Constants.FilterOperations Operation = Constants.FilterOperations.BIGGERTHANOREQUALTO;

                            Operation = (Constants.FilterOperations)Enum.Parse(typeof(Constants.FilterOperations), filter.Operation.ToUpper());

                            switch (filter.Name)
                            {
                            case "AgentsLoggedIn":

                                switch (Operation)
                                {
                                case Constants.FilterOperations.BIGGERTHANOREQUALTO:

                                    if (Information.AgentsLoggedIn >= filter.Value)
                                    {
                                        bResult = bResult && true;
                                    }
                                    else
                                    {
                                        _Description = "CSQ " + Information.Name + " has less than " + filter.Value + " agents logged in.";
                                        bResult      = bResult && false;
                                    }

                                    break;

                                case Constants.FilterOperations.SMALLERTHANOREQUALTO:

                                    if (Information.AgentsLoggedIn <= filter.Value)
                                    {
                                        bResult = bResult && true;
                                    }
                                    else
                                    {
                                        _Description = "CSQ " + Information.Name + " has more than " + filter.Value + " agents logged in.";
                                        bResult      = bResult && false;
                                    }

                                    break;
                                }

                                break;

                            case "CallsWaiting":

                                switch (Operation)
                                {
                                case Constants.FilterOperations.BIGGERTHANOREQUALTO:

                                    if (Information.ContactsWaiting >= filter.Value)
                                    {
                                        bResult = bResult && true;
                                    }
                                    else
                                    {
                                        _Description = "CSQ " + Information.Name + " has less than " + filter.Value + " calls waiting.";
                                        bResult      = bResult && false;
                                    }

                                    break;

                                case Constants.FilterOperations.SMALLERTHANOREQUALTO:

                                    if (Information.ContactsWaiting <= filter.Value)
                                    {
                                        bResult = bResult && true;
                                    }
                                    else
                                    {
                                        _Description = "CSQ " + Information.Name + " has more than " + filter.Value + " calls waiting.";
                                        bResult      = bResult && false;
                                    }

                                    break;
                                }

                                break;

                            case "LongestQueueTime":

                                switch (Operation)
                                {
                                case Constants.FilterOperations.BIGGERTHANOREQUALTO:

                                    if (Information.LongestWaitingContact >= filter.Value)
                                    {
                                        bResult = bResult && true;
                                    }
                                    else
                                    {
                                        _Description = "CSQ " + Information.Name + " has longest queue time less than " + filter.Value;
                                        bResult      = bResult && false;
                                    }

                                    break;

                                case Constants.FilterOperations.SMALLERTHANOREQUALTO:

                                    if (Information.LongestWaitingContact <= filter.Value)
                                    {
                                        bResult = bResult && true;
                                    }
                                    else
                                    {
                                        _Description = "CSQ " + Information.Name + " has longest queue time more than " + filter.Value;
                                        bResult      = bResult && false;
                                    }

                                    break;
                                }

                                break;

                            case "CallbackRequests":

                                switch (Operation)
                                {
                                case Constants.FilterOperations.BIGGERTHANOREQUALTO:

                                    if (RecordManager.NumberOfRecordsForQueue(Information.Name) >= filter.Value)
                                    {
                                        bResult = bResult && true;
                                    }
                                    else
                                    {
                                        _Description = "CSQ " + Information.Name + " has fewer than " + filter.Value + " callback requests.";
                                        bResult      = bResult && false;
                                    }

                                    break;

                                case Constants.FilterOperations.SMALLERTHANOREQUALTO:

                                    if (RecordManager.NumberOfRecordsForQueue(Information.Name) <= filter.Value)
                                    {
                                        bResult = bResult && true;
                                    }
                                    else
                                    {
                                        _Description = "CSQ " + Information.Name + " has more than " + filter.Value + " callback requests:" + RecordManager.NumberOfRecordsForQueue(Information.Name);
                                        bResult      = bResult && false;
                                    }

                                    break;
                                }

                                break;

                            default:

                                break;
                            }
                        }
                        catch (Exception ex)
                        {
                            _Description = "Exception performing algorithm comparisons.";
                            Trace.TraceWarning("Exception: " + ex.Message + Environment.NewLine + "Stacktrace: " + ex.StackTrace);
                            bResult = false;
                        }
                    }
                }

                return(bResult);
            }
            catch (Exception ex)
            {
                _Description = "Exception running callback offer algorithm.";
                Trace.TraceWarning("Exception: " + ex.Message + Environment.NewLine + "Stacktrace: " + ex.StackTrace);
                return(false);
            }
        }
コード例 #3
0
        private bool ParseResponseIntoArraylist()
        {
            try
            {
                int iCode = 0;

                System.Xml.XmlDocument xmlDoc = null;

                xmlDoc = new System.Xml.XmlDocument();

                xmlDoc.LoadXml(sResponse);

                System.Xml.XmlNode nodCode = xmlDoc.SelectSingleNode("//response/code");

                if (nodCode != null)
                {
                    try
                    {
                        iCode = int.Parse(nodCode.InnerText);
                    }
                    catch (Exception ex)
                    {
                        Trace.TraceWarning("Exception casting Code to integer; Code defaulted to -1.");
                        iCode = -1;
                    }
                }
                else
                {
                    Trace.TraceWarning("//response/code element not found. Code defaulted to -1");
                    iCode = -1;
                }

                if (iCode == -1)
                {
                    Trace.TraceWarning("//response/code element = -1");
                    nodCode = null;
                    xmlDoc  = null;
                    return(false);
                }

                nodCode = null;

                System.Xml.XmlNodeReader reader = new System.Xml.XmlNodeReader(xmlDoc);

                CSQInfo.Clear();

                ContactServiceQueueInformation _con = null;

                while (reader.Read())
                {
                    switch (reader.NodeType)
                    {
                    case System.Xml.XmlNodeType.Element:

                        if (reader.Name.Equals("csq"))
                        {
                            _con = new ContactServiceQueueInformation();
                        }

                        if (reader.Name.Equals("id"))
                        {
                            _con.ID = reader.ReadString();
                        }

                        if (reader.Name.Equals("name"))
                        {
                            _con.Name = reader.ReadString();
                        }

                        if (reader.Name.Equals("agentsloggedin"))
                        {
                            _con.AgentsLoggedIn = int.Parse(reader.ReadString());
                        }

                        if (reader.Name.Equals("agentsnotready"))
                        {
                            _con.AgentsNotReady = int.Parse(reader.ReadString());
                        }

                        if (reader.Name.Equals("agentsready"))
                        {
                            _con.AgentsReady = int.Parse(reader.ReadString());
                        }

                        if (reader.Name.Equals("agentstalking"))
                        {
                            _con.AgentsTalking = int.Parse(reader.ReadString());
                        }

                        if (reader.Name.Equals("agentswork"))
                        {
                            _con.AgentsWork = int.Parse(reader.ReadString());
                        }

                        if (reader.Name.Equals("contactswaiting"))
                        {
                            _con.ContactsWaiting = int.Parse(reader.ReadString());
                        }

                        if (reader.Name.Equals("longestwaitingcontact"))
                        {
                            _con.LongestWaitingContact = int.Parse(reader.ReadString());
                        }

                        break;

                    case System.Xml.XmlNodeType.EndElement:

                        if (reader.Name.Equals("csq"))
                        {
                            CSQInfo.Add(_con);
                            _con = null;
                        }

                        break;
                    } //switch (reader.NodeType)
                }     //while (reader.Read())

                reader = null;
                xmlDoc = null;

                return(true);
            }
            catch (Exception ex)
            {
                Trace.TraceWarning("Exception: " + ex.Message + Environment.NewLine + "Stacktrace: " + ex.StackTrace);
                return(false);
            }
        }
コード例 #4
0
        private bool ParseResponse()
        {
            try
            {
                System.Xml.XmlDocument xmlDoc = null;

                xmlDoc = new System.Xml.XmlDocument();

                xmlDoc.LoadXml(sResponse);

                System.Xml.XmlNodeReader reader = new System.Xml.XmlNodeReader(xmlDoc);

                while (reader.Read())
                {
                    switch (reader.NodeType)
                    {
                    case System.Xml.XmlNodeType.Element:

                        if (reader.Name.Equals("CSQ"))
                        {
                            _Information      = new ContactServiceQueueInformation();
                            _Information.Name = reader.GetAttribute("name");
                        }

                        if (reader.Name.Equals("LoggedIn"))
                        {
                            try
                            {
                                _Information.AgentsLoggedIn = int.Parse(reader.ReadString());
                            }
                            catch (Exception ex)
                            {
                                _Information.AgentsLoggedIn = -99;
                            }
                        }

                        if (reader.Name.Equals("Talking"))
                        {
                            try
                            {
                                _Information.AgentsTalking = int.Parse(reader.ReadString());
                            }
                            catch (Exception ex)
                            {
                                _Information.AgentsTalking = -99;
                            }
                        }

                        if (reader.Name.Equals("Ready"))
                        {
                            try
                            {
                                _Information.AgentsReady = int.Parse(reader.ReadString());
                            }
                            catch (Exception ex)
                            {
                                _Information.AgentsReady = -99;
                            }
                        }

                        if (reader.Name.Equals("NotReady"))
                        {
                            try
                            {
                                _Information.AgentsNotReady = int.Parse(reader.ReadString());
                            }
                            catch (Exception ex)
                            {
                                _Information.AgentsNotReady = -99;
                            }
                        }

                        if (reader.Name.Equals("Work"))
                        {
                            try
                            {
                                _Information.AgentsWork = int.Parse(reader.ReadString());
                            }
                            catch (Exception ex)
                            {
                                _Information.AgentsWork = -99;
                            }
                        }

                        if (reader.Name.Equals("CallsWaiting"))
                        {
                            try
                            {
                                _Information.ContactsWaiting = int.Parse(reader.ReadString());
                            }
                            catch (Exception ex)
                            {
                                _Information.ContactsWaiting = -99;
                            }
                        }

                        if (reader.Name.Equals("LongestQueueTime"))
                        {
                            try
                            {
                                _Information.LongestWaitingContact = int.Parse(reader.ReadString());
                            }
                            catch (Exception ex)
                            {
                                _Information.LongestWaitingContact = -99;
                            }
                        }

                        //if (reader.Name.Equals("TotalInQueue"))
                        //{
                        //    try
                        //    {
                        //        _Information.TotalInQueue = int.Parse(reader.ReadString());
                        //    }
                        //    catch (Exception ex)
                        //    {
                        //        _Information.TotalInQueue = -99;
                        //    }
                        //}

                        break;

                    case System.Xml.XmlNodeType.EndElement:

                        if (reader.Name.Equals("CSQ"))
                        {
                        }

                        break;
                    }
                }

                reader = null;
                xmlDoc = null;

                return(true);
            }
            catch (Exception ex)
            {
                Trace.TraceWarning("Exception: " + ex.Message + Environment.NewLine + "Stacktrace: " + ex.StackTrace);
                return(false);
            }
        }