//发表帖子 public ActionResult PostDetail(int id) { var sdew = PostManage.selectpost(id); var postef1 = PostManage.selectallpost().OrderByDescending(p => p.Post_Click).Skip(6).Take(5); var buser = sdew.User_id; var userid = Convert.ToInt32(Session["User_id"]); var commdpost = PostManage.findallcomment(id); int attef; ForumPost indew = new ForumPost(); if (userid > 0) { var atter = AttentionManage.selecatten(userid, buser); if (atter != null) { attef = 1; ViewBag.attenrenid = atter.Attention_id; } else { attef = 0; } var userinfo1 = UsersManage.finduser(userid); indew.Userinfo2 = userinfo1; } else { attef = 0; } ViewBag.atterceshi = attef; indew.Post7 = postef1; indew.Post5 = sdew; indew.Commentpost = commdpost; return(View(indew)); }
public ActionResult AddPost([Bind(Include = "Post_id,User_id,PostContent,PostTime,ForumSection_id,Post_Click,PostName")] Post post) { try { string postname = Request["post_nume"]; var forumid = Convert.ToInt32(Session["Forution_id"]); var fghht = Session["Forution_id"].ToString(); if (ModelState.IsValid) { post.ForumSection_id = forumid; post.PostName = postname; post.PostTime = DateTime.Now; post.Post_Click = 1; post.User_id = Convert.ToInt32(Session["User_id"]); PostManage.AddTopost(post); } var sdeadw = Session["Forution_id"].ToString(); return(Content("<script>;alert('发表成功!');history.go(-2)</script>")); } catch (DbEntityValidationException ex) { return(Content(ex.Message)); } }
public ActionResult AddJunba(ForumSection forumssde, HttpPostedFileBase file) { try { var forummi = Request["post_nume"]; var userid = Convert.ToInt32(Session["User_id"]); if (file != null) { var foruimg = Request["FsectionImg"]; if (foruimg != null) { string filePath = foruimg; string filename = filePath.Substring(filePath.LastIndexOf("\\") + 1); string serverpath = Server.MapPath(@"\Images\essay\") + filename; string relativepath = @"/Images/essay/" + filename; file.SaveAs(serverpath); forumssde.FsectionImg = relativepath; } else { return(Content("<script>;alert('请先上传军吧图片!');history.go(-1)</script>")); } var forubackimg = Request["FsectionbackImg"]; if (forubackimg != null) { string filePath = forubackimg; string filename = filePath.Substring(filePath.LastIndexOf("\\") + 1); string serverpath = Server.MapPath(@"\Images\essay\") + filename; string relativepath = @"/Images/essay/" + filename; file.SaveAs(serverpath); forumssde.FsectionbackImg = relativepath; } else { return(Content("<script>;alert('请先军吧背景图片!');history.go(-1)</script>")); } } if (ModelState.IsValid) { forumssde.ForumSectionName = forummi; forumssde.User_id = userid; PostManage.AddForumsection(forumssde); return(Content("<script>;alert('创建成功!');window.location.href='/Forum/ClassifyPost'</script>")); } } catch (DbEntityValidationException ex) { return(Content(ex.Message)); } return(View()); }
/// <summary> /// 根据岗位集合获取岗位名称 /// </summary> private string GetPostName(ICollection <Domain.SYS_POST_USER> collection) { string retval = string.Empty; if (collection != null && collection.Count > 0) { var postlist = String.Join(",", collection.Select(p => p.FK_POSTID).ToList()).Trim(',').Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries).Select(p => p).ToList(); retval = String.Join(",", PostManage.LoadAll(p => postlist.Any(e => e == p.ID)).Select(p => p.POSTNAME).ToList()); } return(retval = retval.TrimEnd(',')); }
public ActionResult ClassifyEssay() { var foru = ForumManage.selectsec().Take(6); var foreess = ForumManage.selectallforum().OrderByDescending(p => p.ForumClicks).Take(6); var post = PostManage.selectallpost().OrderByDescending(p => p.Post_Click).Take(6); ForumEssay indee = new ForumEssay(); indee.Section1 = foru; indee.Forum3 = foreess; indee.Post1 = post; return(View(indee)); }
public ActionResult SelectPostReply(int commpostid) { var repluy = PostManage.findallreply(commpostid); if (repluy == null) { return(HttpNotFound()); } ViewModels.ForumPost indew = new ViewModels.ForumPost(); indew.Replypost = repluy; return(View(indew)); }
public ActionResult Postdeadwe(int?page) { var pose = PostManage.selsectallsec().Skip(9); int pagesize = 9; int pageNum = (page ?? 1); if (Request.IsAjaxRequest()) { return(PartialView("Postdeadwe", pose.ToPagedList(pageNum, pagesize))); } else { return(View("Postdeadwe", pose.ToPagedList(pageNum, pagesize))); } }
public string AddPostReply(ReplyPost replypso, string content, int id, string buser) { var userid = Convert.ToInt32(Session["User_id"]); if (!String.IsNullOrEmpty(content)) { replypso.Content = content; replypso.User_id = userid; replypso.CommentUsername = buser; replypso.CommentPost_id = id; PostManage.addReplyPost(replypso); return("ok"); } else { return("no"); } }
public string AddPostComment(CommentPost commpost) { var contentpos = Request.Form["CommendPostcopne"]; var posid = Convert.ToInt32(Request["post_idcomm"]); var userid = Convert.ToInt32(Session["User_id"]); if (!String.IsNullOrEmpty(contentpos)) { commpost.Post_id = posid; commpost.User_id = userid; commpost.Content = contentpos; PostManage.AddCommentPost(commpost); return("success"); } else { return("fail"); } }
public ActionResult ClassifyPost() { var pose = PostManage.selectallpost(); var usrid = Convert.ToInt32(Session["User_id"]); ForumPost idesw = new ForumPost(); if (usrid > 0) { var userinfo = UsersManage.finduser(usrid); var atte = AttentionManage.selectattenpost(usrid); if (atte != null) { idesw.AttentionPost1 = atte; } idesw.Userinfo = userinfo; } idesw.Post1 = pose; return(View(idesw)); }
public ActionResult Save(Domain.SYS_POST entity) { bool isEdit = false; var json = new JsonHelper() { Msg = "保存岗位成功", Status = "n", ReUrl = "/Post/Index" }; try { if (entity != null) { //添加 if (string.IsNullOrEmpty(entity.ID)) { entity.ID = Guid.NewGuid().ToString(); entity.CREATEDATE = DateTime.Now; entity.CREATEUSER = CurrentUser.Name; entity.UPDATEDATE = DateTime.Now; entity.UPDATEUSER = this.CurrentUser.Name; } else //修改 { entity.UPDATEDATE = DateTime.Now; entity.UPDATEUSER = this.CurrentUser.Name; isEdit = true; } //判断岗位是否重名 if (!this.PostManage.IsExist(p => p.POSTNAME == entity.POSTNAME && p.ID != entity.ID)) { if (PostManage.SaveOrUpdate(entity, isEdit)) { json.Status = "y"; } else { json.Msg = "保存失败"; } } else { json.Msg = "岗位" + entity.POSTNAME + "已存在,不能重复添加"; } } else { json.Msg = "未找到需要保存的岗位"; } if (isEdit) { WriteLog(Common.Enums.enumOperator.Edit, "修改岗位,结果:" + json.Msg, Common.Enums.enumLog4net.INFO); } else { WriteLog(Common.Enums.enumOperator.Add, "添加岗位,结果:" + json.Msg, Common.Enums.enumLog4net.INFO); } } catch (Exception e) { json.Msg = "保存岗位发生内部错误!"; WriteLog(Common.Enums.enumOperator.None, "保存岗位:", e); } return(Json(json)); }
public ActionResult JunBa(int id, string search_internal_input) { var sdedw = PostManage.findforumsec(id); var userid = Convert.ToInt32(Session["user_id"]); var forupost = PostManage.selectzhepost(id); var userinfo = UsersManage.finduser(userid); var postef = PostManage.selectallpost().OrderByDescending(p => p.Post_Click).Take(5); if (!String.IsNullOrEmpty(search_internal_input)) { forupost = forupost.Where(s => s.PostName.Contains(search_internal_input) || s.PostContent.Contains(search_internal_input)); } int attentionposet; int signtrue; int attenid; if (userid > 0) { var sdedq = AttentionManage.selectattenpostforu(userid, id); var sdedfdf = AttentionManage.findsign(userid, id); if (sdedq != null) { attenid = sdedq.AttentionPost_id; ViewBag.attentionid = attenid; attentionposet = 1; } else { attentionposet = 0; } if (sdedfdf != null) { signtrue = 1; ViewBag.signtime = sdedfdf.SignatureTime; } else { signtrue = 0; } } else { attentionposet = 0; signtrue = 0; } ViewBag.atten = attentionposet; ViewBag.signid = signtrue; ViewBag.allcontgun = AttentionManage.findattenjisuan(id); ViewBag.postcount = AttentionManage.findallpost(id); ForumPost idnes = new ForumPost(); idnes.ForumSEC1 = sdedw; idnes.Post1 = forupost; idnes.Post2 = postef; if (userinfo != null) { idnes.Userinfo1 = userinfo; } return(View(idnes)); }