Beispiel #1
0
        private void FillTiles(bool refreshList)
        {
            if (refreshList)
            {
                phoneList = Phones.GetPhoneList();
            }
            if (phoneList == null)
            {
                return;
            }
            PhoneTile tile;

            for (int i = 0; i < 26; i++)
            {
                //Application.DoEvents();
                Control[] controlMatches = Controls.Find("phoneTile" + (i + 1).ToString(), false);
                if (controlMatches.Length == 0)               //no match found for some reason.
                {
                    continue;
                }
                tile                 = ((PhoneTile)controlMatches[0]);
                tile.TimeDelta       = timeDelta;
                tile.ShowImageForced = checkBoxAll.Checked;
                if (phoneList.Count > i)
                {
                    tile.PhoneCur = phoneList[i];
                }
                else
                {
                    tile.PhoneCur = null;
                }
            }
        }
Beispiel #2
0
        private void FillTiles(bool refreshList)
        {
            if (refreshList)              //Refresh the phone list. This will cause a database refresh for our list and call this function again with the new list.
            {
                SetPhoneList(PhoneEmpDefaults.Refresh(), Phones.GetPhoneList(), ChatUsers.GetAll());
                return;
            }
            if (PhoneList == null)
            {
                return;
            }
            PhoneTile tile;

            for (int i = 0; i < TileCount; i++)
            {
                //Application.DoEvents();
                Control[] controlMatches = Controls.Find("phoneTile" + (i + 1).ToString(), false);
                if (controlMatches.Length == 0)               //no match found for some reason.
                {
                    continue;
                }
                tile                 = ((PhoneTile)controlMatches[0]);
                tile.TimeDelta       = timeDelta;
                tile.ShowImageForced = checkBoxAll.Checked;
                if (PhoneList.Count > i)
                {
                    tile.SetPhone(PhoneList[i], PhoneEmpDefaults.GetEmpDefaultFromList(PhoneList[i].EmployeeNum, PhoneEmpDefaultList),
                                  ChatList.Where(x => x.Extension == PhoneList[i].Extension).FirstOrDefault(), PhoneEmpDefaults.IsTriageOperatorForExtension(PhoneList[i].Extension, PhoneEmpDefaultList));
                }
                else
                {
                    Controls.Remove(tile);
                }
            }
        }
Beispiel #3
0
 private void FillTiles(bool doRefreshList)
 {
     if (doRefreshList)              //Refresh the phone list. This will cause a database refresh for our list and call this function again with the new list.
     {
         SetPhoneList(PhoneEmpDefaults.Refresh(), Phones.GetPhoneList(), ChatUsers.GetAll());
         return;
     }
     Invalidate();
 }
Beispiel #4
0
        private void FormPhoneTiles_Load(object sender, EventArgs e)
        {
#if !DEBUG
            if (Environment.MachineName.ToLower() != "jordans" &&
                Environment.MachineName.ToLower() != "nathan")
            {
                checkBoxAll.Visible = false;                      //so this will also be visible in debug
            }
#endif
            timeDelta = MiscData.GetNowDateTime() - DateTime.Now;
            PhoneTile tile;
            int       x = 0;
            int       y = 0;
            SetPhoneList(PhoneEmpDefaults.Refresh(), Phones.GetPhoneList(), ChatUsers.GetAll(), false);         //Do not call FillTiles() yet. Need to create PhoneTile controls first.
            for (int i = 1; i < TileCount + 1; i++)
            {
                tile                      = new PhoneTile();
                tile.Name                 = "phoneTile" + (i).ToString();
                tile.Location             = new Point(tile.Width * x, butOverride.Bottom + 15 + (tile.Height * y));
                tile.GoToChanged         += new System.EventHandler(this.phoneTile_GoToChanged);
                tile.SelectedTileChanged += new System.EventHandler(this.phoneTile_SelectedTileChanged);
                tile.MenuNumbers          = menuNumbers;
                tile.MenuStatus           = menuStatus;
                //adding this in case we ever want to show the NeedsHelp button in the big phones. Currently, it is hidden.
                tile.NeedsHelpClicked += new System.EventHandler(this.tiletoggleHelp_Click);
                this.Controls.Add(tile);
                y++;
                if (i % (TilesPerColumn) == 0)             //If number is divisble by the number of tiles per column, move over to a new column.  TilesPerColumn subtracts one because i is zero based.
                {
                    y = 0;
                    x++;
                }
            }
            FillTiles(false);            //initial fast load and anytime data changes.  After this, pumped in from main form.
            Control[] topLeftMatch = Controls.Find("phoneTile1", false);
            if (PhoneList.Count >= 1 &&
                topLeftMatch != null &&
                topLeftMatch.Length >= 1)
            {
                //Size the window to fit contents
                tile = ((PhoneTile)topLeftMatch[0]);
                int columns    = (int)Math.Ceiling((double)PhoneList.Count / TilesPerColumn);
                int autoWidth  = columns * tile.Width;
                int autoHeight = tile.Top + (tile.Height * TilesPerColumn);
                if (autoWidth > 1650)                 //Window was going off side of screen.  1650 chosen to accommodate side mounted windows taskbar.
                //Resize window to fit, add height for showing horizontal scrollbar.
                //Doesn't use #*column width here because the column width is changing soon, and want to show partial columns so user knows to scroll.
                {
                    autoWidth  = 1650;
                    autoHeight = autoHeight + 20;
                }
                this.ClientSize = new Size(autoWidth, autoHeight);
            }
            radioByExt.CheckedChanged  += radioSort_CheckedChanged;
            radioByName.CheckedChanged += radioSort_CheckedChanged;
        }
