Esempio n. 1
0
        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();
                }
            }
        }