Esempio n. 1
0
        ///<summary>Special logic needs to be run for the phone system when users clock out.</summary>
        private static void ClockOutForHQ(long employeeNum)
        {
            //The name showing for this extension might change to a different user.
            //It would only need to change if the employee clocking out is not assigned to the current extension. (assigned ext set in the employee table)
            //Get the information corresponding to the employee clocking out.
            PhoneEmpDefault pedClockingOut = PhoneEmpDefaults.GetOne(employeeNum);

            if (pedClockingOut == null)
            {
                return;                //This should never happen.
            }
            //Get the employee that is normally assigned to this extension (assigned ext set in the employee table).
            long permanentLinkageEmployeeNum = Employees.GetEmpNumAtExtension(pedClockingOut.PhoneExt);

            if (permanentLinkageEmployeeNum >= 1)               //Extension is nomrally assigned to an employee.
            {
                if (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 = pedClockingOut.PhoneExt;
                        PhoneEmpDefaults.Update(pedRevertTo);
                        //Update phone table to match this change.
                        Phones.SetPhoneStatus(ClockStatusEnum.Home, pedRevertTo.PhoneExt, pedRevertTo.EmployeeNum);
                    }
                }
            }
            //Now let's switch this employee back to his normal extension.
            Employee employeeClockingOut = Employees.GetEmp(employeeNum);

            if (employeeClockingOut == null)           //should not get here
            {
                return;
            }
            if (employeeClockingOut.PhoneExt != pedClockingOut.PhoneExt)           //Revert PhoneEmpDefault and Phone to the normally assigned extension for this employee.
            //Start by setting this employee back to their normally assigned extension.
            {
                pedClockingOut.PhoneExt = employeeClockingOut.PhoneExt;
                //Now check to see if we are about to steal yet a third employee's extension.
                Phone phoneCurrentlyOccupiedBy = Phones.GetPhoneForExtension(Phones.GetPhoneList(), employeeClockingOut.PhoneExt);
                if (phoneCurrentlyOccupiedBy != null &&           //There is yet a third employee who is currently occupying this extension.
                    ClockEvents.IsClockedIn(phoneCurrentlyOccupiedBy.EmployeeNum))
                {
                    //The third employee is clocked in so set our employee extension to 0.
                    //The currently clocked in employee will retain the extension for now.
                    //Our employee will retain the proper extension next time they clock in.
                    pedClockingOut.PhoneExt = 0;
                    //Update the phone table accordingly.
                    Phones.UpdatePhoneToEmpty(pedClockingOut.EmployeeNum, -1);
                }
                PhoneEmpDefaults.Update(pedClockingOut);
            }
            //Update phone table to match this change.
            Phones.SetPhoneStatus(ClockStatusEnum.Home, pedClockingOut.PhoneExt, employeeClockingOut.EmployeeNum);
        }
Esempio n. 2
0
        public static void SetToDefaultRingGroups(int extension, long employeeNum)
        {
            //First, figure out what the defaults are for this employee
            AsteriskRingGroups ringGroups = PhoneEmpDefaults.GetRingGroup(employeeNum);

            /*if(ringGroup==AsteriskRingGroups.All) {
             *      SetToAllRingGroups(extension,employeeNum);
             * }
             * if(ringGroup==AsteriskRingGroups.None) {
             *      RemoveFromRingGroups(extension,employeeNum);
             * }
             * if(ringGroup==AsteriskRingGroups.Backup) {
             *      SetToBackupRingGroupOnly(extension,employeeNum);
             * }*/
            SetRingGroups(extension, ringGroups);
        }
Esempio n. 3
0
 ///<summary>Sets the phone to the default queue for the employee passed in in regards to the phoneempdefault table.
 ///Will correctly put the phone into the Triage ring group if the PhoneEmpDefault has been flagged as IsTriageOperator
 ///This method does nothing if there is no corresponding phoneempdefault row for the employee passed in.</summary>
 public static void SetToDefaultQueue(long employeeNum)
 {
     //No need to check RemotingRole; no call to db.
     SetToDefaultQueue(PhoneEmpDefaults.GetOne(employeeNum));
 }