private void btnCreateVendor_Click(object sender, EventArgs e) { if (String.IsNullOrEmpty(txtBxUsername.Text) || String.IsNullOrEmpty(txtBxPassword.Text) || String.IsNullOrEmpty(txtBxEmail.Text)) { lblAddVendorError.Text = "Please ensure all fields are entered"; lblAddVendorError.Visible = true; } else { DBPOS dbp = new DBPOS(); dbp.InsertAccount(txtBxEmail.Text, txtBxUsername.Text, txtBxPassword.Text, "GETDATE()",2); dbp.InsertVendor(dbp.GetAccountID(txtBxUsername.Text),txtBxUsername.Text, txtBxContactPerson.Text, txtBxContactNo.Text); MessageBox.Show("Vendor account has been created."); txtBxEmail.Text = ""; txtBxUsername.Text = ""; txtBxPassword.Text = ""; txtBxEmail.Text = ""; txtBxContactPerson.Text = ""; txtBxContactNo.Text = ""; } }
private void btnSubmit_Click(object sender, EventArgs e) { panelPg1.Visible = false; panelPg2.Visible = true; DialogResult dr; DBPOS dbp = new DBPOS(); string cardType = ""; if (radioMasterVisa.Checked) { cardType = radioMasterVisa.Text; } else if (radioAmericanExp.Checked) { cardType = radioAmericanExp.Text; } if (String.IsNullOrEmpty(txtBxCreditCardName.Text) || String.IsNullOrEmpty(txtBxCreditCardNo.Text) || String.IsNullOrEmpty(txtBxCVC.Text) || String.IsNullOrEmpty(txtBxSixDigitPIN.Text) || !radioAmericanExp.Checked && !radioMasterVisa.Checked) { dr = MessageBox.Show("Are you sure you want to skip Entering Credit Card Details? (Can be entered later)", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr == DialogResult.No) { MessageBox.Show( "Please ensure that you have fill in all your credit card credentials to complete your payment.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { dbp.InsertAccount(txtBxEmail.Text, txtBxUsername.Text, txtBxPassword.Text, "GETDATE()", 1); dbp.InsertCustomer(dbp.GetAccountID(txtBxUsername.Text), txtBxFirstName.Text, txtBxLastName.Text, txtBxMobileNo.Text, dtpDOB.Value.Date); MessageBox.Show("Your account has been created, without payment"); this.Close(); } } else { dbp.InsertAccount(txtBxEmail.Text, txtBxUsername.Text, txtBxPassword.Text, "GETDATE()", 1); dbp.InsertCustomer(dbp.GetAccountID(txtBxUsername.Text), txtBxFirstName.Text, txtBxLastName.Text, txtBxMobileNo.Text, dtpDOB.Value.Date); dbp.InsertCreditCard(dbp.GetAccountID(txtBxUsername.Text), txtBxCreditCardName.Text, long.Parse(txtBxCreditCardNo.Text), dtpExpiryDate.Value,int.Parse(txtBxCVC.Text), int.Parse(txtBxSixDigitPIN.Text), cardType); MessageBox.Show("Your account has been created, with payment"); this.Close(); } }