コード例 #1
0
        private void bttnAddRunnerWithCustomId_Click(object sender, EventArgs e)
        {
            if (!txtBxRunnerNameAdd.Text.Equals(string.Empty) &&
                cmbBxSexAdd.SelectedValue.ToString() != Gender.Unknown.ToString() &&
                (int)cmbBxCountryAdd.SelectedValue != 0)
            {
                if (_runnerManager.IsKeyIdFree((int)nmrcUpDwnNumberAdd.Value))
                {
                    _runnerManager.AddRunnerToList((int)nmrcUpDwnNumberAdd.Value, new Runner(
                                                       txtBxRunnerNameAdd.Text,
                                                       (int)cmbBxCountryAdd.SelectedValue,
                                                       (int)nmrcUpDwnAgeAdd.Value,
                                                       (Gender)Enum.Parse(typeof(Gender), cmbBxSexAdd.SelectedValue.ToString()
                                                                          )));

                    dtGrdRegisteredRunnersVw.Rows.Clear();
                    PopulateDataGrid();
                }
                else
                {
                    MessageBox.Show("The Number is already in use");
                }
            }
            else
            {
                MessageBox.Show("Please check if you selected all values");
            }
        }
コード例 #2
0
        private void bttnRunnerAddLap_Click(object sender, EventArgs e)
        {
            int keyInput = (int)nmercUpDwnRunnerAddLap.Value;

            if (!_runnerManager.IsKeyIdFree(keyInput) && _runnerManager.GetDictionaryOFRunners()[keyInput].IsOutOfRace == false)
            {
                AddLapToRunner(keyInput);

                if (_raceManager.IsFinishedRunnerAddedToWinningDirectory(race.NumberOfLaps,
                                                                         keyInput,
                                                                         _runnerManager.GetDictionaryOFRunners()[keyInput]))
                {
                    _runnerManager.GetDictionaryOFRunners()[keyInput].IsOutOfRace = true;
                    dtGrdVwFinishedRunners.Rows.Clear();
                    PopulateDtGrdVwFinishedRunners();
                    IsThereStillRunner();
                }
            }
            else
            {
                MessageBox.Show("There is no racer running with selected number");
            }
        }