protected void savePaymentToDatabase(string email, string tx) { decimal paymentAmt = (decimal)Session["TotalExpense"]; ParticipantsTransactionsClient client = new ParticipantsTransactionsClient(); List<ParticipantTransaction> transList = new List<ParticipantTransaction>(); DataSet dsCarts = Carts.LoadCart(email); foreach (DataRow dr in dsCarts.Tables[0].Rows) { ParticipantTransaction t = new ParticipantTransaction(); t.Amount = decimal.Parse(dr["price"].ToString()); t.Email = email; t.EventID = int.Parse(dr["Event_ID"].ToString()); t.TransactionDateTime = DateTime.Now; t.TransactionID = tx; t.Remarks = ""; transList.Add(t); } client.SaveTransaction(tx, transList.ToArray()); Carts.DeleteUserCart(email); client.Close(); MailHandler.sendPaymentReceivedMail(email, tx, paymentAmt); }