private void ucCaiDat_Load(object sender, EventArgs e) { dtgLoaiKhach.DataSource = LoaiKhachDAO.DSLoaiKhach(); addBindingLoaiKhach(); dtgLoaiPhong.DataSource = PhongDAO.DSLoaiPhong(); addBindingLoaiPhong(); }
private void btnThayDoiLoaiKhach_Click(object sender, EventArgs e) { int id = int.Parse(txtMaLoaiKhach.Text); string tenLoai = txtTenLoaiKhach.Text; if (float.TryParse(txtPhuThu.Text, out float phuThu)) { if (tenLoai == "") { MessageBox.Show("Tên loại khách không được để trống!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } int result = LoaiKhachDAO.updateLoaiKhach(id, tenLoai, phuThu); if (result >= 1) { MessageBox.Show("Thay đổi thông tin loại khách thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); dtgLoaiKhach.DataSource = LoaiKhachDAO.DSLoaiKhach(); clearBindingLoaiKhach(); addBindingLoaiKhach(); } } }