Beispiel #1
0
        protected void dlPriceSearchedProducts_ItemCommand(object source, DataListCommandEventArgs e)
        {
            if (e.CommandName == "ProductView")
            {
                int id = Convert.ToInt32(e.CommandArgument);
                Session["ProductViewId"] = id;

                Response.Redirect("~/Customer/ProductQuickView.aspx");
            }
            else if (e.CommandName == "CartView")
            {
                int  colorid      = Convert.ToInt32(e.CommandArgument);
                var  cololrSearch = _color.Search(colorid);
                var  data         = product.Search(cololrSearch.ProductId);
                int  UserId       = Convert.ToInt32(Session["UserId"]);
                bool item         = cart.ProductSearchByColor(data.ProductId, UserId, cololrSearch.Colourname);

                if (item == true)
                {
                    cart.Insert(new Cart
                    {
                        ProductId  = data.ProductId,
                        Quantity   = 1,
                        Date       = DateTime.Today,
                        UserId     = UserId,
                        ColorId    = cololrSearch.Colourname,
                        Size       = data.Size,
                        NewColorId = colorid
                    });

                    Label lblcarts = Page.Master.FindControl("lblcart") as Label;
                    //  Label lblwishlist = Page.Master.FindControl("lblwishlist") as Label;
                    lblcarts.Text = cart.getTotalCountOfCart(UserId).ToString();
                    //    lblwishlist.Text = wishlist.getTotalCountOfCart((UserId)).ToString();
                }
            }
            else if (e.CommandName == "WishlistView")
            {
                int  colorid      = Convert.ToInt32(e.CommandArgument);
                var  cololrSearch = _color.Search(colorid);
                var  data         = product.Search(cololrSearch.ProductId);
                int  UserId       = Convert.ToInt32(Session["UserId"]);
                bool item         = wishlist.ProductSearch(cololrSearch.ProductId, UserId, colorid);

                if (item == true)
                {
                    wishlist.Insert(new Wishlist
                    {
                        ProductId = data.ProductId,
                        UserId    = UserId, ColorId = colorid
                    });
                    // Label lblcarts = Page.Master.FindControl("lblcart") as Label;
                    Label lblwishlist = Page.Master.FindControl("lblwishlist") as Label;
                    // lblcarts.Text = cart.getTotalCountOfCart(UserId).ToString();
                    lblwishlist.Text = wishlist.getTotalCountOfCart((UserId)).ToString();
                }
            }
        }
Beispiel #2
0
        protected void LinkButton2_Click(object sender, EventArgs e)
        {
            int  colorid      = Convert.ToInt32(Session["ProductViewId"]);
            var  colorDetails = _colour.Search(colorid);
            var  data         = product.Search(colorDetails.ProductId);
            int  UserId       = Convert.ToInt32(Session["UserId"]);
            bool item         = wishlist.ProductSearch(colorDetails.ProductId, UserId, colorDetails.ColourId);

            if (item == true)
            {
                wishlist.Insert(new Wishlist
                {
                    ProductId = data.ProductId,
                    UserId    = UserId,
                    ColorId   = colorid
                });

                //  Label lblcarts = Page.Master.FindControl("lblcart") as Label;
                Label lblwishlist = Page.Master.FindControl("lblwishlist") as Label;
                //  lblcarts.Text = cart.getTotalCountOfCart(UserId).ToString();
                lblwishlist.Text = wishlist.getTotalCountOfCart((UserId)).ToString();
            }
        }
Beispiel #3
0
        protected void datalistCartView_ItemCommand(object source, DataListCommandEventArgs e)
        {
            if (e.CommandName == "Remove")
            {
                int id = Convert.ToInt32(e.CommandArgument);
                cart.Delete(id);
                datalistCartView.DataBind();
            }
            if (e.CommandName == "WishlistMove")
            {
                int  colorid     = Convert.ToInt32(e.CommandArgument);
                var  colodetails = _color.Search(colorid);
                var  cartDetails = cart.SearchByColorid(colorid);
                var  data        = product.Search(cartDetails.ProductId);
                int  UserId      = Convert.ToInt32(Session["UserId"]);
                bool item        = wishlist.ProductSearch(cartDetails.ProductId, UserId, cartDetails.NewColorId);

                if (item == true)
                {
                    wishlist.Insert(new Wishlist
                    {
                        ProductId = data.ProductId,
                        UserId    = UserId,
                        ColorId   = colorid
                    });

                    cart.Delete(cartDetails.CartId);
                }
                //  Label lblcarts = Page.Master.FindControl("lblcart") as Label;
                Label lblwishlist = Page.Master.FindControl("lblwishlist") as Label;
                //  lblcart.Text = _cart.getTotalCountOfCart(Convert.ToInt32(Session["UserId"])).ToString();
                lblwishlist.Text = wishlist.getTotalCountOfCart((UserId)).ToString();


                datalistCartView.DataBind();
            }
        }
Beispiel #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //if (IsPostBack)
            //{



            //}
            if (!IsPostBack)
            {
                string userid = Session["UserId"].ToString();
                lblcart.Text     = _cart.getTotalCountOfCart(Convert.ToInt32(userid)).ToString();
                lblwishlist.Text = _wishlist.getTotalCountOfCart(Convert.ToInt32(userid)).ToString();
                //DirectoryInfo di = new DirectoryInfo(Server.MapPath("~/Images/ProfilePic/"));
                //foreach (var item in di.GetFiles())
                //{
                //    if (item.Name.StartsWith(userid))
                //    {
                //        imgprofile.ImageUrl = "~/Images/ProfilePic/" + userid + ".jpg";
                //    }
                //    else
                //    {
                //        imgprofile.ImageUrl = "~/Images/ProfilePic/male.png";
                //    }
                //}
                imgprofile.ImageUrl = "~/Images/ProfilePic/" + userid + ".jpg";
                //   string userid12 = Session["UserId"].ToString();
                lblcart.Text     = _cart.getTotalCountOfCart(Convert.ToInt32(userid)).ToString();
                lblwishlist.Text = _wishlist.getTotalCountOfCart(Convert.ToInt32(userid)).ToString();
            }

            string userid12 = Session["UserId"].ToString();

            lblcart.Text     = _cart.getTotalCountOfCart(Convert.ToInt32(userid12)).ToString();
            lblwishlist.Text = _wishlist.getTotalCountOfCart(Convert.ToInt32(userid12)).ToString();

            foreach (var item in _brand.GetallData())
            {
                Button b1 = new Button
                {
                    Height          = 30,
                    Width           = 100,
                    Text            = item.BrandName,
                    CssClass        = "submenuButton",
                    CommandArgument = item.BrandId.ToString()
                };
                b1.Command += Load_BrandProduct;
                PlaceHolder1.Controls.Add(b1);
            }
            foreach (var item in _category.GetallData())
            {
                Button b = new Button
                {
                    Height          = 30,
                    Width           = 100,
                    Text            = item.CategoryName,
                    CssClass        = "submenuButton",
                    CommandArgument = item.CategoryId.ToString(),
                };
                b.Command += Load_Items;
                PlaceHolder2.Controls.Add(b);
            }
        }