Ejemplo n.º 1
0
        public bool DispatchCall(Call call)
        {
            List <Seniority> compatibleSeniorities = CallEmployeeMapper.GetCompatibleSeniorities(call.CallPriority);

            foreach (Seniority seniority in compatibleSeniorities)
            {
                List <Employee> freeEmployees = employees[seniority].Where(employee => employee.IsFree).ToList();
                if (freeEmployees.Count > 0)
                {
                    Employee selectedEmployee = freeEmployees[0];
                    selectedEmployee.AssignCall(call);


                    if (CallIsEscalated(call) && !selectedEmployee.CanHandleCall(call))
                    {
                        selectedEmployee.FinishCall();
                        return(false);
                    }

                    return(true);
                }
            }

            Logger.InfoLog($"No employees with the correct seniority could be found to handle call {call.CallId}, it will be re-added to the queue list.");
            return(false);
        }
Ejemplo n.º 2
0
        public bool CanHandleCall(Call call)
        {
            List <Seniority> highSenorities = CallEmployeeMapper.GetCompatibleSeniorities(call.CallPriority);

            // check if, after call escalation, the employee can still handle this call
            if (!highSenorities.Contains(Seniority))
            {
                Logger.InfoLog($"Employee assigned to call {call.CallId} is not senior enough to handle the call after priority escalation. The call will be returned to the queue for re-processing.");
                return(false);
            }
            return(true);
        }