private void Pay_Click(object sender, RoutedEventArgs e) { var selectedIndex = DataGridDSPhong.SelectedIndex; if (selectedIndex < 0) { MessageBox.Show("Mời chọn 1 phòng!", "Lỗi : Không chọn phòng"); return; } var selectedItem = DataGridDSPhong.Items[selectedIndex] as TmpPhong; if (selectedItem != null) { if (selectedItem.TinhTrang == "Trống") { MessageBox.Show("Phòng trống không có phiếu thuê!", "Cảnh báo"); return; } LoaiPhong lptinh = new LoaiPhong(); foreach (var item in lplist) { if (item.TenLoai == selectedItem.TenLoai) { lptinh = item; break; } } PhongFunction.frmHoaDon hoadon = new PhongFunction.frmHoaDon(selectedItem.MaPhong, lptinh); hoadon.ShowDialog(); LoadDanhSachLoaiPhong(); } }
private void Pay_Click(object sender, RoutedEventArgs e) { var selectedIndex = DataGridDSPhong.SelectedIndex; if (selectedIndex < 0) { MessageBox.Show("Mời chọn 1 phòng!", "Lỗi : Không chọn phòng"); return; } var selectedItem = DataGridDSPhong.Items[selectedIndex] as TmpPhong; if (selectedItem != null) { if (selectedItem.TinhTrang == "Trống") { MessageBox.Show("Phòng trống không có phiếu thuê!", "Cảnh báo"); return; } LoaiPhong lptinh=new LoaiPhong(); foreach(var item in lplist) { if (item.TenLoai == selectedItem.TenLoai) { lptinh = item; break; } } PhongFunction.frmHoaDon hoadon = new PhongFunction.frmHoaDon(selectedItem.MaPhong, lptinh); hoadon.ShowDialog(); LoadDanhSachLoaiPhong(); } }