Esempio n. 1
0
        /// <summary>
        /// 页面加载方法
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                CheckAdminPower("ReadProductComment", PowerCheckType.Single);

                Name.Text = RequestHelper.GetQueryString <string>("Name");

                StartPostDate.Text = RequestHelper.GetQueryString <string>("StartPostDate");
                EndPostDate.Text   = RequestHelper.GetQueryString <string>("EndPostDate");
                Status.Text        = RequestHelper.GetQueryString <string>("Status");

                ProductCommentSearchInfo productCommentSearch = new ProductCommentSearchInfo();
                productCommentSearch.ProductName   = RequestHelper.GetQueryString <string>("Name");
                productCommentSearch.Title         = RequestHelper.GetQueryString <string>("Title");
                productCommentSearch.Content       = RequestHelper.GetQueryString <string>("Content");
                productCommentSearch.UserIP        = RequestHelper.GetQueryString <string>("UserIP");
                productCommentSearch.StartPostDate = RequestHelper.GetQueryString <DateTime>("StartPostDate");
                productCommentSearch.EndPostDate   = RequestHelper.GetQueryString <DateTime>("EndPostDate");
                productCommentSearch.Status        = RequestHelper.GetQueryString <int>("Status");
                PageSize           = Session["AdminPageSize"] == null ? 20 : Convert.ToInt32(Session["AdminPageSize"]);
                AdminPageSize.Text = Session["AdminPageSize"] == null ? "20" : Session["AdminPageSize"].ToString();
                BindControl(ProductCommentBLL.SearchList(CurrentPage, PageSize, productCommentSearch, ref Count), RecordList, MyPager);
            }
        }
Esempio n. 2
0
        protected override void PageLoad()
        {
            base.PageLoad();

            int currentPage = RequestHelper.GetQueryString <int>("Page");

            if (currentPage < 1)
            {
                currentPage = 1;
            }
            int pageSize = 15;
            int count    = 0;

            ProductCommentSearchInfo productCommentSearch = new ProductCommentSearchInfo();

            productCommentSearch.ProductId = RequestHelper.GetQueryString <int>("id");
            productCommentSearch.Status    = (int)CommentStatus.Show;
            commentList = ProductCommentBLL.SearchList(currentPage, pageSize, productCommentSearch, ref count);
            userList    = UserBLL.SearchList(new UserSearchInfo {
                InUserId = string.Join(",", commentList.Select(k => k.UserId).ToArray())
            });

            pager.CurrentPage = currentPage;
            pager.PageSize    = pageSize;
            pager.Count       = count;
            pager.DisCount    = false;
            pager.ListType    = false;
        }
Esempio n. 3
0
        protected bool isPL = true;                                                  //是否已评论
        /// <summary>
        /// 页面加载
        /// </summary>
        protected override void PageLoad()
        {
            base.PageLoad();
            user          = UserBLL.ReadUserMore(base.UserId);
            userGradeName = UserGradeBLL.Read(base.GradeID).Name;
            int orderID = RequestHelper.GetQueryString <int>("ID");

            order = OrderBLL.Read(orderID, base.UserId);
            if (order.OrderStatus != (int)OrderStatus.ReceiveShipping)
            {
                ScriptHelper.AlertFront("只能评论已收货订单");
            }
            orderDetailList = OrderDetailBLL.ReadList(orderID);
            #region 加载订单下产品
            string strProductID = string.Empty;
            foreach (OrderDetailInfo orderDetail in orderDetailList)
            {
                if (strProductID == string.Empty)
                {
                    strProductID = orderDetail.ProductId.ToString();
                }
                else
                {
                    strProductID += "," + orderDetail.ProductId.ToString();
                }
            }
            if (strProductID != string.Empty)
            {
                ProductSearchInfo productSearch = new ProductSearchInfo();
                productSearch.InProductId = strProductID;
                productList = ProductBLL.SearchList(productSearch);
            }
            #endregion
            #region 判断是否已评论
            List <ProductCommentInfo>[] listPinfoArr = new List <ProductCommentInfo> [productList.Count];
            int pi = 0;
            foreach (ProductInfo item in productList)
            {
                ProductCommentSearchInfo psi = new ProductCommentSearchInfo();
                psi.ProductId    = item.Id;
                psi.UserId       = base.UserId;
                psi.OrderID      = orderID;
                listPinfoArr[pi] = ProductCommentBLL.SearchProductCommentList(psi);
                if (listPinfoArr[pi].Count <= 0)
                {
                    isPL = false;
                }
            }
            #endregion
            if (isPL)
            {
                Response.Redirect("/User/OrderDetail.html?ID=" + orderID);
            }
        }
