private void BtFinish_Click(object sender, RoutedEventArgs e)
        {
            if (CompetitionsToSelect.SelectedItem == null)
            {
                MessageBox.Show(Properties.Resources.NothingSelected);
                return;
            }

            _competition = _competitionService.ListCompetitionsToPreinscribeObject(_athlete)
                           .ElementAt(CompetitionsToSelect.SelectedIndex);

            if (_enrollService.IsAthleteInComp(_competition, _athlete))
            {
                MessageBox.Show(Properties.Resources.PreviouslyEnrolled);
                return;
            }

            new DialogPreinscripted(_athlete, _competition).ShowDialog();

            var competitionService = new CompetitionService();
            var enrollService      = new EnrollService(_competition);

            var category = _enrollService.GetCategory(_athlete, _competition);

            _enrollService.InsertAthleteInCompetition(_athlete, _competition, TypesStatus.PreRegistered);
            LoadData(TxDni.Text);
        }
        public InscriptionProofWindow(AthleteDto athlete, CompetitionDto competition, TypesStatus status)
        {
            _athlete     = athlete;
            _competition = competition;

            InitializeComponent();

            _competitionService = new CompetitionService();
            _enrollService      = new EnrollService(_competition);

            var category = _enrollService.GetCategory(_athlete, _competition);

            _enrollService.InsertAthleteInCompetition(_athlete, _competition, status);

            TxJustificante.Text =
                $"Atleta: {_athlete.Name} {_athlete.Surname}\nCompetición: {_competition.Name}\nCategoría: {category}\nFecha de inscripción: {DateTime.Now.ToShortDateString()}\nPrecio de la inscripción: {_competition.Price} €";
        }
Beispiel #3
0
        private void BtFinish_Click(object sender, RoutedEventArgs e)
        {
            if (CompetitionsToSelect.SelectedItem == null)
            {
                MessageBox.Show(Properties.Resources.NothingSelected);
                return;
            }

            var dto = new CompetitionDto {
                ID = _columnIds[CompetitionsToSelect.SelectedIndex]
            };

            _competition = _competitionService.SearchCompetitionById(dto);

            var stringBuilder = new StringBuilder();

            foreach (var a in _athletes)
            {
                if (_enrollService.IsAthleteInComp(_competition, a))
                {
                    stringBuilder.Append(a.Dni + " inscrito anteriormente en la competición.\n");
                }
                else
                {
                    _enrollService.InsertAthleteInCompetition(a, _competition, TypesStatus.Registered);
                    _count++;
                    stringBuilder.Append(a.Dni + " inscrito correctamente.\n");
                }
            }


            var dialog = new DialogPayment(null, null);

            dialog.Content = new InscriptionProofClubs(_competition, stringBuilder.ToString(), _count);
            dialog.Show();

            _count = 0;
            GetListCompetition();
        }