Ejemplo n.º 1
0
        public static void Break(PhoneTile tile)
        {
            //verify that employee is logged in as user
            int  extension   = tile.PhoneCur.Extension;
            long employeeNum = tile.PhoneCur.EmployeeNum;

            if (Security.CurUser.EmployeeNum != employeeNum)
            {
                if (!Security.IsAuthorized(Permissions.TimecardsEditAll, true))
                {
                    if (!CheckSelectedUserPassword(employeeNum))
                    {
                        return;
                    }
                }
            }
            try {
                ClockEvents.ClockOut(employeeNum, TimeClockStatus.Break);
            }
            catch (Exception ex) {
                MessageBox.Show(ex.Message);                //This message will tell user that they are already clocked out.
                return;
            }
            PhoneEmpDefaults.SetAvailable(extension, employeeNum);
            Employee EmpCur = Employees.GetEmp(employeeNum);

            EmpCur.ClockStatus = Lan.g("enumTimeClockStatus", TimeClockStatus.Break.ToString());
            Employees.Update(EmpCur);
            Phones.SetPhoneStatus(ClockStatusEnum.Break, extension);
        }
Ejemplo n.º 2
0
        private void menuItemBreak_Click(object sender, EventArgs e)
        {
            //verify that employee is logged in as user
            int  extension   = PhoneList[rowI].Extension;
            long employeeNum = PhoneList[rowI].EmployeeNum;

            if (PrefC.GetBool(PrefName.TimecardSecurityEnabled))
            {
                if (Security.CurUser.EmployeeNum != employeeNum)
                {
                    if (!Security.IsAuthorized(Permissions.TimecardsEditAll))
                    {
                        MsgBox.Show(this, "Not authorized.");
                        return;
                    }
                }
            }
            try{
                ClockEvents.ClockOut(employeeNum, TimeClockStatus.Break);
            }
            catch (Exception ex) {
                MessageBox.Show(ex.Message);                //This message will tell user that they are already clocked out.
                return;
            }
            PhoneEmpDefaults.SetAvailable(extension, employeeNum);
            Employee EmpCur = Employees.GetEmp(employeeNum);

            EmpCur.ClockStatus = Lan.g("enumTimeClockStatus", TimeClockStatus.Break.ToString());
            Employees.Update(EmpCur);
            Phones.SetPhoneStatus(ClockStatusEnum.Break, extension);
            FillEmps();
        }
Ejemplo n.º 3
0
        public static void Break(Phone phone)
        {
            //verify that employee is logged in as user
            int  extension   = phone.Extension;
            long employeeNum = phone.EmployeeNum;

            if (!CheckUserCanChangeStatus(phone))
            {
                return;
            }
            try {
                ClockEvents.ClockOut(employeeNum, TimeClockStatus.Break);
            }
            catch (Exception ex) {
                MessageBox.Show(ex.Message);                //This message will tell user that they are already clocked out.
                return;
            }
            PhoneEmpDefaults.SetAvailable(extension, employeeNum);
            Employee EmpCur = Employees.GetEmp(employeeNum);

            EmpCur.ClockStatus = Lan.g("enumTimeClockStatus", TimeClockStatus.Break.ToString());
            Employees.Update(EmpCur);
            Phones.SetPhoneStatus(ClockStatusEnum.Break, extension);
            PhoneAsterisks.SetQueueForExtension(phone.Extension, AsteriskQueues.None);
        }
Ejemplo n.º 4
0
        private void menuItemOfflineAssist_Click(object sender, EventArgs e)
        {
            if (!ClockIn())
            {
                return;
            }
            int  extension   = PhoneList[rowI].Extension;
            long employeeNum = PhoneList[rowI].EmployeeNum;

            PhoneEmpDefaults.SetAvailable(extension, employeeNum);
            Phones.SetPhoneStatus(ClockStatusEnum.OfflineAssist, extension);
            FillEmps();
        }
