void buttonOk_Click(object sender, RoutedEventArgs e)
        {
            // Yuck, but it works
            DateTime nowTime  = DateTime.Now;
            int?     intValue = OrderEntryCommands.GetPrepTime().IntValue;

            if (intValue != null)
            {
                DateTime earliestTime = nowTime +
                                        new TimeSpan(0, intValue.Value - 1, 60 - nowTime.Second);
                if (SelectedDateTime != null &&
                    SelectedDateTime.Value < (earliestTime - new TimeSpan(0, 1, 0)))
                {
                    PosDialogWindow.ShowDialog(
                        Strings.FutureTimeTooEarly +
                        earliestTime.ToLongTimeString(), Strings.FutureTimeTooEarlyError);
                }
                else
                {
                    KeepChanges = true;
                    // Closes the dialog window
                    Window.GetWindow(this).Close();
                }
            }
        }
Esempio n. 2
0
        private void buttonDispatchDriver_Click(object sender, RoutedEventArgs e)
        {
            FunctionsContextMenu.IsOpen = false;
            PosDialogWindow window = TicketDeliveryDispatchControl.CreateInDefaultWindow();

            PosDialogWindow.ShowPosDialogWindow(this, window);
        }
Esempio n. 3
0
        private static void LogDecreasedTicketItemLateCancels(Ticket ticket, TicketItem ticketItem)
        {
            int originalQuantity = ticketItem.GetCurrentQuantity();

            if (ticketItem.QuantityPending.HasValue && (ticketItem.QuantityPending < originalQuantity))
            {
                int             difference = originalQuantity - ticketItem.QuantityPending.Value;
                Item            item       = Item.Get(ticketItem.ItemId);
                PosDialogWindow window     =
                    CancelMadeUnmadeControl.CreateInDefaultWindow("Cancel: " + item.FullName +
                                                                  " (" + difference + ")");
                var control = window.DockedControl as CancelMadeUnmadeControl;
                window.ShowDialog();
                if (control != null && !control.IsMade.HasValue)
                {
                    ticketItem.SetQuantity(originalQuantity);
                }
                else
                {
                    TicketItem canceledTicketItem =
                        TicketItem.Add(ticket.PrimaryKey, ticketItem.ItemId, difference, ticketItem.Price,
                                       ticketItem.OrderTime, ticketItem.PreparedTime);
                    DuplicateItemOptions(ticketItem, canceledTicketItem);
                    Employee employee = SessionManager.PseudoEmployee ?? SessionManager.ActiveEmployee;
                    canceledTicketItem.Cancel(CancelType.DecreasedQuantity,
                                              employee.Id, control != null && control.IsMade.Value);
                }
            }
        }
 private void buttonRemove_Click(object sender, RoutedEventArgs e)
 {
     if (SelectedEmployee == null)
     {
         buttonRemove.IsEnabled = false;
         return;
     }
     if (!SelectedEmployee.IsTerminated)
     {
         PosDialogWindow.ShowDialog(
             Strings.EmployeeEditorTerminateFirst, Strings.Error);
         return;
     }
     if (PosDialogWindow.ShowDialog(
             Strings.EmployeeEditorConfirmRemove,
             Strings.Confirmation, DialogButtons.YesNo) == DialogButton.Yes)
     {
         if (EmployeeManager.RemoveEmployee(SelectedEmployee))
         {
             listBoxEmployees.Items.Remove(listBoxEmployees.SelectedItem);
             listBoxEmployees.SelectedItem = null;
             SelectedEmployee = null;
         }
     }
 }
