protected override void PageLoad() { base.PageLoad(); string action = RequestHelper.GetQueryString <string>("Action"); if (action == "Delete") { string deleteId = RequestHelper.GetForm <string>("id"); ProductCollectBLL.Delete(Array.ConvertAll <string, int>(deleteId.Split(','), k => Convert.ToInt32(k)), base.UserId); ResponseHelper.Write("ok"); ResponseHelper.End(); } ProductCollectList = ProductCollectBLL.ReadListByUserId(base.UserId); int count = ProductCollectList.Count; int currentPage = RequestHelper.GetQueryString <int>("Page"); if (currentPage < 1) { currentPage = 1; } int pageSize = 20; ProductCollectList = ProductCollectList.Skip((currentPage - 1) * pageSize).Take(pageSize).ToList(); pager.Init(currentPage, pageSize, count, !string.IsNullOrEmpty(isMobile)); }
/// <summary> /// 移到我的收藏 /// </summary> private void Collect() { string strCartId = StringHelper.SearchSafe(RequestHelper.GetQueryString <string>("StrProductId")); if (string.IsNullOrEmpty(strCartId)) { ResponseHelper.Write("error|请选择商品!"); ResponseHelper.End(); } if (base.UserId == 0) { ResponseHelper.Write("error|还未登录!"); ResponseHelper.End(); } int[] ids = Array.ConvertAll <string, int>(strCartId.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries), k => Convert.ToInt32(k)); foreach (var id in ids) { if (ProductCollectBLL.Read(id, base.UserId).Id < 1) { ProductCollectInfo productCollect = new ProductCollectInfo(); productCollect.ProductId = id; productCollect.Tm = RequestHelper.DateNow; productCollect.UserId = base.UserId; ProductCollectBLL.Add(productCollect); } } ResponseHelper.Write("error|成功收藏!"); ResponseHelper.End(); }
/// <summary> /// 收藏产品 /// </summary> public void Collect() { string result = string.Empty; int productID = RequestHelper.GetQueryString <int>("ProductID"); if (productID > 0) { if (base.UserId == 0) { result = "还未登录"; } else { if (ProductCollectBLL.Read(productID, base.UserId).Id > 0) { result = "您已经收藏了该产品"; } else { ProductCollectInfo productCollect = new ProductCollectInfo(); productCollect.ProductId = productID; productCollect.Tm = RequestHelper.DateNow; productCollect.UserId = base.UserId; ProductCollectBLL.Add(productCollect); result = "成功收藏"; } } } else { result = "请选择产品"; } ResponseHelper.Write(result); ResponseHelper.End(); }
/// <summary> /// 页面加载 /// </summary> protected override void PageLoad() { base.PageLoad(); user = UserBLL.ReadUserMore(base.UserId); userGradeId = UserGradeBLL.Read(base.GradeID).Id; string action = RequestHelper.GetQueryString <string>("Action"); if (action == "Delete") { string deleteID = RequestHelper.GetQueryString <string>("ID"); ProductCollectBLL.Delete(Array.ConvertAll(deleteID.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries), k => Convert.ToInt32(k)), base.UserId); ResponseHelper.Write("ok"); ResponseHelper.End(); } int currentPage = RequestHelper.GetQueryString <int>("Page"); if (currentPage < 1) { currentPage = 1; } int pageSize = 20; int count = 0; productCollectList = ProductCollectBLL.ReadList(currentPage, pageSize, ref count, base.UserId); //commonPagerClass.CurrentPage = currentPage; //commonPagerClass.PageSize = pageSize; //commonPagerClass.Count = count; //commonPagerClass.FirstPage = "<<首页"; //commonPagerClass.PreviewPage = "<<上一页"; //commonPagerClass.NextPage = "下一页>>"; //commonPagerClass.LastPage = "末页>>"; //commonPagerClass.ListType = false; //commonPagerClass.DisCount = false; //commonPagerClass.PrenextType = true; commonPagerClass.Init(currentPage, pageSize, count, !string.IsNullOrEmpty(isMobile)); string strProductID = string.Empty; foreach (ProductCollectInfo productCollect in productCollectList) { if (strProductID == string.Empty) { strProductID = productCollect.ProductId.ToString(); } else { strProductID += "," + productCollect.ProductId.ToString(); } } if (strProductID != string.Empty) { ProductSearchInfo productSearch = new ProductSearchInfo(); productSearch.InProductId = strProductID; productList = ProductBLL.SearchList(productSearch); } }
protected override void PageLoad() { base.PageLoad(); if (RequestHelper.GetQueryString <string>("Action") == "Delete") { ProductCollectBLL.DeleteProductCollect(RequestHelper.GetQueryString <string>("ID"), base.UserID); ResponseHelper.Write("ok"); ResponseHelper.End(); } int queryString = RequestHelper.GetQueryString <int>("Page"); if (queryString < 1) { queryString = 1; } int pageSize = 20; int count = 0; this.productCollectList = ProductCollectBLL.ReadProductCollectList(queryString, pageSize, ref count, base.UserID); this.commonPagerClass.CurrentPage = queryString; this.commonPagerClass.PageSize = pageSize; this.commonPagerClass.Count = count; string str3 = string.Empty; foreach (ProductCollectInfo info in this.productCollectList) { if (str3 == string.Empty) { str3 = info.ProductID.ToString(); } else { str3 = str3 + "," + info.ProductID.ToString(); } } if (str3 != string.Empty) { ProductSearchInfo productSearch = new ProductSearchInfo(); productSearch.InProductID = str3; this.productList = ProductBLL.SearchProductList(productSearch); } }
private void Collect() { string result = string.Empty; int productId = RequestHelper.GetQueryString <int>("id"); if (productId > 0) { if (base.UserId == 0) { result = "还未登录"; } else { var productCollect = ProductCollectBLL.Read(productId, base.UserId) ?? new ProductCollectInfo(); if (productCollect.Id > 0) { ProductCollectBLL.Delete(new int[] { productCollect.Id }, base.UserId); result = "已取消收藏"; } else { productCollect.ProductId = productId; productCollect.Tm = RequestHelper.DateNow; productCollect.UserId = base.UserId; ProductCollectBLL.Add(productCollect); result = "成功收藏"; } } } else { result = "请选择产品"; } ResponseHelper.Write(result); ResponseHelper.End(); }
protected override void PageLoad() { base.PageLoad(); //检查用户的待付款订单是否超时失效,超时则更新为失效状态 OrderBLL.CheckOrderPayTime(base.UserId); //订单自动收货 OrderBLL.CheckOrderRecieveTimeProg(base.UserId); //cartList = CartBLL.ReadList(base.UserId); topNav = 7; string keywords = RequestHelper.GetQueryString <string>("keywords"); int count = 0; OrderSearchInfo orderSearch = new OrderSearchInfo(); orderSearch.UserId = base.UserId; orderSearch.IsDelete = 0; if (!string.IsNullOrEmpty(keywords)) { orderSearch.OrderNumber = keywords; } orderList = OrderBLL.SearchList(1, 5, orderSearch, ref count); //commonPagerClass.Init(currentPage, pageSize, count, !string.IsNullOrEmpty(isMobile)); //热销商品 proListHot = ProductBLL.SearchList(1, 8, new ProductSearchInfo { IsHot = 1, IsSale = 1, IsDelete = 0 }, ref count); #region 对应状态个数 arrT[0] = OrderBLL.SearchList(new OrderSearchInfo { UserId = base.UserId, IsDelete = 0 }).Count; orderSearch.OrderStatus = (int)(OrderStatus.WaitPay); orderSearch.UserId = base.UserId; orderSearch.IsDelete = 0; arrT[1] = OrderBLL.SearchList(orderSearch).Count; orderSearch.OrderStatus = (int)(OrderStatus.Shipping); orderSearch.UserId = base.UserId; orderSearch.IsDelete = 0; arrT[2] = OrderBLL.SearchList(orderSearch).Count; orderSearch.OrderStatus = (int)(OrderStatus.HasShipping); orderSearch.UserId = base.UserId; orderSearch.IsDelete = 0; arrT[3] = OrderBLL.SearchList(orderSearch).Count; orderSearch.OrderStatus = (int)(OrderStatus.WaitCheck); orderSearch.UserId = base.UserId; orderSearch.IsDelete = 0; arrT[4] = OrderBLL.SearchList(orderSearch).Count; orderSearch.OrderStatus = (int)(OrderStatus.NoEffect); orderSearch.UserId = base.UserId; orderSearch.IsDelete = 0; arrT[5] = OrderBLL.SearchList(orderSearch).Count; #endregion #region 浏览过的商品 strHistoryProduct = Server.UrlDecode(CookiesHelper.ReadCookieValue("HistoryProduct")); if (strHistoryProduct.StartsWith(",")) { strHistoryProduct = strHistoryProduct.Substring(1); } if (strHistoryProduct.EndsWith(",")) { strHistoryProduct = strHistoryProduct.Substring(0, strHistoryProduct.Length - 1); } if (!string.IsNullOrEmpty(strHistoryProduct)) { proHistoryList = ProductBLL.SearchList(1, 12, new ProductSearchInfo { IsSale = 1, InProductId = strHistoryProduct, IsDelete = 0 }, ref count); } #endregion #region 收藏的商品 productCollectList = ProductCollectBLL.ReadListByUserId(base.UserId); string strProductID = string.Empty; foreach (ProductCollectInfo productCollect in productCollectList) { if (strProductID == string.Empty) { strProductID = productCollect.ProductId.ToString(); } else { strProductID += "," + productCollect.ProductId.ToString(); } } if (!string.IsNullOrEmpty(strProductID)) { productList = ProductBLL.SearchList(1, 8, new ProductSearchInfo { InProductId = strProductID, IsSale = 1, IsDelete = 0 }, ref count); } #endregion }