示例#1
0
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);
            Graphics              g                   = e.Graphics;
            Pen                   pen                 = new Pen(Color.Black);
            SolidBrush            solidBrush          = new SolidBrush(Color.Black);
            Font                  fontDraw            = new Font("Microsoft Sans Serif", 8.25f);
            Font                  fontBold            = new Font("Microsoft Sans Serif", 8.25f, FontStyle.Bold);
            List <WebChatSession> listWebChatSessions = WebChatSessions.GetActiveSessions();
            int                   controlHeight       = 16;
            int                   controlMargin       = 3;
            int                   customerWidth       = 80;
            int                   customerX           = 60;
            int                   customerY           = 18;
            int                   extensionWidth      = 96;
            int                   statusWidth         = 62;
            int                   statusX             = 0;
            int                   statusY             = 20;
            int                   imageLocationX      = 99;
            int                   proxLocationX       = 126;
            int                   timeBoxLocationX    = 3;
            int                   timeBoxLocationY    = 17;
            int                   timeBoxWidth        = 56;
            int                   timeLocationX       = 11;
            int                   yTop                = _tileStart; //the offset of the phone tile taking the other controls of the form into account
            int                   x                   = 0;          //x axis location
            int                   y                   = 0;          //y axis location
            int                   numColumns          = (int)Math.Ceiling((double)_listPhones.Count / _tilesPerColumn);
            int                   webChatHeightWidth  = 17;         //Used for the rectangle that houses the web chat icon to prevent it from breaking the box boundary.

            //i starts at 1, because it determines the number of columns with modulo division on line if(i%_tilesPerColumn==0)
            for (int i = 1; i < _listPhones.Count + 1; i++)
            {
                int            numCur         = i - 1;
                ChatUser       chatUser       = _listChatUsers.Where(chat => chat.Extension == _listPhones[numCur].Extension).FirstOrDefault();
                WebChatSession webChatSession = listWebChatSessions.FirstOrDefault(session => session.TechName == _listPhones[numCur].EmployeeName);
                Color          outerColor;
                Color          innerColor;
                Color          fontColor;
                bool           isTriageOperatorOnTheClock = false;
                //set the phone color
                Phones.GetPhoneColor(_listPhones[numCur], _listPhoneEmpDefaults.Find(phone => phone.EmployeeNum == _listPhones[numCur].EmployeeNum), false,
                                     out outerColor, out innerColor, out fontColor, out isTriageOperatorOnTheClock);
                //get the color scheme
                Phones.PhoneColorScheme phoneColorScheme = new Phones.PhoneColorScheme(true);
                string extensionAndName = $"{_listPhones[numCur].Extension}-{_listPhones[numCur].EmployeeName}";
                //determine if the extension has a user associated with it
                if (_listPhones[numCur].EmployeeName == "")
                {
                    extensionAndName += "Vacant";
                }
                //determine the status or note if the user is gone, otherwise just leave it
                string statusAndNote = "";
                if (_listPhones[numCur].ClockStatus == ClockStatusEnum.Home ||
                    _listPhones[numCur].ClockStatus == ClockStatusEnum.None ||
                    _listPhones[numCur].ClockStatus == ClockStatusEnum.Off)
                {
                    statusAndNote = "Clock In";
                }
                if (_listPhones[numCur].ClockStatus == ClockStatusEnum.Unavailable)
                {
                    statusAndNote = "Unavailable";
                }
                //get the customer number
                string customer = _listPhones[numCur].CustomerNumber;
                //get the time that has passed on a call
                string time = "";
                if (_listPhones[numCur].DateTimeNeedsHelpStart.Date == DateTime.Today)
                {
                    time = (DateTime.Now - _listPhones[numCur].DateTimeNeedsHelpStart + _timeSpanDelta).ToStringHmmss();
                }
                else if (_listPhones[numCur].DateTimeStart.Date == DateTime.Today)
                {
                    time = (DateTime.Now - _listPhones[numCur].DateTimeStart + _timeSpanDelta).ToStringHmmss();
                }
                //draw the time box with its determined color
                Color colorBar = outerColor;
                //don't draw anything if they are clocked out or unavailable
                if (_listPhones[numCur].ClockStatus != ClockStatusEnum.Home &&
                    _listPhones[numCur].ClockStatus != ClockStatusEnum.None &&
                    _listPhones[numCur].ClockStatus != ClockStatusEnum.Off &&
                    _listPhones[numCur].ClockStatus != ClockStatusEnum.Unavailable)
                {
                    //determine if they need help and flash pink if they do
                    if (_listPhones[numCur].ClockStatus == ClockStatusEnum.NeedsHelp)
                    {
                        if (_isFlashingPink)
                        {
                            colorBar = phoneColorScheme.ColorOuterNeedsHelp;
                        }
                        else
                        {
                            colorBar = Color.Transparent;
                        }
                    }
                    //set the color of the inside of the time box
                    if (_listPhones[numCur].ClockStatus == ClockStatusEnum.HelpOnTheWay)
                    {
                        colorBar = phoneColorScheme.ColorOuterNeedsHelp;
                    }
                    //draw the inside of the time box if the user is not on break
                    if (_listPhones[numCur].ClockStatus != ClockStatusEnum.Break)
                    {
                        using (SolidBrush brush = new SolidBrush(colorBar)) {
                            g.FillRectangle(brush, (x * _tileWidth) + timeBoxLocationX, (y * _tileHeight) + yTop + timeBoxLocationY, timeBoxWidth, controlHeight);
                        }
                    }
                    //draw the outline of the time box
                    g.DrawRectangle(pen, (x * _tileWidth) + timeBoxLocationX, (y * _tileHeight) + yTop + timeBoxLocationY, timeBoxWidth, controlHeight);
                    //draw either the figure or circle depending on if they are proxmial
                    if (_listPhones[numCur].IsProxVisible)
                    {
                        g.DrawImage(Properties.Resources.Figure, (x * _tileWidth) + proxLocationX, (y * _tileHeight) + yTop + controlMargin);
                    }
                    else if (_listPhones[numCur].DateTProximal.AddHours(8) > DateTime.Now)
                    {
                        g.DrawImage(Properties.Resources.NoFigure, (x * _tileWidth) + proxLocationX, (y * _tileHeight) + yTop + controlMargin);
                    }
                    //draw the phone image if it is in use
                    if (_listPhones[numCur].Description != "")
                    {
                        g.DrawImage(Properties.Resources.phoneInUse, (x * _tileWidth) + imageLocationX, (y * _tileHeight) + yTop + controlMargin);
                    }
                    else if (webChatSession != null)
                    {
                        g.DrawImage(Properties.Resources.WebChatIcon,
                                    new Rectangle((x * _tileWidth) + imageLocationX, (y * _tileHeight) + yTop + controlMargin, webChatHeightWidth, webChatHeightWidth));
                        time = (DateTime.Now - webChatSession.DateTcreated).ToStringHmmss();
                    }
                    else if (chatUser != null && chatUser.CurrentSessions != 0)
                    {
                        g.DrawImage(Properties.Resources.gtaicon3, (x * _tileWidth) + imageLocationX, (y * _tileHeight) + yTop + controlMargin);
                        time = TimeSpan.FromMilliseconds(chatUser.SessionTime).ToStringHmmss();
                    }
                    //draw the time on call or what ever activity they are doing
                    if (time != "")
                    {
                        g.DrawString(time, fontDraw, solidBrush, (x * _tileWidth) + timeLocationX, (y * _tileHeight) + yTop + timeBoxLocationY + 2);
                    }
                }
                //draw the things that need to be shown at all times such as the employee name, customer, and emp status
                g.DrawString(extensionAndName, fontBold, solidBrush, new RectangleF((x * _tileWidth), (y * _tileHeight) + yTop + controlMargin,
                                                                                    extensionWidth, controlHeight), new StringFormat()
                {
                    FormatFlags = StringFormatFlags.NoWrap
                });
                if (statusAndNote != "")                //the status only shows if it is Clock In or Unavailable
                {
                    g.DrawString(statusAndNote, fontDraw, solidBrush, new RectangleF((x * _tileWidth) + statusX, (y * _tileHeight) + yTop + statusY,
                                                                                     statusWidth, controlHeight), new StringFormat()
                    {
                        Trimming = StringTrimming.EllipsisCharacter, FormatFlags = StringFormatFlags.NoWrap
                    });
                }
                g.DrawString(customer, fontDraw, solidBrush, new RectangleF((x * _tileWidth) + customerX, (y * _tileHeight) + yTop + customerY + controlMargin,
                                                                            customerWidth, controlHeight), new StringFormat()
                {
                    Trimming = StringTrimming.EllipsisCharacter, FormatFlags = StringFormatFlags.NoWrap
                });
                //draw the grid lines
                if (i == 1)                //this line needs to be drawn differently than the rest
                {
                    g.DrawLine(pen, 0, yTop, numColumns * _tileWidth, yTop);
                }
                else
                {
                    g.DrawLine(pen, 0, (_tileHeight * y) + yTop, numColumns * _tileWidth, (_tileHeight * y) + yTop);
                }
                y++;
                if (i % _tilesPerColumn == 0 && i != _listPhones.Count)
                {
                    x++;
                    //draw the right grid line of the entire column
                    g.DrawLine(pen, _tileWidth * x, yTop, _tileWidth * x, (_tileHeight * _tilesPerColumn) + yTop);
                    y = 0;
                }
            }                                                                                                                            //for listPhones
            g.DrawLine(pen, 0, (_tileHeight * _tilesPerColumn) + yTop, numColumns * _tileWidth, (_tileHeight * _tilesPerColumn) + yTop); //final bottom line
            g.DrawLine(pen, _tileWidth * (x + 1), yTop, _tileWidth * (x + 1), (_tileHeight * _tilesPerColumn) + yTop);                   //final right line
            //dispose of the objects we no longer need
            pen.Dispose();
            solidBrush.Dispose();
            fontDraw.Dispose();
            fontBold.Dispose();
        }
