示例#1
0
        protected void Page_PreRender(object sender, EventArgs e)
        {
            ShoppingCartActions usersShoppingCart = new ShoppingCartActions();
            string cartStr = string.Format("Cart ({0})", usersShoppingCart.GetCount());

            cartCount.InnerText = cartStr;
        }
示例#2
0
 protected void Page_PreRender(object sender, EventArgs e)
 {
     using (ShoppingCartActions sca = new ShoppingCartActions())
     {
         cartCount.InnerText = string.Format("Cart: ({0})", sca.GetCount());
     }
 }
 protected void Page_PreRender(object sender, EventArgs e)
 {
     using (ShoppingCartActions usersShoppingCart = new ShoppingCartActions())
     {
         cartCount.InnerText = usersShoppingCart.GetCount().ToString();
     }
 }
 protected void Page_PreRender(object sender, EventArgs e)
 {
     using (ShoppingCartActions userShoppingCart = new ShoppingCartActions())
     {
         cartCount.InnerText = String.Format("Cart ({0}) ", userShoppingCart.GetCount());
     }
 }
示例#5
0
 protected void Page_PreRender(object sender, EventArgs e)
 {
     using (var usersShoppingCart = new ShoppingCartActions()) {
         string cartStr = $"Cart&nbsp;&nbsp;<span class=\"badge\">{usersShoppingCart.GetCount()}</span>";
         cartCount.InnerHtml = cartStr;
     }
 }
示例#6
0
 protected void Page_PreRender(object sender, EventArgs e)
 {
     using (ShoppingCartActions shoppingCart = new ShoppingCartActions())
     {
         string cartStr = string.Format("Cart ({0})", shoppingCart.GetCount());
         CartItemCountLink.Text = cartStr;
     }
 }
示例#7
0
 protected void Page_PreRender(object sender, EventArgs e)
 {
     using (ShoppingCartActions shoppingCartActions = new ShoppingCartActions())
     {
         string catStr = string.Format("Cart ({0})", shoppingCartActions.GetCount());
         cartCount.InnerText = catStr;
     }
 }
示例#8
0
 protected void Page_PreRender(Object sender, EventArgs e)
 {
     using (ShoppingCartActions userShoppingCart = new ShoppingCartActions())
     {
         string cartStr = string.Format($"Cart ({userShoppingCart.GetCount()})");
         cartCount.InnerText = cartStr;
     }
 }
示例#9
0
 protected void Page_Prerender(object sender, EventArgs e)
 {
     using (ShoppingCartActions usersShoppingCart = new ShoppingCartActions())
     {
         string cartStr = " " + usersShoppingCart.GetCount();
         CartCount.Text = cartStr;
     }
 }
示例#10
0
 protected void Page_PreRender(object sender, EventArgs e)                           // This was needed to add he counter to the shoppingCart
 {
     using (ShoppingCartActions usersShoppingCart = new ShoppingCartActions())
     {
         string cartStr = string.Format("Cart ({0})", usersShoppingCart.GetCount());
         cartCount.InnerText = cartStr;
     }
 }
示例#11
0
        protected void Page_PreRender(object sender, EventArgs e)
        {
            using (var shoppingCartActions = new ShoppingCartActions())
            {
                var cartStr = string.Format($"Cart({shoppingCartActions.GetCount()})");

                cartCount.InnerText = cartStr;
            }
        }
示例#12
0
 //Pre nego što se stranica prikaže kao HTML, podiže se događaj Page_PreRender.
 //Page_PreRender-u, total count korpe za kupovinu se određuje pozivanjem metode GetCount.
 protected void Page_PreRender(object sender, EventArgs e)
 {
     using (ShoppingCartActions usersShoppingCart = new ShoppingCartActions())
     {
         string cartStr = string.Format("Korpa ({0})", usersShoppingCart.GetCount());
         // Vraćena vrednost se dodaje u oznaku cartCount koja je uključena u označavanje stranice Site.Master.
         cartCount.InnerText = cartStr;
     }
 }
示例#13
0
 protected void Page_Load(object sender, EventArgs e)
 {
     using (ShoppingCartActions actions = new ShoppingCartActions())
     {
         if (actions.GetCount() > 0)
         {
             Response.Redirect("ScreenBuilder.aspx");
         }
     }
 }
