Esempio n. 1
0
 //获取dataTable
 private DataTable getDataMatchChart(SeasonMatch match)
 {
     //新建一个datatable
     DataTable dataTable = new DataTable();
     //为datatable添加列
     dataTable.Columns.Add("gameName");
     dataTable.Columns.Add("yellowCardNum");
     dataTable.Columns.Add("redCardNum");
     //声明变量
     DataRow dataRow;
     PlayerCardRecord playerCardRecord;
     //取出比赛的所有罚牌记录
     List<PlayerCardRecord> list = MatchCardRecordDAO.getMatchCardRecord(match.getID());
     for (int i = 0; i < list.Count; i++)
     {
         playerCardRecord = list[i];
         dataRow = dataTable.NewRow();
         //设置数据内容
         dataRow["gameName"] = playerCardRecord.getGameName();
         dataRow["yellowCardNum"] = playerCardRecord.getYellowCardNum();
         dataRow["redCardNum"] = playerCardRecord.getRedCardNum();
         //添加数据行
         dataTable.Rows.Add(dataRow);
     }
         //为dataTable添加数据内容
         return dataTable;
 }
Esempio n. 2
0
 private bool alterMatchInfo(SeasonMatch match)
 {
     if (textBox_switchNum.Text == "" || textBox_serialNum.Text == "")
     {
         MessageBox.Show("转换数量或轮次数量不能为空", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
         return false;
     }
     else
     {
         //检查数量是否正确
         if (!checkSwitchResult.checkStringSwitchInteger(textBox_switchNum.Text))
         {
             MessageBox.Show("转换次数必须是数字", "非数字", MessageBoxButtons.OKCancel, MessageBoxIcon.Error);
             return false;
         }
         if (!checkSwitchResult.checkStringSwitchInteger(textBox_serialNum.Text))
         {
             MessageBox.Show("赛事轮次必须是数字", "非数字", MessageBoxButtons.OKCancel, MessageBoxIcon.Error);
             return false;
         }
         int switchNum = Convert.ToInt32(textBox_switchNum.Text);
         int serialNum = Convert.ToInt32(textBox_serialNum.Text);
         match.setName(textBox_name.Text);
         match.setDescription(richTextBox_description.Text);
         match.setSwitchNum(switchNum);
         match.setSerialNum(serialNum);
         //更新数据库操作
         MatchInfoDAO.updateMatchInfo(match);
         //关闭本页面
         return true;
     }
 }
Esempio n. 3
0
 //往数据库中添加赛事,并且返回新被添加的赛事
 public static SeasonMatch addNewMatch(string name,string description,int switchNum,int serialNum)
 {
     SeasonMatch match = new SeasonMatch();
     DBUtility dbutility = new DBUtility();
     int matchID;
     string SQL = "insert into matchinfo(seasonName,description,switchNum,serialNum) values('";
     SQL=SQL+name + "','" + description + "'," + switchNum + "," + serialNum + ")";
     try
     {
         dbutility.openConnection();
         matchID = dbutility.ExecuteQuery_Last_Insert_ID(SQL);
        // dbutility.ExecuteUpdate(SQL);
         match.setID(matchID);
         match.setName(name);
         match.setDescription(description);
         match.setSwitchNum(switchNum);
         match.setSerialNum(serialNum);
     }
     catch (MySqlException ex)
     {
         Console.WriteLine(ex.ToString());
     }
     finally
     {
         dbutility.Close();
     }
     return match;
 }
Esempio n. 4
0
 //刷新数据信息
 public void flushDataInfo(SeasonMatch match)
 {
     if (dataGridView_playerManage.Rows.Count > 0)
     {
         dataGridView_playerManage.Rows.Clear();
     }
     //显示比赛信息列表
     this.showDataInfo(match);
 }
Esempio n. 5
0
 //修改
 private void alter_Click(object sender, EventArgs e)
 {
     try
     {
         int matchID = Convert.ToInt32(dataGridView_match.Rows[rowIndex].Cells["match_ID"].Value);
         match = ContentDAO.getMatchInfo(matchID);
         //打开修改窗体
         AlterMatch form = new AlterMatch(match);
         form.ShowDialog();
     }
     catch (NullReferenceException ex)
     {
         Console.WriteLine(ex.ToString());
     }
 }
Esempio n. 6
0
 //显示并且绑定chart中的数据源
 private void showMatchChart(SeasonMatch match)
 {
     //获取数据
     DataTable dataTable =default(DataTable);
     dataTable = this.getDataMatchChart(match);
     //绑定数据源
     chart_match.DataSource = dataTable;
     //设置Y轴显示的信息的数据值
     chart_match.Series[0].YValueMembers = "yellowCardNum";
      //   chart_match.Series[1].YValueMembers = "redCardNum";
     //设置chartX轴对应的项目
     chart_match.Series[0].XValueMember = "gameName";
     //绑定数据
     chart_match.DataBind();
 }
Esempio n. 7
0
 //显示赛事的基本信息
 private void showPlayerData(SeasonMatch match)
 {
     //先清除DataGridView中的数据
     if (dataGridView_playerManage.Rows.Count > 0)
     {
         dataGridView_playerManage.Rows.Clear();
     }
     //取出数据
     List<FootballPlayer> list = MatchPlayerInfoDAO.getAssignedPlayerInfo(match.getID());
     //往dataGridView中添加数据
     for (int i = 0; i < list.Count; i++)
     {
         player = list[i];  //取出线性表中的赛事的信息
         dataGridView_playerManage.Rows.Add(player.getID().ToString(), player.getName(), player.getNumber().ToString(), player.getPostion(), player.getBelongTeam());
     }
 }
Esempio n. 8
0
 //显示赛事的基本信息
 public void showMatchData()
 {
     //先清除DataGridView中的数据
     if (dataGridView_match.Rows.Count > 0)
     {
         dataGridView_match.Rows.Clear();
     }
     //取出数据
     List<SeasonMatch> list = ContentDAO.getMatchInfo();
     //往dataGridView中添加数据
     for (int i = 0; i < list.Count; i++)
     {
         match = list[i];  //取出线性表中的赛事的信息
         dataGridView_match.Rows.Add(match.getID().ToString(), match.getName(), match.getDescription(), match.getSwitchNum().ToString(), match.getSerialNum().ToString());
     }
 }
Esempio n. 9
0
        //单击表格的单元格
        private void dataGridView_match_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (e.RowIndex >= 0)
                {
                    try
                    {
                        matchID = Convert.ToInt32(dataGridView_match.Rows[e.RowIndex].Cells["match_ID"].Value);
                        rowIndex = e.RowIndex;
                        match = ContentDAO.getMatchInfo(matchID);
                        textBox_Name.Text = match.getName();
                        //
                        seasonList= SeasonInfoDAO.getSeasonsOfCertainMatch(match.getName());
                        this.cleanListBox();
                   ////如果当前赛事没有创建赛季,则弹窗要求创建一个赛季
                        if (seasonList.Count != 0)  //存在相应的赛季
                        {
                            listBox_Seasons.Items.Clear();
                            richTextBox_SeasonDescription.Text = "";
                            foreach (SeasonOfMatch s in seasonList)
                            {
                                listBox_Seasons.Items.Add("第" + s.getNumOfSeason() + "赛季");

                            }

                            richTextBox_MatchDescription.Text = match.getDescription();
                        }
                        else {
                            MessageBox.Show("您当前选中的赛事没有设置赛季,请至少添加一个赛季!","无赛季信息");
                            SystemParam.setMatch(match);
                            CreateNewSeason newSeason = new CreateNewSeason();
                            newSeason.Show();

                        }

                    }
                    catch (NullReferenceException ex)
                    {
                        Console.WriteLine(ex.ToString());
                    }
                }
            }
            catch
            {
            }
        }