Esempio n. 4
0
 public void PrepareCondition(MssqlCondition mssqlCondition, ProductCommentSearchInfo productCommentSearch)
 {
     mssqlCondition.Add("[Name]", productCommentSearch.ProductName, ConditionType.Like);
     mssqlCondition.Add("[Title]", productCommentSearch.Title, ConditionType.Like);
     mssqlCondition.Add("[Content]", productCommentSearch.Content, ConditionType.Like);
     mssqlCondition.Add("[UserIP]", productCommentSearch.UserIP, ConditionType.Like);
     mssqlCondition.Add("[PostDate]", productCommentSearch.StartPostDate, ConditionType.MoreOrEqual);
     mssqlCondition.Add("[PostDate]", productCommentSearch.EndPostDate, ConditionType.LessOrEqual);
     mssqlCondition.Add("[UserID]", productCommentSearch.UserID, ConditionType.Equal);
     mssqlCondition.Add("[Status]", productCommentSearch.Status, ConditionType.Equal);
     mssqlCondition.Add("[ProductID]", productCommentSearch.ProductID, ConditionType.Equal);
 }
Esempio n. 5
0
        protected bool isPL            = true;//是否已评论

        protected override void PageLoad()
        {
            base.PageLoad();
            //检查用户的待付款订单是否超时失效,超时则更新为失效状态
            OrderBLL.CheckOrderPayTime(base.UserId);
            int orderId = RequestHelper.GetQueryString <int>("id");

            userGradeName = UserGradeBLL.Read(base.GradeID).Name;


            order = OrderBLL.Read(orderId, base.UserId);


            if (order.Id <= 0)
            {
                ScriptHelper.AlertFront("订单不存在", "/user/index.html");
            }
            //礼品
            if (order.GiftId > 0)
            {
                gift = FavorableActivityGiftBLL.Read(order.GiftId);
            }
            orderDetailList = OrderDetailBLL.ReadList(orderId);
            int[] productIds = orderDetailList.Select(k => k.ProductId).ToArray();
            if (productIds.Length > 0)
            {
                int count = 0;
                productList = ProductBLL.SearchList(1, productIds.Length, new ProductSearchInfo {
                    InProductId = string.Join(",", productIds)
                }, ref count);
            }

            #region 判断是否已评论
            List <ProductCommentInfo>[] listPinfoArr = new List <ProductCommentInfo> [productList.Count];
            int pi = 0;
            foreach (ProductInfo item in productList)
            {
                ProductCommentSearchInfo psi = new ProductCommentSearchInfo();
                psi.ProductId    = item.Id;
                psi.UserId       = base.UserId;
                psi.OrderID      = orderId;
                listPinfoArr[pi] = ProductCommentBLL.SearchProductCommentList(psi);
                if (listPinfoArr[pi].Count <= 0)
                {
                    isPL = false;
                }
            }
            #endregion
            Title = "我的订单";
        }
Esempio n. 6
0
        public List <ProductCommentInfo> SearchProductCommentList(ProductCommentSearchInfo productCommentSearch)
        {
            MssqlCondition mssqlCondition = new MssqlCondition();

            this.PrepareCondition(mssqlCondition, productCommentSearch);
            List <ProductCommentInfo> productCommentList = new List <ProductCommentInfo>();

            SqlParameter[] pt = new SqlParameter[] { new SqlParameter("@condition", SqlDbType.NVarChar) };
            pt[0].Value = mssqlCondition.ToString();
            using (SqlDataReader reader = ShopMssqlHelper.ExecuteReader(ShopMssqlHelper.TablePrefix + "SearchProductCommentList", pt))
            {
                this.PrepareProductCommentModel(reader, productCommentList);
            }
            return(productCommentList);
        }
Esempio n. 7
0
        /// <summary>
        /// 页面加载
        /// </summary>
        protected override void PageLoad()
        {
            base.PageLoad();

            int orderID = RequestHelper.GetQueryString <int>("OrderID");


            order           = OrderBLL.Read(orderID, base.UserId);
            orderDetailList = OrderDetailBLL.ReadList(orderID);

            foreach (OrderDetailInfo orderDetail in orderDetailList)
            {
                if (strProductID2 == string.Empty)
                {
                    strProductID2 = orderDetail.ProductId.ToString();
                }
                else
                {
                    strProductID2 += "," + orderDetail.ProductId.ToString();
                }
            }
            if (strProductID2 != string.Empty)
            {
                ProductSearchInfo productSearch = new ProductSearchInfo();
                productSearch.InProductId = strProductID2;
                productList = ProductBLL.SearchList(productSearch);
            }
            ProductCommentSearchInfo productCommentSearch = new ProductCommentSearchInfo();

            productCommentSearch.OrderID = orderID;
            if (ProductCommentBLL.SearchProductCommentList(productCommentSearch).Count >= productList.Count)
            {
                string url = "";
                if (Request.RawUrl.ToLower().IndexOf("/mobile/") >= 0)
                {
                    url = "/mobile/UserProductComment.html";
                }
                else
                {
                    url = "/User/UserProductComment.html";
                }
                Response.Redirect(url);
            }
            Title = "订单评价 - 会员中心";
        }
