示例#1
0
 private void DiscountBtn_Click(object sender, EventArgs e)
 {
     try
     {
         if (MessageBox.Show("Senior Citizen Discount?", "DISCOUNT", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
         {
             DiscountForm df = new DiscountForm(this);
             df.IDlbl.Text   = id;
             df.PriceTb.Text = TotalLbl.Text;
             df.SeniorName.Select();
             df.ShowDialog();
         }
         else
         {
             DiscountForm df = new DiscountForm(this);
             df.IDlbl.Text   = id;
             df.PriceTb.Text = TotalLbl.Text;
             df.PercentTb.Select();
             df.SeniorName.Enabled  = false;
             df.SeniorIdtxt.Enabled = false;
             df.ShowDialog();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
示例#2
0
        // "Discount" button click event handler
        private void button_Discount_Click(object sender, EventArgs e)
        {
            // create discount form and show it
            string       selectedItemID    = listView_sales.SelectedItems[0].SubItems[0].Text;
            float        selectedItemPrice = float.Parse(listView_sales.SelectedItems[0].SubItems[4].Text);
            DiscountForm discountForm      = new DiscountForm(selectedItemID, selectedItemPrice);

            discountForm.Show();

            // subscribe to events from the discount form
            discountForm.OnApplyDiscount += new EventHandler <DiscountForm.DiscountEventArgs>(applyDiscount);
        }