Пример #1
0
        private void buyButton_Click(object sender, EventArgs e)
        {
            invoice = new InvoiceCreator();
            double price;
            if (!double.TryParse(priceInput.Text,out price))
            {
                priceInput.Clear();
                qtyInput.Clear();
                qtyInput.Focus();
                return;
            }

            double quantity;
            if (!double.TryParse(qtyInput.Text, out quantity))
            {
                priceInput.Clear();
                qtyInput.Clear();
                qtyInput.Focus();
                return;
            }

            invoice.Price = price;
            invoice.Quantity = quantity;
            invoice.GetPrices();
            line1 = string.Format("Sales Receipt\nUnit price: {0:c}\nNumber of units: {1}\n", invoice.Price, invoice.Quantity);
            line2 = string.Format("Net price: {0:C}\nState Tax:{2:C}\nLocal Tax: {1:C}\n", invoice.Cost, invoice.LocalTax, invoice.StateTax);
            line3 = string.Format("Amount Due:{0:C}", invoice.TotalCost);
            MessageBox.Show(line1 + "------------------\n" + line2 + line3);
        }
Пример #2
0
 private void resetButton_Click(object sender, EventArgs e)
 {
     invoice = new InvoiceCreator();
     priceInput.Clear();
     qtyInput.Clear();
 }