Beispiel #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);
            }
        }
        protected void Gönder_Click(object sender, EventArgs e)
        {
            Sepetim usersShoppingCart = new Sepetim();

            if ((usersShoppingCart.SiparişiGönder(txtKartNo.Text, txtAdSoyad.Text) == true) && (txtAdres.Text != ""))
            {
                CheckOutHeader.InnerText = "Teşekkürler - Siparişiniz Alındı.";
                //Message.Visible = false;
                SiparişTamamlama.Visible = false;
                Session.Remove("SepetId");
            }
            else
            {
                Gönder.Visible           = true;
                CheckOutHeader.InnerText = "Siparişiniz Alınamadı - Lütfen Tekrar Deneyin. ";
            }
        }
        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;
        }
Beispiel #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string rawId = Request.QueryString["ÜrünId"];
            int    ürünId;

            if (!String.IsNullOrEmpty(rawId) && Int32.TryParse(rawId, out ürünId))
            {
                //Ürün ekle
                Sepetim usersShoppingCart = new Sepetim();
                usersShoppingCart.UrunEkle(ürünId, 1);
            }
            else
            {
                Debug.Fail("ERROR!");
                throw new Exception("ERROR!");
            }
            Response.Redirect("Sepetim.aspx");
        }
Beispiel #5
0
        protected void UpdateBtn_Click(object sender, ImageClickEventArgs e)
        {
            Sepetim usersShoppingCart = new Sepetim();
            string  sepetID           = usersShoppingCart.SepetIdAl();

            SepetGüncelleme[] sepetUpdates = new SepetGüncelleme[grdListe.Rows.Count];
            for (int i = 0; i < grdListe.Rows.Count; i++)
            {
                IOrderedDictionary rowValues = new OrderedDictionary();
                rowValues = GetValues(grdListe.Rows[i]);
                sepetUpdates[i].UrunId = Convert.ToInt32(rowValues["Id"]);

                sepetUpdates[i].AlimMiktari = Convert.ToInt16(rowValues["Miktar"]);

                CheckBox cbRemove = (CheckBox)grdListe.Rows[i].FindControl("chkCikar");
                sepetUpdates[i].UrunCikar = cbRemove.Checked;
            }

            usersShoppingCart.SepetiVeritabanındaGüncelle(sepetID, sepetUpdates);
            grdListe.DataBind();
        }