/// <summary>
 /// 收藏关系修改
 /// </summary>
 /// <param name="GoodsId">商品id</param>
 /// <returns></returns>
 public JsonResult CollectionPlay(int GoodsId)
 {
     if (CollectionBll.CreateOrUpdateCollection(GoodsId, Convert.ToInt32(Session["userid"])))
     {
         return(Json(1, JsonRequestBehavior.AllowGet));
     }
     return(Json(0, JsonRequestBehavior.AllowGet));
 }
 // GET: 购物车首页
 public ActionResult ShopCarIndex()
 {
     //商品图片
     ViewBag.GoodsPhoto = GoodsPhotoBll.SelectAllGoodsPhoto();
     //查询当前用户与购物车中的商品的收藏关系
     ViewBag.UserCollection = CollectionBll.SelectUserCollection(Convert.ToInt32(Session["userid"]));
     //查询当前用户所有购物车信息
     return(View(ShopingCarBll.SelectAllShopCar(Convert.ToInt32(Session["userid"]))));
 }
Example #3
0
        protected void collectbutton_Click(object sender, EventArgs e)
        {
            if (Session["User_ID"] != null)
            {
                if (collectflag == false)
                {
                    Collection collection = new Collection();
                    collection.User_ID = int.Parse(Session["User_ID"].ToString());
                    collection.Pro_ID  = int.Parse(Request.QueryString["pro_id"].ToString());
                    collection.collect = "收藏";
                    if (CollectionBll.addCollect(collection) == 1)
                    {
                        ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "updateScript", "alert('收藏成功!');", true);
                        collectbutton.CssClass = "btn btn-large";
                        collectbutton.Text     = "已收藏";
                        collectflag            = true;
                    }
                }
                else if (collectflag == true)
                {
                    int User_ID = int.Parse(Session["User_ID"].ToString());
                    int Pro_ID  = int.Parse(Request.QueryString["pro_id"].ToString());

                    if (CollectionBll.deleteCollect(User_ID, Pro_ID) == 1)
                    {
                        ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "updateScript", "alert('取消收藏成功!');", true);
                        collectbutton.CssClass = "btn btn-primary btn-large";
                        collectbutton.Text     = "收藏";
                        collectflag            = false;
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "updateScript", "alert('取消失败!');", true);
                    }
                }
            }
            else
            {
                ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "updateScript", "alert('收藏失败,请登录!');", true);
            }
        }
        /// <summary>
        /// 商品详情
        /// </summary>
        /// <param name="goodsid">商品id</param>
        /// <returns></returns>
        public ActionResult GoodsDesc(int goodsid)
        {
            //商品图片
            ViewBag.GoodsPhoto = GoodsPhotoBll.SelectAllGoodsPhoto().Where(p => p.GoodsID == goodsid).ToList();
            //商品的所有评价(置顶排序)
            List <CommentTable> list = CommentBll.SelectGoodsComment(goodsid).OrderByDescending(p => p.IsTop).ToList();

            Session["GoodsComment"] = list;
            //用户是否收藏商品
            ViewBag.iscollection = CollectionBll.SelectOneCollection(Convert.ToInt32(Session["userid"]), goodsid);
            //加载或更新用户购物车数量
            if (Session["userid"] != null)
            {
                Session["carcount"] = ShopingCarBll.SelectAllShopCar(Convert.ToInt32(Session["userid"])).Count();
            }
            //获取到的该商品的信息
            GoodsTable good = GoodsBll.SelectGoodsIdGoods(goodsid);

            //相关商品的推荐(3条)
            ViewBag.GetGoods      = GoodsBll.SelectGetGoods(good.TID ?? 0).Where(p => p.GoodsID != good.GoodsID).OrderBy(p => Guid.NewGuid()).Take(3).ToList();
            Session["GoodsPhoto"] = GoodsPhotoBll.SelectAllGoodsPhoto();
            return(View(good));
        }
Example #5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     CKFinder.FileBrowser fileBrowser = new CKFinder.FileBrowser();
     fileBrowser.BasePath = "../ckfinder/";  //设置CKFinder的基路径
     fileBrowser.SetupCKEditor(txtContent);
     if (!IsPostBack)
     {
         flag = true;
         //id = int.Parse(Request.QueryString["pro_id"].ToString());
         #region 绑定前台数据
         //BindNew();
         //BindTop();
         //BindTally();
         if (Request.QueryString["pro_id"] != null)
         {
             SqlDataReader proclassname = AcgService.select(int.Parse(Request.QueryString["pro_id"].ToString()));
             proclassname.Read();
             string    classname = proclassname["Pro_Class"].ToString();
             DataTable dt        = AcgService.select1(int.Parse(Request.QueryString["pro_id"].ToString()));
             if (classname == "视频")
             {
                 shiping.Visible      = true;
                 otheracg.Visible     = false;
                 acgdetall.DataSource = dt;
                 acgdetall.DataBind();
             }
             else
             {
                 shiping.Visible      = false;
                 otheracg.Visible     = true;
                 Repeater2.DataSource = dt;
                 Repeater2.DataBind();
             }
             BindBC();
             //显示总共多少评论
             num.Text = CommentService.num(int.Parse(Request.QueryString["pro_id"].ToString())).ToString();
         }
         #endregion
         #region 举报收藏
         if (Session["User_ID"] != null && Request.QueryString["pro_id"].ToString() != null)
         {
             SqlDataReader colletdt = CollectionBll.seletcCollect(int.Parse(Session["User_ID"].ToString()), int.Parse(Request.QueryString["pro_id"].ToString()));
             colletdt.Read();
             SqlDataReader informdt = InformBll.seletcInform(int.Parse(Session["User_ID"].ToString()), int.Parse(Request.QueryString["pro_id"].ToString()));
             informdt.Read();
             if (colletdt != null && colletdt.HasRows == true)
             {
                 collectbutton.CssClass = "btn btn-large";
                 collectbutton.Text     = "已收藏";
                 collectflag            = true;
             }
             else
             {
                 collectbutton.CssClass = "btn btn-primary btn-large";
                 collectbutton.Text     = "收藏";
                 collectflag            = false;
             }
             if (informdt != null && informdt.HasRows == true)
             {
                 informbutton.CssClass = "btn btn-large";
                 informbutton.Text     = "已举报";
                 informflag            = true;
             }
             else
             {
                 informbutton.CssClass = "btn btn-danger btn-large";
                 informbutton.Text     = "举报";
                 informflag            = false;
             }
         }
         #endregion
     }
 }
Example #6
0
        /// <summary>
        /// 我的收藏分布视图
        /// </summary>
        /// <returns></returns>
        public ActionResult MyCollection()
        {
            List <CollectionTable> list = CollectionBll.SelectUserCollection(Convert.ToInt32(Session["userid"])).Where(p => p.IsCollection == 1).ToList();

            return(PartialView("MyCollection", list));
        }