public string InsertintoCollect() { string skuid = ""; string type = ""; bool result = false; if (Request.Cookies["UserInfo"] != null) { if (!string.IsNullOrEmpty(RequestBase.GetString("skuid"))) { skuid = RequestBase.GetString("skuid").ToString(); } if (!string.IsNullOrEmpty(RequestBase.GetString("type"))) { type = RequestBase.GetString("type").ToString(); } Model.VipCollectionBase cmodel = new Model.VipCollectionBase(); int mid = (CookieEncrypt.DeserializeObject(System.Web.HttpContext.Current.Request.Cookies["UserInfo"].Value) as Model.MemberBase).m_ID; new BLL.VipCollectionBase().Deletebyskuid(mid, int.Parse(skuid)); cmodel.sku_ID = int.Parse(skuid); cmodel.m_ID = mid; cmodel.vc_CreateOn = DateTime.Now; result = new BLL.VipCollectionBase().Add(cmodel); if (result) { return "操作成功"; } else { return "操作失败"; } } else { return "未登陆"; } }
//我的收藏 public ActionResult VipMycollect() { var model = new ListModel(); string where2 = ""; int page = 1; string skulist = ""; int mid = 0; if (LoginMember != null) { mid = (CookieEncrypt.DeserializeObject(System.Web.HttpContext.Current.Request.Cookies["UserInfo"].Value) as Model.MemberBase).m_ID; ViewData["mid"] =mid; Model.VipCollectionBase cmodel = new Model.VipCollectionBase(); var clist = new BLL.VipCollectionBase().GetModelList(" m_Id=" + mid + " and vc_IsDel=0"); if (clist.Count > 0) { ViewData["collect"] = true; foreach (var item in clist) { skulist += item.sku_ID + ","; } skulist = skulist.Substring(0, skulist.Length - 1); where2 = " and sku_ID in(" + skulist + ")"; List<Model.vw_PInfo> list = new BLL.vw_PInfo().GetModelList(" p_IsDel=0 and p_SellStatus=1 and p_StatusCode=0 " + where2); return View(list.ToList()); } else { ViewData["collect"] = false; return View(); } } else { Response.Redirect("/wapLogin/Login"); return View(); } }
//清空我的收藏 public bool delcollect() { int mid=0; bool result = true; if (!string.IsNullOrEmpty(Request.QueryString["mid"])) { mid = int.Parse(Request.QueryString["mid"]); result = new BLL.VipCollectionBase().DeleteList(" m_id =" + mid); if (result) { return true; } else { return false; } } return false; }
public ActionResult ProDetail() { ViewData["skuid"] = skuid; string where = ""; //添加历史浏览记录 CookieHelper.AddandRepairGoodsToCookie("History", skuid); int zixunpageSize = 2;//每一页的行数 int zixunpageNumber = 1;//当前页数 if (skuid != "") { where = " and sku_ID=" + int.Parse(skuid); } model.vmpinfolist = new BLL.vw_PInfo().GetModelList(" p_IsDel=0 and p_StatusCode=0 and p_SellStatus=1 " + where);//商品信息 model.pimglist = new BLL.ProductImgBase().GetModelList(" sku_ID=" + int.Parse(skuid)+" and pi_IsDel=0 and pi_StatusCode=0");//图片列表 model.productinfo = new BLL.ProductInfoBase().GetModelList(" p_ID=(select p_ID from SKUBase where sku_ID=" + skuid + ") and pin_StatusCode=0 and pin_IsDel=0 and pin_Type='商品介绍'");//商品介绍 model.proattr = new BLL.ProductAttributesBase().GetModelListByskuId(" pad.sku_ID= " + int.Parse(skuid));//属性 model.proattr2 = new BLL.ProductAttributesBase().GetModelListByPid(" and pa.pa_Type=2 and pa.pa_ID in(select pa_ID from ProductAttributeDetails where sku_ID in (select sku_ID from SKUBase where p_ID=(select p_ID from SKUBase where sku_ID=" + int.Parse(skuid) + "))) and sku.sku_ID in (select sku_ID from SKUBase where p_ID=(select p_ID from SKUBase where sku_ID=" + int.Parse(skuid) + "))");//规格 model.zhoupaihang = new BLL.vw_PInfo().getmodelListPH(); //评论 model.pinglun = new BLL.ProductAppraiseBase().GetModelListByskuId(" sku_ID=" + int.Parse(skuid) + "and pa_StatusCode=0 and pa_IsDel=0"); if (model.pinglun.Count > 0) { ViewData["pingluncount"] = model.pinglun.Count; ViewData["tiao"] = int.Parse(model.pinglun[0].pavg.ToString()) * 20;//显示满意度的箭头所指的地方 ViewData["xing"] = int.Parse(model.pinglun[0].pavg.ToString()) * 68 / 5;//显示满意度的箭头所指的地方 } else { ViewData["pingluncount"] = "0"; } //咨询 model.prozixunall = new BLL.ProductConsultBase().GetModelListByskuId(" and sku_ID= " + int.Parse(skuid) + "and pc_StatusCode=0 and pc_IsDel=0"); var zxall = new BLL.ProductConsultBase().GetModelListByskuId(" and sku_ID= " + int.Parse(skuid)); ViewBag.zxall = zxall.ToPagedList(zixunpageNumber, zixunpageSize); ViewData["all"] = model.prozixunall.Count; model.prozixunp1 = new BLL.ProductConsultBase().GetModelListByskuId(" and sku_ID= " + int.Parse(skuid) + " and pc.pc_Type='促销活动提问'"); var zx1 = new BLL.ProductConsultBase().GetModelListByskuId(" and sku_ID= " + int.Parse(skuid) + " and pc.pc_Type='促销活动提问'"); ViewBag.zx1 = zx1.ToPagedList(zixunpageNumber, zixunpageSize); model.prozixunp2 = new BLL.ProductConsultBase().GetModelListByskuId(" and sku_ID= " + int.Parse(skuid) + " and pc.pc_Type='库存及物流提问'"); var zx2 = new BLL.ProductConsultBase().GetModelListByskuId(" and sku_ID= " + int.Parse(skuid) + " and pc.pc_Type='库存及物流提问'"); ViewBag.zx2 = zx2.ToPagedList(zixunpageNumber, zixunpageSize); model.prozixunp3 = new BLL.ProductConsultBase().GetModelListByskuId(" and sku_ID= " + int.Parse(skuid) + " and pc.pc_Type='售后提问'"); var zx3 = new BLL.ProductConsultBase().GetModelListByskuId(" and sku_ID= " + int.Parse(skuid) + " and pc.pc_Type='售后提问'"); ViewBag.zx3 = zx3.ToPagedList(zixunpageNumber, zixunpageSize); model.prozixunp4 = new BLL.ProductConsultBase().GetModelListByskuId(" and sku_ID= " + int.Parse(skuid) + " and pc.pc_Type='商品提问'"); var zx4 = new BLL.ProductConsultBase().GetModelListByskuId(" and sku_ID= " + int.Parse(skuid) + " and pc.pc_Type='商品提问'"); ViewBag.zx4 = zx4.ToPagedList(zixunpageNumber, zixunpageSize); ViewData["p1"] = model.prozixunp1.Count; ViewData["p2"] = model.prozixunp2.Count; ViewData["p3"] = model.prozixunp3.Count; ViewData["p4"] = model.prozixunp4.Count; if (model.vmpinfolist.Any()) { ViewData["youhui"] = model.vmpinfolist[0].sku_scPric - model.vmpinfolist[0].sku_Price; if (LoginMember != null) { var clist = new BLL.VipCollectionBase().GetModelList(" m_ID=" + (CookieEncrypt.DeserializeObject(System.Web.HttpContext.Current.Request.Cookies["UserInfo"].Value) as Model.MemberBase).m_ID + " and sku_ID=" + model.vmpinfolist[0].sku_ID + " and vc_IsDel=0"); if (clist.Count > 0) { ViewData["collect"] = true; } else { ViewData["collect"] = false; } ViewData["logon"] = true; } else { ViewData["collect"] = false; ViewData["logon"] = false; } } else { ViewData["youhui"] = 0; } var groupbuy = new BLL.GroupPurchaseBase().GetModelList(" sku_ID=" + skuid + " and gp_StatusCode=0 and gp_IsDel=0 and gp_EndTime > '" + DateTime.Now + "'"); if (groupbuy.Count > 0) { ViewBag.tuan = groupbuy[0]; } else { ViewBag.tuan = null; ; } var zixunshuoming = _newsBase.GetModelList(" n_Title='咨询说明' and n_StatusCode=0 and n_IsDel=0"); if (zixunshuoming != null && zixunshuoming.Any()) { ViewBag.zixunshuoming = zixunshuoming[0].n_Content; } else { ViewBag.zixunshuoming = "暂无咨询说明"; } return View(model); }
//加入收藏夹 public string InsertintoCollect() { string skuid = ""; string type = ""; bool result = false; if (LoginMember != null) { if (!string.IsNullOrEmpty(RequestBase.GetString("skuid"))) { skuid = RequestBase.GetString("skuid").ToString(); } if (!string.IsNullOrEmpty(RequestBase.GetString("type"))) { type = RequestBase.GetString("type").ToString(); } Model.VipCollectionBase cmodel = new VipCollectionBase(); int mid = (CookieEncrypt.DeserializeObject(System.Web.HttpContext.Current.Request.Cookies["UserInfo"].Value) as Model.MemberBase).m_ID; if (type == "cancel") { result = new BLL.VipCollectionBase().Deletebyskuid(mid, int.Parse(skuid)); } else if (type == "insert") { List<Model.VipCollectionBase> coll = new BLL.VipCollectionBase().GetModelList(" m_ID=" + mid + " and sku_ID=" + skuid+" and vc_IsDel=0"); if (coll.Count > 0) { return "已收藏"; } else { cmodel.sku_ID = int.Parse(skuid); cmodel.m_ID = mid; cmodel.vc_CreateOn = DateTime.Now; result = new BLL.VipCollectionBase().Add(cmodel); } } if (result) { return "操作成功"; } else { return "操作失败"; } } else { return "未登陆"; } }
public ActionResult vipCollect() { var model = new ListModel(); string where = ""; string where2 = ""; string sortby = ""; int page = 1; int pagerows = 2; string skulist = ""; int mid = 0; if (LoginMember != null) { mid = (CookieEncrypt.DeserializeObject(System.Web.HttpContext.Current.Request.Cookies["UserInfo"].Value) as Model.MemberBase).m_ID; Model.VipCollectionBase cmodel = new Model.VipCollectionBase(); var clist = new BLL.VipCollectionBase().GetModelList(" m_Id=" + mid + " and vc_IsDel=0"); if (clist.Count > 0) { ViewData["collect"] = true; foreach (var item in clist) { skulist += item.sku_ID + ","; } skulist = skulist.Substring(0, skulist.Length - 1); where = " and vw.sku_ID in(" + skulist + ")"; where2 = " and sku_ID in(" + skulist + ")"; model.vmpinfolist = new BLL.vw_PInfo().GetModelListVC(" vc.m_ID=" + mid + " and p_IsDel=0 and p_StatusCode=0 and p_SellStatus=1 and vw.sku_ID = vc.sku_ID and vc.vc_IsDel=0 " + where, page, pagerows, sortby); List<Model.vw_PInfo> list = new BLL.vw_PInfo().GetModelList(" p_IsDel=0 and p_SellStatus=1 and p_StatusCode=0 " + where2); ViewData["count"] = list.Count; ViewData["pagerows"] = pagerows; ViewData["page"] = page; return View(model.vmpinfolist); } else { ViewData["collect"] = false; return View(); } } else { Response.Redirect("/Index/Index"); return View(); } }
//删除收藏夹里的商品 public bool delcollect() { string vcid = ""; if (!string.IsNullOrEmpty(RequestBase.GetString("id"))) { vcid = RequestBase.GetString("id").ToString(); } Model.VipCollectionBase vcmodel = new Model.VipCollectionBase(); bool result = new BLL.VipCollectionBase().Delete(int.Parse(vcid)); return result; }
public string collectpage() { int pageSize = 2;//每一页的行数 int pageNumber = 1;//当前页数 string html = ""; string skuid = ""; string where = ""; string where2 = ""; string skulist = ""; string sortby = ""; int mid = 0; if (LoginMember != null) { mid = (CookieEncrypt.DeserializeObject(System.Web.HttpContext.Current.Request.Cookies["UserInfo"].Value) as Model.MemberBase).m_ID; } Model.VipCollectionBase cmodel = new Model.VipCollectionBase(); var clist = new BLL.VipCollectionBase().GetModelList(" m_Id=" + mid + " and vc_IsDel=0"); if (clist.Count > 0) { foreach (var item in clist) { skulist += item.sku_ID + ","; } skulist = skulist.Substring(0, skulist.Length - 1); where = " and sku_ID in(" + skulist + ")"; where2 = " and vw.sku_ID in(" + skulist + ")"; } if (!string.IsNullOrEmpty(RequestBase.GetString("pageNum"))) { pageNumber = Convert.ToInt32(RequestBase.GetString("pageNum")); } List<Model.vw_PInfo> list = new BLL.vw_PInfo().GetModelList(" p_IsDel=0 and p_SellStatus=1 and p_StatusCode=0 " + where); ViewBag.collect = new BLL.vw_PInfo().GetModelListVC(" vc.m_ID=" + mid + " and p_IsDel=0 and p_StatusCode=0 and p_SellStatus=1 and vw.sku_ID = vc.sku_ID and vc.vc_IsDel=0 " + where2, pageNumber, pageSize, sortby); //ViewBag.collect = list.ToPagedList(pageNumber, pageSize); foreach (var item in ViewBag.collect) { html += "<li><table class=\"order-list\"><tbody><tr><td width=\"345\"><div class=\"pro-imgs\"><a href=\"/ProDetail/ProDetail?skuid="+item.sku_ID+"\"><img name=\"page_cnt_1\" src=\""+item.pi_Url+"\" alt=\""+item.p_Name+"\" /></a></div><p><a href=\"/ProDetail/ProDetail?skuid="+item.sku_ID+"\">"+item.p_Name+" "+item.shuxing+"</a></p></td><td width=\"100\" align=\"center\">"+item.sku_Price+"</td><td width=\"80\" align=\"center\">"+item.vc_CreateOn+"</td><td width=\"90\" align=\"center\"><a href=\"javascript:void(0)\" onclick=\"delcollect("+item.vc_id+")\">删除</a><br /><a href=\"javascript:void(0)\" onclick=\"TuiinsertintoCart("+item.sku_ID+")\">添加到购物车</a><br /></td></tr></tbody></table></li>"; } return html; }