Beispiel #1
0
        public void AddExistingCart(string barcode)
        {
            CartBarcodeBorder crtb = new CartBarcodeBorder(id, barcode)
            {
                Height = 45,
                Margin = new Thickness(2)
            };

            //if (Children.Count <= 1)
            //{
            //crtb._isEN = false;
            //}
            //else
            //{
            foreach (CartBarcodeBorder cbb in Children.OfType <CartBarcodeBorder>())
            {
                cbb._isEN = true;
            }
            //}

            crtb.deleteMe += (se, ev) =>
            {
                RemoveCart(se as CartBarcodeBorder);
            };
            Children.Insert(Children.Count - 1, crtb);
            id++;
        }
Beispiel #2
0
        public void RemoveCart(CartBarcodeBorder crtb)
        {
            (wind.Owner as MainWindow).sqlQueriesToSend.Add("DELETE FROM orderbaskets WHERE basketBarcode="
                                                            + crtb.Barcode + " AND orderId=" + wind.orders.order_id + ";");

            Children.Remove(crtb);

            /*int id = 1;
             * foreach (CartBarcodeBorder cbb in Children.OfType<CartBarcodeBorder>())
             * {
             *  cbb.ID = id;
             *  if (Children.OfType<CartBarcodeBorder>().Count() == 1)
             *  {
             *      cbb._isEN = false;
             *  }
             *  id++;
             * }
             * this.id = id;*/
        }