Esempio n. 5
0
        private void SetEditMode(bool inEdit)
        {
            buttonAdd.IsEnabled            =
                buttonEditToggle.IsEnabled =
                    listBox1.IsEnabled     = !inEdit;
            if ((ViewMode == SeatingViewMode.Rooms) && (listBox1.SelectedItem == null))
            {
                buttonEditToggle.IsEnabled = false;
            }
            else if ((ViewMode == SeatingViewMode.Rooms) &&
                     (SelectedRoom.TicketingType != PosModels.Types.TicketType.DineIn))
            {
                buttonEditToggle.IsEnabled = false;
            }

            buttonDelete.IsEnabled             = ((listBox1.SelectedItem != null) && !inEdit);
            roomEditorControl.IsEnabled        =
                seatingEditorControl.IsEnabled =
                    (inEdit || listBox1.SelectedItem != null);
            buttonCancel.IsEnabled     =
                buttonUpdate.IsEnabled = inEdit;

            PosDialogWindow parentWindow = Window.GetWindow(this) as PosDialogWindow;

            if (parentWindow != null)
            {
                parentWindow.SetButtonsEnabled(!inEdit);
            }
        }
Esempio n. 6
0
        private void DeleteOption()
        {
            FormattedListBoxItem item = listBoxOptions.SelectedItem as FormattedListBoxItem;

            if (item == null || (item.ReferenceObject == null))
            {
                return;
            }
            if (PosDialogWindow.ShowDialog(
                    Strings.ItemSetupConfirmDeleteItemOption, Strings.Confirmation,
                    DialogButtons.YesNo) != DialogButton.Yes)
            {
                return;
            }
            ItemOption option = item.ReferenceObject as ItemOption;

            if (option == null)
            {
                return;
            }
            option.Discontinue();
            listBoxOptions.Items.Remove(item);
            buttonDelete.IsEnabled         = false;
            editorControl.IsEnabled        = false;
            editorControl.ActiveItemOption = null;
        }
        private void AddTicket()
        {
#if DEMO
            IEnumerable <Ticket> tickets = TicketManager.GetPartyTickets(ParentTicket.PartyId);
            int count = tickets.Count <Ticket>();
            if (count >= 2)
            {
                PosDialogWindow.ShowDialog(Window.GetWindow(this),
                                           Types.Strings.YouCanOnlyHave2PartyTicketsInTheDemoVersion,
                                           Types.Strings.DemoRestriction);
                return;
            }
#endif
            // Create a new ticket with the same data as the current ticket
            Ticket newTicket = TicketManager.Add(OriginalTicket.Type,
                                                 OriginalTicket.PartyId, OriginalTicket.SeatingId,
                                                 OriginalTicket.EmployeeId, OriginalTicket.CustomerId);

            newTicket.SetStartTime(OriginalTicket.StartTime);
            newTicket.SetPrepareTime(OriginalTicket.PrepareTime);
            newTicket.SetReadyTime(OriginalTicket.ReadyTime);
            newTicket.Update();

            string text = Types.Strings.Ticket + ": " + newTicket.PrimaryKey.Id;
            // Add the new ticket to the source list
            listboxSourceTicket.Items.Add(
                new FormattedListBoxItem(newTicket.PrimaryKey, text, true));

            if ((receiptTape.SelectedItems != null) && (receiptTape.SelectedItems.Count > 0))
            {
                //listBoxDestinationTicket.Items.Add(new FormattedListBoxItem(newTicket.Id, text, 280));
                PopulateDestinationList();
            }
        }
        private void buttonRemove_Click(object sender, RoutedEventArgs e)
        {
            FormattedListBoxItem selectedItem =
                listBoxItemIngredients.SelectedItem as FormattedListBoxItem;

            if (selectedItem == null)
            {
                return;
            }

            DialogButton result = PosDialogWindow.ShowDialog(
                Types.Strings.IngredientEditorConfirmRemove,
                Types.Strings.Confirmation, DialogButtons.YesNo);

            if (result != DialogButton.Yes)
            {
                return;
            }

            RemoveIngredientSet(selectedItem.Id);
            listBoxItemIngredients.SelectedItem = null;
            ResetYieldIfEmpty();
            InitializeFields();
            DoValueChangedEvent();
        }
        private void buttonYield_PreviewMouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            PosDialogWindow         window  = IngredientAmountControl.CreateInDefaultWindow(Types.Strings.IngredientEditorEditRecipeYield);
            IngredientAmountControl control = window.DockedControl as IngredientAmountControl;
            PosDialogWindow         parent  = Window.GetWindow(this) as PosDialogWindow;

            control.MeasurementUnit = MeasurementUnit;
            control.Amount          = (ExtendedIngredientYield.HasValue ?
                                       ExtendedIngredientYield.Value : 0);

            window.ShowDialog(parent);
            if (!window.ClosedByUser)
            {
                double amount = 0;
                if (control.Amount > 0)
                {
                    amount = UnitConversion.Convert(control.Amount,
                                                    control.MeasurementUnit, MeasurementUnit);
                    _extendedIngredientYield = amount;
                }
                else
                {
                    _extendedIngredientYield = null;
                }
                buttonYield.Text   = amount.ToString(CultureInfo.InvariantCulture);
                labelUnits.Content = MeasurementUnit.ToString() +
                                     (Math.Abs(amount - 1) > double.Epsilon ? Types.Strings.S : "");
                if (YieldAmountChanged != null)
                {
                    YieldAmountChanged.Invoke(this, new EventArgs());
                }
                DoValueChangedEvent();
            }
            e.Handled = true;
        }
 private void checkBoxEnabled_SelectionChanged(object sender, EventArgs e)
 {
     if (!checkBoxEnabled.IsSelected)
     {
         if (listBoxItemIngredients.Items.Count > 0)
         {
             DialogButton result = PosDialogWindow.ShowDialog(
                 Types.Strings.IngredientEditorWarningUncheck,
                 Types.Strings.Confirmation, DialogButtons.OkCancel);
             if (result == DialogButton.Cancel)
             {
                 checkBoxEnabled.IsSelected = true;
             }
             else
             {
                 foreach (FormattedListBoxItem item in listBoxItemIngredients.Items)
                 {
                     RemoveIngredientSet(item.Id);
                 }
                 listBoxAvailableIngredients.SelectedItem = null;
                 listBoxItemIngredients.SelectedItem      = null;
                 InitializeFields();
                 DoValueChangedEvent();
             }
         }
     }
     else
     {
         listBoxAvailableIngredients.SelectedItem = null;
         listBoxItemIngredients.SelectedItem      = null;
         InitializeFields();
     }
 }
        private void buttonAdd_Click(object sender, RoutedEventArgs e)
        {
            FormattedListBoxItem selectedIngredient = (FormattedListBoxItem)
                                                      listBoxAvailableIngredients.SelectedItem;
            PosDialogWindow         window  = IngredientAmountControl.CreateInDefaultWindow(Types.Strings.IngredientEditorAddIngredient);
            IngredientAmountControl control = window.DockedControl as IngredientAmountControl;
            PosDialogWindow         parent  = Window.GetWindow(this) as PosDialogWindow;
            Ingredient ingredient           = Ingredient.Get(selectedIngredient.Id);

            control.Amount          = 0;
            control.MeasurementUnit = ingredient.MeasurementUnit;

            window.ShowDialog(parent);
            if (window.ClosedByUser || (!(control.Amount > 0)))
            {
                return;
            }

            _ingredientSetsAdded.Add(
                IngredientSet.Add(0, selectedIngredient.Id,
                                  control.Amount, control.MeasurementUnit));
            listBoxAvailableIngredients.SelectedItem = null;
            listBoxItemIngredients.SelectedItem      = null;
            InitializeFields();
            DoValueChangedEvent();
        }
        private void DeleteCoupon()
        {
            var listItem = listBox1.SelectedItem as FormattedListBoxItem;

            if (listItem == null || (listItem.ReferenceObject == null))
            {
                return;
            }
            if (PosDialogWindow.ShowDialog(
                    Strings.AreYouSureYouWantToDeleteTheSelectedCoupon, Strings.Confirmation,
                    DialogButtons.YesNo) != DialogButton.Yes)
            {
                return;
            }
            var coupon = listItem.ReferenceObject as Coupon;

            if (coupon != null)
            {
                coupon.Discontinue();
            }
            listBox1.Items.Remove(listItem);
            buttonDelete.IsEnabled       = false;
            groupBoxProperties.IsEnabled = false;
            editorControl.ActiveCoupon   = null;
        }
        private void InitializeMainWindow()
        {
            double width       = System.Windows.SystemParameters.PrimaryScreenWidth;
            double height      = System.Windows.SystemParameters.PrimaryScreenHeight;
            double aspectRatio = Math.Round(width / height, 1);

            if (aspectRatio == Math.Round((double)4 / 3, 1))
            {
                width  = width * 0.90;
                height = height * 0.78;
            }
            else
            {
                width  = width * 0.90;
                height = height * 0.90;
            }
            CustomerSetupControl customerControl    = new CustomerSetupControl();
            LicenseSetupControl  licenseControl     = new LicenseSetupControl();
            UpdateBuilderControl builderControl     = new UpdateBuilderControl();
            UpdateServiceControl serviceControl     = new UpdateServiceControl();
            CrashReportControl   crashReportControl = new CrashReportControl();

            mainWindow = new PosDialogWindow("TemPOS Client Administration",
                                             new FrameworkElement[] { customerControl, licenseControl, serviceControl, builderControl, crashReportControl },
                                             new string[] { "Customers", "Licenses", "Update Service", "Update Builder", "Crash Reports" },
                                             new double[] { 80, 75, 110, 110, 110 },
                                             width, height);
            //mainWindow.Topmost = true;
            mainWindow.IsClosable = true;
            mainWindow.Closing   += new CancelEventHandler(mainWindow_Closing);
        }
        private void buttonTest_Click(object sender, RoutedEventArgs e)
        {
#if !DEMO
            this.Dispatcher.Invoke((Action)(() =>
            {
                if (BroadcastClientSocket.IsConnected &&
                    BroadcastServerSocket.IsRunning)
                {
                    BroadcastClientSocket.ReceivedMessage +=
                        BroadcastClientSocket_ReceivedMessage;
                    BroadcastServerSocket.BroadcastMessage(Strings.Test);
                }
                else if (!BroadcastServerSocket.IsRunning)
                {
                    PosDialogWindow.ShowDialog(
                        Strings.ServerIsNotRunning, Strings.TestFailed);
                }
                else // if (!BroadcastClientSocket.IsConnected)
                {
                    PosDialogWindow.ShowDialog(
                        Strings.ClientIsNotRunning, Strings.TestFailed);
                }
            }));
#endif
        }
