internal void RefreshDataBinding(ChiTietDatPhongDTO chiTiet) { chiTietDatPhong = chiTiet; phong = PhongBUS.LayThongTinPhong(chiTiet.MaPhong); txtMaPhong.EditValue = phong.MaPhong; txtTenPhong.EditValue = phong.TenPhong; txtLoaiPhong.EditValue = LoaiPhongBUS.LayLoaiPhong(phong).TenLoaiPhong; txtTang.EditValue = phong.Tang; txtTinhTrangPhong.EditValue = PhongBUS.LayTinhTrangPhong(phong.MaTinhTrangPhong).TinhTrangPhong; txtGhiChu.EditValue = phong.GhiChu; RefreshDataBindingDichVuPhong(); }
private void txtGioVao_Properties_EditValueChanged(object sender, EventArgs e) { dtPhong = DatPhongBUS.LayCacPhongConTrongTrongThoiGian(txtGioVao.Time, ThamSoBUS.LayKhoangThoiGianToiThieuGiuaHaiLanThue()); dtPhong.Columns.Add(new DataColumn("colThoiDiemDatPhongGanNhat_Sau")); dtPhong.Columns.Add(new DataColumn("colThoiDiemDatPhongGanNhat_Truoc")); dtPhong.Columns.Add(new DataColumn("colTinhTrangPhong")); foreach (DataRow r in dtPhong.Rows) { DateTime t = DatPhongBUS.LayThoiDiemDatPhongGanNhat_Sau((int)r["MaPhong"], txtGioVao.Time); r["colThoiDiemDatPhongGanNhat_Sau"] = t == DateTime.MinValue ? "Không có" : t.ToString("dd/MM/yyyy hh:mm"); t = DatPhongBUS.LayThoiDiemDatPhongGanNhat_Truoc((int)r["MaPhong"], txtGioVao.Time); r["colThoiDiemDatPhongGanNhat_Truoc"] = t == DateTime.MinValue ? "Không có" : t.ToString("dd/MM/yyyy hh:mm"); r["colTinhTrangPhong"] = PhongBUS.LayTinhTrangPhong((int)r["MaTinhTrangPhong"]).TinhTrangPhong + " " + (listPhongDangThue.ContainsKey((int)r["MaPhong"])? "(" + ToCustomString((DateTime.Now - listPhongDangThue[(int)r["MaPhong"]].GioThuePhong)) + ")":""); } txtPhong.Properties.DataSource = dtPhong; selectedPhong.Clear(); txtPhong.Refresh(); }