示例#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
     }
 }
示例#3
0
 ///<summary>Set phone and triage flag to display. Get/Set accessor won't work here because we require 2 seperate fields in order to update the control properly.</summary>
 public void SetPhone(Phone phone, PhoneEmpDefault phoneEmpDefault, ChatUser chatUserCur, bool isTriageOperator)
 {
     _phoneCur = phone;
     if (_phoneCur == null)                      //empty out everything and return
     {
         pictureInUse.Visible           = false; //pictureInUse.Visible=false;
         labelStatusAndNote.Text        = "";
         pictureProx.Visible            = false;
         labelExtensionName.Text        = "";
         labelTime.Text                 = "";
         labelTime.BackColor            = this.BackColor;
         pictureNeedsHelpButton.Visible = false;
         pictureGTA.Visible             = false;
         labelCustomer.Text             = "Invalid Comp or Phone";
         return;
     }
     pictureInUse.Visible = _phoneCur.Description != "";
     //Check if the user is logged in.
     if (_phoneCur.ClockStatus == ClockStatusEnum.Home ||
         _phoneCur.ClockStatus == ClockStatusEnum.None ||
         _phoneCur.ClockStatus == ClockStatusEnum.Off)
     {
         labelStatusAndNote.Text = "Clock In";
     }
     else
     {
         labelStatusAndNote.Text = _phoneCur.ClockStatus.GetDescription();
     }
     //Always show ext and name, no matter if user is clocked in or not. This keeps phone tiles from appearing blank with no extension and name.
     if (_phoneCur.EmployeeName != "")
     {
         labelExtensionName.Text = _phoneCur.Extension.ToString() + " - " + _phoneCur.EmployeeName;
     }
     else
     {
         labelExtensionName.Text = _phoneCur.Extension.ToString() + " - Vacant";
     }
     if (_phoneCur.DateTimeNeedsHelpStart.Date == DateTime.Today)
     {
         labelTime.Text = (DateTime.Now - _phoneCur.DateTimeNeedsHelpStart + TimeDelta).ToStringHmmss();
     }
     else if (_phoneCur.DateTimeStart.Date == DateTime.Today)
     {
         labelTime.Text = (DateTime.Now - _phoneCur.DateTimeStart + TimeDelta).ToStringHmmss();
     }
     else
     {
         labelTime.Text = "";
     }
     if (_phoneCur.ClockStatus == ClockStatusEnum.Home ||
         _phoneCur.ClockStatus == ClockStatusEnum.None ||
         _phoneCur.ClockStatus == ClockStatusEnum.Break)
     {
         labelTime.BackColor = this.BackColor;              //No color if employee is not currently working.
         pictureNeedsHelpButton.BackColor = this.BackColor; //No color if employee is not currently working.
     }
     else
     {
         Color outerColor;
         Color innerColor;
         Color fontColor;
         bool  isTriageOperatorOnTheClock = false;
         //get the cubicle color and triage status
         Phones.GetPhoneColor(phone, phoneEmpDefault, false, out outerColor, out innerColor, out fontColor, out isTriageOperatorOnTheClock);
         if (!timerFlash.Enabled)
         {
             //if the control is already flashing then don't overwrite the colors. this would cause a "spastic" flash effect.
             Phones.PhoneColorScheme colorScheme = new Phones.PhoneColorScheme(true);
             labelTime.BackColor = outerColor;
             if (phone.ClockStatus == ClockStatusEnum.HelpOnTheWay)
             {
                 labelTime.BackColor = colorScheme.ColorOuterNeedsHelp;
             }
             if (_phoneCur.ClockStatus == ClockStatusEnum.NeedsHelp)
             {
                 //Only start the flash timer and color the control once. This prevents over-flashing effect.
                 labelTime.Tag = new object[2] {
                     false, colorScheme.ColorOuterNeedsHelp
                 };                                                                                           // labelTime.BackColor };
                 timerFlash.Start();
             }
         }
     }
     if (_phoneCur.ClockStatus != ClockStatusEnum.NeedsHelp)            //Always assume the flash timer was previously turned on and turn it off here. No harm if it' already off.
     {
         timerFlash.Stop();
     }
     if (_phoneCur.ClockStatus == ClockStatusEnum.Home ||
         _phoneCur.ClockStatus == ClockStatusEnum.None)
     {
         labelTime.BorderStyle = System.Windows.Forms.BorderStyle.None;              //Remove color box if employee is not currently working.
     }
     else
     {
         labelTime.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
     }
     labelCustomer.Text = _phoneCur.CustomerNumber;
     //Always show ext and name, no matter if user is clocked in or not. This keeps phone tiles from appearing blank with no extension and name.
     if (_phoneCur.EmployeeName != "")
     {
         labelExtensionName.Text = _phoneCur.Extension.ToString() + " - " + _phoneCur.EmployeeName;           // +(IsProximal ? " "+_cPerson : "");
     }
     else
     {
         labelExtensionName.Text = _phoneCur.Extension.ToString() + " - Vacant";
     }
     pictureProx.Visible = true;
     if (phone.IsProxVisible)
     {
         pictureProx.Image = Properties.Resources.Figure;
     }
     else if (phone.DateTProximal.AddHours(8) > DateTime.Now)
     {
         pictureProx.Image = Properties.Resources.NoFigure;              //TODO: replace image with one from Nathan
     }
     else
     {
         pictureProx.Visible = false;
     }
     if (LayoutHorizontal)
     {
         this.labelExtensionName.Location = new Point(3, 9);
         pictureProx.Location             = new Point(173, 11);
     }
     else
     {
         int stringW   = TextRenderer.MeasureText(labelExtensionName.Text, labelExtensionName.Font).Width;
         int locationX = labelExtensionName.Location.X
                         + stringW
                         + (labelExtensionName.Width - stringW) / 2 //half of the unused space around the centered text
                         + 1;                                       //padding
         pictureProx.Location           = new Point(locationX, 6);
         pictureNeedsHelpButton.Visible = true;
     }
     if (phone.ClockStatus == ClockStatusEnum.Home ||
         phone.ClockStatus == ClockStatusEnum.Lunch ||
         phone.ClockStatus == ClockStatusEnum.Break ||
         phone.ClockStatus == ClockStatusEnum.None)
     {
         pictureNeedsHelpButton.Visible = false;
     }
     else
     {
         pictureNeedsHelpButton.Enabled = true;
         pictureNeedsHelpButton.Image   = Properties.Resources.raisehanddisabled;
     }
     if (chatUserCur == null || chatUserCur.CurrentSessions == 0 || pictureInUse.Visible)
     {
         pictureGTA.Visible = false;
         pictureGTA.SendToBack();
     }
     else
     {
         pictureGTA.Visible = true;
         pictureGTA.BringToFront();
         labelTime.Text = TimeSpan.FromMilliseconds(chatUserCur.SessionTime).ToStringHmmss();
     }
 }
