//when confirm button are clicked protected void btnConfirm_Click(object sender, EventArgs e) { //payment details can not be null if (tbxName.Text != null && tbxCC.Text != null && ddlCCType.Text != null && tbxExpDate.Text != null) { ShoppingCart sc = (ShoppingCart)Session["cart"]; sc.Name = tbxName.Text; if (rdbCash.Checked == true) { sc.OptionPay = rdbCash.Text; } else { sc.OptionPay = rdbCC.Text; } sc.CreditCard = tbxCC.Text; sc.CreditCardType = ddlCCType.Text; sc.SecurityCode = tbxCode.Text; sc.CCExpiryDate = tbxExpDate.Text; string a = lblAmount.Text; string b = a.Substring(1); lblAmount.Text = b; sc.TotalAmount = Convert.ToDecimal(lblAmount.Text); Review r = new Review() { Rating = 0, Remarks = " ", Seminar = sc.Seminar, Member = sc.Member }; int id = ReviewDBMgr.insertReview(r); int Id = ShoppingCartDBMgr.purchaseSeminar(sc); lblOutput.Text = "Confirm. order id is " + Id; //display output for payment successfully //lblOutput.Text = "Payment Successfully!"; //make it null for amount, date and session of cart after transaction are being successful lblAmount.Text = null; lblDate.Text = null; Session["cart"] = null; //send an email for confirmation SmtpClient client = new SmtpClient("smtp.gmail.com"); client.EnableSsl = true; client.Credentials = new NetworkCredential("*****@*****.**", "inft.3050"); MailMessage msg = new MailMessage("*****@*****.**", sc.Member.Email); msg.Subject = "Payment confirmation"; msg.Body = "Thanks for joining our seminar!"; client.Send(msg); } else { //display an output if payment is not valid lblOutput.Text = "Payment is not valid!"; } }