Esempio n. 10
0
 //显示数据到表格中
 private void showDataInfo(SeasonMatch match)
 {
     Game game;  //用来记录信息
     if (dataGridView_gameInfo.Rows.Count > 0)
     {
         dataGridView_gameInfo.Rows.Clear();  //清空表格
     }
     List<Game> list = GameInfoDAO.getMatchGameInfo(match.getID());
     for (int i=0; i < list.Count; i++)
     {
         game = list[i];
         //往表格中添加记录
         dataGridView_gameInfo.Rows.Add(game.getUniqueID().ToString(),game.getMatchID().ToString(),game.getGameName(),
             game.getMatchGameNum().ToString(),game.getHomeTeam(),game.getGuestTeam(),game.getGameWinner(),
             game.getGameResult(),game.getGameAddress(),game.getGameDate().ToLongDateString());
     }
 }
Esempio n. 11
0
 //显示表格中的数据信息
 private void showDataInfo(SeasonMatch match)
 {
     //清空表格
     if (dataGridView_gameInfo.Rows.Count > 0)
     {
         dataGridView_gameInfo.Rows.Clear();
     }
     //声明一个变量
     PlayerCardRecord cardRecord;
     //获取某一赛事中的所有罚牌记录信息
     List<PlayerCardRecord> list = MatchCardRecordDAO.getMatchPlayerCardRecord(match.getID());
     for (int i = 0; i < list.Count; i++)
     {
         cardRecord = list[i];
         dataGridView_gameInfo.Rows.Add(cardRecord.getUniqueID().ToString(),cardRecord.getMatchID().ToString(),
             cardRecord.getMatchName(),cardRecord.getPlayerID().ToString(),cardRecord.getPlayerName(),
             cardRecord.getYellowCardNum().ToString(),cardRecord.getRedCardNum().ToString(),
             cardRecord.getSerialNum().ToString(),cardRecord.getDateTime().ToLongDateString());
     }
 }