示例#4
0
        private void UserControlPhoneSmall_Paint(object sender, PaintEventArgs e)
        {
            Graphics g = e.Graphics;

            g.FillRectangle(SystemBrushes.Control, this.Bounds);
            if (phoneList == null)
            {
                return;
            }
            int   rows      = 7;
            int   columns   = 7;
            float boxWidth  = 21.4f;
            float boxHeight = 17f;
            float hTot      = boxHeight * rows;
            float x         = 0f;
            float y         = 0f;

            //Create a white "background" rectangle so that any empty squares (no employees) will show as white boxes instead of no color.
            g.FillRectangle(new SolidBrush(Color.White), x, y, boxWidth * columns, boxHeight * rows);
            for (int i = 0; i < phoneList.Count; i++)
            {
                //Draw the extension number if a person is available at that extension.
                if (phoneList[i].ClockStatus != ClockStatusEnum.Home &&
                    phoneList[i].ClockStatus != ClockStatusEnum.None)
                {
                    //Colors the box a color based on the corresponding phone's status.
                    Color outerColor;
                    Color innerColor;
                    Color fontColor;
                    bool  isTriageOperatorOnTheClock = false;
                    //get the cubicle color and triage status
                    PhoneEmpDefault ped = PhoneEmpDefaults.GetEmpDefaultFromList(phoneList[i].EmployeeNum, phoneEmpDefaultList);
                    Phones.GetPhoneColor(phoneList[i], ped, false, out outerColor, out innerColor, out fontColor, out isTriageOperatorOnTheClock);
                    using (Brush brush = new SolidBrush(outerColor)) {
                        g.FillRectangle(brush, x * boxWidth, y * boxHeight, boxWidth, boxHeight);
                    }
                    Font  baseFont = new Font("Arial", 7);
                    SizeF extSize  = g.MeasureString(phoneList[i].Extension.ToString(), baseFont);
                    float padX     = (boxWidth - extSize.Width) / 2;
                    float padY     = (boxHeight - extSize.Height) / 2;
                    using (Brush brush = new SolidBrush(Color.Black)) {
                        g.DrawString(phoneList[i].Extension.ToString(), baseFont, brush, (x * boxWidth) + (padX), (y * boxHeight) + (padY));
                    }
                }
                x++;
                if (x >= columns)
                {
                    x = 0f;
                    y++;
                }
            }
            //horiz lines
            for (int i = 0; i < rows + 1; i++)
            {
                g.DrawLine(Pens.Black, 0, i * boxHeight, Width, i * boxHeight);
            }
            //Very bottom
            g.DrawLine(Pens.Black, 0, Height - 1, Width, Height - 1);
            //vert
            for (int i = 0; i < columns; i++)
            {
                g.DrawLine(Pens.Black, i * boxWidth, 0, i * boxWidth, hTot);
            }
            g.DrawLine(Pens.Black, Width - 1, 0, Width - 1, hTot);
        }