Beispiel #5
0
        private void escalationToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (!Security.IsAuthorized(Permissions.Setup))
            {
                return;
            }
            FormPhoneEmpDefaultEscalationEdit FormE = new FormPhoneEmpDefaultEscalationEdit();

            FormE.ShowDialog();
            refreshCurrentTabHelper(PhoneEmpDefaults.Refresh(), Phones.GetPhoneList(), PhoneEmpSubGroups.GetAll());
            SecurityLogs.MakeLogEntry(Permissions.Setup, 0, "Escalation team changed");
        }
Beispiel #6
0
        private void FillTile()
        {
            phoneList = Phones.GetPhoneList();
            Invalidate();            //as long as we have a new list anyway.
            if (phoneList == null)
            {
                phoneTile.PhoneCur = null;
                return;
            }
            Phone phone = Phones.GetPhoneForExtension(phoneList, Extension);

            phoneTile.PhoneCur = phone;          //could be null
        }
Beispiel #7
0
        private void butBuildFromPhoneTable_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("This action will clear all information from clinicmapitem table and recreated it from current phone table rows. Would you like to continue?", "", MessageBoxButtons.YesNo) != System.Windows.Forms.DialogResult.Yes)
            {
                return;
            }
            mapAreaPanel.Clear(true);
            List <Phone> phones          = Phones.GetPhoneList();
            int          defaultSizeFeet = 6;
            int          row             = 1;
            int          column          = 0;

            for (int i = 0; i < 78; i++)
            {
                if (row >= 7)
                {
                    if (++column > 8)
                    {
                        column = 3;
                        row++;
                    }
                }
                else
                {
                    if (++column > 10)
                    {
                        column = 1;
                        row++;
                    }
                    if (row == 7)
                    {
                        column = 3;
                        //row=8;
                    }
                }

                //Phone phone=phones[i];
                MapArea clinicMapItem = new MapArea();
                clinicMapItem.Description = "";
                clinicMapItem.Extension   = i;             //phone.Extension;
                clinicMapItem.Width       = defaultSizeFeet;
                clinicMapItem.Height      = defaultSizeFeet;
                clinicMapItem.XPos        = (1 * column) + ((column - 1) * defaultSizeFeet);
                clinicMapItem.YPos        = 1 + ((row - 1) * defaultSizeFeet);
                mapAreaPanel.AddCubicle(clinicMapItem);
                MapAreas.Insert(clinicMapItem);
            }
        }