Esempio n. 12
0
        private SeasonMatch _match; //记录被传入的赛事信息

        #endregion Fields

        #region Constructors

        public AlterMatch(SeasonMatch match)
        {
            InitializeComponent();
            _match = match;
        }
Esempio n. 13
0
        private void dataGridView_match_KeyUp(object sender, KeyEventArgs e)
        {
            try
                    {
                        matchID = Convert.ToInt32(dataGridView_match.SelectedRows[0].Cells["match_ID"].Value);
                        rowIndex = dataGridView_match.SelectedRows[0].Index;
                        match = ContentDAO.getMatchInfo(matchID);
                        textBox_Name.Text = match.getName();
                        //
                        seasonList = SeasonInfoDAO.getSeasonsOfCertainMatch(match.getName());
                        listBox_Seasons.Items.Clear();
                        richTextBox_SeasonDescription.Text = "";
                        foreach (SeasonOfMatch s in seasonList)
                        {
                            listBox_Seasons.Items.Add("第" + s.getNumOfSeason() + "赛季");

                        }

                        richTextBox_MatchDescription.Text = match.getDescription();

                    }
                    catch (NullReferenceException ex)
                    {
                        Console.WriteLine(ex.ToString());
                    }
        }
        private static FootballPlayer _player; //记录被选中的用户

        #endregion Fields

        #region Constructors

        public addPlayerCardRecordcs()
        {
            InitializeComponent();
            _match = SystemParam.getMatch();
        }
Esempio n. 15
0
 //初始显示窗体时,调用已经打开的赛事信息
 private void showDataInfo(SeasonMatch match)
 {
     //读取赛事信息,并且在文本框中显示
     textBox_matchName.Text = match.getName();
     textBox_matchGameNum.Text = match.getSerialNum().ToString();
     //获取已经存放的比赛的最大序号
     int _maxGameNum = GameInfoDAO.getMatchMaxGameNum(match.getID());
     textBox_gameNum.Text = (_maxGameNum + 1).ToString();
 }
