コード例 #1
0
        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");
        }
コード例 #2
0
ファイル: Order.cs プロジェクト: AistisT/WhiskyGaloreShop
        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();
        }
コード例 #3
0
ファイル: Payment.cs プロジェクト: AistisT/WhiskyGaloreShop
        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();
                }
            }
        }
コード例 #4
0
        // 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");
            }
        }