예제 #1
0
        public List <SepetUrun> GetSepetItems()
        {
            Sepetim usersShoppingCart = new Sepetim();
            string  sepetID           = usersShoppingCart.SepetIdAl();

            if (sepetID == null)
            {
                LabelTotalText.Text         = "";
                lblTotal.Text               = "";
                ShoppingCartTitle.InnerText = "Sepetiniz Boş";
                UpdateBtn.Visible           = false;
                CheckoutBtn.Visible         = false;
                return(null);
            }
            var items = usersShoppingCart.SepetItems(sepetID);

            decimal sepetTutari = items.Sum(od => od.Miktar * od.Urun.BirimFiyat);

            if (sepetTutari > 0)
            {
                lblTotal.Text = string.Format("{0:c}", sepetTutari);
                return(items.Select(x => new SepetUrun {
                    Miktar = x.Miktar, BirimFiyat = x.Urun.BirimFiyat, Ad = x.Urun.Ad, Id = x.Urun.Id
                }).ToList());
            }
            else
            {
                LabelTotalText.Text         = "";
                lblTotal.Text               = "";
                ShoppingCartTitle.InnerText = "Sepetiniz Boş";
                UpdateBtn.Visible           = false;
                CheckoutBtn.Visible         = false;
                return(null);
            }
        }
예제 #2
0
        decimal _SepetToplam = 0; //sepette yer alan ürünlerin toplam fiyatı
                                  //-------------------------------------------------------------
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack)
            {
                return;
            }
            Sepetim usersShoppingCart = new Sepetim();
            var     items             = usersShoppingCart.SepetItems(Session["SepetId"].ToString());

            Listem.DataSource = items.Select(x => new SepetUrun {
                Miktar = x.Miktar, BirimFiyat = x.Urun.BirimFiyat, Ad = x.Urun.Ad, Id = x.Urun.Id
            }).ToList();
            Listem.DataBind();

            //CheckOutHeader.InnerText = "Sepetiniz Boş";
            //LabelCartHeader.Text = "";
            //Gönder.Visible = false;
        }