Esempio n. 16
0
 //显示某一比赛中可上场成员的信息
 private void showAvaliableDataInfo(SeasonMatch match,Game game)
 {
     if (dataGridView_playerManage.Rows.Count > 0)  //清除表格行
     {
         dataGridView_playerManage.Rows.Clear();
     }
     //查询属于该场比赛的所有球员信息``
     if (game.getHomeTeam() == "" || game.getGuestTeam() == "")
     {
         MessageBox.Show("比赛中的主队或客队不能为空", "比赛球队空", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
     }
     else
     {
         //获取参加该比赛的球员信息
         List<FootballPlayer> list = PlayerInfoDAO.getPlayerInfo(game);
         FootballPlayer player;  //记录球员信息
      //   SuspendedRecord _suspendedRecord;  //记录球员的停赛记录
         PlayerCardRecord _playerCardRecord;  //记录球员的罚牌记录信息
         string label = "";  //记录球员可上场状态
         string leftYellowCardNum = "-";  //记录球员上场之后,可以被罚的黄牌数量
         for (int i = 0; i < list.Count; i++)  //循环查询每一个球员的信息,显示该球员在某一场比赛中是否能够上场
         {
             player = list[i];
             label = "";
             leftYellowCardNum = "-";
             //取出指定用户的所有停赛记录
         //    List<SuspendedRecord> suspendedList = SuspendedRecordDAO.getPlayerSuspendedRecord(match.getID(), player.getID());
             //取出指定用户在指定比赛前的所有停赛记录数量
             List<SuspendedRecord> _suspenedList = SuspendedRecordDAO.getPlayerSuspendedRecord_BeforeGame(match.getID(), player.getID(), game.getMatchGameNum());
             //判断用户是否在本次比赛中具有停赛信息记录
             if (SuspendedRecordDAO.checkPlayerSuspended(player.getID(), match.getID(), game.getMatchGameNum()))  //若具有停赛记录
             {
                 label = "停赛";
             }
             else  //若还没有记录到停赛信息时
             {
                 //取出该球员在这场比赛之前的所有罚牌记录
                 List<PlayerCardRecord> cardRecordList = MatchCardRecordDAO.getPlayerCardRecord_beforeGame(match.getID(), player.getID(), game.getMatchGameNum());
                 //统计该球员的所有黄牌和红牌数量
                 int yellowCardNum = 0;
                 int redCardNum = 0;
                 for (int k = 0; k < cardRecordList.Count; k++)
                 {
                     _playerCardRecord = cardRecordList[k];
                     //统计该球员在该场比赛前所有获得黄牌和红牌的数量
                     yellowCardNum = yellowCardNum + _playerCardRecord.getYellowCardNum();
                     redCardNum = redCardNum + _playerCardRecord.getRedCardNum();
                 }
                 //统计该球员所有黄牌和红牌总和可以得到的停赛次数
                 int attendedSuspendedQuantity = redCardNum + yellowCardNum / match.getSwitchNum();
                 //若应当停赛的次数比实际停赛次数多时,那么应当添加一次停赛,并且设置标签数据为停赛
                 if (attendedSuspendedQuantity > _suspenedList.Count)
                 {
                     //修改参赛标签
                     label = "停赛";
                     //添加一次停赛记录
                     SuspendedRecordDAO.addNewSuspendedRecord(match.getID(), game.getMatchGameNum(), player.getID(), game.getGameDate());
                 }
                 else  //当应当停赛次数没有实际停赛次数多时,比实际停赛次数少或等时,说明该球员在之前已经停赛过了
                 {
                     //设置标签为参赛
                     label = "可参赛";
                     //求得余下可被罚的黄牌数量
                     leftYellowCardNum = (match.getSwitchNum() - yellowCardNum % match.getSwitchNum()).ToString();
                 }
             }
             dataGridView_playerManage.Rows.Add(player.getID().ToString(), player.getName(), player.getNumber().ToString(), player.getPostion(), player.getBelongTeam(),label,leftYellowCardNum);
         }
         //设置表格颜色
         this.setDataRowColor();
     }
 }
Esempio n. 17
0
 public static void setMatch(SeasonMatch match)
 {
     _match = match;
 }
Esempio n. 18
0
        //查询特定赛事所属的球队
        public static List<Team> getTeamInfoOfCertainMatch(SeasonMatch match)
        {
            //声明实例
            List<Team> list = new List<Team>();
            //执行查询数据库操作
            DBUtility dbutility = new DBUtility();
            // string SQL = "select ID,teamName,teamLeader,teamManager,teamCoach from team order by ID";
            string SQL = "select * from team where matchName= '"+match.getName()+"' order by ID";
            try
            {
                dbutility.openConnection();
                MySqlDataReader rd = dbutility.ExecuteQuery(SQL);
                while (rd.Read())
                {
                    Team team = new Team(Convert.ToInt32(rd[0]), Convert.ToString(rd[1]), Convert.ToString(rd[2]),
                              Convert.ToString(rd[3]), Convert.ToString(rd[4]), Convert.ToString(rd[5]),
                              Convert.ToString(rd[6]), Convert.ToString(rd[7]), Convert.ToString(rd[8]),
                              Convert.ToString(rd[9]));

                    list.Add(team);
                }
            }
            catch (MySqlException ex)
            {
                Console.WriteLine(ex.ToString());
            }
            finally
            {
                dbutility.Close();
            }
            return list;
        }
Esempio n. 19
0
 //显示数据方法
 private void showData(SeasonMatch match)
 {
     textBox_name.Text = match.getName();
     textBox_switchNum.Text = match.getSwitchNum().ToString();
     textBox_serialNum.Text = match.getSerialNum().ToString();
     richTextBox_description.Text = match.getDescription();
 }
Esempio n. 20
0
        //依据赛事名称,返回赛事信息
        public static SeasonMatch getMatchInfo(string matchName)
        {
            SeasonMatch match = new SeasonMatch();
            //执行查询数据库操作
            DBUtility dbutility = new DBUtility();
            string SQL = "select ID,seasonName,description,switchNum,serialNum from matchinfo where seasonName='" + matchName + "'";
            try
            {
                dbutility.openConnection();
                MySqlDataReader rd = dbutility.ExecuteQuery(SQL);
                while (rd.Read())
                {
                    match.setID(Convert.ToInt32(rd[0]));
                    match.setName(Convert.ToString(rd[1]));
                    match.setDescription(Convert.ToString(rd[2]));
                    match.setSwitchNum(Convert.ToInt32(rd[3]));
                    match.setSerialNum(Convert.ToInt32(rd[4]));

                }
            }
            catch (MySqlException ex)
            {
                Console.WriteLine(ex.ToString());
            }
            finally
            {
                dbutility.Close();
            }
            return match;
        }
Esempio n. 21
0
 //加载下拉列表信息
 private void loadBaseInfo(SeasonMatch match)
 {
     this.bingComboBox(match.getID());
 }
Esempio n. 22
0
        //确定按钮
        private void OK_Click(object sender, EventArgs e)
        {
            try
            {
                matchID = Convert.ToInt32(dataGridView_match.Rows[rowIndex].Cells["match_ID"].Value);
                match = ContentDAO.getMatchInfo(matchID);
                SystemParam.setMatchID(matchID);
                SystemParam.setMatch(match);
                SystemParam.setCurrentSelectedSeason(season);

                //测试
                SystemParam.setCurrentSelectedMatchName(match.getName());
                SystemParam.getDefaultPageForm().UpdateTreeView(season.getmatchName(), 5);

                //刷新主窗体中显示的数据信息
                if (!SystemParam.getMainForm().checkChildFormExist("AvaliableInfo"))
                {
                    if (SystemParam.getMatch() != null)
                    {
                        SystemParam.setAvaliableInfoForm(new AvaliableInfo(SystemParam.getMainForm()));
                        SystemParam.getAvaliableInfoForm().Show();

                    }
                    else
                    {
                        if (MessageBox.Show("请先选择打开一个赛事", "打开赛事提醒", MessageBoxButtons.OKCancel, MessageBoxIcon.Information) == DialogResult.OK)
                        {
                            OpenMatch openMatch = new OpenMatch();
                            openMatch.ShowDialog();
                        }
                    }

                }
                else
                {
                    SystemParam.getAvaliableInfoForm().flushDataInfo(SystemParam.getMatch());

                    try { SystemParam.getTeamManageForm().flushDataInfo(); }

                       catch (Exception ex) { MessageBox.Show("当前赛事没有球队"); }

                }

                //关闭本窗体
                this.Close();
            }
            catch
            {
                MessageBox.Show("请选择相应的赛季!","提示");
            }
        }
Esempio n. 23
0
 //添加一个比赛的记录,
 private void addNewMatchGameInfo(SeasonMatch match)
 {
     if (textBox_GameName.Text != "") //检查比赛名字
     {
         //检查比赛名称是否合法
         string gameName = textBox_GameName.Text;
         if (GameInfoDAO.checkGameNameExist(match.getID(), gameName))
         {
             MessageBox.Show("比赛名字已经存在,请修改", "比赛名字重复", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
         }
         else
         {
             //检查比赛序号
             if (textBox_gameNum.Text != "")
             {
                 if (checkSwitchResult.checkStringSwitchInteger(textBox_gameNum.Text))
                 {
                     int gameNum = Convert.ToInt32(textBox_gameNum.Text);
                     //检查比赛序号是否存在
                     if (GameInfoDAO.checkGameNumExist(match.getID(), gameNum))
                     {
                         MessageBox.Show("比赛序号已经存在,请修改", "比赛序号重复", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
                     }
                     else
                     {
                         //判断比赛序号是否合法,即是否超过该赛事所限制的比赛次数
                         if (gameNum <= match.getSerialNum())
                         {
                             if (comboBox_homeTeam.Text != "")
                             {
                                 if (comboBox_guestTeam.Text != "")
                                 {
                                     Game _game = new Game();  //声明一个比赛类,并且赋值
                                     _game.setMatchID(match.getID());
                                     _game.setGameName(gameName);
                                     _game.setMatchGameNum(gameNum);
                                     _game.setHomeTeam(comboBox_homeTeam.Text);
                                     _game.setGuestTeam(comboBox_guestTeam.Text);
                                     _game.setGameWinner(comboBox_winner.Text);
                                     _game.setGameResult(textBox_gameResult.Text);
                                     _game.setGameAddress(textBox_gameAddress.Text);
                                     _game.setGameDate(Convert.ToDateTime(dateTimePicker_gameDate.Text));
                                     //执行更新操作
                                     GameInfoDAO.addNewGameInfo(_game);
                                     //弹出对话框,提示是否继续添加
                                     if (MessageBox.Show("添加比赛信息成功,是否继续添加?", "添加比赛成功", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
                                     {
                                         //清空其他
                                         textBox_GameName.Text = "";
                                         textBox_gameNum.Text = "";
                                         textBox_gameResult.Text = "";
                                         textBox_gameAddress.Text = "";
                                     }
                                     else
                                     {
                                         this.Close();
                                     }
                                 }
                                 else
                                 {
                                     MessageBox.Show("客队名字不能为空", "球队空", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
                                 }
                             }
                             else
                             {
                                 MessageBox.Show("主队名字不能为空", "球队空", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
                             }
                         }
                         else
                         {
                             MessageBox.Show("比赛序号超过赛事比赛总数", "比赛序号溢出", MessageBoxButtons.OKCancel, MessageBoxIcon.Error);
                         }
                     }
                 }
                 else
                 {
                     MessageBox.Show("比赛序号必须填数字", "序号非数字", MessageBoxButtons.OKCancel, MessageBoxIcon.Error);
                 }
             }
             else
             {
                 MessageBox.Show("比赛序号不能为空", "比赛序号空", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
             }
         }
     }
     else
     {
         MessageBox.Show("比赛名称不能为空", "比赛名称空", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
     }
 }
Esempio n. 24
0
 ///
 ///本类针对赛事信息的数据库处理
 ///
 /*
  * 更新某一个赛事的信息
  */
 public static void updateMatchInfo(SeasonMatch match)
 {
     DBUtility dbutility = new DBUtility();
     string sql = "update matchinfo set seasonName='"+match.getName()+"' ,description='"+match.getDescription();
     sql = sql + "' ,switchNum=" + match.getSwitchNum() + " ,serialNum=" + match.getSerialNum();
     sql = sql + " where ID=" + match.getID();
     try
     {
         dbutility.openConnection();
         dbutility.ExecuteUpdate(sql);
     }
     catch (MySqlException ex)
     {
         Console.WriteLine(ex.ToString());
     }
     finally
     {
         dbutility.Close();
     }
 }