Exemplo n.º 1
0
 public ActionResult AjaxAddComment(FormCollection Fm)
 {
     if (string.IsNullOrWhiteSpace(Fm["ProductId"]))
     {
         return base.Content("False");
     }
     int num = Globals.SafeInt(Fm["ProductId"], 0);
     string productName = Fm["ProductName"];
     string str2 = InjectionFilter.SqlFilter(Fm["Content"]);
     Maticsoft.BLL.Shop.Products.ProductReviews reviews = new Maticsoft.BLL.Shop.Products.ProductReviews();
     Maticsoft.Model.Shop.Products.ProductReviews model = new Maticsoft.Model.Shop.Products.ProductReviews {
         CreatedDate = DateTime.Now,
         Status = 0,
         UserId = base.CurrentUser.UserID,
         UserName = base.CurrentUser.NickName,
         UserEmail = base.CurrentUser.Email,
         ParentId = 0,
         ProductId = num,
         ReviewText = str2
     };
     bool boolValueByCache = ConfigSystem.GetBoolValueByCache("Shop_Create_Post");
     if (!reviews.AddEx(model, productName, boolValueByCache))
     {
         return base.Content("False");
     }
     return base.Content("True");
 }
Exemplo n.º 2
0
 private void ShowInfo(int ReviewId)
 {
     Maticsoft.Model.Shop.Products.ProductReviews model = new Maticsoft.BLL.Shop.Products.ProductReviews().GetModel(ReviewId);
     if (model != null)
     {
         this.lblReviewId.Text = model.ReviewId.ToString();
         this.lblProductId.Text = new Maticsoft.BLL.Shop.Products.ProductInfo().GetProductName(model.ProductId);
         this.lblUserId.Text = model.UserId.ToString();
         this.lblReviewText.Text = Globals.HtmlDecode(model.ReviewText);
         this.lblUserName.Text = model.UserName;
         this.lblUserEmail.Text = model.UserEmail;
         this.lblCreatedDate.Text = model.CreatedDate.ToString();
         this.lblParentId.Text = model.ParentId.ToString();
         this.hidImagesNames.Value = model.ImagesNames;
         this.hidImagesPath.Value = model.ImagesPath;
         if (model.Status == 0)
         {
             this.lblState.Text = "未审核";
         }
         else if (model.Status == 1)
         {
             this.lblState.Text = "已审核";
         }
         else
         {
             this.lblState.Text = "审核失败";
         }
         this.lblScore.Text = new Maticsoft.BLL.Shop.Products.ScoreDetails().GetScore(new int?(ReviewId)).ToString();
     }
 }
Exemplo n.º 3
0
 public ActionResult AjAxPReview(FormCollection fm)
 {
     string str = fm["PReviewjson"];
     if (!string.IsNullOrWhiteSpace(str))
     {
         int num4;
         Maticsoft.BLL.Shop.Products.ProductReviews reviews = new Maticsoft.BLL.Shop.Products.ProductReviews();
         List<Maticsoft.Model.Shop.Products.ProductReviews> modelList = new List<Maticsoft.Model.Shop.Products.ProductReviews>();
         JsonArray array = JsonConvert.Import<JsonArray>(str);
         long orderId = -1L;
         foreach (JsonObject obj2 in array)
         {
             long num2 = Globals.SafeInt(obj2["pid"].ToString(), -1);
             orderId = Globals.SafeInt(obj2["orderId"].ToString(), -1);
             string str2 = InjectionFilter.Filter(obj2["contentval"].ToString());
             string str3 = Globals.SafeString(obj2["imagesurlPath"].ToString(), "");
             string str4 = Globals.SafeString(obj2["imagesurlName"].ToString(), "");
             string str5 = InjectionFilter.Filter(obj2["attribute"].ToString());
             string str6 = InjectionFilter.Filter(obj2["sku"].ToString());
             if (((num2 <= 0L) || (orderId <= 0L)) || string.IsNullOrWhiteSpace(str2))
             {
                 return base.Content("false");
             }
             Maticsoft.Model.Shop.Products.ProductReviews item = new Maticsoft.Model.Shop.Products.ProductReviews {
                 Attribute = str5,
                 CreatedDate = DateTime.Now,
                 OrderId = orderId,
                 ProductId = num2,
                 ReviewText = str2,
                 SKU = str6,
                 Status = 0,
                 UserEmail = base.currentUser.Email,
                 UserId = base.currentUser.UserID,
                 UserName = base.currentUser.UserName,
                 ParentId = 0
             };
             if (!string.IsNullOrWhiteSpace(str3) && !string.IsNullOrWhiteSpace(str4))
             {
                 string virtualPath = string.Format("/Upload/Shop/ProductReviews/{0}/", DateTime.Now.ToString("yyyyMM"));
                 string path = base.Request.MapPath(virtualPath);
                 if (!Directory.Exists(path))
                 {
                     Directory.CreateDirectory(path);
                 }
                 string[] strArray = str3.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
                 string[] strArray2 = str4.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
                 if (strArray.Length != strArray2.Length)
                 {
                     throw new ArgumentOutOfRangeException("路径与文件名长度不匹配!");
                 }
                 for (int i = 0; i < strArray.Length; i++)
                 {
                     File.Move(base.Request.MapPath(strArray[i]), path + strArray2[i]);
                 }
                 item.ImagesPath = virtualPath + "{0}";
                 item.ImagesNames = string.Join("|", strArray2);
             }
             modelList.Add(item);
         }
         if ((modelList.Count > 0) && reviews.AddEx(modelList, orderId, out num4))
         {
             return base.Content(num4.ToString());
         }
     }
     return base.Content("false");
 }