コード例 #1
0
        public void ScanRefereeScore()
        {
            foreach (DataGridViewRow row in dataGridView1.Rows)
            {
                if (row.Cells[0].Value == null)
                {
                    break;
                }

                if (!(Convert.ToBoolean(row.Cells[3].Value)) && (Convert.ToBoolean(row.Cells[7].Value)))
                {
                    flag = false;
                    OrdinaryRefereeForm ordinaryRefereeForm = new OrdinaryRefereeForm(
                        service.SearchRefereeScoreById(row.Cells[0].Value.ToString())[0]);
                    ordinaryRefereeForm.Show();
                    MessageBox.Show("已返回给相应裁判进行重新评分!");
                }

                if ((Convert.ToBoolean(row.Cells[3].Value)) && (row.Cells[5].Value != null) && (row.Cells[6].Value != null))
                {
                    try
                    {
                        RefereeScore refereeScore = service.SearchRefereeScoreById(row.Cells[0].Value.ToString())[0];
                        refereeScore.P = Convert.ToDouble(row.Cells[5].Value);
                        refereeScore.D = Convert.ToDouble(row.Cells[6].Value);
                        service.UpdateRefereeScore(refereeScore);
                    }catch (Exception ex)
                    {
                        MessageBox.Show("error: " + ex.Message);
                    }
                }
            }
        }
コード例 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text != null && textBox2.Text != null)
            {
                int n = service.Login(textBox1.Text, textBox2.Text);
                switch (n)
                {
                case 1:
                    AdminForm adminForm = new AdminForm();
                    adminForm.Show();
                    this.Close();
                    break;

                case 2:
                    List <Team> teams = service.SearchTeamByAccount(textBox1.Text);

                    TeamForm teamForm = new TeamForm(teams[0]);
                    teamForm.Show();
                    this.Close();
                    break;

                case 3:
                    List <RefereeScore> ts = service.SearchRefereeScoreByRefereeIdAndGameInfo(GameInfo.Id, textBox1.Text);
                    if (ts.Count > 0)
                    {
                        if (chiefReferee)
                        {
                            ChiefRefereeForm chiefRefereeForm = new ChiefRefereeForm(ts[0]);
                            chiefRefereeForm.Show();
                        }
                        else
                        {
                            OrdinaryRefereeForm refereeForm = new OrdinaryRefereeForm(ts[0]);
                            refereeForm.Show();
                        }
                    }
                    else
                    {
                        MessageBox.Show("您不是当前比赛项目分组的裁判!");
                    }
                    this.Close();
                    break;

                default:
                    MessageBox.Show("账号/密码/姓名错误");
                    break;
                }
            }
            else
            {
                MessageBox.Show("不能为空!");
            }
        }