示例#14
0
        protected void Page_PreRender(object sender, EventArgs e)
        {
            using (ShoppingCartActions usersShoppingCart = new ShoppingCartActions())
            {
                string cartStr = string.Format("Cart ({0})", usersShoppingCart.GetCount());
                cartCount.InnerText = cartStr;
            }

            using (WishlistCartActions usersWishlistCart = new WishlistCartActions())
            {
                string wishStr = string.Format("WishList ({0})", usersWishlistCart.GetCount());
                wishCount.InnerText = wishStr;
            }
        }
示例#15
0
        // GET: Cart
        public ActionResult Index()
        {
            var cartId = new Helpers.CartHelpers().GetCartId();
            var vm     = new CartViewModel();

            using (ShoppingCartActions usersShoppingCart = new ShoppingCartActions(cartId))
            {
                var shoppingCartItems = usersShoppingCart.GetCartItems();
                var cartItemsVM       = Mapper.Map <List <CartItemViewModel> >(shoppingCartItems);
                vm.CartItems  = cartItemsVM;
                vm.ItemsTotal = usersShoppingCart.GetCount();
                vm.OrderTotal = usersShoppingCart.GetTotal();
            }
            //var shoppingCartItems = db.ShoppingCartItems.Include(c => c.Product);
            return(View(vm));
        }
示例#16
0
        // GET: Cart
        public ActionResult Index()
        {
            var cartId = new Helpers.CartHelpers().GetCartId(HttpContext);
            var vm     = new CartModel();

            var usersShoppingCart = new ShoppingCartActions(_db, cartId);

            var shoppingCartItems = usersShoppingCart.GetCartItems();
            var cartItemsVM       = _mapper.Map <List <CartItemModel> >(shoppingCartItems);

            vm.CartItems  = cartItemsVM;
            vm.ItemsTotal = usersShoppingCart.GetCount();
            vm.OrderTotal = usersShoppingCart.GetTotal();

            //var shoppingCartItems = db.ShoppingCartItems.Include(c => c.Product);
            return(View(vm));
        }
示例#17
0
        // GET: Checkout
        public ActionResult Index()
        {
            var vm = new CheckoutModel();

            using (ShoppingCartActions usersShoppingCart = new ShoppingCartActions(cartId, items, categories))
            {
                var shoppingCartItems = usersShoppingCart.GetCartItems();
                var cartItemsVM       = Mapper.Map <List <CartItemModel> >(shoppingCartItems);
                vm.CartItems  = cartItemsVM;
                vm.OrderTotal = usersShoppingCart.GetTotal();
                vm.ItemsTotal = usersShoppingCart.GetCount();
            }

            var user  = (User)Session["User"];
            var email = "*****@*****.**";

            if (user != null && !string.IsNullOrWhiteSpace(user.Email))
            {
                email = user.Email;
            }

            // To make filling out the form faster for demo purposes, pre-fill the values:
            vm.Order = new OrderModel
            {
                // Important! Keep this property here!
                Total = vm.OrderTotal,
                // Prefill properties for convenience:
                FirstName        = "Bob",
                LastName         = "Loblaw",
                Address          = "1313 Mockingbird Lane",
                City             = "Virginia Beach",
                State            = "VA",
                PostalCode       = "23456",
                Country          = "United States",
                Email            = email,
                NameOnCard       = "Bob Loblaw",
                CreditCardType   = "Visa",
                CreditCardNumber = "4111111111111111",
                ExpirationDate   = "12/25",
                CCV      = "987",
                SMSOptIn = true
            };

            return(View(vm));
        }
