Example #1
0
 ///<summary>Refresh the phone panel every X seconds after it has already been setup.  Make sure to call FillMapAreaPanel before calling this the first time.</summary>
 public void SetPhoneList(List <PhoneEmpDefault> peds, List <Phone> phones, List <PhoneEmpSubGroup> listSubGroups, List <ChatUser> listChatUsers)
 {
     try {
         string title = "Call Center Map - Triage Coord. - ";
         try {                 //get the triage coord label but don't fail just because we can't find it
             SiteLink siteLink = SiteLinks.GetFirstOrDefault(x => x.SiteNum == _mapCur.SiteNum);
             title += Employees.GetNameFL(Employees.GetEmp(siteLink.EmployeeNum));
         }
         catch {
             title += "Not Set";
         }
         labelTriageCoordinator.Text = title;
         labelCurrentTime.Text       = DateTime.Now.ToShortTimeString();
         #region Triage Counts
         //The triage count used to only count up the triage operators within the currently selected room.
         //Now we want to count all operators at the selected site (local) and then all operators across all sites (total).
         int triageStaffCountLocal = 0;
         int triageStaffCountTotal = 0;
         foreach (PhoneEmpDefault phoneEmpDefault in peds.FindAll(x => x.IsTriageOperator && x.HasColor))
         {
             Phone phone = phones.FirstOrDefault(x => x.Extension == phoneEmpDefault.PhoneExt);
             if (phone == null)
             {
                 continue;
             }
             if (phone.ClockStatus.In(ClockStatusEnum.None, ClockStatusEnum.Home, ClockStatusEnum.Lunch, ClockStatusEnum.Break, ClockStatusEnum.Off
                                      , ClockStatusEnum.Unavailable, ClockStatusEnum.NeedsHelp, ClockStatusEnum.HelpOnTheWay))
             {
                 continue;
             }
             //This is a triage operator who is currently here and on the clock.
             if (phoneEmpDefault.SiteNum == _mapCur.SiteNum)
             {
                 triageStaffCountLocal++;
             }
             triageStaffCountTotal++;
         }
         labelTriageOpsCountLocal.Text = triageStaffCountLocal.ToString();
         labelTriageOpsCountTotal.Text = triageStaffCountTotal.ToString();
         #endregion
         for (int i = 0; i < this.mapAreaPanelHQ.Controls.Count; i++)            //loop through all of our cubicles and labels and find the matches
         {
             try {
                 if (!(this.mapAreaPanelHQ.Controls[i] is MapAreaRoomControl))
                 {
                     continue;
                 }
                 MapAreaRoomControl room = (MapAreaRoomControl)this.mapAreaPanelHQ.Controls[i];
                 if (room.MapAreaItem.Extension == 0)                        //This cubicle has not been given an extension yet.
                 {
                     room.Empty = true;
                     continue;
                 }
                 Phone phone = Phones.GetPhoneForExtension(phones, room.MapAreaItem.Extension);
                 if (phone == null)                       //We have a cubicle with no corresponding phone entry.
                 {
                     room.Empty = true;
                     continue;
                 }
                 ChatUser        chatuser        = listChatUsers.Where(x => x.Extension == phone.Extension).FirstOrDefault();
                 PhoneEmpDefault phoneEmpDefault = PhoneEmpDefaults.GetEmpDefaultFromList(phone.EmployeeNum, peds);
                 if (phoneEmpDefault == null)                       //We have a cubicle with no corresponding phone emp default entry.
                 {
                     room.Empty = true;
                     continue;
                 }
                 //we got this far so we found a corresponding cubicle for this phone entry
                 room.EmployeeNum  = phone.EmployeeNum;
                 room.EmployeeName = phone.EmployeeName;
                 if (phone.DateTimeNeedsHelpStart.Date == DateTime.Today)                        //if they need help, use that time.
                 {
                     TimeSpan span      = DateTime.Now - phone.DateTimeNeedsHelpStart + _timeDelta;
                     DateTime timeOfDay = DateTime.Today + span;
                     room.Elapsed = timeOfDay.ToString("H:mm:ss");
                 }
                 else if (phone.DateTimeStart.Date == DateTime.Today && phone.Description != "")                        //else if in a call, use call time.
                 {
                     TimeSpan span      = DateTime.Now - phone.DateTimeStart + _timeDelta;
                     DateTime timeOfDay = DateTime.Today + span;
                     room.Elapsed = timeOfDay.ToString("H:mm:ss");
                 }
                 else if (phone.Description == "" && chatuser != null && chatuser.CurrentSessions > 0)                    //else if in a chat, use chat time.
                 {
                     TimeSpan span = TimeSpan.FromMilliseconds(chatuser.SessionTime) + _timeDelta;
                     room.Elapsed = span.ToStringHmmss();
                 }
                 else if (phone.DateTimeStart.Date == DateTime.Today)                        //else available, use that time.
                 {
                     TimeSpan span      = DateTime.Now - phone.DateTimeStart + _timeDelta;
                     DateTime timeOfDay = DateTime.Today + span;
                     room.Elapsed = timeOfDay.ToString("H:mm:ss");
                 }
                 else                           //else, whatever.
                 {
                     room.Elapsed = "";
                 }
                 if (phone.IsProxVisible)
                 {
                     room.ProxImage = Properties.Resources.Figure;
                 }
                 else if (phone.DateTProximal.AddHours(8) > DateTime.Now)
                 {
                     room.ProxImage = Properties.Resources.NoFigure;                          //TODO: replace image with one from Nathan
                 }
                 else
                 {
                     room.ProxImage = null;
                 }
                 room.IsAtDesk = phone.IsProxVisible;
                 string status = Phones.ConvertClockStatusToString(phone.ClockStatus);
                 //Check if the user is logged in.
                 if (phone.ClockStatus == ClockStatusEnum.None ||
                     phone.ClockStatus == ClockStatusEnum.Home)
                 {
                     status = "Home";
                 }
                 room.Status = status;
                 if (phone.Description == "")
                 {
                     room.PhoneImage = null;
                     if (chatuser != null && chatuser.CurrentSessions != 0)
                     {
                         room.ChatImage = Properties.Resources.gtaicon3;
                     }
                     else
                     {
                         room.ChatImage = null;
                     }
                 }
                 else
                 {
                     room.PhoneImage = Properties.Resources.phoneInUse;
                 }
                 Color outerColor;
                 Color innerColor;
                 Color fontColor;
                 bool  isTriageOperatorOnTheClock;
                 //get the cubicle color and triage status
                 Phones.GetPhoneColor(phone, phoneEmpDefault, true, out outerColor, out innerColor, out fontColor, out isTriageOperatorOnTheClock);
                 if (!room.IsFlashing)                          //if the control is already flashing then don't overwrite the colors. this would cause a "spastic" flash effect.
                 {
                     room.OuterColor = outerColor;
                     room.InnerColor = innerColor;
                 }
                 room.ForeColor = fontColor;
                 if (phone.ClockStatus == ClockStatusEnum.NeedsHelp)                        //turn on flashing
                 {
                     room.StartFlashing();
                 }
                 else                           //turn off flashing
                 {
                     room.StopFlashing();
                 }
                 room.Invalidate(true);
             }
             catch (Exception e) {
                 e.DoNothing();
             }
         }
         refreshCurrentTabHelper(peds, phones, listSubGroups);
     }
     catch {
         //something failed unexpectedly
     }
 }
