Beispiel #1
0
 public ShoppingCart()
 {
     InitializeComponent();
     if(Role.Instance.ShopCart.Count == 0)
     {
         MessageBox.Show("No item added");
         bClose.PerformClick();
     }
     foreach (var item in Role.Instance.ShopCart)
     {
         var p = new ShoppingCartItem(item, Role.Instance.DeleteFromShopCart, RefreshTLP);
         p.Dock = DockStyle.Top;
         p.Name = item.ID.ToString();
         tlpList.Controls.Add(p);
         tlpList.SetCellPosition(p, new TableLayoutPanelCellPosition(0, tlpList.Controls.Count));
     }
 }
Beispiel #2
0
 public ShoppingCart()
 {
     InitializeComponent();
     foreach (var item in Role.Instance.ShopCart)
     {
         var p = new ShoppingCartItem(item, Role.Instance.DeleteFromShopCart, updatePrice, RefreshTLP);
         p.Dock = DockStyle.Top;
         p.Name = item.ID.ToString();
         tlpList.Controls.Add(p);
         //tlpList.SetCellPosition(p, new TableLayoutPanelCellPosition(0, tlpList.Controls.Count));
     }
     lSubtotal = new Label();
     lSubtotal.Font = new Font("Calibri", 12F, FontStyle.Bold, GraphicsUnit.Point, 0);
     lSubtotal.Text = "Subtotal: " + Role.Instance.Subtotal.ToString("C2");
     lSubtotal.Margin = new Padding(3);
     lSubtotal.TextAlign = ContentAlignment.MiddleRight;
     lSubtotal.Dock = DockStyle.Top;
     lTax = new Label();
     lTax.Font = lSubtotal.Font;
     lTax.Text = "Tax: " + Role.Instance.Tax.ToString("C2");
     lTax.Margin = new Padding(3);
     lTax.TextAlign = ContentAlignment.MiddleRight;
     lTax.Dock = DockStyle.Top;
     lTotal = new Label();
     lTotal.Font = lSubtotal.Font;
     lTotal.Text = "Total: " + (Role.Instance.Subtotal + Role.Instance.Tax).ToString("C2");
     lTotal.Margin = new Padding(3);
     lTotal.TextAlign = ContentAlignment.MiddleRight;
     lTotal.Dock = DockStyle.Top;
     tlpList.Controls.Add(lSubtotal);
     tlpList.SetCellPosition(lSubtotal, new TableLayoutPanelCellPosition(0, tlpList.Controls.Count));
     tlpList.Controls.Add(lTax);
     tlpList.SetCellPosition(lTax, new TableLayoutPanelCellPosition(0, tlpList.Controls.Count));
     tlpList.Controls.Add(lTotal);
     tlpList.SetCellPosition(lTotal, new TableLayoutPanelCellPosition(0, tlpList.Controls.Count));
 }