Beispiel #8
0
        private void FillTile()
        {
            //Get the new phone list from the database and redraw control.
            SetPhoneList(PhoneEmpDefaults.Refresh(), Phones.GetPhoneList());
            //Set the currently selected phone accordingly.
            if (phoneList == null)           //No phone list. Shouldn't get here.
            {
                phoneTile.SetPhone(null, null, false);
                return;
            }
            Phone           phone           = Phones.GetPhoneForExtension(phoneList, Extension);
            PhoneEmpDefault phoneEmpDefault = null;

            if (phone != null)
            {
                phoneEmpDefault = PhoneEmpDefaults.GetEmpDefaultFromList(phone.EmployeeNum, phoneEmpDefaultList);
            }
            phoneTile.SetPhone(phone, phoneEmpDefault, PhoneEmpDefaults.IsTriageOperatorForExtension(Extension, phoneEmpDefaultList));
        }
        private void FillTile()
        {
            //UpdateComboRooms();//We can't do this in the constructor and all the other methods fire too often.  FillTile is a good place for this.
            //Get the new phone list from the database and redraw control.
            SetPhoneList(PhoneEmpDefaults.Refresh(), Phones.GetPhoneList());
            //Set the currently selected phone accordingly.
            if (_listPhones == null)           //No phone list. Shouldn't get here.
            {
                phoneTile.SetPhone(null, null, null, false);
                return;
            }
            Phone           phone           = Phones.GetPhoneForExtension(_listPhones, Extension);
            PhoneEmpDefault phoneEmpDefault = null;
            ChatUser        chatUser        = null;

            if (phone != null)
            {
                phoneEmpDefault = PhoneEmpDefaults.GetEmpDefaultFromList(phone.EmployeeNum, _listPhoneEmpDefaults);
                chatUser        = ChatUsers.GetFromExt(phone.Extension);
            }
            phoneTile.SetPhone(phone, phoneEmpDefault, chatUser, PhoneEmpDefaults.IsTriageOperatorForExtension(Extension, _listPhoneEmpDefaults));
        }
Beispiel #10
0
 private void FormPhoneTiles_Load(object sender, EventArgs e)
 {
     if (!ODBuild.IsDebug() && Environment.MachineName.ToLower() != "jordans" &&
         Environment.MachineName.ToLower() != "nathan")
     {
         checkBoxAll.Visible = false;              //so this will also be visible in debug
     }
     _tileStart      = butSettings.Bottom + 8;
     _isFlashingPink = false;
     _timeSpanDelta  = MiscData.GetNowDateTime() - DateTime.Now;
     _listPhoneTiles = new List <PhoneTile>();
     SetPhoneList(PhoneEmpDefaults.Refresh(), Phones.GetPhoneList(), ChatUsers.GetAll(), false);         //Do not call FillTiles() yet. Need to create PhoneTile controls first.
     if (_listPhones.Count >= 1)
     {
         int columns    = (int)Math.Ceiling((double)_listPhones.Count / _tilesPerColumn);
         int widthForm  = 1780;             //This width and height is changed to accomadate Jordan's taskbar and sidebar setup.
         int heightForm = 1026;
         this.Size = new Size(widthForm, heightForm);
     }
     radioByExt.CheckedChanged  += radioSort_CheckedChanged;
     radioByName.CheckedChanged += radioSort_CheckedChanged;
 }
        private void FillEmps()
        {
            gridEmp.BeginUpdate();
            gridEmp.ListGridColumns.Clear();
            GridColumn col;

            col = new GridColumn(Lan.g("TableEmpClock", "Ext"), 25);
            gridEmp.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g("TableEmpClock", "Employee"), 60);
            gridEmp.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g("TableEmpClock", "Status"), 80);
            gridEmp.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g("TableEmpClock", "Phone"), 50);
            gridEmp.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g("TableEmpClock", "InOut"), 35);
            gridEmp.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g("TableEmpClock", "Customer"), 90);
            gridEmp.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g("TableEmpClock", "Time"), 70);
            gridEmp.ListGridColumns.Add(col);
            gridEmp.ListGridRows.Clear();
            UI.GridRow row;
            PhoneList = Phones.GetPhoneList();
            DateTime dateTimeStart;
            TimeSpan span;
            DateTime timeOfDay;            //because TimeSpan does not have good formatting.

            for (int i = 0; i < PhoneList.Count; i++)
            {
                row = new OpenDental.UI.GridRow();
                row.Cells.Add(PhoneList[i].Extension.ToString());
                row.Cells.Add(PhoneList[i].EmployeeName);
                if (PhoneList[i].ClockStatus == ClockStatusEnum.None)
                {
                    row.Cells.Add("");
                }
                else if (!PrefC.GetBool(PrefName.ClockEventAllowBreak) && PhoneList[i].ClockStatus == ClockStatusEnum.Lunch)
                {
                    row.Cells.Add(ClockStatusEnum.Break.GetDescription());                    //Breaks turned off, Lunch is now "Break", but maintains Lunch functionality.
                }
                else
                {
                    row.Cells.Add(PhoneList[i].ClockStatus.ToString());
                }
                row.Cells.Add(PhoneList[i].Description);
                row.Cells.Add(PhoneList[i].InOrOut);
                row.Cells.Add(PhoneList[i].CustomerNumber);
                dateTimeStart = PhoneList[i].DateTimeStart;
                if (dateTimeStart.Date == DateTime.Today)
                {
                    span      = DateTime.Now - dateTimeStart + timeDelta;
                    timeOfDay = DateTime.Today + span;
                    row.Cells.Add(timeOfDay.ToString("H:mm:ss"));
                }
                else
                {
                    row.Cells.Add("");
                }
                row.ColorBackG = PhoneList[i].ColorBar;
                row.ColorText  = PhoneList[i].ColorText;
                gridEmp.ListGridRows.Add(row);
            }
            gridEmp.EndUpdate();
            gridEmp.SetSelected(false);
        }