Esempio n. 8
0
        protected override void PageLoad()
        {
            base.PageLoad();
            ProductCommentSearchInfo productComment = new ProductCommentSearchInfo();

            productComment.UserID = base.UserID;
            int queryString = RequestHelper.GetQueryString <int>("Page");

            if (queryString < 1)
            {
                queryString = 1;
            }
            int pageSize = 20;
            int count    = 0;

            this.productCommentList           = ProductCommentBLL.SearchProductCommentList(queryString, pageSize, productComment, ref count);
            this.commonPagerClass.CurrentPage = queryString;
            this.commonPagerClass.PageSize    = pageSize;
            this.commonPagerClass.Count       = count;
        }
Esempio n. 9
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!this.Page.IsPostBack)
     {
         base.CheckAdminPower("ReadProductComment", PowerCheckType.Single);
         this.Name.Text          = RequestHelper.GetQueryString <string>("Name");
         this.Title.Text         = RequestHelper.GetQueryString <string>("Title");
         this.StartPostDate.Text = RequestHelper.GetQueryString <string>("StartPostDate");
         this.EndPostDate.Text   = RequestHelper.GetQueryString <string>("EndPostDate");
         this.Status.Text        = RequestHelper.GetQueryString <string>("Status");
         ProductCommentSearchInfo productComment = new ProductCommentSearchInfo();
         productComment.ProductName   = RequestHelper.GetQueryString <string>("Name");
         productComment.Title         = RequestHelper.GetQueryString <string>("Title");
         productComment.Content       = RequestHelper.GetQueryString <string>("Content");
         productComment.UserIP        = RequestHelper.GetQueryString <string>("UserIP");
         productComment.StartPostDate = RequestHelper.GetQueryString <DateTime>("StartPostDate");
         productComment.EndPostDate   = RequestHelper.GetQueryString <DateTime>("EndPostDate");
         productComment.Status        = RequestHelper.GetQueryString <int>("Status");
         base.BindControl(ProductCommentBLL.SearchProductCommentInnerList(base.CurrentPage, base.PageSize, productComment, ref this.Count), this.RecordList, this.MyPager);
     }
 }
Esempio n. 10
0
 protected override void PageLoad()
 {
     base.PageLoad();
     int queryString = RequestHelper.GetQueryString<int>("CommentID");
     this.productComment = ProductCommentBLL.ReadProductComment(queryString, 0);
     this.product = ProductBLL.ReadProduct(this.productComment.ProductID);
     int count = -2147483648;
     int currentPage = 1;
     int pageSize = 5;
     ProductCommentSearchInfo productComment = new ProductCommentSearchInfo();
     productComment.ProductID = this.product.ID;
     this.productCommentList = ProductCommentBLL.SearchProductCommentList(currentPage, pageSize, productComment, ref count);
     string strProductID = base.Server.UrlDecode(CookiesHelper.ReadCookieValue("HistoryProduct"));
     if (strProductID != string.Empty)
     {
         ProductSearchInfo productSearch = new ProductSearchInfo();
         productSearch.InProductID = strProductID;
         this.tempProductList = ProductBLL.SearchProductList(productSearch);
         this.tempMemberPriceList = MemberPriceBLL.ReadMemberPriceByProductGrade(strProductID, base.GradeID);
     }
 }
Esempio n. 11
0
        protected override void PageLoad()
        {
            base.PageLoad();

            int currentPage = RequestHelper.GetQueryString <int>("Page");

            if (currentPage < 1)
            {
                currentPage = 1;
            }
            int pageSize = 10;
            int count    = 0;

            ProductCommentSearchInfo productCommentSearch = new ProductCommentSearchInfo();

            productCommentSearch.ProductId = RequestHelper.GetQueryString <int>("ProductID");
            productCommentSearch.Status    = (int)CommentStatus.Show;
            commentList = ProductCommentBLL.SearchList(currentPage, pageSize, productCommentSearch, ref count);

            pager.CurrentPage = currentPage;
            pager.PageSize    = pageSize;
            pager.Count       = count;
        }