Esempio n. 15
0
 private void BeginStartup()
 {
     if ((ServiceHelper.IsSqlServiceLocal && !ServiceHelper.IsSqlServiceRunningLocally) ||
         (ServiceHelper.IsSqlBrowserServiceLocal && !ServiceHelper.IsSqlBrowserServiceRunningLocally &&
          !string.IsNullOrEmpty(LocalSetting.DatabaseServerLoginName)))
     {
         string message;
         if (!ServiceHelper.IsSqlServiceRunningLocally &&
             !ServiceHelper.IsSqlBrowserServiceLocal)
         {
             message = Types.Strings.TheSQLServiceAndSQLBrowserServiceAreNotRunningWouldYouLikeToStartThem;
         }
         else if (!ServiceHelper.IsSqlServiceRunningLocally)
         {
             message = Types.Strings.TheSQLServiceIsNotRunningWouldYouLikeToStartIt;
         }
         else
         {
             message = Types.Strings.TheSQLBrowserServiceIsNotRunningWouldYouLikeToStartIt;
         }
         if (PosDialogWindow.ShowDialog(message,
                                        Types.Strings.Warning, DialogButtons.YesNo) == DialogButton.Yes)
         {
             _notification = ActionNotificationControl.Create(null,
                                                              Types.Strings.StartingSQLServices, Types.Strings.Notification);
             _notification.Show();
             Thread thread = new Thread(ServiceStartThreadStart);
             thread.Start(thread);
             return;
         }
     }
     ContinueStartUp();
 }
