public static void addPaymentRecord(PaymentMake obj) { string cs = ConfigurationManager.ConnectionStrings["BowlingConnectionString"].ConnectionString; using (SqlConnection con = new SqlConnection(cs)) { SqlCommand cmd = new SqlCommand("insert into payment values (@cardName,@cardNumber,@secCode,@date)", con); con.Open(); cmd.Parameters.AddWithValue("cardName", obj.cardName); cmd.Parameters.AddWithValue("cardNumber", obj.cardNumber); cmd.Parameters.AddWithValue("date", obj.date); cmd.Parameters.AddWithValue("secCode", obj.secCode); cmd.ExecuteNonQuery(); } }
protected void Pay_Click(object sender, EventArgs e) { Customer Cust = (Customer)Session["Customer"]; Receipt PendingBooking = (Receipt)Session["PendingBooking"]; LaneTicket LaneTick = (LaneTicket)Session["LaneTick"]; String ExpDate = DropDownListExpMon.SelectedValue + "/" + DropDownListExpYear.SelectedValue; PaymentMake obj = new PaymentMake { cardName = txtCardName.Text, cardNumber = txtCardNum.Text, date = ExpDate, secCode = txtSecCode.Text }; LaneStatusAccessLayer.addPaymentRecord(obj); LaneStatusAccessLayer.addRecord(Cust, PendingBooking, LaneTick); Response.Redirect("~/ConfirmForm.aspx"); }