示例#5
0
        ///<summary>Set phone and triage flag to display. Get/Set accessor won't work here because we require 2 seperate fields in order to update the control properly.</summary>
        public void SetPhone(Phone phone, PhoneEmpDefault phoneEmpDefault, bool isTriageOperator)
        {
            phoneCur = phone;
            if (phoneCur == null)            //empty out everything and return
            {
                this.Visible            = false;
                pictureWebCam.Image     = null;          //or just make it not visible?
                pictureInUse.Visible    = false;
                labelExtensionName.Text = "";
                labelStatusAndNote.Text = "";
                labelTime.Text          = "";
                labelTime.BackColor     = this.BackColor;
                labelCustomer.Text      = "";
                return;
            }
            this.Visible = true;
            if (ShowImageForced)
            {
                pictureWebCam.Image   = PIn.Bitmap(phoneCur.WebCamImage);
                pictureWebCam.Visible = true;
            }
            else if (phoneCur.ClockStatus == ClockStatusEnum.Home ||
                     phoneCur.ClockStatus == ClockStatusEnum.None ||
                     phoneCur.ClockStatus == ClockStatusEnum.Off)
            {
                pictureWebCam.Image   = null;
                pictureWebCam.Visible = false;
            }
            else if (phoneCur.ClockStatus == ClockStatusEnum.Break ||
                     phoneCur.ClockStatus == ClockStatusEnum.Lunch)
            {
                pictureWebCam.Visible = true;
                Bitmap   bmp = new Bitmap(pictureWebCam.Width, pictureWebCam.Height);
                Graphics g   = Graphics.FromImage(bmp);
                try {
                    g.FillRectangle(SystemBrushes.Control, 0, 0, bmp.Width, bmp.Height);
                    string strStat = phoneCur.ClockStatus.ToString();
                    SizeF  sizef   = g.MeasureString(strStat, labelStatusAndNote.Font);
                    g.DrawString(strStat, labelStatusAndNote.Font, SystemBrushes.GrayText, (bmp.Width - sizef.Width) / 2, (bmp.Height - sizef.Height) / 2);
                    pictureWebCam.Image = (Image)bmp.Clone();
                }
                finally {
                    g.Dispose();
                    g = null;
                    bmp.Dispose();
                    bmp = null;
                }
            }
            else
            {
                pictureWebCam.Visible = true;
                pictureWebCam.Image   = PIn.Bitmap(phoneCur.WebCamImage);
            }
            if (phoneCur.Description == "")
            {
                pictureInUse.Visible = false;
            }
            else
            {
                pictureInUse.Visible = true;
            }
            labelExtensionName.Text = "";
            string str = phoneCur.ClockStatus.ToString();

            //Check if the user is logged in.
            if (phoneCur.ClockStatus == ClockStatusEnum.None ||
                phoneCur.ClockStatus == ClockStatusEnum.Home)
            {
                str = "Clock In";
            }
            //Always show ext and name, no matter if user is clocked in or not. This keeps phone tiles from appearing blank with no extension and name.
            string nameStr = "Vacant";

            if (phoneCur.EmployeeName != "")
            {
                nameStr = phoneCur.EmployeeName;
            }
            labelExtensionName.Text = phoneCur.Extension.ToString() + " - " + nameStr;
            labelStatusAndNote.Text = str;
            DateTime dateTimeStart = phoneCur.DateTimeStart;

            if (dateTimeStart.Date == DateTime.Today)
            {
                TimeSpan span      = DateTime.Now - dateTimeStart + TimeDelta;
                DateTime timeOfDay = DateTime.Today + span;
                labelTime.Text = timeOfDay.ToString("H:mm:ss");
            }
            else
            {
                labelTime.Text = "";
            }
            if (phoneCur.ClockStatus == ClockStatusEnum.Home ||
                phoneCur.ClockStatus == ClockStatusEnum.None ||
                phoneCur.ClockStatus == ClockStatusEnum.Break)
            {
                labelTime.BackColor = this.BackColor;              //No color if employee is not currently working.
            }
            else
            {
                Color outerColor;
                Color innerColor;
                Color fontColor;
                bool  isTriageOperatorOnTheClock = false;
                //get the cubicle color and triage status
                Phones.GetPhoneColor(phone, phoneEmpDefault, false, out outerColor, out innerColor, out fontColor, out isTriageOperatorOnTheClock);
                if (!timerFlash.Enabled)                  //if the control is already flashing then don't overwrite the colors. this would cause a "spastic" flash effect.
                {
                    labelTime.BackColor = outerColor;
                }
                if (phoneCur.ClockStatus == ClockStatusEnum.NeedsHelp)
                {
                    if (!timerFlash.Enabled)                      //Only start the flash timer and color the control once. This prevents over-flashing effect.
                    {
                        labelTime.Tag = new object[2] {
                            false, labelTime.BackColor
                        };
                        timerFlash.Start();
                    }
                }
            }
            if (phoneCur.ClockStatus == ClockStatusEnum.Home ||
                phoneCur.ClockStatus == ClockStatusEnum.None)
            {
                labelTime.BorderStyle = System.Windows.Forms.BorderStyle.None;              //Remove color box if employee is not currently working.
            }
            else
            {
                labelTime.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            }
            if (phoneCur.ClockStatus != ClockStatusEnum.NeedsHelp)            //Always assume the flash timer was previously turned on and turn it off here. No harm if it' already off.
            {
                timerFlash.Stop();
            }
            labelCustomer.Text = phoneCur.CustomerNumber;
        }
示例#6
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
     }
 }