Esempio n. 12
0
        /// <summary>
        /// 页面加载
        /// </summary>
        protected override void PageLoad()
        {
            base.PageLoad();

            int count = int.MinValue;

            topNav = 2;
            int id = RequestHelper.GetQueryString <int>("ID");

            if (id <= 0)
            {
                ScriptHelper.AlertFront("该产品未上市,不能查看");
            }
            string fromwhere = RequestHelper.GetQueryString <string>("fw");

            product = ProductBLL.Read(id);
            if (product.IsSale == (int)BoolType.False || product.IsDelete == 1)
            {
                if (fromwhere.ToLower() != "admin")
                {
                    ScriptHelper.AlertFront("该产品未上市,不能查看");
                }
                else
                {
                    if (Cookies.Admin.GetAdminID(true) == 0)//用户未登录
                    {
                        ScriptHelper.AlertFront("该产品未上市,不能查看");
                    }
                }
            }

            navList = ProductClassBLL.ProductClassNameList(product.ClassId);
            //更新查看数量
            if (CookiesHelper.ReadCookie("productview" + product.Id + "") == null)
            {
                ProductBLL.ChangeViewCount(id, 1);
                CookiesHelper.AddCookie("productview" + product.Id + "", product.Id.ToString());
            }
            ProductCommentSearchInfo proCommSear = new ProductCommentSearchInfo();

            proComm = ProductCommentBLL.SearchProductCommentList(proCommSear = new ProductCommentSearchInfo {
                ProductId = product.Id
            });

            //会员等级
            userGradeList = UserGradeBLL.ReadList();
            //产品价格
            int hotCount = 0;

            currentMemberPrice = ProductBLL.GetCurrentPrice(product.SalePrice, base.GradeID);
            hotProductList     = ProductBLL.SearchList(1, 7, new ProductSearchInfo {
                IsHot = (int)BoolType.True, IsSale = (int)BoolType.True, IsDelete = (int)BoolType.False, NotInProductId = product.Id.ToString()
            }, ref hotCount);
            ishot = ProductBLL.SearchList(1, 7, new ProductSearchInfo {
                IsHot = (int)BoolType.True, IsSale = (int)BoolType.True, IsTop = (int)BoolType.True, IsDelete = (int)BoolType.False, NotInProductId = product.Id.ToString()
            }, ref hotCount);
            proishot = ProductBLL.SearchList(1, 3, new ProductSearchInfo {
                IsSale = (int)BoolType.True, IsTop = (int)BoolType.True, IsDelete = (int)BoolType.False, NotInProductId = product.Id.ToString()
            }, ref hotCount);

            //产品图片
            ProductPhotoInfo productPhoto = new ProductPhotoInfo();

            productPhoto.Name     = product.Name;
            productPhoto.ImageUrl = product.Photo;
            productPhotoList.Add(productPhoto);
            productPhotoList.AddRange(ProductPhotoBLL.ReadList(id, 0));
            // 关联产品,配件,浏览过的商品
            strHistoryProduct = Server.UrlDecode(CookiesHelper.ReadCookieValue("HistoryProduct"));
            string tempStrProductID = product.RelationProduct + "," + product.Accessory + "," + strHistoryProduct;

            tempStrProductID = tempStrProductID.Replace(",,", ",");
            if (tempStrProductID.StartsWith(","))
            {
                tempStrProductID = tempStrProductID.Substring(1);
            }
            if (tempStrProductID.EndsWith(","))
            {
                tempStrProductID = tempStrProductID.Substring(0, tempStrProductID.Length - 1);
            }
            ProductSearchInfo productSearch = new ProductSearchInfo();

            productSearch.InProductId = tempStrProductID;
            tempProductList           = ProductBLL.SearchList(productSearch);

            //属性
            attributeRecordList = ProductTypeAttributeRecordBLL.ReadList(id);

            //产品文章
            if (product.RelationArticle != string.Empty)
            {
                ArticleSearchInfo articleSearch = new ArticleSearchInfo();
                articleSearch.InArticleId = product.RelationArticle;
                productArticleList        = ArticleBLL.SearchList(articleSearch);
            }
            //产品规格
            standardRecordList = ProductTypeStandardRecordBLL.ReadListByProduct(product.Id, product.StandardType);
            if (standardRecordList.Count > 0)
            {
                string[] standardIDArray = standardRecordList[0].StandardIdList.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
                for (int i = 0; i < standardIDArray.Length; i++)
                {
                    int standardID = Convert.ToInt32(standardIDArray[i]);
                    ProductTypeStandardInfo standard = ProductTypeStandardBLL.Read(standardID);
                    string[] valueArray = standard.ValueList.Split(';');
                    string   valueList  = string.Empty;
                    for (int k = 0; k < valueArray.Length; k++)
                    {
                        foreach (ProductTypeStandardRecordInfo standardRecord in standardRecordList)
                        {
                            string[] tempValueArray = standardRecord.ValueList.Split(';');
                            if (valueArray[k] == tempValueArray[i])
                            {
                                valueList += valueArray[k] + ";";
                                break;
                            }
                        }
                    }
                    if (valueList != string.Empty)
                    {
                        valueList = valueList.Substring(0, valueList.Length - 1);
                    }
                    standard.ValueList = valueList;
                    standardList.Add(standard);
                }
                //规格值
                foreach (ProductTypeStandardRecordInfo standardRecord in standardRecordList)
                {
                    standardRecordValueList += standardRecord.ProductId + ";" + standardRecord.ValueList + "|";
                }
            }
            //计算剩余库存量

            leftStorageCount = product.TotalStorageCount - product.OrderCount;

            //搜索优化
            Title       = (product.SubTitle == string.Empty) ? product.Name : product.SubTitle;
            Keywords    = (product.Keywords == string.Empty) ? product.Name : product.Keywords;
            Description = (product.Summary == string.Empty) ? StringHelper.Substring(StringHelper.KillHTML(product.Introduction1), 200) : product.Summary;
        }
