///<summary>Add a cubicle to the panel.</summary> public void AddCubicle(MapArea cubicle, bool allowRightClickOptions = true) { MapAreaRoomControl phone = new MapAreaRoomControl( cubicle, TimeSpan.FromSeconds(Rand.Next(60, 1200)), "Emp: " + this.Controls.Count.ToString(), this.Controls.Count, cubicle.Extension.ToString(), "Status", this.FontCubicle, this.FontCubicleHeader, Color.FromArgb(40, Color.Red), Color.Red, this.FloorColor, GetScreenLocation(cubicle.XPos, cubicle.YPos, this.PixelsPerFoot), GetScreenSize(cubicle.Width, cubicle.Height, this.PixelsPerFoot), Properties.Resources.phoneInUse, Properties.Resources.gtaicon3, Properties.Resources.WebChatIcon, this.AllowDragging, this.AllowEditing, allowRightClickOptions); phone.DragDone += mapAreaControl_DragDone; phone.MapAreaRoomChanged += mapAreaControl_Changed; phone.RoomControlClicked += roomControl_Clicked; phone.GoToChanged += GoTo_Changed; this.Controls.Add(phone); }
///<summary>Call this BEFORE calling Invalidate(true).</summary> private void ResizeCubicles() { if (this.Controls == null || this.Controls.Count <= 0) { return; } for (int i = 0; i < this.Controls.Count; i++) { if (this.Controls[i] == null) { continue; } else if (this.Controls[i] is MapAreaRoomControl) { MapAreaRoomControl cubicle = (MapAreaRoomControl)this.Controls[i]; cubicle.Location = GetScreenLocation(cubicle.MapAreaItem.XPos, cubicle.MapAreaItem.YPos, this.PixelsPerFoot); cubicle.Size = GetScreenSize(cubicle.MapAreaItem.Width, cubicle.MapAreaItem.Height, this.PixelsPerFoot); } else if (this.Controls[i] is MapAreaDisplayLabelControl) { MapAreaDisplayLabelControl displayLabel = (MapAreaDisplayLabelControl)this.Controls[i]; displayLabel.Location = GetScreenLocation(displayLabel.MapAreaItem.XPos, displayLabel.MapAreaItem.YPos, this.PixelsPerFoot); displayLabel.Size = MapAreaDisplayLabelControl.GetDrawingSize(displayLabel, this.PixelsPerFoot); //draw labels on top of all other controls displayLabel.BringToFront(); } } }
///<summary>Sets the detail control to the clicked on cubicle as long as there is an associated phone.</summary> private void FillDetails(MapAreaRoomControl cubeClicked = null) { if (cubeClicked.PhoneCur != null) { Image empImage = GetEmployeePicture(cubeClicked.PhoneCur); userControlMapDetails1.SetEmployee(cubeClicked, empImage); userControlMapDetails1.Visible = true; } }
public void MapAreaPanelHQ_RoomControlClicked(object sender, EventArgs e) { MapAreaRoomControl clickedPhone = (MapAreaRoomControl)sender; if (clickedPhone == null) { return; } FillDetails(clickedPhone); RoomControlClicked?.Invoke(sender, e); }
private void pdLabels_PrintPage(object sender, PrintPageEventArgs ev) { int totalPages = (int)Math.Ceiling((double)gridMain.SelectedIndices.Length / 30); Graphics g = ev.Graphics; float yPos = 63; float xPos = 50; string text = ""; while (yPos < 1000 && patientsPrinted < gridMain.SelectedIndices.Length) { text = ""; DataRow curRow = (DataRow)gridMain.SelectedGridRows[patientsPrinted].Tag; text = curRow["FName"].ToString() + " " + curRow["LName"].ToString() + "\r\n"; text += curRow["address"].ToString() + "\r\n"; text += curRow["City"].ToString() + ", " + curRow["State"].ToString() + " " + curRow["Zip"].ToString() + "\r\n"; Rectangle rect = new Rectangle((int)xPos, (int)yPos, 275, 100); MapAreaRoomControl.FitText(text, new Font(FontFamily.GenericSansSerif, 11), Brushes.Black, rect, new StringFormat(), g); //reposition for next label xPos += 275; if (xPos > 850) //drop a line { xPos = 50; yPos += 100; } patientsPrinted++; } pagesPrinted++; if (pagesPrinted == totalPages) { ev.HasMorePages = false; pagesPrinted = 0; //because it has to print again from the print preview patientsPrinted = 0; } else { ev.HasMorePages = true; } g.Dispose(); }
///<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 } }
///<summary>Add a cubicle to the panel.</summary> public void AddCubicle(MapArea cubicle) { MapAreaRoomControl phone=new MapAreaRoomControl( cubicle, TimeSpan.FromSeconds(Rand.Next(60,1200)).ToString(), "Emp: "+this.Controls.Count.ToString(), this.Controls.Count, cubicle.Extension.ToString(), "Status", this.FontCubicle, this.FontCubicleHeader, Color.FromArgb(40,Color.Red), Color.Red, this.FloorColor, GetScreenLocation(cubicle.XPos,cubicle.YPos,this.PixelsPerFoot), GetScreenSize(cubicle.Width,cubicle.Height,this.PixelsPerFoot), Properties.Resources.phoneInUse, this.AllowDragging, this.AllowEditing); phone.DragDone+=mapAreaControl_DragDone; phone.MapAreaRoomChanged+=mapAreaControl_Changed; this.Controls.Add(phone); }
///<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 } }