示例#18
0
        protected void Page_Load(object sender, EventArgs e)
        {
            using (ShoppingCartActions usersShopCart = new ShoppingCartActions())
            {
                decimal cartTotal = 0;
                cartTotal     = usersShopCart.GetTotal();
                lblTotal.Text = String.Format("{0:c}", cartTotal);

                if (usersShopCart.GetCount() == 0)
                {
                    CartList.Visible       = false;
                    LabelTotalText.Visible = false;
                    lblTotal.Visible       = false;
                    RemoveButton.Visible   = false;

                    Button1.Visible     = false;
                    PaypalStuff.Visible = false;

                    EmptyLabel.InnerText = "Cart Is Empty";
                }
            }
        }
        // GET: Checkout
        public ActionResult Index()
        {
            var vm = new CheckoutViewModel();

            using (ShoppingCartActions usersShoppingCart = new ShoppingCartActions(cartId))
            {
                var shoppingCartItems = usersShoppingCart.GetCartItems();
                var cartItemsVM       = Mapper.Map <List <CartItemViewModel> >(shoppingCartItems);
                vm.CartItems  = cartItemsVM;
                vm.OrderTotal = usersShoppingCart.GetTotal();
                vm.ItemsTotal = usersShoppingCart.GetCount();
            }

            // To make filling out the form faster for demo purposes, pre-fill the values:
            vm.Order = new OrderViewModel
            {
                // Important! Keep this property here!
                Total = vm.OrderTotal,
                // Prefill properties for convenience:
                FirstName        = "Bob",
                LastName         = "Loblaw",
                Address          = "1313 Mockingbird Lane",
                City             = "Virginia Beach",
                State            = "VA",
                PostalCode       = "23456",
                Country          = "United States",
                Email            = "*****@*****.**",
                NameOnCard       = "Bob Loblaw",
                CreditCardType   = "Visa",
                CreditCardNumber = "4111111111111111",
                ExpirationDate   = "12/20",
                CCV      = "987",
                SMSOptIn = true
            };

            return(View(vm));
        }
示例#20
0
        public void CalculaFrete()
        {
            // Irá calcular frete conforme o endereço de entrega alterar

            double frete = 0;

            if (Convert.ToInt32(dropIdEnderecoEntrega.SelectedIndex) != 0)
            {
                Endereco endereco = new Endereco();
                // passar o ID do endereço selecionado
                endereco.ID = Convert.ToInt32(dropIdEnderecoEntrega.SelectedValue);

                // pesquisa no BD pelo cliente com e-mail
                entidades = commands["CONSULTAR"].execute(endereco).Entidades;

                endereco = (Endereco)entidades.ElementAt(0);
                int quantidade = 0;

                using (ShoppingCartActions usersShoppingCart = new ShoppingCartActions())
                {
                    // pega quantidade de livros no carrinho
                    quantidade = usersShoppingCart.GetCount();
                }

                // if por ID de estado e arranjo de região
                // SUL
                if (endereco.Cidade.Estado.ID == 18 ||
                    endereco.Cidade.Estado.ID == 23 ||
                    endereco.Cidade.Estado.ID == 24)
                {
                    frete = (quantidade * 5.5);
                }
                // SUDESTE
                else if (endereco.Cidade.Estado.ID == 8 ||
                         endereco.Cidade.Estado.ID == 11 ||
                         endereco.Cidade.Estado.ID == 19 ||
                         endereco.Cidade.Estado.ID == 26)
                {
                    frete = (quantidade * 4.5);
                }
                // CENTRO-OESTE
                else if (endereco.Cidade.Estado.ID == 7 ||
                         endereco.Cidade.Estado.ID == 9 ||
                         endereco.Cidade.Estado.ID == 12 ||
                         endereco.Cidade.Estado.ID == 13)
                {
                    frete = (quantidade * 6.5);
                }
                // NORTE
                else if (endereco.Cidade.Estado.ID == 1 ||
                         endereco.Cidade.Estado.ID == 3 ||
                         endereco.Cidade.Estado.ID == 4 ||
                         endereco.Cidade.Estado.ID == 14 ||
                         endereco.Cidade.Estado.ID == 21 ||
                         endereco.Cidade.Estado.ID == 22 ||
                         endereco.Cidade.Estado.ID == 27)
                {
                    frete = (quantidade * 8.5);
                }
                // NORDESTE (2, 5, 6, 10, 15, 16, 17, 20 e 25)
                else
                {
                    frete = (quantidade * 7.5);
                }
            }

            if (frete != 0)
            {
                // passa para lblFrete o valor do frete
                lblFrete.Text = String.Format("{0:c}", frete);
                float subtotal;
                if (float.TryParse(lblSubtotal.Text.Remove(0, 3), out subtotal))
                {
                    lblTotal.Text = String.Format("{0:c}", frete + subtotal);
                }
            }
        }