Ejemplo n.º 5
0
        ///<summary>Sets the current phone's employee and extension as "available" and then sets the phone status to the clock status passed in.
        ///Returns false if the user currently clocked in does not have permission or the credentials to do the desired action.
        ///Also, calls FillEmps() if action was successfully taken.</summary>
        private bool SetPhoneAvailable(ClockStatusEnum clockStatus)
        {
            if (!ClockIn())
            {
                return(false);
            }
            int  extension   = PhoneList[rowI].Extension;
            long employeeNum = PhoneList[rowI].EmployeeNum;

            PhoneEmpDefaults.SetAvailable(extension, employeeNum);
            Phones.SetPhoneStatus(clockStatus, extension);
            FillEmps();
            return(true);
        }
Ejemplo n.º 6
0
        private void menuItemBackup_Click(object sender, EventArgs e)
        {
            if (!ClockIn())
            {
                return;
            }
            int  extension   = PhoneList[rowI].Extension;
            long employeeNum = PhoneList[rowI].EmployeeNum;

            PhoneEmpDefaults.SetAvailable(extension, employeeNum);
            PhoneAsterisks.SetRingGroups(extension, AsteriskRingGroups.Backup);
            Phones.SetPhoneStatus(ClockStatusEnum.Backup, extension);
            FillEmps();
        }
Ejemplo n.º 7
0
        private void menuItemWrapUp_Click(object sender, EventArgs e)
        {
            if (!ClockIn())
            {
                return;
            }
            int  extension   = PhoneList[rowI].Extension;
            long employeeNum = PhoneList[rowI].EmployeeNum;

            PhoneEmpDefaults.SetAvailable(extension, employeeNum);
            Phones.SetPhoneStatus(ClockStatusEnum.WrapUp, extension);
            //this is usually an automatic status
            FillEmps();
        }
Ejemplo n.º 8
0
        public static void Training(PhoneTile tile)
        {
            if (!ClockIn(tile))
            {
                return;
            }
            int  extension   = tile.PhoneCur.Extension;
            long employeeNum = tile.PhoneCur.EmployeeNum;

            if (!CheckSelectedUserPassword(employeeNum))
            {
                return;
            }
            PhoneEmpDefaults.SetAvailable(extension, employeeNum);
            Phones.SetPhoneStatus(ClockStatusEnum.Training, extension);
        }
Ejemplo n.º 9
0
        public static void Available(Phone phone)
        {
            long employeeNum = Security.CurUser.EmployeeNum;

            if (Security.CurUser.EmployeeNum != phone.EmployeeNum)            //We are on someone else's tile. So Let's do some checks before we assume we can take over this extension.
            {
                if (phone.ClockStatus == ClockStatusEnum.NeedsHelp)
                {
                    //Allow the specific state where we are changing their status back from NeedsHelp to Available.
                    //This does not require any security permissions as any tech in can perform this action on behalf of any other tech.
                    Phones.SetPhoneStatus(ClockStatusEnum.Available, phone.Extension, phone.EmployeeNum);                  //green
                    return;
                }
                //We are on a tile that is not our own
                //If another employee is occupying this extension then assume we are trying to change that employee's status back to available.
                if (ClockEvents.IsClockedIn(phone.EmployeeNum))                  //This tile is taken by an employee who is clocked in.
                //Transition the employee back to available.
                {
                    ChangeTileStatus(phone, ClockStatusEnum.Available);
                    PhoneAsterisks.SetToDefaultQueue(phone.EmployeeNum);
                    return;
                }
                if (phone.ClockStatus != ClockStatusEnum.None &&
                    phone.ClockStatus != ClockStatusEnum.Home)
                {
                    //Another person is still actively using this extension.
                    MsgBox.Show(langThis, "Cannot take over this extension as it is currently occuppied by someone who is likely on Break or Lunch.");
                    return;
                }
                //If another employee is NOT occupying this extension then assume we are trying clock in at this extension.
                if (ClockEvents.IsClockedIn(employeeNum))                  //We are already clocked in at a different extension.
                {
                    MsgBox.Show(langThis, "You are already clocked in at a different extension.  You must clock out of the current extension you are logged into before moving to another extension.");
                    return;
                }
                //We got this far so fall through and allow user to clock in.
            }
            //We go here so all of our checks passed and we may login at this extension
            if (!ClockIn())              //Clock in on behalf of yourself
            {
                return;
            }
            //Update the Phone tables accordingly.
            PhoneEmpDefaults.SetAvailable(phone.Extension, employeeNum);
            PhoneAsterisks.SetToDefaultQueue(phone.EmployeeNum);
            Phones.SetPhoneStatus(ClockStatusEnum.Available, phone.Extension, employeeNum);          //green
        }
