Ejemplo n.º 1
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.º 2
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.º 3
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.º 4
0
 private void butOK_Click(object sender, System.EventArgs e)
 {
     EmployeeCur.LName     = textLName.Text;
     EmployeeCur.FName     = textFName.Text;
     EmployeeCur.MiddleI   = textMI.Text;
     EmployeeCur.PayrollID = textPayrollID.Text;
     try{
         EmployeeCur.PhoneExt = PIn.Int(textPhoneExt.Text);
     }
     catch {
         EmployeeCur.PhoneExt = 0;
     }
     EmployeeCur.IsHidden = checkIsHidden.Checked;
     try {
         if (IsNew)
         {
             Employees.Insert(EmployeeCur);
         }
         else
         {
             Employees.Update(EmployeeCur);
         }
     }
     catch (Exception ex) {
         MessageBox.Show(ex.Message);
         return;
     }
     DialogResult = DialogResult.OK;
 }
Ejemplo n.º 5
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);
        }
Ejemplo n.º 6
0
 private void butOK_Click(object sender, System.EventArgs e)
 {
     EmployeeCur.LName    = textLName.Text;
     EmployeeCur.FName    = textFName.Text;
     EmployeeCur.MiddleI  = textMI.Text;
     EmployeeCur.IsHidden = checkIsHidden.Checked;
     if (IsNew)
     {
         Employees.Insert(EmployeeCur);
     }
     else
     {
         Employees.Update(EmployeeCur);
     }
     DialogResult = DialogResult.OK;
 }
Ejemplo n.º 7
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 (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);
        }
Ejemplo n.º 8
0
        public static void Home(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 {             //Update the clock event, phone (HQ only), and phone emp default (HQ only).
                ClockEvents.ClockOut(employeeNum, TimeClockStatus.Home);
            }
            catch (Exception ex) {
                MessageBox.Show(ex.Message);                //This message will tell user that they are already clocked out.
                return;
            }
            Employee EmpCur = Employees.GetEmp(employeeNum);

            EmpCur.ClockStatus = Lan.g("enumTimeClockStatus", TimeClockStatus.Home.ToString());
            Employees.Update(EmpCur);
        }
Ejemplo n.º 9
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);
        }
Ejemplo n.º 10
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);
        }
Ejemplo n.º 11
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);
        }