private void btndongy_Click(object sender, EventArgs e) { if (checkValidate()) { int id = -1, role = 0; nv.addValue(id, name, username, password, role); if (!nv.excuteInsertQuery()) { lbThongbao.Text = "Tên tài khoản bị trùng,xin nhập tên khác!"; return; } //excute success isInsert = true; this.Close(); MessageBox.Show("Thêm nhân viên thành công!!"); } }
private void btndongy_Click(object sender, EventArgs e) { nv = new nhanvienConfig(); name = txtbtennhanvien.Text; username = txttaikhoan.Text; password = txtmatkhau.Text; if (checkValidate()) { int role = 0; nv.addValue(id, name, username, password, role); if (nv.excuteUpdateQuery()) { MessageBox.Show("Chỉnh sửa thành công!"); isUpdate = true; this.Close(); } else { lbThongbao.Text = "Có ai đó đã đặt tên tài khoản này, xin hãy đỗi lại!"; isUpdate = false; } } }