示例#1
0
 private void MapAreaRoomControl_MouseUp(object sender,MouseEventArgs e)
 {
     if(!_allowClickOptions || _phoneCur==null) {
         return;//disable click options in setup window.
     }
     if(e==null || e.Button!=MouseButtons.Right) {
         if(e.Button==MouseButtons.Left && !IsFlashing && Status!="OnWay") {
             if(_rectName.Contains(e.Location)) {
                 PhoneUI.EmployeeSettings(_phoneCur);
                 return;
             }
             if(_rectPhone.Contains(e.Location) && _phoneCur.PatNum!=0) {
                 OnGoToChanged();
             }
         }
         return;
     }
     bool allowStatusEdit=ClockEvents.IsClockedIn(EmployeeNum);
     if(EmployeeNum==Security.CurUser.EmployeeNum) {//can always edit yourself
         allowStatusEdit=true;
     }
     if(Status==Phones.ConvertClockStatusToString(ClockStatusEnum.NeedsHelp)) {
         //Always allow any employee to change any other employee from NeedsAssistance to Available
         allowStatusEdit=true;
     }
     string statusOnBehalfOf=EmployeeName;
     bool allowSetSelfAvailable=false;
     if(!ClockEvents.IsClockedIn(EmployeeNum) //No one is clocked in at this extension.
         && !ClockEvents.IsClockedIn(Security.CurUser.EmployeeNum)) //This user is not clocked in either.
     {
         //Vacant extension and this user is not clocked in so allow this user to clock in at this extension.
         statusOnBehalfOf=Security.CurUser.UserName;
         allowSetSelfAvailable=true;
     }
     AddToolstripGroup("menuItemStatusOnBehalf","Status for: "+statusOnBehalfOf);
     AddToolstripGroup("menuItemRingGroupOnBehalf","Queues for ext: "+Extension.ToString());
     AddToolstripGroup("menuItemClockOnBehalf","Clock event for: "+EmployeeName);
     AddToolstripGroup("menuItemCustomer","Customer: "+_phoneCur.CustomerNumber);
     AddToolstripGroup("menuItemEmployee","Employee: "+EmployeeName);
     SetToolstripItemText("menuItemAvailable",allowStatusEdit || allowSetSelfAvailable);
     SetToolstripItemText("menuItemTraining",allowStatusEdit);
     SetToolstripItemText("menuItemTeamAssist",allowStatusEdit);
     SetToolstripItemText("menuItemNeedsHelp",allowStatusEdit);
     SetToolstripItemText("menuItemWrapUp",allowStatusEdit);
     SetToolstripItemText("menuItemOfflineAssist",allowStatusEdit);
     SetToolstripItemText("menuItemUnavailable",allowStatusEdit);
     SetToolstripItemText("menuItemTCResponder",allowStatusEdit);
     SetToolstripItemText("menuItemBackup",allowStatusEdit);
     SetToolstripItemText("menuItemLunch",allowStatusEdit);
     SetToolstripItemText("menuItemHome",allowStatusEdit);
     SetToolstripItemText("menuItemBreak",allowStatusEdit);
     menuItemGoTo.Enabled=true;
     if(_phoneCur.PatNum==0) {//disable go to if not a current patient
         menuItemGoTo.Enabled=false;
     }
     Point p=new Point(Location.X+e.Location.X,Location.Y+e.Location.Y);
     menuStatus.Show(Cursor.Position);
 }
示例#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, 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
     }
 }