Exemple #1
0
        private void UpdateOption()
        {
            bool isNew = (listBoxOptions.SelectedItem == null);

            if (!editorControl.HasValidationError())
            {
                editorControl.Update();
                if (isNew)
                {
                    FormattedListBoxItem item = new FormattedListBoxItem(
                        editorControl.ActiveItemOption,
                        editorControl.ActiveItemOption.Name,
                        true);
                    listBoxOptions.Items.Add(item);
                    listBoxOptions.UpdateLayout();
                    listBoxOptions.SelectedItem = item;
                    listBoxOptions.ScrollIntoView(item);
                }
                else
                {
                    FormattedListBoxItem listItem = listBoxOptions.SelectedItem as FormattedListBoxItem;
                    if (listItem != null)
                    {
                        listItem.Set(editorControl.ActiveItemOption,
                                     editorControl.ActiveItemOption.Name);
                    }
                }
                SetEditMode(false);
            }
        }
        private void UpdateListBoxItem()
        {
            if (listBox1.SelectedItem == null)
            {
                return;
            }
            FormattedListBoxItem selectedItem = listBox1.SelectedItem as FormattedListBoxItem;

            if (selectedItem != null)
            {
                selectedItem.Set(selectedItem.ReferenceObject, GetText(ActiveIngredient));
            }
        }
        private void EditEmployeePayRate()
        {
            double?payRate = PosDialogWindow.PromptCurrency(Strings.EmployeeJobEditorPayRate, 0.0);

            if (payRate != null)
            {
                FormattedListBoxItem item = listBoxSelectedJobs.SelectedItem as FormattedListBoxItem;
                if (item != null)
                {
                    EmployeeJob     job  = item.ReferenceObject as EmployeeJob;
                    EmployeePayRate rate =
                        EmployeePayRate.GetEmployeePayRateForJob(SelectedEmployee.Id, job.Id);
                    rate.SetWage(payRate.Value);
                    rate.Update();
                    item.Set(job, job.Description + Environment.NewLine +
                             rate.Wage.ToString("C2"));
                }
            }
        }
Exemple #4
0
        private void UpdateChanges()
        {
            bool updated = false;

            if (ViewMode == SeatingViewMode.Rooms)
            {
                bool isNew   = (roomEditorControl.SelectedRoom == null);
                Room oldRoom = (roomEditorControl.SelectedRoom != null ?
                                SeatingManager.GetRoom(roomEditorControl.SelectedRoom.Id) : null);
                if (roomEditorControl.UpdateRoom())
                {
                    if (isNew)
                    {
                        FormattedListBoxItem item =
                            new FormattedListBoxItem(roomEditorControl.SelectedRoom,
                                                     roomEditorControl.SelectedRoom.Description, true);
                        listBox1.Items.Add(item);
                        SelectedRoom          = roomEditorControl.SelectedRoom;
                        listBox1.SelectedItem = item;
                        SetDefaultSeating(SelectedRoom);
                        updated = true;
                    }
                    else if (listBox1.SelectedItem != null)
                    {
                        FormattedListBoxItem selected = listBox1.SelectedItem as FormattedListBoxItem;
                        if (selected != null)
                        {
                            Room room = selected.ReferenceObject as Room;
                            if (room != null)
                            {
                                selected.Set(room, room.Description);
                                if (oldRoom != null && oldRoom.TicketingType != room.TicketingType)
                                {
                                    SetDefaultSeating(room);
                                }
                            }
                            updated = true;
                        }
                    }
                }
            }
            else if (ViewMode == SeatingViewMode.Seating)
            {
                bool isNew = (seatingEditorControl.SelectedSeating == null);
                if (seatingEditorControl.UpdateSeating())
                {
                    if (isNew)
                    {
                        FormattedListBoxItem item =
                            new FormattedListBoxItem(seatingEditorControl.SelectedSeating,
                                                     seatingEditorControl.SelectedSeating.Description, true);
                        listBox1.Items.Add(item);
                        SelectedSeating       = seatingEditorControl.SelectedSeating;
                        listBox1.SelectedItem = item;
                        updated = true;
                    }
                    else if (listBox1.SelectedItem != null)
                    {
                        FormattedListBoxItem selected = listBox1.SelectedItem as FormattedListBoxItem;
                        if (selected != null)
                        {
                            Seating seating = selected.ReferenceObject as Seating;
                            if (seating != null)
                            {
                                selected.Set(seating, seating.Description);
                            }
                        }
                        updated = true;
                    }
                }
            }
            if (updated)
            {
                SetEditMode(false);
            }
        }