예제 #1
0
        protected override object GetDataFromDataRow(DataTable dt, int i)
        {
            BinhLuan bl = new BinhLuan();

            bl.MaBinhLuan = (int)dt.Rows[i]["MaBinhLuan"];
            bl.IdUser     = dt.Rows[i].IsNull("IdUser") ? 0 : (int)dt.Rows[i]["IdUser"];
            bl.NoiDung    = dt.Rows[i]["NoiDung"].ToString();
            bl.ThoiGian   = (DateTime)dt.Rows[i]["ThoiGian"];
            bl.MaDuLieu   = (int)dt.Rows[i]["MaDuLieu"];
            bl.TrangThai  = (int)dt.Rows[i]["TrangThai"];

            return((object)bl);
        }
예제 #2
0
 public bool insertBinhLuan(BinhLuan bl)
 {
     try
     {
         connect();
         string insertCommand = "INSERT INTO BINHLUAN VALUES(" +
                                bl.MaDuLieu + ", " +
                                bl.IdUser + ", N'" +
                                bl.NoiDung + "', '" +
                                bl.ThoiGian.Year + "-" + bl.ThoiGian.Month + "-" + bl.ThoiGian.Day + " " + bl.ThoiGian.Hour + ":" + bl.ThoiGian.Minute + ":" + bl.ThoiGian.Second + "'," +
                                bl.TrangThai + ")";
         executeNonQuery(insertCommand);
         disconnect();
         return(true);
     }
     catch (Exception e)
     {
         return(false);
     }
 }