Beispiel #1
0
        /// <summary>
        /// 晒单评论
        /// </summary>
        public void Comment_reply()
        {
            int          id         = RequestTool.RequestInt("id", 0);
            int          Product_id = 0;
            Lebi_Product product    = B_Lebi_Product.GetModel(id);

            if (product != null)
            {
                Product_id = product.Product_id;
            }
            Lebi_Comment pmodel = B_Lebi_Comment.GetModel(id);

            if (pmodel == null)
            {
                Response.Write("{\"msg\":\"" + Tag("参数错误") + "\"}");
                return;
            }
            string Content = RequestTool.RequestSafeString("comment");

            if (Content == "")
            {
                Response.Write("{\"msg\":\"" + Tag("内容不能为空") + "\"}");
                return;
            }
            Lebi_Comment model = new Lebi_Comment();

            model.TableName = "Product";
            model.Keyid     = id;
            //model.Admin_UserName = CurrentUser.NickName;
            model.Admin_id      = 0;
            model.User_id       = CurrentUser.id;
            model.User_UserName = CurrentUser.NickName;
            model.Content       = Content;
            model.Parentid      = id;
            model.Status        = 280;
            model.Time_Add      = System.DateTime.Now;
            model.Language_Code = CurrentLanguage.Code;
            model.Product_id    = Product_id;
            model.IsRead        = 0;
            model.Supplier_id   = product.Supplier_id;
            if (!Comment.CheckSafeWord(model.Content))
            {
                Response.Write("{\"msg\":\"" + Tag("内容中包含敏感词") + "\"}");
                return;
            }
            B_Lebi_Comment.Add(model);
            //发送邮件
            if (ShopCache.GetBaseConfig().AdminMailSign.ToLower().Contains("comment"))
            {
                Lebi_User user = B_Lebi_User.GetModel(CurrentUser.id);
                Email.SendEmail_comment(user, model);
            }
            Response.Write("{\"msg\":\"OK\"}");
        }
        protected override void LoadPage(string themecode, int siteid, string languagecode, string pcode)
        {
            LoadTheme(themecode, siteid, languagecode, pcode);
            int id = Rint_Para("0");

            comment = B_Lebi_Comment.GetModel(id);
            if (comment.id == 0)
            {
                Response.Redirect(URL("P_404", ""));
                Response.End();
            }
            product      = GetProduct(comment.Keyid);
            string where = "Parentid =" + id;
            comments     = B_Lebi_Comment.GetList(where, "id desc", PageSize, pageindex);
            int recordCount = B_Lebi_Comment.Counts(where);

            PageString  = Shop.Bussiness.Pager.GetPaginationStringForWeb("?page={0}&id=" + id, pageindex, PageSize, recordCount, CurrentLanguage);
            ProductStar = Convert.ToInt32(product.Star_Comment);
            if (ProductStar > 5)
            {
                ProductStar = 5;
            }
            if (ProductStar < 0)
            {
                ProductStar = 0;
            }
            pro_type = B_Lebi_Pro_Type.GetModel(product.Pro_Type_id);
            path     = "<a href=\"" + URL("P_Index", "") + "\" class=\"home\" title=\"" + Tag("首页") + "\"><span>" + Tag("首页") + "</span></a><em class=\"home\">&raquo;</em>";
            if (pro_type != null)
            {
                string[,] parr = Categorypath(pro_type.id);
                for (int i = 0; i <= parr.GetUpperBound(0); i++)
                {
                    path += "<a href=\"" + URL("P_ProductCategory", "" + parr[i, 0] + "") + "\"><span>" + parr[i, 1] + "</span></a><em>&raquo;</em>";
                }
            }
            path += "<a href=\"" + URL("P_Product", product.id) + "\"><span>" + Lang(product.Name) + "</span></a><em>&raquo;</em>";
            path += "<a><span>" + Tag("晒单") + "</span></a>";
            //path += "<a href=\"" + URL("P_Product", id) + "\"><span>" + Lang(product.Name) + "</span></a>";

            smalls = comment.ImagesSmall.Split('@');
            bigs   = comment.Images.Split('@');
            if (bigs.Count() > 1)
            {
                DefaultImage = bigs[1];
            }

            productcomments = B_Lebi_Comment.GetList("TableName='Product' and Keyid=" + comment.Keyid + " and id!=" + comment.id + "", "id desc", 5, 1);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!EX_Admin.Power("ask_edit", "编辑商品咨询"))
            {
                WindowNoPower();
            }
            int id = RequestTool.RequestInt("id", 0);

            model = B_Lebi_Comment.GetModel(id);
            if (model == null)
            {
                model = new Lebi_Comment();
            }
            models = B_Lebi_Comment.GetList("Parentid = " + id, "id desc", PageSize, page);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Power("supplier_ask", "商品咨询"))
            {
                WindowNoPower();
            }
            int id = RequestTool.RequestInt("id", 0);

            model = B_Lebi_Comment.GetModel("id = " + id + " and Supplier_id = " + CurrentSupplier.id);
            if (model == null)
            {
                model = new Lebi_Comment();
            }
            models = B_Lebi_Comment.GetList("Parentid = " + id, "id desc", PageSize, page);
        }