// cap nhap team public void UpdateTeam() { System.Windows.Forms.UserControl usr = new usrHomepage(); string id = usrHomepage.Instance.tb_MaDoi.Text; string tendoi = usrHomepage.Instance.tb_TenDoi.Text; string slgct = usrHomepage.Instance.cb_Team_slgct.Text; string sannha = usrHomepage.Instance.tb_SanNha.Text; // MessageBox.Show(id); string UpdateQuery = "UPDATE DOIBONG " + "SET TenDoi = '" + tendoi + "',SoCauThu = '" + slgct + "',SanNha = '" + sannha + "' " + " WHERE MaDoi = '" + id + "'"; int result = DataProvider.Instance.ExecuteNonQuery(UpdateQuery); if (result > 0) { MessageBox.Show("Đội bóng đã được cập nhật", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
// xoa doi bong bang ma doi public void DeleteTeam() { System.Windows.Forms.UserControl usr = new usrHomepage(); string id = usrHomepage.Instance.tb_MaDoi.Text; string CheckQuery = "SELECT * " + "FROM DOIBONG WHERE MaDoi = '" + id + "' "; DataTable dt = DataProvider.Instance.ExecuteQuery(CheckQuery); if (dt.Rows.Count != 0) { var resultDialog = MessageBox.Show("Bạn có chắc muốn xóa đội bóng?", "Warning", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning); if (resultDialog == DialogResult.OK) { string DeleteQuery = "DELETE DOIBONG WHERE MaDoi = '" + id + "'"; string DeletePlayer = "DELETE CauThu WHERE MaDoi = '" + id + "'"; string DeleteMatch1 = "DELETE TRANDAU Where DoiChuNha = '" + id + "' "; string DeleteMatch2 = "DELETE TRANDAU Where DoiKhach = '" + id + "' "; int result = DataProvider.Instance.ExecuteNonQuery(DeleteQuery); if (result > 0) { DataProvider.Instance.ExecuteNonQuery(DeletePlayer); DataProvider.Instance.ExecuteNonQuery(DeleteMatch1); DataProvider.Instance.ExecuteNonQuery(DeleteMatch2); MessageBox.Show("Đội bóng đã bị xóa", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } }