public void CreateNewsComment(NewsComment newsComment) { using (SqlConnection connection = base.GetConnection()) { SqlCommand command = new SqlCommand("_NewsCommentUpdate", connection) { CommandType = CommandType.StoredProcedure }; command.Parameters.AddWithValue("@Type", 0); command.Parameters.AddWithValue("@CommentNewsID", 0); command.Parameters.AddWithValue("@NewsID", newsComment.NewsID); command.Parameters.AddWithValue("@FullName", newsComment.FullName); command.Parameters.AddWithValue("@Email", newsComment.Email); command.Parameters.AddWithValue("@Title", newsComment.Title); command.Parameters.AddWithValue("@Content", newsComment.Content); command.Parameters.AddWithValue("@DateCreated", newsComment.DateCreated); command.Parameters.AddWithValue("@Actived", newsComment.Actived); command.Parameters.AddWithValue("@GroupCate", newsComment.GroupCate); command.Parameters.AddWithValue("@ApprovalUserName", newsComment.ApprovalUserName); command.Parameters.AddWithValue("@ApprovalDate", newsComment.ApprovalDate); connection.Open(); if (command.ExecuteNonQuery() <= 0) { throw new DataAccessException("Lỗi kh\x00f4ng thể tao moi"); } command.Dispose(); } }
protected NewsComment ReceiveHtml() { NewsComment newsComment = new NewsComment(); newsComment.CommentNewsID = 0; newsComment.NewsID = Convert.ToInt32(txtNewsGroupID.Value); newsComment.Title = txtTitle.Text; newsComment.Content = txtContent.Text; newsComment.FullName = txtFullName.Text; newsComment.Email = txtEmail.Text; newsComment.DateCreated = DateTime.Now; newsComment.Actived = false; newsComment.GroupCate = Convert.ToInt32(hddGroupCate.Value); newsComment.ApprovalDate = DateTime.Now; newsComment.ApprovalUserName = ""; return newsComment; }
protected NewsComment ReceiveHtml() { NewsComment newsComment = new NewsComment(); newsComment.CommentNewsID = (hddCommentID.Value != "") ? Convert.ToInt32(hddCommentID.Value) : 0; newsComment.NewsID = (hddNewsID.Value != "") ? Convert.ToInt32(hddNewsID.Value) : 0; newsComment.Title = txtTitle.Text; newsComment.Content = txtContent.Html; newsComment.FullName = txtFullName.Text; newsComment.Email = txtEmail.Text; newsComment.DateCreated = txtDateCreated.SelectedDate.Value; // newsComment.Actived = Convert.ToBoolean(rdbActive.SelectedItem.Value); newsComment.GroupCate = Convert.ToInt32(hddGroup.Value); newsComment.Actived = Convert.ToBoolean(rdbActive.SelectedValue); if (hddApprovalUserName.Value != "") { newsComment.ApprovalUserName = hddApprovalUserName.Value; newsComment.ApprovalDate = Convert.ToDateTime(hddApprovalDate.Value); } else if (Convert.ToBoolean(rdbActive.SelectedValue)) { newsComment.ApprovalUserName = Session["Admin_UserName"].ToString(); newsComment.ApprovalDate = DateTime.Now; } else { newsComment.ApprovalUserName = ""; newsComment.ApprovalDate = DateTime.Now; } return newsComment; }
public void CreateNewsComment(NewsComment newsComment) { new NewsCommentDAO().CreateNewsComment(newsComment); }
public void UpdateNewsComment(NewsComment newsComment) { new NewsCommentDAO().UpdateNewsComment(newsComment); }