Esempio n. 13
0
        /// 页面加载
        /// </summary>
        protected override void PageLoad()
        {
            base.PageLoad();
            string action = RequestHelper.GetQueryString <string>("Action");

            switch (action)
            {
            case "Add":
                PostProductComment();
                break;

            //case "Against":
            //    AgainstComment();
            //    break;
            //case "Support":
            //    SupportComment();
            //    break;
            //case "AddTags":
            //    PostTags();
            //    break;
            default:
                break;
            }

            int currentPage = RequestHelper.GetQueryString <int>("Page");
            int commStyle   = RequestHelper.GetQueryString <int>("commStyle");

            if (currentPage < 1)
            {
                currentPage = 1;
            }
            int pageSize = 8;
            int count    = 0;

            ProductCommentSearchInfo productCommentSearch = new ProductCommentSearchInfo();

            productCommentSearch.ProductId = RequestHelper.GetQueryString <int>("ProductID");
            productCommentSearch.Status    = (int)CommentStatus.Show;
            switch (commStyle)
            {
            case 1: productCommentSearch.Rank = "5";
                break;

            case 2: productCommentSearch.Rank = "2,3,4";
                break;

            case 3: productCommentSearch.Rank = "1";
                break;

            default:
                break;
            }

            productCommentList = ProductCommentBLL.SearchList(currentPage, pageSize, productCommentSearch, ref count);

            ajaxPagerClass.CurrentPage = currentPage;
            ajaxPagerClass.PageSize    = pageSize;
            ajaxPagerClass.Count       = count;
            ajaxPagerClass.FirstPage   = "<<首页";
            ajaxPagerClass.PreviewPage = "<<上一页";
            ajaxPagerClass.NextPage    = "下一页>>";
            ajaxPagerClass.LastPage    = "末页>>";
            ajaxPagerClass.ListType    = false;
            ajaxPagerClass.DisCount    = false;
            ajaxPagerClass.NumType     = false;
            ajaxPagerClass.PrenextType = true;

            string strUserID = string.Empty;

            foreach (ProductCommentInfo productComment in productCommentList)
            {
                if (strUserID == string.Empty)
                {
                    strUserID = productComment.UserId.ToString();
                }
                else
                {
                    strUserID += "," + productComment.UserId.ToString();
                }
            }
            if (strUserID != string.Empty)
            {
                UserSearchInfo userSearch = new UserSearchInfo();
                userSearch.InUserId = strUserID;
                userList            = UserBLL.SearchList(userSearch);
            }
        }
Esempio n. 14
0
 public static List <ProductCommentInfo> SearchInnerProductList(int currentPage, int pageSize, ProductCommentSearchInfo searchInfo, ref int count)
 {
     return(dal.SearchInnerProductList(currentPage, pageSize, searchInfo, ref count));
 }
Esempio n. 15
0
 /// <summary>
 /// 搜索产品评论数据列表
 /// </summary>
 /// <param name="productComment">ProductCommentSearchInfo模型变量</param>
 /// <returns>产品评论数据列表</returns>
 public static List <ProductCommentInfo> SearchProductCommentList(ProductCommentSearchInfo productComment)
 {
     return(dal.SearchProductCommentList(productComment));
 }
Esempio n. 16
0
        protected override void PageLoad()
        {
            base.PageLoad();
            string queryString = RequestHelper.GetQueryString <string>("Action");

            if (queryString != null)
            {
                if (!(queryString == "Add"))
                {
                    if (queryString == "Against")
                    {
                        this.AgainstComment();
                    }
                    else if (queryString == "Support")
                    {
                        this.SupportComment();
                    }
                    else if (queryString == "AddTags")
                    {
                        this.PostTags();
                    }
                }
                else
                {
                    this.PostProductComment();
                }
            }
            int currentPage = RequestHelper.GetQueryString <int>("Page");

            if (currentPage < 1)
            {
                currentPage = 1;
            }
            int pageSize = 8;
            int count    = 0;
            ProductCommentSearchInfo productComment = new ProductCommentSearchInfo();

            productComment.ProductID        = RequestHelper.GetQueryString <int>("ProductID");
            productComment.Status           = 2;
            this.productCommentList         = ProductCommentBLL.SearchProductCommentList(currentPage, pageSize, productComment, ref count);
            this.ajaxPagerClass.CurrentPage = currentPage;
            this.ajaxPagerClass.PageSize    = pageSize;
            this.ajaxPagerClass.Count       = count;
            this.ajaxPagerClass.DisCount    = false;
            this.ajaxPagerClass.ListType    = false;
            string str2 = string.Empty;

            foreach (ProductCommentInfo info2 in this.productCommentList)
            {
                if (str2 == string.Empty)
                {
                    str2 = info2.UserID.ToString();
                }
                else
                {
                    str2 = str2 + "," + info2.UserID.ToString();
                }
            }
            if (str2 != string.Empty)
            {
                UserSearchInfo user = new UserSearchInfo();
                user.InUserID = str2;
                this.userList = UserBLL.SearchUserList(user);
            }
        }
