private bool CustomSaveOnEdit(T_Comment t_comment, out bool customsave_hasissues, string command = "") { var result = false; customsave_hasissues = false; return(result); }
private bool CustomSaveOnImport(T_Comment t_comment, out string customerror, int i) { var result = false; customerror = ""; return(result); }
public string SubmitComment(string BeCommentedUserName, string BeCommentedInfo, string Time, string AuthorName, int W_Id, string WorkName, string ResponseInfo, string GetTime) { using (剧享网Entities db = new 剧享网Entities()) { //判断用户是否登录 if (Session["UserName"] == null) { return("Warning"); } //判断该功能权限是否关闭 var JudgePermission = from judge in db.T_Function where judge.F_SubId == "3F1" && judge.F_Function == "SendFunction" && judge.F_FatherId == "2F3" select judge; int F_IsOpen = 1; foreach (var open in JudgePermission) { F_IsOpen = open.F_IsOpen; } if (F_IsOpen == 0) { return("Close"); } string UserName = Session["UserName"].ToString(); string PassWord = Session["PassWord"].ToString(); //查询出当前用户的信息表 var SelectUserInfo = from userinfo in db.T_User where userinfo.U_UserName == UserName && userinfo.U_UserPassWord == PassWord select userinfo; //获取当前评论用户的Id int U_Id = 0; foreach (var info in SelectUserInfo) { U_Id = info.U_Id; } //查询出被评论的人的所有信息 var SelectBeCommented = from becomment in db.T_Comment where becomment.U_UserName == BeCommentedUserName && becomment.C_Info == BeCommentedInfo && becomment.C_CommentTime == Time && becomment.C_WorkTime == GetTime select becomment; //获取被评论的人的编号 int C_InfoId = 0; //获取本作品的发表时间,为下面插入提供 string C_WorkTime = null; foreach (var getInfoId in SelectBeCommented) { C_InfoId = getInfoId.C_InfoId; C_WorkTime = getInfoId.C_WorkTime; } string NowTime = Convert.ToString(DateTime.Now); T_Comment t_Comment = new T_Comment(); t_Comment.U_UserName = UserName; t_Comment.U_Id = U_Id; t_Comment.C_Id = 3; t_Comment.C_UserName = AuthorName; t_Comment.W_Id = W_Id; t_Comment.C_WorkName = WorkName; t_Comment.C_WorkTime = GetTime; t_Comment.C_Info = ResponseInfo; t_Comment.C_Response = C_InfoId;//对应对象唯一Id t_Comment.C_CommentTime = NowTime; db.T_Comment.Add(t_Comment); db.SaveChanges(); ManagerController manager = new ManagerController(); manager.NotifyInfo(ResponseInfo, AuthorName, W_Id, UserName, WorkName); return(UserName + " :" + ResponseInfo); } }
private bool CustomDelete(T_Comment t_comment, out bool customdelete_hasissues, string command = "") { var result = false; customdelete_hasissues = false; return(result); }
public List <T_Comment> ChildrenInfo(int JudgeObject) { using (剧享网Entities db = new 剧享网Entities()) { List <T_Comment> SubList = new List <T_Comment>();//存放C_Response!=0的列表 var GetSubInfo = from subinfo in db.T_Comment where subinfo.C_Response == JudgeObject select subinfo; int GetSubInfoCount = (from subinfocount in db.T_Comment where subinfocount.C_Response == JudgeObject select subinfocount).Count(); if (GetSubInfoCount == 0) { return(SubList); } //string str1 = ":"; foreach (var subinfo in GetSubInfo) { T_Comment comment = new T_Comment(); comment.U_UserName = subinfo.U_UserName; comment.C_Info = subinfo.C_Info; SubList.Add(comment); //SubList.Add(subinfo.U_UserName);//1:子信息的用户名 //SubList.Add(str1);//2:冒号 //SubList.Add(subinfo.C_Info);//3:子信息的用户评论内容 } return(SubList); } }
public ActionResult DeleteConfirmed(Guid id) { T_Comment t_Comment = db.T_Comment.Find(id); db.T_Comment.Remove(t_Comment); db.SaveChanges(); return(RedirectToAction("Index")); }
public string SelfComment(string AuthorName, int W_Id, string WorkName, string Comment, string GetTime) { using (剧享网Entities db = new 剧享网Entities()) { //判断用户是否登录 if (Session["UserName"] == null) { return("Warning"); } //判断该功能权限是否关闭 var JudgePermission = from judgepermission in db.T_Function where judgepermission.F_SubId == "3F1" && judgepermission.F_Function == "SendFunction" && judgepermission.F_FatherId == "2F3" select judgepermission; int F_IsOpen = 1; foreach (var open in JudgePermission) { F_IsOpen = open.F_IsOpen; } if (F_IsOpen == 0) { return("Close"); } string UserName = Session["UserName"].ToString(); string PassWord = Session["PassWord"].ToString(); //查询出当前用户的信息表 var SelectUserInfo = from userinfo in db.T_User where userinfo.U_UserName == UserName && userinfo.U_UserPassWord == PassWord select userinfo; //获取当前评论用户的Id int U_Id = 0; string NowTime = Convert.ToString(DateTime.Now); foreach (var info in SelectUserInfo) { U_Id = info.U_Id; } T_Comment t_Comment = new T_Comment(); t_Comment.U_UserName = UserName; t_Comment.U_Id = U_Id; t_Comment.C_Id = 3; t_Comment.C_UserName = AuthorName; t_Comment.W_Id = W_Id; t_Comment.C_WorkName = WorkName; t_Comment.C_WorkTime = GetTime; t_Comment.C_Info = Comment; t_Comment.C_Response = 0;//自己评论对象是0 t_Comment.C_CommentTime = NowTime; db.T_Comment.Add(t_Comment); db.SaveChanges(); ManagerController manager = new ManagerController(); if (W_Id == 1) { manager.NotifyInfo(Comment, AuthorName, W_Id, UserName, WorkName); } else { manager.NotifyInfo(Comment, AuthorName, W_Id, UserName, WorkName); } return(""); } }
public ActionResult Edit([Bind(Include = "ID,DomainID,Path,IP,Name,Comment,ParentID,DatePosted,QueryString")] T_Comment t_Comment) { if (ModelState.IsValid) { db.Entry(t_Comment).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ParentID = new SelectList(db.T_Comment, "ID", "DomainID", t_Comment.ParentID); ViewBag.DomainID = new SelectList(db.T_Domain, "ID", "Host", t_Comment.DomainID); return(PartialView(t_Comment)); }
public string CheckBeforeSave(T_Comment t_comment, string command = "") { var AlertMsg = ""; // Write your logic here //Make sure to assign AlertMsg with proper message //AlertMsg = "Validation Alert - Before Save !! Information not saved."; //ModelState.AddModelError("CustomError", AlertMsg); //ViewBag.ApplicationError = AlertMsg; return(AlertMsg); }
// GET: Comment1/Details/5 public ActionResult Details(Guid?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } T_Comment t_Comment = db.T_Comment.Find(id); if (t_Comment == null) { return(HttpNotFound()); } return(PartialView(t_Comment)); }
public bool CheckBeforeDelete(T_Comment t_comment) { var result = true; // Write your logic here if (!result) { var AlertMsg = "Validation Alert - Before Delete !! Information not deleted."; ModelState.AddModelError("CustomError", AlertMsg); ViewBag.ApplicationError = AlertMsg; } return(result); }
// GET: Comment1/Edit/5 public ActionResult Edit(Guid?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } T_Comment t_Comment = db.T_Comment.Find(id); if (t_Comment == null) { return(HttpNotFound()); } ViewBag.ParentID = new SelectList(db.T_Comment, "ID", "DomainID", t_Comment.ParentID); ViewBag.DomainID = new SelectList(db.T_Domain, "ID", "Host", t_Comment.DomainID); return(PartialView(t_Comment)); }
public ActionResult Create([Bind(Include = "ID,DomainID,Path,IP,Name,Comment,ParentID,DatePosted,QueryString")] T_Comment t_Comment) { if (ModelState.IsValid) { t_Comment.ID = Guid.NewGuid(); db.T_Comment.Add(t_Comment); db.SaveChanges(); return(RedirectToAction("Index")); } Response.StatusCode = 422; ViewBag.ParentID = new SelectList(db.T_Comment, "ID", "DomainID", t_Comment.ParentID); ViewBag.DomainID = new SelectList(db.T_Domain, "ID", "Host", t_Comment.DomainID); return(PartialView(t_Comment)); }
public List <T_Comment> FatherInfo(string AuthorName, int W_Id, string WorkName, string WorkTime) { using (剧享网Entities db = new 剧享网Entities()) { // var fatherinfo = from info in db.T_Comment where info.C_Response == 0 && info.C_UserName == AuthorName && info.W_Id == W_Id && info.C_WorkName == WorkName && info.C_WorkTime == WorkTime select info; // List <T_Comment> FatherList = new List <T_Comment>(); foreach (var info in fatherinfo) { T_Comment comment = new T_Comment(); comment.U_Id = info.U_Id; comment.C_Id = info.C_Id; comment.C_InfoId = info.C_InfoId; comment.U_UserName = info.U_UserName; comment.C_Info = info.C_Info; comment.C_CommentTime = info.C_CommentTime; FatherList.Add(comment); } return(FatherList); } }
public ActionResult PostComment(CommentPostModel commentPost) { JsonViewResult json = new JsonViewResult() { Success = false }; if (!ModelState.IsValid) { json.Success = false; json.Message = "输入错误"; return(Json(json, JsonRequestBehavior.AllowGet)); } string verifyCode = Session["ValidateCode"] as string; if (verifyCode.ToLower() != commentPost.VerifyCode) { json.Success = false; json.Message = "验证码输入错误"; return(Json(json, JsonRequestBehavior.AllowGet)); } var jokeinfo = jokeBusinessLogic.JokeDetailGet(commentPost.JokeID); T_Comment commentDomain = new T_Comment(); commentDomain.AddDate = DateTime.Now; commentDomain.Content = commentPost.Comment; commentDomain.Floor = jokeinfo.CommentCount + 1; commentDomain.JokeId = commentPost.JokeID; commentDomain.UserID = user.UserId; jokeinfo.CommentCount = jokeinfo.CommentCount + 1; jokeBusinessLogic.UpdateJoke(jokeinfo); json.Success = jokeBusinessLogic.AddComment(commentDomain); return(Json(json, JsonRequestBehavior.AllowGet)); }
public void OnDeleting(T_Comment t_comment) { // Write your logic here }
private void CustomLoadViewDataListAfterOnCreate(T_Comment t_comment) { }
private void CustomLoadViewDataListBeforeEdit(T_Comment t_comment) { }
private void CustomLoadViewDataListAfterEdit(T_Comment t_comment) { }
public void AfterSave(T_Comment t_comment) { // Write your logic here }
public void OnSaving(T_Comment t_comment, ApplicationContext db) { // Write your logic here }
public bool AddComment(T_Comment comment) { return(commentData.Add(comment) > 0); }
private RedirectToRouteResult CustomRedirectUrl(T_Comment t_comment, string action, string command = "") { // Sample Custom implemention below // return RedirectToAction("Index", "T_Comment"); return(null); }