Exemplo n.º 1
0
        ////////////////// UI Events and UI Management //////////////////////

        private void StoreItems_ItemSelected(object sender, EventArgs e)
        {
            POSItem     item     = ((StoreItem)((Control)sender).Parent).Item;
            POSLineItem lineItem = Store.CurrentOrder.AddItem(item, 1);

            DisplayLineItem displayLineItem = null;

            posLineItemToDisplayLineItem.TryGetValue(lineItem, out displayLineItem);
            if (displayLineItem == null)
            {
                displayLineItem = DisplayFactory.createDisplayLineItem();
                posLineItemToDisplayLineItem[lineItem] = displayLineItem;
                displayLineItem.quantity = "1";
                displayLineItem.name     = lineItem.Item.Name;
                displayLineItem.price    = (lineItem.Item.Price / 100.0).ToString("C2");
                DisplayOrder.addDisplayLineItem(displayLineItem);
                UpdateDisplayOrderTotals();
                cloverConnector.DisplayOrderLineItemAdded(DisplayOrder, displayLineItem);
            }
            else
            {
                displayLineItem.quantity = lineItem.Quantity.ToString();
                UpdateDisplayOrderTotals();
                cloverConnector.DisplayOrder(DisplayOrder);
            }

            UpdateUI();
        }
Exemplo n.º 2
0
        /// <summary>
        /// manages adding a POSItem to an order. If the POSItem already exists, the quantity is just incremented
        /// </summary>
        /// <param name="i"></param>
        /// <param name="quantity"></param>
        /// <returns>The POSLineItem for the POSItem. Will either return a new one, or an existing with its quantity incremented</returns>
        public POSLineItem AddItem(POSItem i, int quantity)
        {
            bool        exists     = false;
            POSLineItem targetItem = null;

            foreach (POSLineItem lineI in Items)
            {
                if (lineI.Item.ID == i.ID)
                {
                    exists          = true;
                    lineI.Quantity += quantity;
                    targetItem      = lineI;
                    break;
                }
            }
            if (!exists)
            {
                POSLineItem li = new POSLineItem();
                li.Quantity = quantity;
                li.Item     = i;
                targetItem  = li;
                Items.Add(li);
            }
            onOrderChange(this, OrderChangeTarget.ITEM);
            return(targetItem);
        }
Exemplo n.º 3
0
 private void OrderItems_SelectedIndexChanged(object sender, EventArgs e)
 {
     // Need to show item panel?
     if (OrderItems.SelectedItems.Count == 1)
     {
         POSLineItem lineItem = (POSLineItem)((ListViewItem)OrderItems.SelectedItems[0]).Tag;
         SelectedLineItem         = lineItem;
         ItemNameLabel.Text       = lineItem.Item.Name;
         ItemQuantityTextbox.Text = lineItem.Quantity.ToString();
         // enable/disable Discount button. Can't add it twice...
         DiscountButton.Enabled = lineItem.Discount == null;
     }
     RegisterTabs.SelectedIndex = 1;
 }
Exemplo n.º 4
0
        public void AddItem(POSItem i, int quantity)
        {
            bool exists = false;
            foreach(POSLineItem lineI in Items)
            {
                if(lineI.Item.ID == i.ID)
                {
                    exists = true;
                    lineI.Quantity += quantity;
                    break;
                }
            }
            if(!exists)
            {
                POSLineItem li = new POSLineItem();
                li.Quantity = quantity;
                li.Item = i;

                Items.Add(li);
            }
        }
Exemplo n.º 5
0
 public void AddOrderLineItem(POSLineItem item)
 {
     this.Items.Add(item);
     onOrderChange(this, OrderChangeTarget.ITEM);
 }
Exemplo n.º 6
0
 internal void RemoveItem(POSLineItem selectedLineItem)
 {
     Items.Remove(selectedLineItem);
     onOrderChange(this, OrderChangeTarget.ITEM);
 }
 private void OrderItems_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (OrderItems.SelectedItems.Count == 1)
     {
         POSLineItem lineItem = (POSLineItem)((ListViewItem)OrderItems.SelectedItems[0]).Tag;
         SelectedLineItem = lineItem;
         ItemNameLabel.Text = lineItem.Item.Name;
         ItemQuantityTextbox.Text = lineItem.Quantity.ToString();
         // enable/disable Discount button. Can't add it twice...
         DiscountButton.Enabled = lineItem.Discount == null;
     }
     RegisterTabs.SelectedIndex = 1;
 }
Exemplo n.º 8
0
 internal void RemoveItem(POSLineItem selectedLineItem)
 {
     Items.Remove(selectedLineItem);
 }
Exemplo n.º 9
0
 /// <summary>
 /// manages adding a POSItem to an order. If the POSItem already exists, the quantity is just incremented
 /// </summary>
 /// <param name="i"></param>
 /// <param name="quantity"></param>
 /// <returns>The POSLineItem for the POSItem. Will either return a new one, or an exising with its quantity incremented</returns>
 public POSLineItem AddItem(POSItem i, int quantity)
 {
     bool exists = false;
     POSLineItem targetItem = null;
     foreach(POSLineItem lineI in Items)
     {
         if(lineI.Item.ID == i.ID)
         {
             exists = true;
             lineI.Quantity += quantity;
             targetItem = lineI;
             break;
         }
     }
     if(!exists)
     {
         POSLineItem li = new POSLineItem();
         li.Quantity = quantity;
         li.Item = i;
         targetItem = li;
         Items.Add(li);
     }
     return targetItem;
 }
Exemplo n.º 10
0
 internal void RemoveItem(POSLineItem selectedLineItem)
 {
     Items.Remove(selectedLineItem);
     onOrderChange(this, OrderChangeTarget.ITEM);
 }
Exemplo n.º 11
0
 public void AddOrderLineItem(POSLineItem item)
 {
     this.Items.Add(item);
     onOrderChange(this, OrderChangeTarget.ITEM);
 }
Exemplo n.º 12
0
 internal void RemoveItem(POSLineItem selectedLineItem)
 {
     Items.Remove(selectedLineItem);
 }