Exemple #1
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
            {
            }
        }
 //显示赛事的基本信息
 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());
     }
 }
 //初始显示窗体时,调用已经打开的赛事信息
 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();
 }
Exemple #4
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();
 }
        //查询特定赛事所属的球队
        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;
        }
Exemple #6
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("请选择相应的赛季!","提示");
            }
        }
Exemple #7
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());
                    }
        }
 ///
 ///本类针对赛事信息的数据库处理
 ///
 /*
  * 更新某一个赛事的信息
  */
 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();
     }
 }