예제 #1
0
 public ActionResult Index(int top = 6, int id = -1, int typeid = 3, string viewName = "Index")
 {
     ((dynamic) base.ViewBag).contentid = id;
     ((dynamic) base.ViewBag).typeid = typeid;
     List<Maticsoft.Model.CMS.Comment> model = new Maticsoft.BLL.CMS.Comment().GetModelList(top, id, typeid);
     return base.View(viewName, model);
 }
예제 #2
0
 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");
 }
예제 #3
0
 public ActionResult Comments(int top)
 {
     List<Maticsoft.Model.CMS.Comment> model = new Maticsoft.BLL.CMS.Comment().GetModelList(top, "", " ID desc");
     if ((model != null) && (model.Count > 0))
     {
         foreach (Maticsoft.Model.CMS.Comment comment2 in model)
         {
             comment2.CreatedNickName = string.IsNullOrWhiteSpace(comment2.CreatedNickName) ? "游客" : comment2.CreatedNickName;
         }
     }
     return base.View(model);
 }
예제 #4
0
 public ActionResult Comment(Maticsoft.Model.CMS.Comment model)
 {
     if ((base.Session["CMS_CommentDate"] != null) && !string.IsNullOrEmpty(model.Description))
     {
         DateTime? nullable = Globals.SafeDateTime(base.Session["CMS_CommentDate"].ToString(), (DateTime?) null);
         if (nullable.HasValue && ((DateTime.Now - nullable.Value) < this._commentTimeSpan))
         {
             return base.Content("NOCOMMENT");
         }
     }
     model.CreatedDate = DateTime.Now;
     Maticsoft.BLL.CMS.Comment comment = new Maticsoft.BLL.CMS.Comment();
     List<Maticsoft.Model.CMS.Comment> modelList = new List<Maticsoft.Model.CMS.Comment>();
     if (string.IsNullOrEmpty(model.Description))
     {
         modelList = comment.GetModelList("ContentId=" + model.ContentId);
         if ((modelList != null) && (modelList.Count > 0))
         {
             foreach (Maticsoft.Model.CMS.Comment comment2 in modelList)
             {
                 comment2.CreatedNickName = string.IsNullOrWhiteSpace(comment2.CreatedNickName) ? "游客" : comment2.CreatedNickName;
             }
         }
         return base.PartialView(modelList);
     }
     model.TypeID = 3;
     if (base.currentUser != null)
     {
         model.CreatedUserID = base.currentUser.UserID;
         model.CreatedNickName = base.currentUser.NickName;
     }
     if ((model.ContentId = new int?(comment.Add(model))) > 0)
     {
         model.CreatedNickName = string.IsNullOrWhiteSpace(model.CreatedNickName) ? "游客" : model.CreatedNickName;
         modelList.Add(model);
         base.Session["CMS_CommentDate"] = DateTime.Now;
         return base.PartialView(modelList);
     }
     return base.Content("False");
 }