Beispiel #12
0
 private void tabMain_SelectedIndexChanged(object sender, EventArgs e)
 {
     refreshCurrentTabHelper(PhoneEmpDefaults.Refresh(), Phones.GetPhoneList(), PhoneEmpSubGroups.GetAll());
 }
        private void butOK_Click(object sender, System.EventArgs e)
        {
            //Using a switch statement in case we want special functionality for the other statuses later on.
            switch ((PhoneEmpStatusOverride)listStatusOverride.SelectedIndex)
            {
            case PhoneEmpStatusOverride.None:
                if (StatusOld == PhoneEmpStatusOverride.Unavailable)
                {
                    MsgBox.Show(this, "Change your status from unavailable by using the small phone panel.");
                    return;
                }
                break;

            case PhoneEmpStatusOverride.OfflineAssist:
                if (StatusOld == PhoneEmpStatusOverride.Unavailable)
                {
                    MsgBox.Show(this, "Change your status from unavailable by using the small phone panel.");
                    return;
                }
                break;
            }
            if (IsNew)
            {
                if (textEmployeeNum.Text == "")
                {
                    MsgBox.Show(this, "Unique EmployeeNum is required.");
                    return;
                }
                if (textEmpName.Text == "")
                {
                    MsgBox.Show(this, "Employee name is required.");
                    return;
                }
                PedCur.EmployeeNum = PIn.Long(textEmployeeNum.Text);
            }
            //Get the current database state of the phone emp default (before we change it)
            PhoneEmpDefault pedFromDatabase = PhoneEmpDefaults.GetOne(PedCur.EmployeeNum);

            if (pedFromDatabase == null)
            {
                pedFromDatabase = new PhoneEmpDefault();
            }
            int  newExtension    = PIn.Int(textPhoneExt.Text);
            bool extensionChange = pedFromDatabase.PhoneExt != newExtension;

            if (extensionChange)              //Only check when extension has changed and clocked in.
            //We need to prevent changes to phoneempdefault table which involve employees who are currently logged in.
            //Failing to do so would cause subtle race conditions between the phone table and phoneempdefault.
            //Net result would be the phone panel looking wrong.
            {
                if (ClockEvents.IsClockedIn(PedCur.EmployeeNum))                 //Prevent any change if employee being edited is currently clocked in.
                {
                    MsgBox.Show(this, "You must first clock out before making changes");
                    return;
                }
                //Find out if the target extension is already being occuppied by a different employee.
                Phone phoneOccuppied = Phones.GetPhoneForExtension(Phones.GetPhoneList(), PIn.Int(textPhoneExt.Text));
                if (phoneOccuppied != null)
                {
                    if (ClockEvents.IsClockedIn(phoneOccuppied.EmployeeNum))                      //Prevent change if employee's new extension is occupied by a different employee who is currently clocked in.
                    {
                        MessageBox.Show(Lan.g(this, "This extension cannot be inherited because it is currently occuppied by an employee who is currently logged in.\r\n\r\nExisting employee: ") + phoneOccuppied.EmployeeName);
                        return;
                    }
                    if (phoneOccuppied.EmployeeNum != PedCur.EmployeeNum)
                    {
                        //We are setting to a new employee so let's clean up the old employee.
                        //This will prevent duplicates in the phone table and subsequently prevent duplicates in the phone panel.
                        Phones.UpdatePhoneToEmpty(phoneOccuppied.EmployeeNum, -1);
                        PhoneEmpDefault pedOccuppied = PhoneEmpDefaults.GetOne(phoneOccuppied.EmployeeNum);
                        if (pedOccuppied != null)                       //prevent duplicate in phoneempdefault
                        {
                            pedOccuppied.PhoneExt = 0;
                            PhoneEmpDefaults.Update(pedOccuppied);
                        }
                    }
                }
                //Get the employee that is normally assigned to this extension (assigned ext set in the employee table).
                long permanentLinkageEmployeeNum = Employees.GetEmpNumAtExtension(pedFromDatabase.PhoneExt);
                if (permanentLinkageEmployeeNum >= 1)                      //Extension is nomrally assigned to an employee.
                {
                    if (PedCur.EmployeeNum != permanentLinkageEmployeeNum) //This is not the normally linked employee so let's revert back to the proper employee.
                    {
                        PhoneEmpDefault pedRevertTo = PhoneEmpDefaults.GetOne(permanentLinkageEmployeeNum);
                        //Make sure the employee we are about to revert is not logged in at yet a different workstation. This would be rare but it's worth checking.
                        if (pedRevertTo != null && !ClockEvents.IsClockedIn(pedRevertTo.EmployeeNum))
                        {
                            //Revert to the permanent extension for this PhoneEmpDefault.
                            pedRevertTo.PhoneExt = pedFromDatabase.PhoneExt;
                            PhoneEmpDefaults.Update(pedRevertTo);
                            //Update phone table to match this change.
                            Phones.SetPhoneStatus(ClockStatusEnum.Home, pedRevertTo.PhoneExt, pedRevertTo.EmployeeNum);
                        }
                    }
                }
            }
            //Ordering of these updates is IMPORTANT!!!
            //Phone Emp Default must be updated first
            PedCur.EmpName          = textEmpName.Text;
            PedCur.IsGraphed        = checkIsGraphed.Checked;
            PedCur.HasColor         = checkHasColor.Checked;
            PedCur.RingGroups       = (AsteriskRingGroups)listRingGroup.SelectedIndex;
            PedCur.PhoneExt         = PIn.Int(textPhoneExt.Text);
            PedCur.StatusOverride   = (PhoneEmpStatusOverride)listStatusOverride.SelectedIndex;
            PedCur.Notes            = textNotes.Text;
            PedCur.ComputerName     = textComputerName.Text;
            PedCur.IsPrivateScreen  = checkIsPrivateScreen.Checked;
            PedCur.IsTriageOperator = checkIsTriageOperator.Checked;
            if (IsNew)
            {
                PhoneEmpDefaults.Insert(PedCur);
                //insert the new Phone record to keep the 2 tables in sync
                Phone phoneNew = new Phone();
                phoneNew.EmployeeName = PedCur.EmpName;
                phoneNew.EmployeeNum  = PedCur.EmployeeNum;
                phoneNew.Extension    = PedCur.PhoneExt;
                phoneNew.ClockStatus  = ClockStatusEnum.Home;
                Phones.Insert(phoneNew);
            }
            else
            {
                PhoneEmpDefaults.Update(PedCur);
            }
            //It is now safe to update Phone table as it will draw from the newly updated Phone Emp Default row
            if ((PhoneEmpStatusOverride)listStatusOverride.SelectedIndex == PhoneEmpStatusOverride.Unavailable &&
                ClockEvents.IsClockedIn(PedCur.EmployeeNum))
            {
                //We set ourselves unavailable from this window because we require an explanation.
                //This is the only status that will synch with the phone table, all others should be handled by the small phone panel.
                Phones.SetPhoneStatus(ClockStatusEnum.Unavailable, PedCur.PhoneExt, PedCur.EmployeeNum);
            }
            if (extensionChange)
            {
                //Phone extension has changed so update the phone table as well.
                //We have already guaranteed that this employee is Clocked Out (above) so set to home and update phone table.
                Phones.SetPhoneStatus(ClockStatusEnum.Home, PedCur.PhoneExt, PedCur.EmployeeNum);
            }
            DialogResult = DialogResult.OK;
        }