Esempio n. 16
0
        private void buttonEditQuantity_Click(object sender, RoutedEventArgs e)
        {
            FormattedListBoxItem selectedItem = listBoxIncludedItems.SelectedItem as FormattedListBoxItem;

            if (selectedItem == null)
            {
                return;
            }
            ItemGroup itemGroup = selectedItem.ReferenceObject as ItemGroup;

            if (itemGroup == null)
            {
                return;
            }
            int?newQuantity = PosDialogWindow.PromptNumber(Strings.ItemEditorEditQuantity, null);

            if (newQuantity.HasValue)
            {
                itemGroup.SetTargetItemQuantity(newQuantity.Value);
                if (EditQuantityNeedsUpdating(itemGroup))
                {
                    _itemGroupsNeedingUpdate.Add(itemGroup);
                }

                InitializeListBoxes();
                DoValueChangedEvent();
            }
        }
Esempio n. 17
0
        private void ServiceStartThreadStart(object threadObject)
        {
            Thread thread = threadObject as Thread;

            if (thread == null)
            {
                return;
            }
            VistaSecurity.RestartElevated("/STARTSQL", true);
            Dispatcher.Invoke((Action)(() =>
            {
                for (int maxDelay = 200; (!ServiceHelper.IsSqlServiceRunningLocally && (maxDelay > 0)); maxDelay--)
                {
                    Thread.Sleep(100);
                }
                if (ServiceHelper.IsSqlServiceRunningLocally)
                {
                    ContinueStartUp();
                }
                else
                {
                    if (PosDialogWindow.ShowDialog(
                            Types.Strings.CouldNotStartTheSQLServiceWouldYouLikeToContinue,
                            Types.Strings.Warning, DialogButtons.YesNo) == DialogButton.Yes)
                    {
                        ContinueStartUp();
                    }
                    else
                    {
                        Application.Current.Shutdown();
                    }
                }
            }));
            thread.Abort();
        }
