private void showAlterTeamInfo(Team team) { textBox_teamName.Text = team.getName(); textBox_teamLeader.Text = team.getLeader(); textBox_teamManager.Text = team.getManager(); textBox_teamCoach.Text = team.getCoach(); }
//显示赛事的基本信息 public void showTeamData() { //先清除DataGridView中的数据 if (dataGridView_teamManage.Rows.Count > 0) { dataGridView_teamManage.Rows.Clear(); } //取出数据 List<Team> list =TeamInfoDAO.getTeamInfoOfCertainMatch(SystemParam.getMatch()); //往dataGridView中添加数据 for (int i = 0; i < list.Count; i++) { team = list[i]; //取出线性表中的赛事的信息 dataGridView_teamManage.Rows.Add(team.getID().ToString(), team.getName(),team.getTeamFullName(),team.getMatchName(), team.getLocation(),team.getBirthDate().ToString(),team.getIntroduction(),team.getLeader(),team.getManager(),team.getCoach()); } }
//往数据库中添加球队,返回是否添加成功的信息 public static bool addNewTeam(Team team) { DBUtility dbutility = new DBUtility(); string SQL = "insert into team(teamName,teamLeader,teamManager,teamCoach,teamFullName,birthDate,matchName,location,introduction) values('"; SQL = SQL + team.getName() + "','" + team.getLeader() + "','" + team.getManager() + "','" + team.getCoach() + "','" + team.getTeamFullName() + "','" + team.getBirthDate() + "','" + team.getMatchName() + "','" + team.getLocation()+ "','" + team.getIntroduction() + "')"; try { dbutility.openConnection(); dbutility.ExecuteUpdate(SQL); return true; } catch (MySqlException ex) { Console.WriteLine(ex.ToString()); return false; } finally { dbutility.Close(); } }
//显示未分配球队信息 private void showNotAssignedTeam() { if (dataGridView_NotAssiagnedTeam.Rows.Count > 0) //若已经有记录,先清除记录 { dataGridView_NotAssiagnedTeam.Rows.Clear(); } //显示数据操作 Team team = new Team(); //查询未被分配的球队信息,并且返回到一个线性表中 List<Team> list = MatchTeamInfoDAO.getNotAssignedMatchTeamInfo(SystemParam.getMatch().getID()); for (int i = 0; i < list.Count; i++) { team = list[i]; //取出球队信息 dataGridView_NotAssiagnedTeam.Rows.Add(team.getID().ToString(), team.getName(), team.getLeader(), team.getManager(), team.getCoach()); } }
/* * 更新某一个球队的信息 */ public static bool updateTeamInfo(Team team) { DBUtility dbutility = new DBUtility(); string sql = "update team set teamName='" + team.getName() + "' ,teamLeader='" + team.getLeader(); sql = sql + "' ,teamManager='" + team.getManager() + "' ,teamCoach='" + team.getCoach(); sql = sql + "' where ID=" + team.getID(); try { dbutility.openConnection(); dbutility.ExecuteUpdate(sql); return true; } catch (MySqlException ex) { Console.WriteLine(ex.ToString()); return false; } finally { dbutility.Close(); } }