Example #1
0
        ///<summary>If already clocked in, this does nothing.  Returns false if not able to clock in due to security, or true if successful.</summary>
        private static bool ClockIn(PhoneTile tile)
        {
            long employeeNum = Security.CurUser.EmployeeNum; //tile.PhoneCur.EmployeeNum;

            if (employeeNum == 0)                            //Can happen if logged in as 'admin' user (employeeNum==0). Otherwise should not happen, means the employee trying to clock doesn't exist in the employee table.
            {
                MsgBox.Show(langThis, "Inavlid OD User: "******"Working";
            Employees.Update(EmpCur);
            return(true);
        }
        ///<summary>If already clocked in, this does nothing.  Returns false if not able to clock in due to security, or true if successful.</summary>
        private bool ClockIn()
        {
            long employeeNum = PhoneList[rowI].EmployeeNum;

            if (employeeNum == 0)
            {
                MsgBox.Show(this, "No employee at that extension.");
                return(false);
            }
            if (ClockEvents.IsClockedIn(employeeNum))
            {
                return(true);
            }
            if (PrefC.GetBool(PrefName.TimecardSecurityEnabled))
            {
                if (Security.CurUser.EmployeeNum != employeeNum)
                {
                    if (!Security.IsAuthorized(Permissions.TimecardsEditAll))
                    {
                        MsgBox.Show(this, "Not authorized.");
                        return(false);
                    }
                }
            }
            try{
                ClockEvents.ClockIn(employeeNum);
            }
            catch (Exception ex) {
                if (ex.Message.Contains("Already clocked in"))
                {
                    return(true);
                }
                return(false);
            }
            Employee EmpCur = Employees.GetEmp(employeeNum);

            EmpCur.ClockStatus = Lan.g(this, "Working");;
            Employees.Update(EmpCur);
            return(true);
        }
Example #3
0
        ///<summary>If already clocked in, this does nothing.  Returns false if not able to clock in due to security, or true if successful.</summary>
        private bool ClockIn()
        {
            long employeeNum = PhoneList[rowI].EmployeeNum;

            if (employeeNum == 0)
            {
                MsgBox.Show(this, "No employee at that extension.");
                return(false);
            }
            if (ClockEvents.IsClockedIn(employeeNum))
            {
                return(true);
            }
            if (PrefC.GetBool(PrefName.TimecardSecurityEnabled))
            {
                if (Security.CurUser.EmployeeNum != employeeNum)
                {
                    if (!Security.IsAuthorized(Permissions.TimecardsEditAll))
                    {
                        MsgBox.Show(this, "Not authorized.");
                        return(false);
                    }
                }
            }
            try{
                ClockEvents.ClockIn(employeeNum);
            }
            catch {
                //This should never happen.  Fail silently.
                return(true);
            }
            Employee EmpCur = Employees.GetEmp(employeeNum);

            EmpCur.ClockStatus = Lan.g(this, "Working");;
            Employees.Update(EmpCur);
            return(true);
        }
Example #4
0
        ///<summary>If already clocked in, this does nothing.  Returns false if not able to clock in due to security, or true if successful.</summary>
        private static bool ClockIn(PhoneTile tile)
        {
            long employeeNum = tile.PhoneCur.EmployeeNum;

            if (employeeNum == 0)
            {
                MsgBox.Show(langThis, "No employee at that extension.");
                return(false);
            }
            if (ClockEvents.IsClockedIn(employeeNum))
            {
                return(true);
            }
            if (Security.CurUser.EmployeeNum != employeeNum)
            {
                if (!Security.IsAuthorized(Permissions.TimecardsEditAll, true))
                {
                    if (!CheckSelectedUserPassword(employeeNum))
                    {
                        return(false);
                    }
                }
            }
            try {
                ClockEvents.ClockIn(employeeNum);
            }
            catch {
                //This should never happen.  Fail silently.
                return(true);
            }
            Employee EmpCur = Employees.GetEmp(employeeNum);

            EmpCur.ClockStatus = "Working";
            Employees.Update(EmpCur);
            return(true);
        }