Esempio n. 18
0
        private void buttonDrop_Click(object sender, RoutedEventArgs e)
        {
            RegisterContextMenu.IsOpen = false;
            double?amount = PosDialogWindow.PromptCurrency(Types.Strings.RegisterMenuDropAmount, null);

            if (amount.HasValue && (amount.Value > 0))
            {
                double total = RegisterManager.ActiveRegisterDrawer.CurrentAmount;
                total = RegisterDrop.GetAll(RegisterManager.ActiveRegisterDrawer.Id)
                        .Aggregate(total, (current, drop) => current - drop.Amount);
                if (amount.Value < total)
                {
                    RegisterDrop.Add(RegisterManager.ActiveRegisterDrawer.Id,
                                     SessionManager.ActiveEmployee.Id, amount.Value, DateTime.Now);
                    RegisterManager.ActiveRegisterDrawer.RemoveFromCurrentAmount(amount.Value);
                    RegisterManager.OpenCashDrawer();
                }
                else
                {
                    PosDialogWindow.ShowDialog(
                        Types.Strings.RegisterMenuCantDropThatMuch,
                        Types.Strings.RegisterMenuInvalidAmount);
                }
            }
        }
Esempio n. 19
0
        private void ChangeSeating()
        {
            if (!LockCheckPass(true, false, Types.Strings.ThisTicketIsOpenSomewhereElseItCanNotBeModified))
            {
                return;
            }

            // Create the seating selection control
            PosDialogWindow         window  = SeatingSelectionControl.CreateInDefaultWindow();
            SeatingSelectionControl control = window.DockedControl as SeatingSelectionControl;

            control.InitializeFromTicket(CurrentTicket);

            // Show the dialog
            ParentWindow.ShowShadingOverlay = true;
            window.ShowDialog(ParentWindow);

            if (!window.ClosedByUser)
            {
                // Process Results
                if (CurrentTicket != null)
                {
                    if (control.SelectedCustomer != null)
                    {
                        CurrentTicket.SetCustomerId(control.SelectedCustomer.Id);
                    }
                    CurrentTicket.SetType(control.TicketType);
                    CurrentTicket.SetSeatingId(control.SelectedSeatingId);
                    CurrentTicket.Update();
                }
            }
            ParentWindow.ShowShadingOverlay = false;
        }
