private void radioButtonNoAutoLogoutEnabled_SelectionGained(object sender, EventArgs e)
 {
     SettingManager.SetStoreSetting("DisableAutoLogoff", 1);
     LoginControl.StopAutoLogoutTimer();
     radioButtonYesAutoLogoutEnabled.IsSelected = false;
     SetAutoLogoutEnabledControls();
 }
        void parent_Loaded(object sender, RoutedEventArgs e)
        {
            StoreSetting setting =
                SettingManager.GetStoreSetting("EnableAutoLogoffInPasswordChange");

            if ((setting.IntValue == null) || (setting.IntValue.Value == 0))
            {
                LoginControl.StopAutoLogoutTimer();
            }
        }
Example #3
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:

            #line 12 "..\..\..\MainWindow.xaml"
                ((TemPOS.MainWindow)(target)).Closing += new System.ComponentModel.CancelEventHandler(this.Window_Closing);

            #line default
            #line hidden

            #line 12 "..\..\..\MainWindow.xaml"
                ((TemPOS.MainWindow)(target)).Closed += new System.EventHandler(this.Window_Closed);

            #line default
            #line hidden

            #line 13 "..\..\..\MainWindow.xaml"
                ((TemPOS.MainWindow)(target)).Loaded += new System.Windows.RoutedEventHandler(this.Window_Loaded);

            #line default
            #line hidden
                return;

            case 2:
                this.Configuration = ((PosControls.ConfigurationManager)(target));
                return;

            case 3:

            #line 17 "..\..\..\MainWindow.xaml"
                ((System.Windows.Controls.Grid)(target)).Initialized += new System.EventHandler(this.Grid_Initialized);

            #line default
            #line hidden
                return;

            case 4:
                this.mainPane = ((System.Windows.Controls.DockPanel)(target));
                return;

            case 5:
                this.orderEntryControl = ((TemPOS.OrderEntryControl)(target));
                return;

            case 6:
                this.loginControl = ((TemPOS.LoginControl)(target));
                return;
            }
            this._contentLoaded = true;
        }
        private void CreateTicketCommand()
        {
            // Make sure that start-of-day has occured
            if (DayOfOperation.Today == null)
            {
                PosDialogWindow.ShowDialog(
                    Types.Strings.YouCanNotCreateTicketsUntilStartOfDayHasBeenCompleted,
                    Types.Strings.RequiresStartOfDay, DialogButtons.Ok);
                return;
            }

            // Create the seating selection control
            if (ConfigurationManager.UseSeating)
            {
                PosDialogWindow window  = SeatingSelectionControl.CreateInDefaultWindow();
                var             control = window.DockedControl as SeatingSelectionControl;
                if (control == null)
                {
                    return;
                }
                control.InitializeFromTicket(null);

                // Show the dialog
                PosDialogWindow.ShowPosDialogWindow(window);

                if (!window.ClosedByUser)
                {
                    SessionManager.ActiveTicket =
                        TicketManager.Add(control.TicketType, Party.NoPartyId,
                                          control.SelectedSeatingId, SessionManager.ActiveEmployee.Id,
                                          ((control.SelectedCustomer != null) ?
                                           control.SelectedCustomer.Id : Customer.NoCustomerId));
                    SelectedTicket = SessionManager.ActiveTicket;
                    OrderEntryControl.SetAndLoadActiveTicket(SessionManager.ActiveTicket);
                }
                MainWindow.ShowWindowShadingOverlay = false;
            }
            else
            {
                SessionManager.ActiveTicket = TicketManager.Add(TicketType.DineIn,
                                                                Party.NoPartyId, Seating.NoSeatingId, SessionManager.ActiveEmployee.Id,
                                                                Customer.NoCustomerId);
                SelectedTicket = SessionManager.ActiveTicket;
                OrderEntryControl.SetAndLoadActiveTicket(SessionManager.ActiveTicket);
            }

            // Stop auto-logoff timer, if it should be disabled
            StoreSetting setting =
                SettingManager.GetStoreSetting("EnableAutoLogoffWhileInOrderEntry");

            if ((setting.IntValue == null) || (setting.IntValue.Value == 0))
            {
                LoginControl.StopAutoLogoutTimer();
            }

            // Need to change displayed tickets to open tickets, otherwise it will cause
            //  an exception in the TicketCashoutControl when cashing-out from in-order
            if ((TicketFilterControl.CurrentFilter != TicketSelectionShow.MyOpen) &&
                (TicketFilterControl.CurrentFilter != TicketSelectionShow.AllOpen) &&
                (TicketFilterControl.CurrentFilter != TicketSelectionShow.AllDay) &&
                (TicketFilterControl.CurrentFilter != TicketSelectionShow.All))
            {
                TicketFilterControl.CurrentFilter = TicketSelectionShow.MyOpen;
            }
            UpdateTickets();
        }
Example #5
0
        void Current_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
        {
            e.Handled = true;

            // Stop the auto-logoof timer
            LoginControl.StopAutoLogoutTimer();

            // Close all database connections
            DataModelBase.CloseAll();

#if !DEMO
            // Send the exception to the upgrade server
            Updater.StartCrashReport(e.Exception);
#endif
            // Save the exception, serialized to the AppData folder
            try
            {
                DateTime now           = DateTime.Now;
                string   rootDirectory =
                    Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) +
                    Path.DirectorySeparatorChar + "TemPOS";
                if (!Directory.Exists(rootDirectory))
                {
                    Directory.CreateDirectory(rootDirectory);
                }
                string path = rootDirectory + Path.DirectorySeparatorChar + "crashdata-" +
                              now.Year + now.Month.ToString("D2") + now.Day.ToString("D2") + "-" +
                              now.Hour.ToString("D2") + now.Minute.ToString("D2") + now.Second.ToString("D2") +
                              ".bin";
                using (FileStream fileStream = new FileStream(path, FileMode.CreateNew))
                {
                    byte[] serialData = e.Exception.SerializeObject();
                    using (BinaryWriter writer = new BinaryWriter(fileStream))
                    {
                        writer.Write(serialData);
                    }
                }
            }
            catch { }

            // Display the exception message
            DisplayExceptionDialog(e.Exception);

            // Remove employee table lock (that prevents simultaneous login)
            if (SessionManager.ActiveEmployee != null)
            {
                PosHelper.Unlock(TableName.Employee, SessionManager.ActiveEmployee.Id);
            }

            // Close this app
            if (_mainWindow != null)
            {
                _mainWindow.AllowClose = true;
                _mainWindow.Close();
            }

            // Disable user control crap
            if (ConfigurationManager.UseKeyboardHook)
            {
                UserControlManager.Disable();
            }

            UserControlManager.ShowTaskbar(true);
#if !DEBUG
            if (PastRestartPoint)
            {
                // Restart application
                Process.Start(Application.ResourceAssembly.Location, "/RESTART");
                App.SwitchToDefaultDesktopOnClose = false;
            }
            else
            {
                App.SwitchToDefaultDesktopOnClose = true;
            }
#else
            App.SwitchToDefaultDesktopOnClose = true;
#endif
            // Shutdown current application
            Application.Current.Shutdown();
            Process.GetCurrentProcess().Kill();
        }
 void ChangePasswordControl_Closed(object sender, EventArgs e)
 {
     LoginControl.StartAutoLogoutTimer();
 }