예제 #1
0
        ///<summary>Returns true if the employee for the PhoneEmpDefault should be added to the selected escalation view.</summary>
        private bool DoAddToEscalationView(PhoneEmpDefault ped, List <Phone> phones)
        {
            if (ped.EscalationOrder <= 0)            //Filter out employees that do not have an escalation order set.
            {
                return(false);
            }
            Phone phone = Phones.GetPhoneForEmployeeNum(phones, ped.EmployeeNum);

            if (phone == null || phone.Description != "")          //Filter out invalid employees or employees that are already on the phone.
            {
                return(false);
            }
            if (_curSubGroupType == PhoneEmpSubGroupType.Avail)           //Special rules for the Avail escalation view
            {
                if (!phone.IsProxVisible)
                {
                    return(false);
                }
                if (!IsAtCurrentLocation(ped))
                {
                    return(false);
                }
                if (!phone.ClockStatus.In(ClockStatusEnum.Available, ClockStatusEnum.Training, ClockStatusEnum.Backup))
                {
                    return(false);
                }
                return(true);
            }
            //All other escalation views besides Avail
            if (!phone.ClockStatus.In(ClockStatusEnum.Available, ClockStatusEnum.OfflineAssist, ClockStatusEnum.Backup))
            {
                return(false);
            }
            return(true);
        }
예제 #2
0
 private void SetEscalationList(List <PhoneEmpDefault> peds, List <Phone> phones)
 {
     try {
         escalationView.BeginUpdate();
         escalationView.Items.Clear();
         escalationView.DictProximity.Clear();
         escalationView.DictShowExtension.Clear();
         escalationView.DictExtensions.Clear();
         escalationView.DictWebChat.Clear();
         escalationView.DictGTAChat.Clear();
         if (escalationView.Tag == null || (((int)escalationView.Tag) != tabMain.SelectedIndex))
         {
             escalationView.IsNewItems = true;
             escalationView.Tag        = tabMain.SelectedIndex;
         }
         List <PhoneEmpDefault> listFiltered = peds.FindAll(x => DoAddToEscalationView(x, phones));
         List <PhoneEmpDefault> listSorted   = SortForEscalationView(listFiltered, phones);
         if (_listChatUsers == null)
         {
             _listChatUsers = ChatUsers.GetAll();
         }
         if (_listWebChatSessions == null)
         {
             _listWebChatSessions = WebChatSessions.GetActiveSessions();
         }
         for (int i = 0; i < listSorted.Count; i++)
         {
             PhoneEmpDefault ped   = listSorted[i];
             Phone           phone = ODMethodsT.Coalesce(Phones.GetPhoneForEmployeeNum(phones, ped.EmployeeNum));
             escalationView.Items.Add(ped.EmpName);
             //Only show the proximity icon if the phone.IsProxVisible AND the employee is at the same site as our currently selected room.
             escalationView.DictProximity.Add(ped.EmpName, (_mapCur.SiteNum == ped.SiteNum && phone.IsProxVisible));
             WebChatSession webChatSession = _listWebChatSessions.FirstOrDefault(x => x.TechName == phone.EmployeeName);
             if (webChatSession != null)
             {
                 escalationView.DictWebChat.Add(ped.EmpName, true);
                 escalationView.DictGTAChat.Add(ped.EmpName, false);
             }
             else
             {
                 escalationView.DictWebChat.Add(ped.EmpName, false);
                 escalationView.DictGTAChat.Add(ped.EmpName, _listChatUsers.FindAll(x => x.Extension == ped.PhoneExt && x.CurrentSessions > 0).Count > 0);
             }
             //Extensions will always show for both locations unless the employee is not proximal.
             escalationView.DictShowExtension.Add(ped.EmpName, phone.IsProxVisible);
             escalationView.DictExtensions.Add(ped.EmpName, ped.PhoneExt);
         }
     }
     catch {
     }
     finally {
         escalationView.EndUpdate();
     }
 }
예제 #3
0
 ///<summary>Sorts the list of PhoneEmpDefaults in the appropriate way for the selected escalation view.</summary>
 private List <PhoneEmpDefault> SortForEscalationView(List <PhoneEmpDefault> peds, List <Phone> phones)
 {
     if (_curSubGroupType == PhoneEmpSubGroupType.Avail)
     {
         Func <PhoneEmpDefault, Phone> getPhone = new Func <PhoneEmpDefault, Phone>((phoneEmpDef) => {
             return(ODMethodsT.Coalesce(Phones.GetPhoneForEmployeeNum(phones, phoneEmpDef.EmployeeNum)));
         });
         return(peds.OrderBy(x => getPhone(x).ClockStatus != ClockStatusEnum.Available) //Show Available first
                .ThenBy(x => getPhone(x).ClockStatus != ClockStatusEnum.Training)       //Training next
                .ThenBy(x => getPhone(x).ClockStatus != ClockStatusEnum.Backup)         //Backup next
                .ThenBy(x => getPhone(x).DateTimeStart.Year < 1880)                     //Show people who have an actual DateTimeStart first
                .ThenBy(x => getPhone(x).DateTimeStart)                                 //Show those first who have been in this status longest
                .ToList());
     }
     //All other escalation views beside Avail
     return(peds.OrderBy(x => x.EscalationOrder)            //Show people at the selected location first
            .ThenBy(x => x.EmpName).ToList());
 }
예제 #4
0
 private void SetEscalationList(List <PhoneEmpDefault> peds, List <Phone> phones)
 {
     try {
         escalationView.BeginUpdate();
         escalationView.Items.Clear();
         escalationView.DictProximity.Clear();
         escalationView.DictShowExtension.Clear();
         escalationView.DictExtensions.Clear();
         escalationView.DictColors.Clear();
         if (escalationView.Tag == null || (((int)escalationView.Tag) != tabMain.SelectedIndex))
         {
             escalationView.IsNewItems = true;
             escalationView.Tag        = tabMain.SelectedIndex;
         }
         List <PhoneEmpDefault> listFiltered = peds.FindAll(x => DoAddToEscalationView(x, phones));
         List <PhoneEmpDefault> listSorted   = SortForEscalationView(listFiltered, phones);
         for (int i = 0; i < listSorted.Count; i++)
         {
             PhoneEmpDefault ped   = listSorted[i];
             Phone           phone = ODMethodsT.Coalesce(Phones.GetPhoneForEmployeeNum(phones, ped.EmployeeNum));
             escalationView.Items.Add(ped.EmpName);
             //Only show the proximity icon if the phone.IsProxVisible AND the employee is at the same site as our currently selected room.
             escalationView.DictProximity.Add(ped.EmpName, (_mapCur.SiteNum == ped.SiteNum && phone.IsProxVisible));
             //Extensions will always show for both locations unless the employee is not proximal.
             escalationView.DictShowExtension.Add(ped.EmpName, phone.IsProxVisible);
             escalationView.DictExtensions.Add(ped.EmpName, ped.PhoneExt);
             if (_mapCur.SiteNum != ped.SiteNum)
             {
                 escalationView.DictColors.Add(ped.EmpName, SiteLinks.GetSiteColorBySiteNum(ped.SiteNum, escalationView.BackColor));
             }
         }
     }
     catch {
     }
     finally {
         escalationView.EndUpdate();
     }
 }