Esempio n. 17
0
        public ActionResult Detail(int id)
        {
            int userGrade = UserGradeBLL.ReadByMoney(0).Id;
            int uid       = RequestHelper.GetForm <int>("uid");
            var user      = UserBLL.ReadUserMore(uid);

            if (user.Id > 0)
            {
                userGrade     = UserGradeBLL.ReadByMoney(user.MoneyUsed).Id;
                user.UserName = HttpUtility.UrlDecode(user.UserName, System.Text.Encoding.UTF8);
            }

            if (id <= 0)
            {
                return(Json(new { ok = false, error = "该产品未上市" }));
            }
            string      fromwhere = RequestHelper.GetQueryString <string>("fw");
            ProductInfo product   = ProductBLL.Read(id);

            if (product.IsSale == (int)BoolType.False || product.IsDelete == 1)
            {
                return(Json(new { ok = false, error = "该产品未上市" }));
            }
            #region 如果商品没有小程序码 则生成并保存
            if (string.IsNullOrWhiteSpace(product.Qrcode))
            {
                string product_miniProramCode = string.Empty;
                CreateMiniProgramCode(product.Id, ref product_miniProramCode, product.Qrcode);
                if (!string.IsNullOrWhiteSpace(product_miniProramCode))
                {//如果调用接口成功生成小程序码(因为只有发布后才能使用此微信接口)
                    Dictionary <string, object> dict = new Dictionary <string, object>();
                    dict.Add("[Qrcode]", product_miniProramCode);
                    ProductBLL.UpdatePart("[Product]", dict, product.Id);
                    product.Qrcode = product_miniProramCode;
                }
            }
            #endregion
            //更新查看数量
            if (CookiesHelper.ReadCookie("productview" + product.Id + "") == null)
            {
                ProductBLL.ChangeViewCount(id, 1);
                CookiesHelper.AddCookie("productview" + product.Id + "", product.Id.ToString());
            }
            ProductCommentSearchInfo proCommSear = new ProductCommentSearchInfo();
            var proComm = ProductCommentBLL.SearchProductCommentList(proCommSear = new ProductCommentSearchInfo {
                ProductId = product.Id, Status = (int)CommentStatus.Show
            });
            var procomlist = new List <VirtualProductCommend>();
            foreach (var item in proComm)
            {
                VirtualProductCommend vpc = new VirtualProductCommend()
                {
                    id         = item.Id,
                    name       = HttpUtility.UrlDecode(item.UserName, Encoding.UTF8),
                    avator     = ShopCommon.ShowImage(UserBLL.Read(item.UserId).Photo),
                    lv         = item.Rank,
                    date       = item.PostDate,
                    content    = item.Content,
                    imglist    = ProductPhotoBLL.ReadList(item.Id, 3),
                    adminreply = item.AdminReplyContent,
                    replydate  = item.AdminReplyDate
                };
                procomlist.Add(vpc);
            }

            //产品价格
            int hotCount           = 0;
            var currentMemberPrice = ProductBLL.GetCurrentPrice(product.SalePrice, userGrade);
            var prorecommend       = ProductBLL.SearchList(1, 8, new ProductSearchInfo {
                IsSale = (int)BoolType.True, IsTop = (int)BoolType.True, IsDelete = (int)BoolType.False, NotInProductId = product.Id.ToString()
            }, ref hotCount);
            var prorelist = new List <ProductVirtualModel>();
            foreach (var item in prorecommend)
            {
                var vp = new ProductVirtualModel()
                {
                    id          = item.Id,
                    name        = item.Name,
                    img         = ShopCommon.ShowImage(item.Photo.Replace("Original", "150-150")),
                    imgbig      = ShopCommon.ShowImage(item.Photo.Replace("Original", "350-350")),
                    imgorg      = ShopCommon.ShowImage(item.Photo),
                    price       = ProductBLL.GetCurrentPrice(item.SalePrice, userGrade),
                    marketprice = item.MarketPrice,
                    click       = item.ViewCount,
                    like        = item.LikeNum,
                    totalstore  = item.StandardType == (int)ProductStandardType.Single ? ProductTypeStandardRecordBLL.GetSumStorageByProduct(item.Id) : item.TotalStorageCount,
                    //ordercount = item.OrderCount
                    //是否启用不限库存,分别计算销量
                    ordercount = item.UnlimitedStorage == 1 ? OrderBLL.GetProductOrderCountDaily(item.Id, item.StandardType, DateTime.Now) : item.OrderCount
                };
                prorelist.Add(vp);
            }
            //产品图片
            List <ProductPhotoInfo> productPhotoList = new List <ProductPhotoInfo>();
            ProductPhotoInfo        productPhoto     = new ProductPhotoInfo();
            productPhoto.Name     = product.Name;
            productPhoto.ImageUrl = product.Photo;
            productPhotoList.Add(productPhoto);
            productPhotoList.AddRange(ProductPhotoBLL.ReadList(id, 0));
            productPhotoList.ForEach(k => k.ImageUrl = k.ImageUrl.Replace("75-75", "Original"));
            //属性
            var attributeRecordList = ProductTypeAttributeRecordBLL.ReadList(id);

            #region 产品规格
            List <ProductTypeStandardInfo> standardList = new List <ProductTypeStandardInfo>();
            string  standardRecordValueList             = "|";
            var     standardRecordList = ProductTypeStandardRecordBLL.ReadListByProduct(product.Id, product.StandardType);
            decimal maxPrice           = product.SalePrice;
            if (standardRecordList.Count > 0)
            {
                string[] standardIDArray = standardRecordList[0].StandardIdList.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
                for (int i = 0; i < standardIDArray.Length; i++)
                {
                    int standardID = Convert.ToInt32(standardIDArray[i]);
                    ProductTypeStandardInfo standard = ProductTypeStandardBLL.Read(standardID);
                    string[] valueArray = standard.ValueList.Split(';');
                    string   valueList  = string.Empty;
                    for (int k = 0; k < valueArray.Length; k++)
                    {
                        foreach (ProductTypeStandardRecordInfo standardRecord in standardRecordList)
                        {
                            if (standardRecord.MarketPrice > maxPrice)
                            {
                                maxPrice = standardRecord.MarketPrice;
                            }
                            string[] tempValueArray = standardRecord.ValueList.Split(';');
                            if (valueArray[k] == tempValueArray[i])
                            {
                                valueList += valueArray[k] + ";";
                                break;
                            }
                        }
                    }
                    if (valueList != string.Empty)
                    {
                        valueList = valueList.Substring(0, valueList.Length - 1);
                    }
                    standard.ValueList = valueList;
                    standardList.Add(standard);
                }
                //规格值
                foreach (ProductTypeStandardRecordInfo standardRecord in standardRecordList)
                {
                    standardRecordValueList += standardRecord.ProductId + ";" + standardRecord.ValueList + "|";
                }
            }
            #endregion
            #region 正在开的团(进行中,排除本人开的团)
            GroupBuySearchInfo gpsearch = new GroupBuySearchInfo
            {
                ProductId = product.Id,
                //NotLeader = user.Id,
                Status = (int)GroupBuyStatus.Going
            };
            List <GroupBuyInfo> gpList = GroupBuyBLL.SearchList(gpsearch);
            gpList.ForEach(k => k.groupSignList = GroupSignBLL.ReadListByGroupId(k.Id));
            gpList.ForEach(k => k.GroupUserName = System.Web.HttpUtility.UrlDecode(k.GroupUserName, Encoding.UTF8));
            #endregion
            return(Json(new
            {
                ok = true,
                product = new
                {
                    id = product.Id,
                    img = ShopCommon.ShowImage(product.Photo.Replace("Original", "350-350")),
                    imgorg = ShopCommon.ShowImage(product.Photo),
                    title = product.Name,
                    summary = product.Summary,
                    price = currentMemberPrice,
                    marketprice = product.MarketPrice,
                    intro = string.IsNullOrEmpty(product.Introduction1_Mobile) ? product.Introduction1 : product.Introduction1_Mobile,
                    remark = product.Remark,
                    totalstore = product.StandardType == (int)ProductStandardType.Single ? ProductTypeStandardRecordBLL.GetSumStorageByProduct(product.Id) : product.TotalStorageCount,
                    ordercount = product.UnlimitedStorage == 1 ? OrderBLL.GetProductOrderCountDaily(product.Id, product.StandardType, DateTime.Now) : product.OrderCount,
                    unlimitedstorage = product.UnlimitedStorage,
                    virtualordercount = product.VirtualOrderCount,
                    usevirtualorder = product.UseVirtualOrder,
                    opengroup = product.OpenGroup,
                    groupprice = product.GroupPrice,
                    groupquantity = product.GroupQuantity,
                    qrcode = product.Qrcode,
                    groupphoto = string.IsNullOrWhiteSpace(product.GroupPhoto) ? product.Photo : product.GroupPhoto
                },
                standardList = standardList,
                standardRecordValueList = standardRecordValueList,
                attributeRecordList = attributeRecordList,
                productPhotoList = productPhotoList,
                prorecommend = prorelist,
                proComm = procomlist,
                maxPrice = maxPrice,
                groupList = gpList
            }, JsonRequestBehavior.AllowGet));
        }
