protected void Calc_Click(object sender, EventArgs e) { if (IsValid) { var receipt = new Model.Receipt(Double.Parse(EditTotal.Text)); ReceiptPanel.Visible = true; SubTotal.Text = String.Format("{0:c}", receipt.Subtotal); DiscountRate.Text = String.Format("{0:p0}", receipt.DiscountRate); Discount.Text = String.Format("{0:c}", receipt.MoneyOff); Total.Text = String.Format("{0:c}", receipt.Total); } }
protected void CalculateButton_Click(object sender, EventArgs e) { if (IsValid) { Receipt MyReceipt = new Receipt(Double.Parse(AmountTextBox.Text)); SubtotalLabel.Text = String.Format("{0:c}", MyReceipt.Subtotal); DiscountRateLabel.Text = String.Format("{0:p0}", MyReceipt.DiscountRate); MoneyOffLabel.Text = String.Format("{0:c}", MyReceipt.MoneyOff); TotalLabel.Text = String.Format("{0:c}", MyReceipt.Total); ReceiptPanel.Visible = true; } }