예제 #1
0
        //-------------------------------------------------------------------------------
        public void SetAgentBusy(Int32 agentId, bool busy)
        {
            PoolDS.PoolDSDataTable dtPool = BllProxyPool.SelectPoolAgent(agentId);
            if (dtPool.Rows.Count != 0)
            {
                bool isBusy = busy;

                if (!isBusy)
                {
                    IncidentDS.IncidentDSDataTable dtIncident = BllProxyIncident.GetIncidentsByStatus(2, agentId);   //2:In-Progress
                    if (dtIncident.Rows.Count != 0)
                    {
                        isBusy = true;
                    }
                }


                if (isBusy)
                {
                    BllProxyPool.SetPoolAgentBusy(agentId, true);
                }
                else
                {
                    BllProxyPool.SetPoolAgentBusy(agentId, busy);
                }

                BllProxyPool.SetPoolAgentIncident(agentId, 0);
            }
        }
예제 #2
0
        /// <summary>
        /// Disable the Agent if not online (Agent in AgentPool is not renewed for too long)
        /// Remove the Agent from AgentPool if not online for a week
        /// </summary>
        /// <param name="dtAllPoolAgents"></param>
        /// <returns></returns>
        protected bool cleanUp(PoolDS.PoolDSDataTable dtAllPoolAgents)
        {
            bool result = false;

            int cleanUpInterval = UcConfParameters.UcCallCleanUpInterval;

            foreach (PoolDS.PoolDSRow row in dtAllPoolAgents.Rows)
            {
                Int32 agentId = row.agent_id;


                DateTime now  = DateTime.Now.ToUniversalTime();
                TimeSpan span = now.Subtract(row.date_accessed);
                TimeSpan max;

                if (row.is_available)
                {
                    // Disable the Agent if not online (Agent in AgentPool is not renewed for too long)
                    max = new TimeSpan(0, 0, cleanUpInterval);             // seconds
                    if (TimeSpan.Compare(span, max) > 0)
                    {
                        BllProxyPool.SetPoolAgentAvailable(agentId, false);
                        result = true;
                    }



                    // Clean up the Agent's Incident and turn Agent available if the Incident is gone
                    if (!row.Isincident_idNull())
                    {
                        IncidentDS.IncidentDSDataTable dtIncident = BllProxyIncident.SelectIncident(row.incident_id);
                        if (dtIncident.Rows.Count > 0)
                        {
                            //if ((dtIncident[0].status_id != 1) || (dtIncident[0].agent_id != agentId))
                            if ((dtIncident[0].status_id != 1) || ((!dtIncident[0].Isagent_idNull()) && (dtIncident[0].agent_id != agentId)))
                            {
                                BllProxyPool.SetPoolAgentIncident(agentId, 0);
                                BllProxyPool.SetPoolAgentBusy(agentId, false);

                                result = true;
                            }
                        }
                    }
                }
                else
                {
                    // Remove the Agent from AgentPool if not online for a week

                    max = new TimeSpan(7, 0, 0, 0);                        // 7 days
                    if (TimeSpan.Compare(span, max) > 0)
                    {
                        BllProxyPool.DeletePoolAgent(agentId);
                        result = true;
                    }
                }
            }

            return(result);
        }
예제 #3
0
 //-------------------------------------------------------------------------------
 public void ReleaseIncident(Int32 incidentId)
 {
     PoolDS.PoolDSDataTable dt = BllProxyPool.GetAllPoolAgents();
     foreach (PoolDS.PoolDSRow row in dt.Rows)
     {
         if (!dt[0].Isincident_idNull())
         {
             if (row.incident_id == incidentId)
             {
                 BllProxyPool.SetPoolAgentIncident(row.agent_id, 0);
             }
         }
     }
 }
예제 #4
0
        /// <summary>
        /// Assign the Incident to the available Agent
        /// </summary>
        /// <param name="dtAllPoolAgents"></param>
        /// <returns></returns>
        protected bool handleIncidentQueue(PoolDS.PoolDSDataTable dtAllPoolAgents)
        {
            bool result = false;

            IncidentDS.IncidentDSDataTable dt;

            PoolDS.PoolDSRow[] rows = (PoolDS.PoolDSRow[])dtAllPoolAgents.Select("", "last_call_time");

            foreach (PoolDS.PoolDSRow row in rows)
            {
                Int32 agentId = row.agent_id;

                if ((row.is_available) && (!row.is_busy))
                {
                    dt = BllProxyIncident.GetIncidentQueueList(1, agentId);   //1:New

                    foreach (IncidentDS.IncidentDSRow rowIncident in dt)
                    {
                        if (rowIncident.Isreserved_agent_idNull())
                        {
                            Int32 incidentId = rowIncident.incident_id;
                            BllProxyIncidentHelper.SetIncidentReservation(incidentId, agentId);

                            BllProxyPool.SetPoolAgentBusy(agentId, true);
                            BllProxyPool.SetPoolAgentIncident(agentId, incidentId);

                            result = true;
                            break;
                        }

                        //---
                    }
                }
            }


            return(result);
        }