public ActionResult AjaxAddComment(FormCollection Fm)
 {
     if (base.currentUser == null)
     {
         return null;
     }
     Maticsoft.Model.CMS.Comment model = new Maticsoft.Model.CMS.Comment();
     int num = Globals.SafeInt(Fm["ContentId"], 0);
     int num2 = 0;
     string str = ViewModelBase.ReplaceFace(Globals.HtmlEncode(Fm["Des"]));
     model.CreatedDate = DateTime.Now;
     model.CreatedNickName = base.currentUser.NickName;
     model.CreatedUserID = base.currentUser.UserID;
     model.Description = str;
     model.IsRead = false;
     model.ReplyCount = 0;
     model.ContentId = new int?(num);
     model.TypeID = 3;
     model.State = true;
     num2 = this.comBll.AddEx(model);
     if (num2 <= 0)
     {
         return base.Content("No");
     }
     model.ID = num2;
     List<Maticsoft.Model.CMS.Comment> list = new List<Maticsoft.Model.CMS.Comment>();
     if (!FilterWords.ContainsModWords(model.Description))
     {
         list.Add(model);
     }
     return this.PartialView("_ArticleComment", list);
 }
 public ActionResult AjaxComment(FormCollection Fm)
 {
     int num = Globals.SafeInt(Fm["id"], 0);
     int num2 = Globals.SafeInt(Fm["typeid"], 0);
     string str = InjectionFilter.Filter(Fm["cont"]);
     string str2 = InjectionFilter.Filter(Fm["username"]);
     if (((num <= 0) || (num2 <= 0)) || (string.IsNullOrWhiteSpace(str) || string.IsNullOrWhiteSpace(str2)))
     {
         return base.Content("false");
     }
     Maticsoft.BLL.CMS.Comment comment = new Maticsoft.BLL.CMS.Comment();
     Maticsoft.Model.CMS.Comment model = new Maticsoft.Model.CMS.Comment {
         CreatedDate = DateTime.Now,
         CreatedNickName = str2,
         Description = str,
         State = false,
         ParentID = 0,
         TypeID = num2,
         IsRead = false,
         ContentId = new int?(num),
         CreatedUserID = -1
     };
     if (comment.AddTran(model) <= 0)
     {
         return base.Content("false");
     }
     return base.Content("true");
 }
Beispiel #3
0
 public Maticsoft.Model.CMS.Comment DataRowToModel(DataRow row)
 {
     Maticsoft.Model.CMS.Comment comment = new Maticsoft.Model.CMS.Comment();
     if (row != null)
     {
         if ((row["ID"] != null) && (row["ID"].ToString() != ""))
         {
             comment.ID = int.Parse(row["ID"].ToString());
         }
         if ((row["ContentId"] != null) && (row["ContentId"].ToString() != ""))
         {
             comment.ContentId = new int?(int.Parse(row["ContentId"].ToString()));
         }
         if (row["Description"] != null)
         {
             comment.Description = row["Description"].ToString();
         }
         if ((row["CreatedDate"] != null) && (row["CreatedDate"].ToString() != ""))
         {
             comment.CreatedDate = DateTime.Parse(row["CreatedDate"].ToString());
         }
         if ((row["CreatedUserID"] != null) && (row["CreatedUserID"].ToString() != ""))
         {
             comment.CreatedUserID = int.Parse(row["CreatedUserID"].ToString());
         }
         if ((row["ReplyCount"] != null) && (row["ReplyCount"].ToString() != ""))
         {
             comment.ReplyCount = int.Parse(row["ReplyCount"].ToString());
         }
         if ((row["ParentID"] != null) && (row["ParentID"].ToString() != ""))
         {
             comment.ParentID = int.Parse(row["ParentID"].ToString());
         }
         if ((row["TypeID"] != null) && (row["TypeID"].ToString() != ""))
         {
             comment.TypeID = int.Parse(row["TypeID"].ToString());
         }
         if ((row["State"] != null) && (row["State"].ToString() != ""))
         {
             if ((row["State"].ToString() == "1") || (row["State"].ToString().ToLower() == "true"))
             {
                 comment.State = true;
             }
             else
             {
                 comment.State = false;
             }
         }
         if ((row["IsRead"] != null) && (row["IsRead"].ToString() != ""))
         {
             if ((row["IsRead"].ToString() == "1") || (row["IsRead"].ToString().ToLower() == "true"))
             {
                 comment.IsRead = true;
             }
             else
             {
                 comment.IsRead = false;
             }
         }
         if (row["CreatedNickName"] != null)
         {
             comment.CreatedNickName = row["CreatedNickName"].ToString();
         }
     }
     return comment;
 }