示例#1
0
 public MainWindow()
 {
     InitializeComponent();
     DataContext = this;
     RunAsync();
     TicketTotalPrice.Add(new TicketItem {
         TotalPrice = 0
     });
 }
示例#2
0
 private void bClear_Click(object sender, RoutedEventArgs e)
 {
     Clear();
     TicketItemList.Clear();
     TicketTotalPrice.Clear();
     TicketTotalPrice.Add(new TicketItem {
         TotalPrice = 0
     });
 }
示例#3
0
        private void DelItem_Click(object sender, RoutedEventArgs e)
        {
            TicketItem p = TicketItems.SelectedItem as TicketItem;

            if (p != null)
            {
                TicketItemList.Remove(p);
                double ttprice = TicketTotalPrice[0].TotalPrice - p.TotalPrice;
                TicketTotalPrice.Clear();
                TicketTotalPrice.Add(new TicketItem {
                    TotalPrice = ttprice
                });
                DelItem.IsEnabled = false;
            }
        }
示例#4
0
        private void AddItem_Click(object sender, RoutedEventArgs e)
        {
            if (product != null)
            {
                int     n      = TicketItemList.Count + 1;
                int     qua    = Convert.ToInt32(Cantidad.Text);
                Product item   = product;
                double  price  = Convert.ToDouble(Costo.Text);
                double  tprice = Math.Round(price * qua, 2);

                TicketItemList.Add(new TicketItem {
                    Nitem = n, Quantity = qua, Item = item, UnitPrice = price, TotalPrice = tprice
                });
                Clear();
                double ttprice = TicketTotalPrice[0].TotalPrice + tprice;
                TicketTotalPrice.Clear();
                TicketTotalPrice.Add(new TicketItem {
                    TotalPrice = ttprice
                });
            }
        }