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
        public static void testDisplayOrder(CloverConnector cloverConnector, TestConnectorListener connListener)
        {
            DisplayOrder order = DisplayFactory.createDisplayOrder();

            order.title               = "Get Ready!";
            order.note                = "Here is the note field";
            order.serviceChargeName   = "Gonna Getcha";
            order.serviceChargeAmount = "$2,123.34";

            DisplayLineItem lineItem = DisplayFactory.createDisplayLineItem();

            lineItem.name  = "My Item Name";
            lineItem.price = "$123.43";

            order.addDisplayLineItem(lineItem);

            DisplayDiscount discount = DisplayFactory.createDisplayDiscount();

            discount.amount = "$543.21";
            discount.name   = "Nice Guy discount";

            order.addDisplayDiscount(discount);

            cloverConnector.ShowDisplayOrder(order);

            DisplayLineItem line2 = DisplayFactory.createDisplayLineItem();

            line2.name      = "another item";
            line2.price     = "$4.68";
            line2.quantity  = "2";
            line2.unitPrice = "$2.34";
            order.addDisplayLineItem(line2);

            cloverConnector.ShowDisplayOrder(order);
        }
Exemplo n.º 3
0
        public void LineItemRemovedFromDisplayOrder(DisplayOrder order, DisplayLineItem lineItem)
        {
            LineItemRemovedFromDisplayOrder dolia = new LineItemRemovedFromDisplayOrder();

            dolia.DisplayOrder    = order;
            dolia.DisplayLineItem = lineItem;
            Send("/LineItemRemovedFromDisplayOrder", dolia);
        }
Exemplo n.º 4
0
        public void LineItemAddedToDisplayOrder(DisplayOrder order, DisplayLineItem lineItem)
        {
            LineItemAddedToDisplayOrder dolia = new LineItemAddedToDisplayOrder();

            dolia.DisplayOrder    = order;
            dolia.DisplayLineItem = lineItem;
            Send("/LineItemAddedToDisplayOrder", dolia);
        }
Exemplo n.º 5
0
        private void RemoveSelectedItemFromCurrentOrder()
        {
            Store.CurrentOrder.RemoveItem(SelectedLineItem);
            DisplayLineItem dli = posLineItemToDisplayLineItem[SelectedLineItem];

            DisplayOrder.removeDisplayLineItem(dli);
            UpdateDisplayOrderTotals();
            cloverConnector.DisplayOrderLineItemRemoved(DisplayOrder, dli);
            RegisterTabs.SelectedIndex = 0;
            UpdateUI();
        }
 public void LineItemRemovedFromDisplayOrder(DisplayOrder order, DisplayLineItem lineItem)
 {
     if (websocket != null)
     {
         LineItemRemovedFromDisplayOrderRequestMessage message = new LineItemRemovedFromDisplayOrderRequestMessage();
         LineItemRemovedFromDisplayOrder payload = new LineItemRemovedFromDisplayOrder();
         payload.DisplayLineItem = lineItem;
         payload.DisplayOrder    = order;
         message.payload         = payload;
         websocket.Send(JsonUtils.serialize(message));
     }
 }
 public void DisplayOrderLineItemRemoved(DisplayOrder order, DisplayLineItem lineItem)
 {
     if (websocket != null)
     {
         DisplayOrderLineItemRemovedRequestMessage message = new DisplayOrderLineItemRemovedRequestMessage();
         DisplayOrderLineItemRemoved payload = new DisplayOrderLineItemRemoved();
         payload.DisplayLineItem = lineItem;
         payload.DisplayOrder    = order;
         message.payload         = payload;
         websocket.Send(JsonUtils.serialize(message));
     }
 }
Exemplo n.º 8
0
        private void DiscountButton_Click(object sender, EventArgs e)
        {
            SelectedLineItem.Discount = new POSLineItemDiscount(0.1f, "10% Off");
            DisplayDiscount discount        = new DisplayDiscount();
            DisplayLineItem displayLineItem = posLineItemToDisplayLineItem[SelectedLineItem];

            discount.lineItemId = displayLineItem.id;
            displayLineItem.addDiscount(discount);

            discount.name       = SelectedLineItem.Discount.Name;
            discount.percentage = "10";
            discount.amount     = (SelectedLineItem.Discount.Value(SelectedLineItem.Item) * SelectedLineItem.Quantity / 100.0).ToString("C2");

            UpdateDisplayOrderTotals();
            cloverConnector.DisplayOrder(DisplayOrder);

            DiscountButton.Enabled = false;
            UpdateUI();
        }
Exemplo n.º 9
0
        //Experimenting on displaying orders
        //NOT READY YET
        public static void StartOrder(ICloverConnector cloverConnector)
        {
            cloverConnector.ResetDevice();
            DisplayOrder    o = new DisplayOrder();
            DisplayLineItem l = new DisplayLineItem();
            DisplayPayment  p = new DisplayPayment();

            l.name  = "hello";
            l.price = "1234";
            o.addDisplayLineItem(l);

            o.subtotal = l.price;
            //o.tax = "0";
            o.total    = o.subtotal + o.tax;
            o.currency = "USD";
            o.title    = "My Order";

            p.amount = o.total;
            cloverConnector.ShowDisplayOrder(o);
        }
        public void DisplayOrderLineItemRemoved(global::com.clover.remote.order.DisplayOrder order, DisplayLineItem lineItem)
        {
            DisplayOrderLineItemRemoved dolia = new DisplayOrderLineItemRemoved();

            dolia.DisplayOrder    = order;
            dolia.DisplayLineItem = lineItem;
            Send("/DisplayOrderLineItemRemoved", dolia);
        }
 public void LineItemRemovedFromDisplayOrder(DisplayOrder order, DisplayLineItem lineItem)
 {
     LineItemRemovedFromDisplayOrder dolia = new LineItemRemovedFromDisplayOrder();
     dolia.DisplayOrder = order;
     dolia.DisplayLineItem = lineItem;
     Send("/LineItemRemovedFromDisplayOrder", dolia);
 }
 public void LineItemAddedToDisplayOrder(DisplayOrder order, DisplayLineItem lineItem)
 {
     LineItemAddedToDisplayOrder dolia = new LineItemAddedToDisplayOrder();
     dolia.DisplayOrder = order;
     dolia.DisplayLineItem = lineItem;
     Send("/LineItemAddedToDisplayOrder", dolia);
 }
 public void LineItemRemovedFromDisplayOrder(DisplayOrder order, DisplayLineItem lineItem)
 {
     if (websocket != null)
     {
         LineItemRemovedFromDisplayOrderRequestMessage message = new LineItemRemovedFromDisplayOrderRequestMessage();
         LineItemRemovedFromDisplayOrder payload = new LineItemRemovedFromDisplayOrder();
         payload.DisplayLineItem = lineItem;
         payload.DisplayOrder = order;
         message.payload = payload;
         websocket.Send(JsonUtils.serialize(message));
     }
 }