private void ExamplePOSForm_Load(object sender, EventArgs e)
        {
            //MessageBox.Show("Would ");
            // what to do in the background thread
            //CloverDeviceConfiguration config = new USBCloverDeviceConfiguration("__deviceID__");
            CloverDeviceConfiguration config = new TestCloverDeviceConfiguration();
            cloverConnector = new CloverConnector(config);

            cloverConnector.Connections += this;
            cloverConnector.Devices += this;

            cloverConnector.Sales += this;
            cloverConnector.Voids += this;
            cloverConnector.ManualRefunds += this;

            Store = new Store();
            Store.AvailableItems.Add(new POSItem("abc123", "Hamburger ", 239));
            Store.AvailableItems.Add(new POSItem("def456", "Cheeseburger ", 269));
            Store.AvailableItems.Add(new POSItem("ace135", "Dbl. Hamburger ", 329));
            Store.AvailableItems.Add(new POSItem("fda321", "Dbl. Cheeseburger ", 379));
            Store.AvailableItems.Add(new POSItem("fdc742", "Chicken Sandwich ", 379));
            Store.AvailableItems.Add(new POSItem("cea987", "French Fries - Small ", 129));
            Store.AvailableItems.Add(new POSItem("acb654", "French Fries - Medium ", 159));
            Store.AvailableItems.Add(new POSItem("dfa342", "French Fries - Large ", 179));
            Store.AvailableItems.Add(new POSItem("dea937", "Soft Drink - Small ", 119));
            Store.AvailableItems.Add(new POSItem("afc470", "Soft Drink - Medium ", 139));
            Store.AvailableItems.Add(new POSItem("bce328", "Soft Drink - Large ", 189));
            Store.AvailableItems.Add(new POSItem("eda216", "Gift Card ", 3000));

            foreach (POSItem item in Store.AvailableItems)
            {
                ListViewItem lvi = new ListViewItem();

                lvi.Tag = item;
                lvi.Name = item.Name;

                lvi.Text = item.Name + (item.Price / 100.0).ToString("C2");
                StoreItems.Items.Add(lvi);
            }
            UpdateUI();
        }
 public void SubscribeToStoreChanges(Store store)
 {
     store.OrderListChange += new Store.OrderListChangeHandler(OrderListChanged);
     store.PreAuthListChange += new Store.PreAuthListChangeHandler(PreAuthListChanged);
 }
        private void ExamplePOSForm_Load(object sender, EventArgs e)
        {
            // some UI cleanup...
            RegisterTabs.Appearance = TabAppearance.FlatButtons;
            RegisterTabs.ItemSize = new Size(0, 1);
            RegisterTabs.SizeMode = TabSizeMode.Fixed;
            // done hiding tabs

            // register for app shutdown
            Application.ApplicationExit += new EventHandler(this.AppShutdown);

            OriginalFormTitle = this.Text;

            Store = new Store();
            Store.AvailableItems.Add(new POSItem(Guid.NewGuid().ToString(), "Hamburger ", 439));
            Store.AvailableItems.Add(new POSItem(Guid.NewGuid().ToString(), "Cheeseburger ", 499));
            Store.AvailableItems.Add(new POSItem(Guid.NewGuid().ToString(), "Dbl. Hamburger ", 559));
            Store.AvailableItems.Add(new POSItem(Guid.NewGuid().ToString(), "Dbl. Cheeseburger ", 629));
            Store.AvailableItems.Add(new POSItem(Guid.NewGuid().ToString(), "Chicken Sandwich ", 699));
            Store.AvailableItems.Add(new POSItem(Guid.NewGuid().ToString(), "Deluxe Chicken Sandwich ", 749));
            Store.AvailableItems.Add(new POSItem(Guid.NewGuid().ToString(), "French Fries - Small ", 189));
            Store.AvailableItems.Add(new POSItem(Guid.NewGuid().ToString(), "French Fries - Medium ", 229));
            Store.AvailableItems.Add(new POSItem(Guid.NewGuid().ToString(), "French Fries - Large ", 269));
            Store.AvailableItems.Add(new POSItem(Guid.NewGuid().ToString(), "Soft Drink - Small ", 174));
            Store.AvailableItems.Add(new POSItem(Guid.NewGuid().ToString(), "Soft Drink - Medium ", 189));
            Store.AvailableItems.Add(new POSItem(Guid.NewGuid().ToString(), "Soft Drink - Large ", 229));
            Store.AvailableItems.Add(new POSItem(Guid.NewGuid().ToString(), "Milk Shake - Vanilla ", 389));
            Store.AvailableItems.Add(new POSItem(Guid.NewGuid().ToString(), "Milk Shake - Chocolate ", 399));
            Store.AvailableItems.Add(new POSItem(Guid.NewGuid().ToString(), "Milk Shake - Strawberry ", 399));
            Store.AvailableItems.Add(new POSItem(Guid.NewGuid().ToString(), "Gift Card - $25 ", 2500, false, false));
            Store.AvailableItems.Add(new POSItem(Guid.NewGuid().ToString(), "Gift Card - $50 ", 5000, false, false));

            Store.AvailableDiscounts.Add(new POSDiscount("None", 0));
            Store.AvailableDiscounts.Add(new POSDiscount("10% Off", 0.1f));
            Store.AvailableDiscounts.Add(new POSDiscount("$5 Off", 500));

            SaleButton.ContextMenu = new ContextMenu();
            MenuItem menuItem = new MenuItem("Sale with Vaulted Card");
            menuItem.Enabled = false;
            menuItem.Click += delegate (object sen, EventArgs args) {
                uiThread.Send(delegate (object state)
                {
                    VaultedCardListForm vclForm = new VaultedCardListForm(this);
                    vclForm.setCardsListView(cardsListView);
                    vclForm.setCardAction(VaultedCardListForm.VaultedCardAction.PAY);
                    vclForm.FormClosing += vaultedCardListClosing;
                    vclForm.Show(this);
                }, null);
            };
            SaleButton.ContextMenu.MenuItems.Add(menuItem);
            menuItem = new MenuItem("Sale with Pre-Auth");
            menuItem.Enabled = false;
            menuItem.Click += delegate (object sen, EventArgs args)
            {
                uiThread.Send(delegate (object state)
                {
                    PreAuthListForm palForm = new PreAuthListForm(this);
                    palForm.preAuths = Store.PreAuths;
                    palForm.FormClosing += preAuthFormClosing;
                    palForm.Show(this);

                }, null);
            };
            SaleButton.ContextMenu.MenuItems.Add(menuItem);
            SaleButton.Click.Add(PayButton_Click);

            AuthButton.ContextMenu = new ContextMenu();
            menuItem = new MenuItem("Auth with Vaulted Card");
            menuItem.Enabled = false;
            menuItem.Click += delegate (object sen, EventArgs args)
            {
                uiThread.Send(delegate (object state)
                {
                    VaultedCardListForm vclForm = new VaultedCardListForm(this);
                    vclForm.setCardsListView(cardsListView);
                    vclForm.setCardAction(VaultedCardListForm.VaultedCardAction.AUTH);
                    vclForm.FormClosing += vaultedCardListClosing;
                    vclForm.Show(this);
                }, null);
            };
            AuthButton.ContextMenu.MenuItems.Add(menuItem);

            AuthButton.Click.Add(AuthButton_Click);

            foreach (POSItem item in Store.AvailableItems)
            {
                StoreItem si = new StoreItem();
                si.Item = item;
                si += StoreItems_ItemSelected;

                StoreItems.Controls.Add(si);
            }

            foreach (POSDiscount discount in Store.AvailableDiscounts)
            {
                StoreDiscount si = new StoreDiscount();
                si.Discount = discount;
                si += StoreItems_DiscountSelected;

                StoreDiscounts.Controls.Add(si);
            }
            SubscribeToStoreChanges(Store);
            NewOrder();
        }
        public void PreAuthListChanged(POSPayment payment, Store.PreAuthAction action)
        {
            if (action == Store.PreAuthAction.ADDED)
            {
                ListViewItem lvi = new ListViewItem();
                lvi.Tag = payment;
                lvi.SubItems.Add(new ListViewItem.ListViewSubItem());

                lvi.SubItems[0].Text = "PRE-AUTH";
                lvi.SubItems[1].Text = (payment.Amount / 100.0).ToString("C2");

                PreAuthListView.Items.Add(lvi);
            }
            else if (action == Store.PreAuthAction.REMOVED)
            {
                foreach (ListViewItem lvi in PreAuthListView.Items)
                {
                    if (lvi.Tag.Equals(payment))
                    {
                        PreAuthListView.Items.Remove(lvi);
                        break;
                    }
                }
            }
            SaleButton.ContextMenu.MenuItems[1].Enabled = Store.PreAuths.Count > 0;
            autoResizeColumns(PreAuthListView);
        }
 public void OrderListChanged(Store store, Store.OrderListAction action)
 {
     autoResizeColumns(OrdersListView);
     switch (GetCurrentTab())
     {
         case ClientTab.ORDER:
             {
                 UpdateOrderUI();
                 break;
             }
         case ClientTab.ORDERLIST:
             {
                 UpdateOrdersListView();
                 break;
             }
         default: break;
     }
 }
        private void ExamplePOSForm_Load(object sender, EventArgs e)
        {
            // some UI cleanup...
            RegisterTabs.Appearance = TabAppearance.FlatButtons;
            RegisterTabs.ItemSize = new Size(0, 1);
            RegisterTabs.SizeMode = TabSizeMode.Fixed;
            // done hiding tabs

            OriginalFormTitle = this.Text;
            InitializeConnector(TestConfig);

            Store = new Store();
            Store.AvailableItems.Add(new POSItem(Guid.NewGuid().ToString(), "Hamburger ", 439));
            Store.AvailableItems.Add(new POSItem(Guid.NewGuid().ToString(), "Cheeseburger ", 499));
            Store.AvailableItems.Add(new POSItem(Guid.NewGuid().ToString(), "Dbl. Hamburger ", 559));
            Store.AvailableItems.Add(new POSItem(Guid.NewGuid().ToString(), "Dbl. Cheeseburger ", 629));
            Store.AvailableItems.Add(new POSItem(Guid.NewGuid().ToString(), "Chicken Sandwich ", 699));
            Store.AvailableItems.Add(new POSItem(Guid.NewGuid().ToString(), "Deluxe Chicken Sandwich ", 749));
            Store.AvailableItems.Add(new POSItem(Guid.NewGuid().ToString(), "French Fries - Small ", 189));
            Store.AvailableItems.Add(new POSItem(Guid.NewGuid().ToString(), "French Fries - Medium ", 229));
            Store.AvailableItems.Add(new POSItem(Guid.NewGuid().ToString(), "French Fries - Large ", 269));
            Store.AvailableItems.Add(new POSItem(Guid.NewGuid().ToString(), "Soft Drink - Small ", 174));
            Store.AvailableItems.Add(new POSItem(Guid.NewGuid().ToString(), "Soft Drink - Medium ", 189));
            Store.AvailableItems.Add(new POSItem(Guid.NewGuid().ToString(), "Soft Drink - Large ", 229));
            Store.AvailableItems.Add(new POSItem(Guid.NewGuid().ToString(), "Milk Shake - Vanilla ", 389));
            Store.AvailableItems.Add(new POSItem(Guid.NewGuid().ToString(), "Milk Shake - Chocolate ", 399));
            Store.AvailableItems.Add(new POSItem(Guid.NewGuid().ToString(), "Milk Shake - Strawberry ", 399));
            Store.AvailableItems.Add(new POSItem(Guid.NewGuid().ToString(), "Gift Card - $25 ", 2500, false));
            Store.AvailableItems.Add(new POSItem(Guid.NewGuid().ToString(), "Gift Card - $50 ", 5000, false));

            Store.AvailableDiscounts.Add(new POSDiscount("None", 0));
            Store.AvailableDiscounts.Add(new POSDiscount("10% Off", 0.1f));
            Store.AvailableDiscounts.Add(new POSDiscount("$5 Off", 500));

            foreach (POSItem item in Store.AvailableItems)
            {
                StoreItem si = new StoreItem();
                si.Item = item;
                si += StoreItems_ItemSelected;

                StoreItems.Controls.Add(si);
            }

            foreach (POSDiscount discount in Store.AvailableDiscounts)
            {
                StoreDiscount si = new StoreDiscount();
                si.Discount = discount;
                si += StoreItems_DiscountSelected;

                StoreDiscounts.Controls.Add(si);
            }

            NewOrder();

            UpdateUI();
        }
Пример #7
0
 protected void onOrderListChange(Store store, OrderListAction action)
 {
     if (OrderListChange != null)
     {
         OrderListChange(store, action);
     }
 }
 internal void setStore(Store store)
 {
     this.Store = store;
 }