예제 #1
0
        private void btnPost_Click(object sender, EventArgs e)
        {
            ReplyThreadDTO rtdto = new ReplyThreadDTO();
            rtdto.StudentID = GlobalVarian.StudentID;
            rtdto.ThreadID = int.Parse(lstDanhSachThread.SelectedValue.ToString());
            rtdto.Time = DateTime.Now;
            rtdto.Content = txtbNoiDungPost.Text;

            ReplyThreadBUS rtbus = new ReplyThreadBUS();
            rtbus.ThemReply(rtdto);

            txtbNoiDungThread.Text += "\r\n \r\n"; //Them Ten Nguoi Goi + Ngay Thang
            txtbNoiDungThread.Text += GlobalVarian.StudentName + " - " + DateTime.Now.ToString();
            txtbNoiDungThread.Text += "\r\n" + txtbNoiDungPost.Text;
            txtbNoiDungPost.Clear();
        }
예제 #2
0
        public void ThemReply(ReplyThreadDTO rtdto)
        {
            OleDbConnection cn = DataProvider.ConnectionData();
            string strSQL = "Insert into ReplyThread (Content, TimePost,  ThreadID, StudentID) values (?, ?, ?, ?)";

            OleDbCommand cmd = new OleDbCommand(strSQL, cn);

            cmd.Parameters.Add("@Content", OleDbType.VarWChar);
            cmd.Parameters.Add("@TimePost", OleDbType.Date);
            cmd.Parameters.Add("@ThreadID", OleDbType.Integer);
            cmd.Parameters.Add("@StudentID", OleDbType.Integer);

            cmd.Parameters["@Content"].Value = rtdto.Content.ToString();
            cmd.Parameters["@TimePost"].Value = rtdto.Time;
            cmd.Parameters["@ThreadID"].Value = rtdto.ThreadID;
            cmd.Parameters["@StudentID"].Value = rtdto.StudentID;
            cmd.ExecuteNonQuery();

            cn.Close();
        }
예제 #3
0
 public void ThemReply(ReplyThreadDTO rtdto)
 {
     ReplyThreadDAO rtbus = new ReplyThreadDAO();
     rtbus.ThemReply(rtdto);
 }