Beispiel #1
0
        public void StoreCustomerInfo(CustomerInfo ci)
        {
            var db = new LaSuBuContainer();

            var currentDate = DateTime.Now;
            Transaction currentTrans = new Transaction
                {
                    Address = ci.Address,
                    Amount = Session["totalAmount"].ToString(),
                    City = ci.City,
                    CustomerName = ci.Name,
                    Date = currentDate,
                    Email = ci.Email,
                    Phone = ci.Phone,
                    Zip = ci.Zip,
                    State = ci.State,
                    Status = "Failed"
                };

            db.Transactions.Add(currentTrans);
            db.SaveChanges();
            //setUsername / id of transaction in session to persist PayPal Info
            Session["customerName"] = ci.Name;
            Session["transId"] = currentTrans.Id;
        }
Beispiel #2
0
        public void Make_Payment(object sender, EventArgs e)
        {
            CustomerInfo ci = new CustomerInfo{Address = tbAddress.Text, Phone = tbPhoneNumber.Text, City = tbCity.Text, Name = tbName.Text, State = ddlState.SelectedValue, Zip = tbZip.Text};

            if (Session["cart"] != null)
            {
                StoreCustomerInfo(ci);
                StoreTransactionItems();
                GeneratePayPalToken();
            }
            else
            {
                lblWarning.Text = "No items in your shopping cart";
                lblWarning.ForeColor = System.Drawing.Color.Red;
            }
        }