/// <summary> /// 发布 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnPublish_Click(object sender, EventArgs e) { if (String.IsNullOrEmpty(tbComment.Text.Trim())) { base.AlertMessage("提示", "评论不能为空!"); return; } int userId=SPContext.Current.Web.CurrentUser.ID; string userName = String.IsNullOrEmpty(SPContext.Current.Web.CurrentUser.Name) ? SPContext.Current.Web.CurrentUser.LoginName : SPContext.Current.Web.CurrentUser.Name; DM_Comment entity = new DM_Comment(); entity.ID = Guid.NewGuid(); entity.Comment = this.tbComment.Text; entity.CreateTime = DateTime.Now; entity.Creator = userId; entity.CreatorName = userName; entity.ItemId = Convert.ToInt32(ItemId); entity.ListId = new Guid(ListId); entity.Modifier = userId; entity.ModifierName = userName; entity.ModifyTime = DateTime.Now; entity.SiteId = SPContext.Current.Site.ID; CommentBLL.SaveComment(entity,true); this.tbComment.Text = ""; BindGrid(); base.AlertMessage("提示", "发布成功!"); }
/// <summary> /// 删除 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void gvComment_RowDeleting(object sender, GridViewDeleteEventArgs e) { int index = e.RowIndex; GridViewRow gvr = this.gvComment.Rows[index]; LinkButton lbDelete = gvr.FindControl("lbDelete") as LinkButton; string Id = lbDelete.CommandArgument; DM_Comment entity = new DM_Comment(); entity.ID = new Guid(Id); CommentBLL.DeleteComment(entity); this.gvComment.EditIndex = -1; BindGrid(); base.AlertMessage("提示", "删除成功!"); }
/// <summary> /// 保存评论 /// </summary> /// <param name="entity"></param> /// <param name="bFlag"></param> public void SaveComment(DM_Comment entity, bool bFlag) { CommentDao.SaveComment(entity, bFlag); }
/// <summary> /// 删除评论 /// </summary> /// <param name="entity"></param> public void DeleteComment(DM_Comment entity) { CommentDao.DeleteComment(entity); }
partial void DeleteDM_Comment(DM_Comment instance);
partial void UpdateDM_Comment(DM_Comment instance);
partial void InsertDM_Comment(DM_Comment instance);