public ActionResult PaymentDetails(Payment p)
        {
            if (ModelState.IsValid)
            {
                String username = Session["loginName"].ToString();
                String accountType = Session["account"].ToString();
                p.completePayment(p, username, accountType);
            }
            else
            {

                return View(p);
            }
            return RedirectToAction("Index", "Checkout");
        }
Beispiel #2
0
        public Order(string username, String accountType, ShoppingCart cart)
        {
            this.cart = (ShoppingCart) cart;

            if (accountType.Equals("Personal"))
            {
                customerDetails = new Customer(username);
                country = customerDetails.country;
            }
            else
            {
                retailerDetails = new Retailer();
                retailerDetails.getRetailer(username);
                country = retailerDetails.country;
            }

            paymentDetails = new Payment(username, accountType);
            getShippersDetails();

            getTotals();
        }
Beispiel #3
0
        public void updatePayment(Payment p, String username, String accountType)
        {
            using (MySqlConnection con = new MySqlConnection(con_str))
            {
                con.Open();
                using (MySqlCommand cmd = new MySqlCommand("updatePayment", con))
                {
                    cmd.CommandType = CommandType.StoredProcedure;

                    cmd.Parameters.AddWithValue("@username", username);
                    cmd.Parameters.AddWithValue("@accountType", accountType);

                    //params for address
                    cmd.Parameters.AddWithValue("@firstLine", p.firstLine);
                    if (p.secondLine != null)
                    {
                        cmd.Parameters.AddWithValue("@secondLine", p.secondLine);
                    }
                    else
                    {
                        cmd.Parameters.AddWithValue("@secondLine", null);
                    }
                    cmd.Parameters.AddWithValue("@town", p.town);
                    cmd.Parameters.AddWithValue("@postcode", p.postcode);
                    cmd.Parameters.AddWithValue("@region", p.region);
                    cmd.Parameters.AddWithValue("@country", p.country);

                    //params for insert into paymentdetails
                    cmd.Parameters.AddWithValue("@creditCardType", p.cardType.ToString());
                    cmd.Parameters.AddWithValue("@fName", p.cardForename);
                    cmd.Parameters.AddWithValue("@lName", p.cardSurname);
                    cmd.Parameters.AddWithValue("@cardNumber", p.cardNo);
                    cmd.Parameters.AddWithValue("@startDate", p.startDate);
                    cmd.Parameters.AddWithValue("@expiryDate", p.endDate);
                    cmd.Parameters.AddWithValue("@issueNumber", p.issueNo);

                    cmd.ExecuteNonQuery();

                    con.Close();
                }
            }
        }
        // GET: /Details/UpdatePayment
        public ActionResult UpdatePayment()
        {
            if (Session["loggedIn"] != null)
            {
                ModelState.Clear();
                String username = Session["loginName"].ToString();
                String accountType = Session["account"].ToString();
                Payment pay = new Payment(username, accountType);

                return View(pay);
            }
            else
            {
                return RedirectToAction("Index", "Login");
            }
        }