public static bool DeleteDT_TheoLoaiPhong(DT_TheoLoaiPhong dttlp)
        {
            var cm = CreateCommand();

            cm.CommandText = @"Exec delete_row_DT_THEOLOAIPHONG @ID";
            cm.Parameters.Add(new SqlParameter("@ID", dttlp.ID));
            int rs = cm.ExecuteNonQuery();

            cn.Close();
            return(rs > 0);
        }
        public static DT_TheoLoaiPhong Read(SqlDataReader reader)
        {
            var bc = new DT_TheoLoaiPhong()
            {
                ID          = reader.GetString(iID),
                MaLoaiPhong = reader.GetString(iMaLoaiPhong),
                NgayBatDau  = reader.GetDateTime(iNgayBatDau),
                NgayKetThuc = reader.GetDateTime(iNgayKetThuc),
                DoanhThu    = reader.GetInt32(iDoanhThu)
            };

            return(bc);
        }
        public static bool ThemDT_TheoLoaiPhong(DT_TheoLoaiPhong dttlp)
        {
            var cm = CreateCommand();

            cm.CommandText = @"Exec add_row_DT_THEOLOAIPHONG @ID, @MaLoaiPhong, @NgayBatDau, @NgayKetThuc, @DoanhThu";
            cm.Parameters.Add(new SqlParameter("@ID", dttlp.ID));
            cm.Parameters.Add(new SqlParameter("@MaLoaiPhong", dttlp.MaLoaiPhong));
            cm.Parameters.Add(new SqlParameter("@NgayBatDau", dttlp.NgayBatDau));
            cm.Parameters.Add(new SqlParameter("@NgayKetThuc", dttlp.NgayKetThuc));
            cm.Parameters.Add(new SqlParameter("@DoanhThu", dttlp.DoanhThu));
            int rs = cm.ExecuteNonQuery();

            cn.Close();
            return(rs > 0);
        }
        public static bool UpdateDT_TheoLoaiPhong(DT_TheoLoaiPhong dttlp)
        {
            var cm = CreateCommand();

            cm.CommandText = @"Exec update_row_DT_THEOLOAIPHONG @ID, @MLP, @NBD, @NKT, @DT";
            cm.Parameters.Add(new SqlParameter("@ID", dttlp.ID));
            cm.Parameters.Add(new SqlParameter("@MLP", dttlp.MaLoaiPhong));
            cm.Parameters.Add(new SqlParameter("@NBD", dttlp.NgayBatDau));
            cm.Parameters.Add(new SqlParameter("@NKT", dttlp.NgayKetThuc));
            cm.Parameters.Add(new SqlParameter("@DT", dttlp.DoanhThu));
            int rs = cm.ExecuteNonQuery();

            cn.Close();
            return(rs > 0);
        }
        public static List <DT_TheoLoaiPhong> DSDT_TheoLoaiPhong()
        {
            var ldttlp = new List <DT_TheoLoaiPhong>();
            var cm     = CreateCommand();

            cm.CommandText = @"SELECT * FROM DT_THEOLOAIPHONG";
            var reader = cm.ExecuteReader();

            while (reader.Read())
            {
                ldttlp.Add(DT_TheoLoaiPhong.Read(reader));
            }
            cn.Close();
            return(ldttlp);
        }