Ejemplo n.º 1
0
        /// <summary>
        /// Clear the Incident's ReservedAgent and Disable Agent not taking the call
        /// </summary>
        /// <param name="dtAllPoolAgents"></param>
        /// <returns></returns>
        protected bool checkReservations(PoolDS.PoolDSDataTable dtAllPoolAgents)
        {
            bool result = false;

            PoolDS.PoolDSRow[] rows = (PoolDS.PoolDSRow[])dtAllPoolAgents.Select("is_available=1 and is_busy=0", "");
            if (rows.Length > 0)
            {
                int cancelInterval = UcConfParameters.UcCallForwardingInterval;     // seconds


                foreach (PoolDS.PoolDSRow row in dtAllPoolAgents.Rows)
                {
                    if ((!row.Isincident_idNull()) && (!row.Isdate_reservedNull()))
                    {
                        DateTime now  = DateTime.Now.ToUniversalTime();
                        TimeSpan span = now.Subtract(row.date_reserved);
                        TimeSpan max  = new TimeSpan(0, 0, cancelInterval);

                        if (TimeSpan.Compare(span, max) > 0)
                        {
                            Int32 incidentId = row.incident_id;

                            Int32 incidentStatusId = 0;
                            Int32 incidentAgentId  = 0;

                            IncidentDS.IncidentDSDataTable dtIncident = BllProxyIncident.SelectIncident(incidentId);
                            if (dtIncident.Rows.Count > 0)
                            {
                                incidentStatusId = dtIncident[0].status_id;
                                if (!dtIncident[0].Isagent_idNull())
                                {
                                    incidentAgentId = dtIncident[0].agent_id;
                                }
                            }



                            if (incidentAgentId == 0)
                            {
                                if (incidentStatusId == 1)
                                {
                                    BllProxyIncidentHelper.SetIncidentReservation(incidentId, 0);
                                    BllProxyPool.SetPoolAgentAvailable(row.agent_id, false);
                                    BllProxyPool.SetPoolAgentBusy(row.agent_id, false);
                                }
                                else
                                {
                                    BllProxyPool.SetPoolAgentAvailable(row.agent_id, true);
                                    BllProxyPool.SetPoolAgentBusy(row.agent_id, true);
                                }
                            }

                            result = true;
                        }
                    }
                }
            }

            return(result);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 3
0
 public void SetAgentOff(Int32 agentId)
 {
     BllProxyPool.SetPoolAgentAvailable(agentId, false);
 }
Ejemplo n.º 4
0
        ////-------------------------------------------------------------------------------
        //public void SetAgentAvailable(Int32 agentId, bool available)
        //{
        //    BllProxyPool.SetPoolAgentAvailable(agentId, available);
        //    if (available)
        //        this.SetAgentBusy(agentId, false);

        //}


        //-------------------------------------------------------------------------------
        public void SetAgentOn(Int32 agentId)
        {
            BllProxyPool.SetPoolAgentAvailable(agentId, true);
            this.SetAgentBusy(agentId, false);
        }
Ejemplo n.º 5
0
 //-------------------------------------------------------------------------------
 public void UnRegisterAgent(Int32 agentId)
 {
     BllProxyPool.SetPoolAgentAvailable(agentId, false);
     //BllProxyPool.DeletePoolAgent(agentId);
 }