Ejemplo n.º 1
0
        private void DoLogin(string scanCode)
        {
            Employee employee = EmployeeManager.LookupByScanCode(scanCode);

            if (employee == null)
            {
                // The debug version will have an exception here if escape-exit is used
                try
                {
                    PosDialogWindow.ShowDialog(Types.Strings.LoginLoginIncorrect, Types.Strings.Error);
                    return;
                }
                catch
                {
                    return;
                }
            }

            // Check if logged-in somewhere else
            if (PosHelper.IsLocked(TableName.Employee, employee.Id))
            {
#if !DEMO
                BroadcastClientSocket.SendRemoteLogout(employee.Id);
#endif
                PosHelper.Unlock(TableName.Employee, employee.Id);
            }

            // Check if clock-in is required
            if (!employee.IsClockedIn())
            {
                if (!DoClockIn(employee) && !employee.HasPermission(Permissions.SystemMaintenance))
                {
                    return;
                }
            }

            // Proceed with login
            IsLoggedIn = true;

            // Clear dead-locks
            Lock.DeleteAllEmployeeLocks(employee.Id);

            // Lock the employee to prevent simultaneous logins
            PosHelper.Lock(TableName.Employee, employee.Id, employee.Id);

#if !DEMO
            // Tell other clients, that this employee just logged in
            BroadcastClientSocket.SendMessage("LOGIN " + employee.Id);
#endif
            StartAutoLogoutTimer();
            if (Login != null)
            {
                Login.Invoke(this, new UserLoginEventArgs(employee));
            }
        }
Ejemplo n.º 2
0
        private void EditPartyInfo()
        {
            if (PosHelper.IsLocked(TableName.Party, CurrentTicket.PartyId))
            {
                PosDialogWindow.ShowDialog(
                    Types.Strings.ThePartyInformationForThisTicketIsCurrentlyBeingModifiedSomewhereElse,
                    Types.Strings.PartyInformationLocked);
                return;
            }
            PosHelper.Lock(TableName.Party, CurrentTicket.PartyId, SessionManager.ActiveEmployee.Id);

            PosDialogWindow  window  = PartyEditControl.CreateInDefaultWindow();
            PartyEditControl control = window.DockedControl as PartyEditControl;

            control.Initialize(ParentTicket.PartyId);
            window.ShowDialog(ParentWindow);

            control.ActiveParty.Update();
            PosHelper.Unlock(TableName.Party, CurrentTicket.PartyId);
        }