예제 #1
0
 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();
     }
 }
예제 #2
0
        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;
        }
예제 #3
0
        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;
        }
예제 #4
0
 public void CreateNewsComment(NewsComment newsComment)
 {
     new NewsCommentDAO().CreateNewsComment(newsComment);
 }
예제 #5
0
 public void UpdateNewsComment(NewsComment newsComment)
 {
     new NewsCommentDAO().UpdateNewsComment(newsComment);
 }