コード例 #1
0
 public void CreatePageComment(PageComment pageComment)
 {
     using (SqlConnection connection = base.GetConnection())
     {
         SqlCommand command = new SqlCommand("_PageCommentUpdate", connection) {
             CommandType = CommandType.StoredProcedure
         };
         command.Parameters.AddWithValue("@Type", 0);
         command.Parameters.AddWithValue("@CommentPageID", 0);
         command.Parameters.AddWithValue("@PageID", pageComment.PageID);
         command.Parameters.AddWithValue("@FullName", pageComment.FullName);
         command.Parameters.AddWithValue("@Email", pageComment.Email);
         command.Parameters.AddWithValue("@Title", pageComment.Title);
         command.Parameters.AddWithValue("@Content", pageComment.Content);
         command.Parameters.AddWithValue("@DateCreated", pageComment.DateCreated);
         command.Parameters.AddWithValue("@Actived", pageComment.Actived);
         command.Parameters.AddWithValue("@GroupCate", pageComment.GroupCate);
         command.Parameters.AddWithValue("@ApprovalUserName", pageComment.ApprovalUserName);
         command.Parameters.AddWithValue("@ApprovalDate", pageComment.ApprovalDate);
         connection.Open();
         if (command.ExecuteNonQuery() <= 0)
         {
             throw new DataAccessException("Lỗi kh\x00f4ng thể tao moi");
         }
         command.Dispose();
     }
 }
コード例 #2
0
 public void CreatePageComment(PageComment pageComment)
 {
     new PageCommentDAO().CreatePageComment(pageComment);
 }
コード例 #3
0
 public void UpdatePageComment(PageComment pageComment)
 {
     new PageCommentDAO().UpdatePageComment(pageComment);
 }
コード例 #4
0
        protected PageComment ReceiveHtml()
        {


            PageComment pageComment = new PageComment();
            pageComment.CommentPageID = (hddCommentID.Value != "") ? Convert.ToInt32(hddCommentID.Value) : 0;
            pageComment.PageID = (hddNewsID.Value != "") ? Convert.ToInt32(hddNewsID.Value) : 0;
            pageComment.Title = txtTitle.Text;
            pageComment.Content = txtContent.Html;

            pageComment.FullName = txtFullName.Text;
            pageComment.Email = txtEmail.Text;
            pageComment.DateCreated = txtDateCreated.SelectedDate.Value;
            pageComment.Actived = Convert.ToBoolean(rdbActive.SelectedItem.Value);
            pageComment.GroupCate = hddGroup.Value;

            pageComment.Actived = Convert.ToBoolean(rdbActive.SelectedValue);
            if (hddApprovalUserName.Value != "")
            {
                pageComment.ApprovalUserName = hddApprovalUserName.Value;
                pageComment.ApprovalDate = Convert.ToDateTime(hddApprovalDate.Value);
            }
            else
                if (Convert.ToBoolean(rdbActive.SelectedValue))
                {
                    pageComment.ApprovalUserName = Session["Admin_UserName"].ToString();
                    pageComment.ApprovalDate = DateTime.Now;
                }
                else
                {
                    pageComment.ApprovalUserName = "";
                    pageComment.ApprovalDate = DateTime.Now;
                }

            return pageComment;
        }