Exemple #1
0
        private void txtTimKiem_TextChanged(object sender, TextChangedEventArgs e)
        {
            string tenKhach = txtTimKiem.Text;

            if (tenKhach.Equals(""))
            {
                dataGridDsKhach.ItemsSource = DatPhongDAO.LoadThongTinKhach(Int32.Parse(txtMaPhong.Text)).DefaultView;
            }
            else
            {
                dataGridDsKhach.ItemsSource = KhachHangDAO.TimTheoTen(tenKhach).DefaultView;
            }
        }
Exemple #2
0
        public ChiTietDatPhong(int maPhong)
        {
            InitializeComponent();
            MaPhong         = maPhong;
            txtMaPhong.Text = maPhong.ToString();
            Phong     p  = PhongDAO.LoadOne(maPhong);
            LoaiPhong lp = LoaiPhongDAO.LoadOne(p.LoaiPhong);

            cbbLoaiKhach.ItemsSource = LoaiKhachDAO.LoadAll().DefaultView;
            txtLoaiPhong.Text        = lp.TenLoai;

            DataTable table = DatPhongDAO.LoadByMaPhong(maPhong);

            dpNgayThue.Text = table.Rows[0].Field <DateTime>(2).ToString("MM/dd/yyyy");

            dataGridDsKhach.ItemsSource = DatPhongDAO.LoadThongTinKhach(maPhong).DefaultView;
            cbbLoaiKhach.SelectedIndex  = 0;
        }
Exemple #3
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            if (MessageBox.Show("Xác nhận thay đổi thông tin khách?", "Thông báo", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.No)
            {
                return;
            }
            KhachHang kh = new KhachHang(Int32.Parse(txtMaKhach.Text), txtHoTen.Text, txtCMND.Text, txtDiaChi.Text,
                                         txtDienThoai.Text, cbbLoaiKhach.SelectedIndex + 1);

            if (KhachHangDAO.Update(kh) > 0)
            {
                MessageBox.Show("Lưu thông tin thành công", "Thông báo");
                dataGridDsKhach.ItemsSource = DatPhongDAO.LoadThongTinKhach(Int32.Parse(txtMaPhong.Text)).DefaultView;
            }
            else
            {
                MessageBox.Show("Có lỗi xảy ra\r\nXin vui lòng thử lại", "Thông báo");
            }
        }