Example #2
0
 ///<summary>Refresh the phone panel every X seconds after it has already been setup.  Make sure to call FillMapAreaPanel before calling this the first time.</summary>
 public void SetPhoneList(List <PhoneEmpDefault> peds, List <Phone> phones)
 {
     try {
         string title = "Call Center Status Map - Triage Coordinator - ";
         try {                 //get the triage coord label but don't fail just because we can't find it
             title += Employees.GetNameFL(PrefC.GetLong(PrefName.HQTriageCoordinator));
         }
         catch {
             title += "Not Set";
         }
         labelTriageCoordinator.Text = title;
         labelCurrentTime.Text       = DateTime.Now.ToShortTimeString();
         int triageStaffCount = 0;
         for (int i = 0; i < this.mapAreaPanelHQ.Controls.Count; i++)            //loop through all of our cubicles and labels and find the matches
         {
             if (!(this.mapAreaPanelHQ.Controls[i] is MapAreaRoomControl))
             {
                 continue;
             }
             MapAreaRoomControl room = (MapAreaRoomControl)this.mapAreaPanelHQ.Controls[i];
             if (room.MapAreaItem.Extension == 0)                    //This cubicle has not been given an extension yet.
             {
                 room.Empty = true;
                 continue;
             }
             Phone phone = Phones.GetPhoneForExtension(phones, room.MapAreaItem.Extension);
             if (phone == null)                   //We have a cubicle with no corresponding phone entry.
             {
                 room.Empty = true;
                 continue;
             }
             PhoneEmpDefault phoneEmpDefault = PhoneEmpDefaults.GetEmpDefaultFromList(phone.EmployeeNum, peds);
             if (phoneEmpDefault == null)                   //We have a cubicle with no corresponding phone emp default entry.
             {
                 room.Empty = true;
                 continue;
             }
             //we got this far so we found a corresponding cubicle for this phone entry
             room.EmployeeNum  = phone.EmployeeNum;
             room.EmployeeName = phone.EmployeeName;
             if (phone.DateTimeStart.Date == DateTime.Today)
             {
                 TimeSpan span      = DateTime.Now - phone.DateTimeStart + _timeDelta;
                 DateTime timeOfDay = DateTime.Today + span;
                 room.Elapsed = timeOfDay.ToString("H:mm:ss");
             }
             else
             {
                 room.Elapsed = "";
             }
             string status = phone.ClockStatus.ToString();
             //Check if the user is logged in.
             if (phone.ClockStatus == ClockStatusEnum.None ||
                 phone.ClockStatus == ClockStatusEnum.Home)
             {
                 status = "Home";
             }
             room.Status = status;
             if (phone.Description == "")
             {
                 room.PhoneImage = null;
             }
             else
             {
                 room.PhoneImage = Properties.Resources.phoneInUse;
             }
             Color outerColor;
             Color innerColor;
             Color fontColor;
             bool  isTriageOperatorOnTheClock = false;
             //get the cubicle color and triage status
             Phones.GetPhoneColor(phone, phoneEmpDefault, true, out outerColor, out innerColor, out fontColor, out isTriageOperatorOnTheClock);
             if (!room.IsFlashing)                      //if the control is already flashing then don't overwrite the colors. this would cause a "spastic" flash effect.
             {
                 room.OuterColor = outerColor;
                 room.InnerColor = innerColor;
             }
             room.ForeColor = fontColor;
             if (isTriageOperatorOnTheClock)
             {
                 triageStaffCount++;
             }
             if (phone.ClockStatus == ClockStatusEnum.NeedsHelp)                    //turn on flashing
             {
                 room.StartFlashing();
             }
             else                       //turn off flashing
             {
                 room.StopFlashing();
             }
             room.Invalidate(true);
         }
         this.labelTriageOpsStaff.Text = triageStaffCount.ToString();
     }
     catch {
         //something failed unexpectedly
     }
 }