Esempio n. 20
0
        private void buttonDock_Click(object sender, RoutedEventArgs e)
        {
            RegisterContextMenu.IsOpen = false;
            int            registerSubId  = 0;
            RegisterDrawer registerDrawer =
                RegisterDrawer.GetFloating(SessionManager.ActiveEmployee.Id);

            if (registerDrawer == null)
            {
                PosDialogWindow.ShowDialog(
                    Types.Strings.RegisterMenuNotFloating, Types.Strings.Error);
                return;
            }
            if (registerSubId == 0)
            {
                DeviceManager.OpenCashDrawer1();
            }
            else if (registerSubId == 1)
            {
                DeviceManager.OpenCashDrawer2();
            }
            RegisterManager.DockRegisterDrawer(registerDrawer, registerSubId);
            OrderEntryCommands.SetupNoOrderCommands();
            PosDialogWindow.ShowDialog(
                Types.Strings.RegisterMenuDrawerIsNowDocked, Types.Strings.Notification);
            OrderEntryCommands.UpdateTicketDetailCommands();
        }
Esempio n. 21
0
        private void RemoveTicket()
        {
            if (!LockCheckPass(true, false, Types.Strings.TheSelectedTicketCanNotBeRemovedBecauseItAlreadyOpenedSomewhereElse))
            {
                return;
            }

            FormattedListBoxItem selected =
                (FormattedListBoxItem)listboxSourceTicket.SelectedItem;

            if (selected == null)
            {
                return;
            }
            if (TicketItem.GetAll(selected.ReferenceObject as YearId).Any())
            {
                // Remove the ticket
                TicketManager.Delete(selected.ReferenceObject as YearId);
                listboxSourceTicket.Items.Remove(listboxSourceTicket.SelectedItem);
            }
            else
            {
                PosDialogWindow.ShowDialog(
                    Types.Strings.YouCanNotRemoveATicketThatHasItemsOnItFirstTransferThoseItemsToADifferentTicket, Types.Strings.TicketNotEmpty);
            }
        }
Esempio n. 22
0
        private void AdjustInventory(string windowTitle, int factor)
        {
            PosDialogWindow         window  = IngredientAmountControl.CreateInDefaultWindow(windowTitle);
            IngredientAmountControl control = window.DockedControl as IngredientAmountControl;
            PosDialogWindow         parent  = Window.GetWindow(this) as PosDialogWindow;

            control.Amount          = 0;
            control.MeasurementUnit = ActiveIngredient.MeasurementUnit;

            window.ShowDialog(parent);
            if (!window.ClosedByUser)
            {
                if (control.Amount > 0)
                {
                    double amount = UnitConversion.Convert(control.Amount, control.MeasurementUnit,
                                                           ActiveIngredient.MeasurementUnit) * factor;

                    IngredientAdjustment.Add(SessionManager.ActiveEmployee.Id, ActiveIngredient.Id,
                                             ActiveIngredient.InventoryAmount,
                                             ActiveIngredient.InventoryAmount + amount,
                                             ActiveIngredient.MeasurementUnit);

                    ActiveIngredient.SetInventoryAmount(ActiveIngredient.InventoryAmount + amount);
                    ActiveIngredient.Update();
                }
            }
        }
