private void btnTim_Click(object sender, EventArgs e) { if (txtMaPhong.Text != "") { // Lấy dữ liệu TraCuuPhongDTO TCP_DTO = new TraCuuPhongDTO(); TCP_DTO.StrMaPhong = txtMaPhong.Text; DataSet ds = TraCuuPhongBUS.TraCuuPhong(TCP_DTO); dgrvDanhSachPhong.Columns.Clear(); dgrvDanhSachPhong.DataSource = ds.Tables[0]; dgrvDanhSachPhong.Columns[0].HeaderText = "Mã Phòng"; dgrvDanhSachPhong.Columns[1].HeaderText = "Loại Phòng"; dgrvDanhSachPhong.Columns[2].HeaderText = "Đơn Giá"; dgrvDanhSachPhong.Columns[3].HeaderText = "Tình Trạng"; for (int i = 0; i < dgrvDanhSachPhong.Rows.Count - 1; i++) { string strTT = dgrvDanhSachPhong.Rows[i].Cells[3].Value.ToString(); if (strTT == "0") dgrvDanhSachPhong.Rows[i].Cells[3].Value = "Phòng trống"; else if (strTT == "0") dgrvDanhSachPhong.Rows[i].Cells[3].Value = "Phòng đã đặt"; else dgrvDanhSachPhong.Rows[i].Cells[3].Value = "Phòng đang sửa"; } } }
public static DataSet TraCuuPhong(TraCuuPhongDTO TCP_DTO) { SqlConnection con = DataProvider.ConnectionString(); string strSQL = "select MaPhong, TenLP, GiaVN, TinhTrang from Phong, LoaiPhong where Phong.MaLP = LoaiPhong.MaLP and MaPhong = " + TCP_DTO.StrMaPhong; return DataProvider.GetDataSet(strSQL, con); }
public static DataSet TraCuuPhong(TraCuuPhongDTO TCP_DTO) { return TraCuuPhongDAO.TraCuuPhong(TCP_DTO); }