public void submit2_Click(object sender, EventArgs e) { //When you click submit in Form5 CreditCard[] credit = new CreditCard[1]; //object pointer is created credit[0] = new CreditCard(this); //points object of CreditCard credit[0].name = this.name.Text; //sets data members to the text boxes values credit[0].ccNum = this.cc.Text; credit[0].sNum = this.csc.Text; credit[0].expDate = this.expdate.Text; //MessageBox will output information stored in CreditCard and not this form to show that values have been passed to the class DialogResult confirm = MessageBox.Show("Name: " + credit[0].name + "\nCredit Card Number: " + credit[0].ccNum + "\nCVV: " + credit[0].sNum + "\nExpiration Date: " + credit[0].expDate + "\n\n\nConfirm the above information correct?", "Confirm your Credit Card information", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (confirm == DialogResult.Yes) //Information confirmation, yes no { //if yes, executes command that sets status to sold cmd = new MySqlCommand("update listings set status='Sold' where address='" + test + "'", con); read = cmd.ExecuteReader(); MessageBox.Show("Congratulations! You have purchased this property"); //prompts user that they have purchased the property read.Close(); //close the read cmd = new MySqlCommand("SELECT address FROM listings", con); //Sytax, select all "address" from "listings" which is the database read = cmd.ExecuteReader(); //executes the command objs.status.Text = "Sold"; } }
//Repeats the same process for each Radio Button checked private void visa_CheckedChanged(object sender, EventArgs e) { CreditCard[] credit = new CreditCard[1]; credit[0] = new Visa(this); credit[0].PrintCard(); }
private void discovercard_CheckedChanged(object sender, EventArgs e) { CreditCard[] credit = new CreditCard[1]; credit[0] = new DiscoverCard(this); credit[0].PrintCard(); }
//if mastercard radiobutton is checked private void mastercard_CheckedChanged(object sender, EventArgs e) { CreditCard[] credit = new CreditCard[1]; //create pointer object of CreditCard credit[0] = new MasterCard(this); //pointer points to MasterCard (a derived class) and passes argument (this), which is this form credit[0].PrintCard(); //calls the class function, PrintCard }
private void americanexpress_CheckedChanged(object sender, EventArgs e) { CreditCard[] credit = new CreditCard[1]; credit[0] = new AmericanExpress(this); credit[0].PrintCard(); }