Esempio n. 23
0
        private void Delete()
        {
            bool confirmed = false;

            if (listBox1.SelectedItem == null)
            {
                return;
            }
            FormattedListBoxItem selectedItem =
                listBox1.SelectedItem as FormattedListBoxItem;

            if (selectedItem == null)
            {
                return;
            }

            if (ViewMode == SeatingViewMode.Rooms)
            {
                string message = (buttonEditToggle.IsEnabled ?
                                  Strings.AreYouSureYouWantToDeleteTheSelectedRoomAndAllItsSeatings :
                                  Strings.AreYouSureYouWantToDeleteTheSelectedRoom);
                if (PosDialogWindow.ShowDialog(
                        message, Strings.ConfirmDeletion, DialogButtons.OkCancel) == DialogButton.Ok)
                {
                    Room room = selectedItem.ReferenceObject as Room;
                    if (room != null)
                    {
                        SeatingManager.DeleteRoom(room.Id);
                        SeatingManager.DeleteAllSeating(room.Id);
                    }
                    buttonEditToggle.IsEnabled  = false;
                    roomEditorControl.IsEnabled = false;
                    SelectedRoom    = null;
                    SelectedSeating = null;
                    confirmed       = true;
                }
            }
            else if (ViewMode == SeatingViewMode.Seating)
            {
                if (PosDialogWindow.ShowDialog(
                        Strings.AreYouSureYouWantToDeleteTheSelectedSeating,
                        Strings.ConfirmDeletion, DialogButtons.OkCancel) == DialogButton.Ok)
                {
                    Seating seating = selectedItem.ReferenceObject as Seating;
                    if (seating != null)
                    {
                        SeatingManager.DeleteSeating(seating.Id);
                    }
                    seatingEditorControl.IsEnabled = false;
                    SelectedSeating = null;
                    confirmed       = true;
                }
            }
            if (confirmed)
            {
                listBox1.Items.Remove(selectedItem);
                listBox1.SelectedItem  = null;
                buttonDelete.IsEnabled = false;
            }
        }
Esempio n. 24
0
        private void buttonSet_Click(object sender, RoutedEventArgs e)
        {
            PosDialogWindow         window  = IngredientAmountControl.CreateInDefaultWindow(Strings.InventorySetAmount);
            IngredientAmountControl control = window.DockedControl as IngredientAmountControl;
            PosDialogWindow         parent  = Window.GetWindow(this) as PosDialogWindow;

            control.Amount          = 0;
            control.MeasurementUnit = ActiveIngredient.MeasurementUnit;

            window.ShowDialog(parent);
            if (!window.ClosedByUser)
            {
                if (control.Amount > 0)
                {
                    double amount = UnitConversion.Convert(control.Amount, control.MeasurementUnit,
                                                           ActiveIngredient.MeasurementUnit);

                    IngredientAdjustment.Add(SessionManager.ActiveEmployee.Id, ActiveIngredient.Id,
                                             ActiveIngredient.InventoryAmount, amount, ActiveIngredient.MeasurementUnit);

                    ActiveIngredient.SetInventoryAmount(amount);
                    ActiveIngredient.Update();
                }
                UpdateListBoxItem();
            }
        }
Esempio n. 25
0
        private void buttonEditTimesheet_Click(object sender, RoutedEventArgs e)
        {
            FunctionsContextMenu.IsOpen = false;
            PosDialogWindow window = TimesheetMaintenanceControl.CreateInDefaultWindow();

            PosDialogWindow.ShowPosDialogWindow(this, window);
        }
Esempio n. 26
0
        private static void ShowWpfWindow()
        {
            SpecialStartControl control = new SpecialStartControl();
            PosDialogWindow     window  = new PosDialogWindow(control, "Special Start", 835, 435);

            window.ShowDialog();
        }