Esempio n. 18
0
        protected bool isPL = true;//是否已评论
        /// <summary>
        /// 页面加载
        /// </summary>
        protected override void PageLoad()
        {
            base.PageLoad();

            int orderID = RequestHelper.GetQueryString <int>("OrderID");


            order = OrderBLL.Read(orderID, base.UserId);
            if (order.OrderStatus != (int)OrderStatus.ReceiveShipping)
            {
                ScriptHelper.AlertFront("只能评论已收货订单");
            }
            orderDetailList = OrderDetailBLL.ReadList(orderID);
            #region 加载订单下商品
            foreach (OrderDetailInfo orderDetail in orderDetailList)
            {
                if (strProductID2 == string.Empty)
                {
                    strProductID2 = orderDetail.ProductId.ToString();
                }
                else
                {
                    strProductID2 += "," + orderDetail.ProductId.ToString();
                }
            }
            if (strProductID2 != string.Empty)
            {
                ProductSearchInfo productSearch = new ProductSearchInfo();
                productSearch.InProductId = strProductID2;
                productList = ProductBLL.SearchList(productSearch);
            }
            #endregion
            #region 判断是否已评论
            List <ProductCommentInfo>[] listPinfoArr = new List <ProductCommentInfo> [productList.Count];
            int pi = 0;
            foreach (ProductInfo item in productList)
            {
                ProductCommentSearchInfo psi = new ProductCommentSearchInfo();
                psi.ProductId    = item.Id;
                psi.UserId       = base.UserId;
                psi.OrderID      = orderID;
                listPinfoArr[pi] = ProductCommentBLL.SearchProductCommentList(psi);
                if (listPinfoArr[pi].Count <= 0)
                {
                    isPL = false;
                }
            }
            if (isPL)
            {
                string url = "";
                if (Request.RawUrl.ToLower().IndexOf("/mobile/") >= 0)
                {
                    url = "/mobile/User/UserProductComment.html";
                }
                else
                {
                    url = "/User/UserProductComment.html";
                }
                Response.Redirect(url);
            }
            #endregion
            //ProductCommentSearchInfo productCommentSearch = new ProductCommentSearchInfo();
            //productCommentSearch.UserId = base.UserId;
            //productCommentSearch.OrderID = orderID;
            //if (ProductCommentBLL.SearchProductCommentList(productCommentSearch).Count >= productList.Count)
            //{
            //    string url = "";
            //    if (Request.RawUrl.ToLower().IndexOf("/mobile/") >= 0)
            //    {
            //        url = "/mobile/User/UserProductComment.html";
            //    }
            //    else
            //    {
            //        url = "/User/UserProductComment.html";
            //    }
            // Response.Redirect(url);


            Title = "订单评价 - 会员中心";
        }