Ejemplo n.º 10
0
        public static void Backup(PhoneTile tile)
        {
            if (!ClockIn(tile))
            {
                return;
            }
            int  extension   = tile.PhoneCur.Extension;
            long employeeNum = tile.PhoneCur.EmployeeNum;

            if (!CheckSelectedUserPassword(employeeNum))
            {
                return;
            }
            PhoneEmpDefaults.SetAvailable(extension, employeeNum);
            PhoneAsterisks.SetRingGroups(extension, AsteriskRingGroups.Backup);
            Phones.SetPhoneStatus(ClockStatusEnum.Backup, extension);
        }
Ejemplo n.º 11
0
        public static void WrapUp(PhoneTile tile)
        {
            if (!ClockIn(tile))
            {
                return;
            }
            int  extension   = tile.PhoneCur.Extension;
            long employeeNum = tile.PhoneCur.EmployeeNum;

            if (!CheckSelectedUserPassword(employeeNum))
            {
                return;
            }
            PhoneEmpDefaults.SetAvailable(extension, employeeNum);
            Phones.SetPhoneStatus(ClockStatusEnum.WrapUp, extension);
            //this is usually an automatic status
        }
Ejemplo n.º 12
0
 ///<summary>Verify...
 ///1) Security.CurUser is clocked in.
 ///2) Target status change employee is clocked in.
 ///3) Secruity.CurUser has TimecardsEditAll permission.</summary>
 private static bool ChangeTileStatus(Phone phoneCur, ClockStatusEnum newClockStatus)
 {
     if (!ClockEvents.IsClockedIn(Security.CurUser.EmployeeNum))              //Employee performing the action must be clocked in.
     {
         MsgBox.Show(langThis, "You must clock in before completing this action.");
         return(false);
     }
     if (!ClockEvents.IsClockedIn(phoneCur.EmployeeNum))              //Employee having action performed must be clocked in.
     {
         MessageBox.Show(Lan.g(langThis, "Target employee must be clocked in before setting this status:") + " " + phoneCur.EmployeeName);
         return(false);
     }
     if (!CheckUserCanChangeStatus(phoneCur))
     {
         return(false);
     }
     PhoneEmpDefaults.SetAvailable(phoneCur.Extension, phoneCur.EmployeeNum);
     Phones.SetPhoneStatus(newClockStatus, phoneCur.Extension);
     return(true);
 }
Ejemplo n.º 13
0
        public static void Available(PhoneTile tile)
        {
            if (!ClockIn(tile))
            {
                return;
            }
            int  extension   = tile.PhoneCur.Extension;
            long employeeNum = tile.PhoneCur.EmployeeNum;

            if (Security.CurUser.EmployeeNum != employeeNum)
            {
                if (!Security.IsAuthorized(Permissions.TimecardsEditAll, true))
                {
                    if (!CheckSelectedUserPassword(employeeNum))
                    {
                        return;
                    }
                }
            }
            PhoneEmpDefaults.SetAvailable(extension, employeeNum);
            Phones.SetPhoneStatus(ClockStatusEnum.Available, extension);           //green
        }
Ejemplo n.º 14
0
        //Timecard---------------------------------------------------

        public static void Lunch(PhoneTile tile)
        {
            //verify that employee is logged in as user
            int  extension   = tile.PhoneCur.Extension;
            long employeeNum = tile.PhoneCur.EmployeeNum;

            if (!CheckUserCanChangeStatus(tile))
            {
                return;
            }
            try {
                ClockEvents.ClockOut(employeeNum, TimeClockStatus.Lunch);
            }
            catch (Exception ex) {
                MessageBox.Show(ex.Message);                //This message will tell user that they are already clocked out.
                return;
            }
            PhoneEmpDefaults.SetAvailable(extension, employeeNum);
            Employee EmpCur = Employees.GetEmp(employeeNum);

            EmpCur.ClockStatus = Lan.g("enumTimeClockStatus", TimeClockStatus.Lunch.ToString());
            Employees.Update(EmpCur);
            Phones.SetPhoneStatus(ClockStatusEnum.Lunch, extension);
        }