Exemplo n.º 1
0
        protected void btnCheckout_Click(object sender, EventArgs e)
        {
            int          userId   = Convert.ToInt32(Session["userId"].ToString());
            Carts        checkout = CartRepository.getCartData((int)Session["userId"]);
            String       paymentType;
            List <Carts> carts          = db.Carts.Where(c => c.UserID == userId).ToList();
            int          paymentTypesID = paymentTypeID.SelectedIndex;

            try
            {
                paymentType = paymentTypeID.SelectedItem.Value;
            }
            catch
            {
                paymentType = "";
            }
            if (checkout == null)
            {
                errMsg.Text = "Cannot Check out, the cart is empty";
            }
            else if (paymentTypeID.SelectedIndex < 0)
            {
                errMsg.Text = "Payment Type must be selected";
            }
            else
            {
                errMsg.Text     = "PaymentTypeIndex: " + paymentTypesID;
                paymentTypesID += 1;
                TransactionController.CheckOut(userId, paymentTypesID, carts);
                CartRepository.EmptyCart(userId);
                Response.Redirect("Home.aspx");
            }
        }
Exemplo n.º 2
0
        protected void btnCheckout_Click(object sender, EventArgs e)
        {
            User   us          = (User)Session["user"];
            string paymentType = DropDownListPaymentType.Text.ToString();
            int    paymentID   = CartController.searchByName(paymentType);

            TransactionController.CheckOut(us.UserID, paymentID);

            Response.Redirect("SuccessPage.aspx");
        }
        protected void CheckoutButton1_Click(object sender, EventArgs e)
        {
            int userID    = Int32.Parse(Session["user"].ToString());
            int paymentID = Int32.Parse(listPaymentType.Text);

            ErrorMessage.Text = CartController.checkout(listPaymentType.Text, userID);
            if (ErrorMessage.Text == "")
            {
                TransactionController.CheckOut(userID, paymentID);
                GridView1.DataBind();
                ErrorMessage.Text = "Checkout Success";
            }
        }