Example #1
0
        // 2.
        private void BenzerUrunleriGetir()
        {
            int?categoryId = SelectedProduct.CategoryID;

            db = new Web.Library.ORMETicaretDBDataContext();

            var result = from x in db.Products where x.CategoryID == categoryId select x;

            DataList1.DataSource = result.Take(3).ToList();
            // DataList'ime çoklu veriden sadece ilk 3 adedi gelecek ...
            DataList1.DataBind(); // unutmayın !!!
        }
Example #2
0
        protected void lbtnUrunKarsilastir_Click(object sender, EventArgs e)
        {
            db = new Web.Library.ORMETicaretDBDataContext();

            // 1a.
            Web.Library.Product selectedProduct = db.Products.FirstOrDefault(p => p.ProductID == Convert.ToInt32(hfProductID.Value));

            // 2a.
            List <Web.Library.Product> comparableItemsEnd = Web.Library.Compare.CompareTools.AddCompare(Session["myComparable"], selectedProduct);

            // 1b.
            SelectedProduct = selectedProduct;
            // 2b.
            Session["myComparable"] = comparableItemsEnd;

            // sayfayı tekrar kendine gönderme -> auto postBack özelliği gibi ...
            Response.Redirect(Page.Request.Url.ToString());
        }
Example #3
0
        protected void lbtnSepeteEkle_Click(object sender, EventArgs e)
        {
            db = new Web.Library.ORMETicaretDBDataContext();

            Web.Library.Product selectedProd = db.Products.FirstOrDefault(p => p.ProductID == Convert.ToInt32(hfProductID.Value));

            List <Web.Library.Cart.CartProduct> currentItemsEnd = Web.Library.Cart.CartTools.GetAllCartProduct(Session["myCart"]);

            currentItemsEnd.Add(new Web.Library.Cart.CartProduct()
            {
                Quantity        = 1,
                SelectedProduct = (Web.Library.Product)selectedProd
            });

            SelectedProduct   = selectedProd;
            Session["myCart"] = currentItemsEnd;

            // sayfayı tekrar kendine gönderme -> auto postBack özelliği gibi ...
            Response.Redirect(Page.Request.Url.ToString());
        }