Esempio n. 19
0
        public List <ProductCommentInfo> SearchProductCommentList(int currentPage, int pageSize, ProductCommentSearchInfo productCommentSearch, ref int count)
        {
            List <ProductCommentInfo> productCommentList = new List <ProductCommentInfo>();
            ShopMssqlPagerClass       class2             = new ShopMssqlPagerClass();

            class2.TableName   = ShopMssqlHelper.TablePrefix + "ProductComment";
            class2.Fields      = "[ID],[ProductID],[Title],[Content],[UserIP],[PostDate],[Support],[Against],[Status],[Rank],[ReplyCount],[AdminReplyContent],[AdminReplyDate],[UserID],[UserName]";
            class2.CurrentPage = currentPage;
            class2.PageSize    = pageSize;
            class2.OrderField  = "[ID]";
            class2.OrderType   = OrderType.Desc;
            this.PrepareCondition(class2.MssqlCondition, productCommentSearch);
            class2.Count = count;
            count        = class2.Count;
            using (SqlDataReader reader = class2.ExecuteReader())
            {
                this.PrepareProductCommentModel(reader, productCommentList);
            }
            return(productCommentList);
        }
Esempio n. 20
0
        public List <ProductCommentInfo> SearchProductCommentInnerList(int currentPage, int pageSize, ProductCommentSearchInfo productCommentSearch, ref int count)
        {
            List <ProductCommentInfo> list   = new List <ProductCommentInfo>();
            ShopMssqlPagerClass       class2 = new ShopMssqlPagerClass();

            class2.TableName   = string.Concat(new object[] { ' ', ShopMssqlHelper.TablePrefix, "ProductComment INNER JOIN ", ShopMssqlHelper.TablePrefix, "Product ON ", ShopMssqlHelper.TablePrefix, "ProductComment.[ProductID]=", ShopMssqlHelper.TablePrefix, "Product.[ID] " });
            class2.Fields      = ShopMssqlHelper.TablePrefix + "ProductComment.[ID],[ProductID],[Title],[UserIP],[PostDate],[Support],[Against],[Status],[Rank],[ReplyCount],[AdminReplyContent],[AdminReplyDate],[UserID],[UserName],[Name]";
            class2.CurrentPage = currentPage;
            class2.PageSize    = pageSize;
            class2.OrderField  = ShopMssqlHelper.TablePrefix + "ProductComment.[ID]";
            class2.OrderType   = OrderType.Desc;

            this.PrepareCondition(class2.MssqlCondition, productCommentSearch);
            class2.Count = count;
            count        = class2.Count;
            using (SqlDataReader reader = class2.ExecuteReader())
            {
                while (reader.Read())
                {
                    ProductCommentInfo item = new ProductCommentInfo();
                    item.ID                = reader.GetInt32(0);
                    item.ProductID         = reader.GetInt32(1);
                    item.Title             = reader[2].ToString();
                    item.UserIP            = reader[3].ToString();
                    item.PostDate          = reader.GetDateTime(4);
                    item.Support           = reader.GetInt32(5);
                    item.Against           = reader.GetInt32(6);
                    item.Status            = reader.GetInt32(7);
                    item.Rank              = reader.GetInt32(8);
                    item.ReplyCount        = reader.GetInt32(9);
                    item.AdminReplyContent = reader[10].ToString();
                    item.AdminReplyDate    = reader.GetDateTime(11);
                    item.UserID            = reader.GetInt32(12);
                    item.UserName          = reader[13].ToString();
                    item.Product.Name      = reader[14].ToString();
                    list.Add(item);
                }
            }
            return(list);
        }