예제 #1
0
        private void ProcessItemOption(IEnumerable <TicketItemOption> ticketItemOptions,
                                       int setId, ref string itemName)
        {
            bool found = false;

            foreach (TicketItemOption ticketItemOption in ticketItemOptions)
            {
                foreach (ItemOption itemOption in ItemOption.GetInSet(setId))
                {
                    if (itemOption.Id == ticketItemOption.ItemOptionId)
                    {
                        if (found)
                        {
                            itemName += ", ";
                        }
                        found     = true;
                        itemName += itemOption.Name;
                    }
                }
            }
            if (found)
            {
                itemName += Environment.NewLine;
            }
        }
        public void SetOptions(int itemOptionSetId)
        {
            int index = 0;

            Visibility = Visibility.Visible;
            ItemOptionSet set = ItemOptionSet.Get(itemOptionSetId);

            IsBeingUsed = !set.IsPizzaStyle;
            if (IsBeingUsed)
            {
                foreach (ItemOption option in ItemOption.GetInSet(itemOptionSetId))
                {
                    TextBlockButton button = Buttons[index];
                    button.Tag        = option.Id.ToString(CultureInfo.InvariantCulture);
                    button.IsChecked  = false;
                    button.Text       = StringHelper.ThinString(option.Name);
                    button.Visibility = Visibility.Visible;
                    index++;
                }
                SelectedMaximum = set.SelectedMaximum;
                SelectedMinimum = set.SelectedMinimum;
            }
            for (int i = index; i < Buttons.Length; i++)
            {
                TextBlockButton button = Buttons[i];
                button.Tag        = "0";
                button.IsChecked  = false;
                button.Text       = "";
                button.Visibility = Visibility.Hidden;
            }
        }
예제 #3
0
        private void InitializeItemOptionsListBox()
        {
            IEnumerable <ItemOption> options = ItemOption.GetInSet(_activeItemOptionSet.Id);
            FormattedListBoxItem     first   = null;

            foreach (ItemOption option in options)
            {
                FormattedListBoxItem item = new FormattedListBoxItem(option,
                                                                     option.Name, true);
                if (first == null)
                {
                    first = item;
                }
                listBoxOptions.Items.Add(item);
            }
            listBoxOptions.UpdateLayout();
            listBoxOptions.ScrollIntoView(first);
        }
예제 #4
0
        private static void PrintTicketItemOptions(PosPrinter printer, TicketItem ticketItem)
        {
            Item item = Item.Get(ticketItem.ItemId);

            // Get the option sets for this category
            List <ItemOption> options1 = new List <ItemOption>(ItemOption.GetInSet(item.ItemOptionSetIds[0]));
            List <ItemOption> options2 = new List <ItemOption>(ItemOption.GetInSet(item.ItemOptionSetIds[1]));
            List <ItemOption> options3 = new List <ItemOption>(ItemOption.GetInSet(item.ItemOptionSetIds[2]));

            // Get the options for this ticket item's category
            List <TicketItemOption> ticketItemOptions = new List <TicketItemOption>(
                TicketItemOption.GetAll(ticketItem.PrimaryKey));

            if (options1.Count > 0)
            {
                string line = "";
                if (ProcessItemOption(ticketItemOptions, options1, ref line))
                {
                    PrintLineToReceipt(printer, PrinterEscapeCodes.SetSize(5) +
                                       "[" + line + "]");
                }
            }
            if (options2.Count > 0)
            {
                string line = "";
                if (ProcessItemOption(ticketItemOptions, options2, ref line))
                {
                    PrintLineToReceipt(printer, PrinterEscapeCodes.SetSize(5) +
                                       "[" + line + "]");
                }
            }
            if (options3.Count > 0)
            {
                string line = "";
                if (ProcessItemOption(ticketItemOptions, options3, ref line))
                {
                    PrintLineToReceipt(printer, PrinterEscapeCodes.SetSize(5) +
                                       "[" + line + "]");
                }
            }
        }
예제 #5
0
        internal void SetItemOptions(Item item)
        {
            if ((item.ItemOptionSetIds[0] == 0) &&
                (item.ItemOptionSetIds[1] == 0) &&
                (item.ItemOptionSetIds[2] == 0))
            {
                Visibility = Visibility.Collapsed;
                Clear();
                return;
            }

            int           index = 0;
            ItemOptionSet set   = ItemOptionSet.Get(item.ItemOptionSetIds[0]);

            IsBeingUsed = set.IsPizzaStyle;
            Visibility  = (IsBeingUsed ? Visibility.Visible : Visibility.Collapsed);
            if (IsBeingUsed)
            {
                IEnumerable <ItemOption> options = ItemOption.GetInSet(item.ItemOptionSetIds[0]);
                foreach (ItemOption option in options)
                {
                    TextBlockButton button = Buttons[index];
                    button.Tag        = option.Id.ToString(CultureInfo.InvariantCulture);
                    button.IsChecked  = false;
                    button.Text       = StringHelper.ThinString(option.Name);
                    button.Visibility = Visibility.Visible;
                    index++;
                }
                //SelectedMaximum = set.SelectedMaximum;
                //SelectedMinimum = set.SelectedMinimum;
            }
            for (int i = index; i < Buttons.Count; i++)
            {
                TextBlockButton button = Buttons[i];
                button.Tag        = "0";
                button.IsChecked  = false;
                button.Text       = "";
                button.Visibility = Visibility.Hidden;
            }
        }