Esempio n. 27
0
        public static void EndOfDay()
        {
            if (TicketManager.GetOpenTickets().Any())
            {
                PosDialogWindow.ShowDialog(
                    Types.Strings.YouCanNotRunTheEndofdayReportUntilAllOpenTicketsAreClosedout,
                    Types.Strings.EndofdayReport, DialogButtons.Ok);
                return;
            }
            if (RegisterManager.OpenRegisterExists)
            {
                PosDialogWindow.ShowDialog(
                    Types.Strings.YouCanNotRunTheEndofdayReportUntilYouCloseoutAllActiveRegisterDrawers,
                    Types.Strings.EndofdayReport, DialogButtons.Ok);
                return;
            }
            DialogButton dialogButton = PosDialogWindow.ShowDialog(
                Types.Strings.TheEndOfDayReportShouldOnlyBeRunAtTheEndOfTheDay +
                Types.Strings.AreYouSureYouWantToRunThisReport, Types.Strings.Confirmation, DialogButtons.YesNo);

            if (dialogButton == DialogButton.Yes)
            {
                PrintEndOfDay(MainWindow.Singleton);
            }
        }
Esempio n. 28
0
 void client_ConnectFailed(object sender, EventArgs e)
 {
     PosDialogWindow.ShowDialog(
         Strings.CanNotConnectToTheTemposUpdateServerToVerifyYourSerialNumberPleaseCheckYourInternetConnectionIfYouAreConnectedToTheInternetPleaseTryAgainLaterTheUpdateServerIsDownForMaintenance,
         Strings.ConnectionFailed);
     BadLicenseShutdown(false);
 }
Esempio n. 29
0
 private void buttonSave_Click(object sender, RoutedEventArgs e)
 {
     if (dateTimeEditEndTime.SelectedDateTime != null &&
         dateTimeEditStartTime.SelectedDateTime != null &&
         !EmployeeTimesheet.IsOverlapping(_dataModel.Id, _dataModel.GetEmployeeId(),
                                          dateTimeEditStartTime.SelectedDateTime.Value, dateTimeEditEndTime.SelectedDateTime.Value))
     {
         FormattedListBoxItem item = listBoxJobs.SelectedItem as FormattedListBoxItem;
         if (item != null)
         {
             EmployeeJob job = item.ReferenceObject as EmployeeJob;
             if (job != null)
             {
                 _dataModel.SetJobId(job.Id);
                 _dataModel.StartTime          = dateTimeEditStartTime.SelectedDateTime.Value;
                 _dataModel.EndTime            = dateTimeEditEndTime.SelectedDateTime.Value;
                 _dataModel.DeclaredTipAmount  = _tipsDeclared;
                 _dataModel.DriverCompensation = _driverComp;
             }
         }
         IsModelUpdated = true;
         Window.GetWindow(this).Close();
     }
     else
     {
         PosDialogWindow.ShowDialog(
             Strings.TheTimesSpecifiedWouldOverlapAnExistingShift, Strings.ValidationError);
     }
 }
        private void AddJob()
        {
            if (listBoxAllJobs.SelectedItem == null)
            {
                return;
            }
            double?payRate = PosDialogWindow.PromptCurrency(Strings.EmployeeJobEditorPayRate, 0.0);

            if (payRate == null)
            {
                return;
            }
            FormattedListBoxItem item = listBoxAllJobs.SelectedItem as FormattedListBoxItem;

            if (item != null)
            {
                EmployeeJob job = item.ReferenceObject as EmployeeJob;
                if (job != null)
                {
                    EmployeePayRate rate =
                        EmployeePayRate.Add(SelectedEmployee.Id, job.Id, payRate.Value, 0);
                    listBoxAllJobs.Items.Remove(listBoxAllJobs.SelectedItem);
                    item = GetJobListBoxItem(job, rate);
                    listBoxSelectedJobs.Items.Add(item);
                    listBoxSelectedJobs.SelectedItem = item;
                    listBoxSelectedJobs.ScrollToEnd();
                }
            }
            buttonAdd.IsEnabled    = false;
            buttonRemove.IsEnabled = true;
        }