Exemplo n.º 1
0
        public PartialTimesDto SelectPartialTimesByAthlete(CompetitionDto competition, AthleteDto athlete)
        {
            var partial = new SelectPartialTimes(ref _conn, athlete, competition);

            partial.Execute();
            return(partial.PartialTimes);
        }
Exemplo n.º 2
0
 public IsAthleteInCompetition(ref DBConnection conn, CompetitionDto competitionP, AthleteDto athlete)
 {
     _conn        = conn;
     _competition = competitionP;
     _athlete     = athlete;
     IsEnroll     = false;
 }
Exemplo n.º 3
0
        public Task <bool> ExistsAsync(Competition competition)
        {
            var  dto   = new CompetitionDto(competition);
            long count = competitions.CountDocuments(filter => filter.Id.Equals(dto.Id));

            return(Task.FromResult(count > 0));
        }
Exemplo n.º 4
0
        public async Task <IActionResult> AddNext([FromRoute] string type, [FromForm] CompetitionDto source)
        {
            bool t;

            if (type.ToLower().Equals("daily"))
            {
                t = false;
            }
            else if (type.ToLower().Equals("monthly"))
            {
                t = true;
            }
            else
            {
                return(BadRequest($"there is not Competition Type named {type} "));
            }

            var state = await _service.AddNextCompetition(new Competition
            {
                Roles           = source.Roles,
                Type            = t,
                MinUniqueUsers  = source.MinUniqueUsers,
                MinUniqueVisits = source.MinUniqueVisits,
            });

            if (!state.Success)
            {
                return(BadRequest(state.Error));
            }

            return(Ok(_mapper.Map <Competition, CompetitionDto>(state.Source)));
        }
 public SelectCategoryByAthleteAndCompetition(ref DBConnection conn, CompetitionDto competition,
                                              AthleteDto athlete)
 {
     _conn        = conn;
     _competition = competition;
     _athlete     = athlete;
 }
Exemplo n.º 6
0
        public CompetitionDto SelectCompetitionDtoFromName(CompetitionDto competition)
        {
            var select = new SelectCompetitionLogic(ref _conn);

            select.Execute();
            return(select.List.First(s => s.Name.Equals(competition.Name)));
        }
        private void CompetitionList_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            Competition = new CompetitionDto {
                ID = _ids[CompetitionList.SelectedIndex]
            };

            Competition = _competitionService.SearchCompetitionById(Competition);

            var lista = _service.SelectPartialTimes(Competition);

            GenerateTable(lista);

            //if (Athlete == null) {
            //    Athlete = new AthletesService().SelectAthleteByDniObject(_table.Rows[0][0] as string);
            //}

            if (Athlete != null)
            {
                LbNameSurname.Content = $"{Athlete.Name} {Athlete.Surname}";

                var category = _competitionService.SelectCompetitionByAthleteAndCompetition(Competition, Athlete);
                LbCategory.Content = $"{category.Name.Replace('_', ' ')} ({category.MinAge} - {category.MaxAge})";

                var p    = _service.SelectCompetitionHasParticipated(Competition, Athlete);
                var time = PartialTimeString(p.FinishTime == 0 ? 0 : p.FinishTime - p.InitialTime);
                LbTiempoTotal.Content = $"T. Final: {time}";
            }
        }
Exemplo n.º 8
0
        public bool IsCategoryInCompetition(CompetitionDto competition, AthleteDto athlete)
        {
            var isCategory = new IsCategoryInCompetitionLogic(ref _conn, _competition, athlete);

            isCategory.Execute();
            return(isCategory.IsCorrect);
        }
Exemplo n.º 9
0
        public void InsertAthleteInCompetition(AthleteDto athlete, CompetitionDto competition, TypesStatus status)
        {
            var insertAthletesInCompetition =
                new InsertAthletesInCompetitionLogic(ref _conn, athlete, competition, status);

            insertAthletesInCompetition.Execute();
        }
 public SelectHasParticipatedTimeObject(ref DBConnection conn, CompetitionDto competition, AthleteDto athlete)
 {
     _conn           = conn;
     HasParticipated = new HasParticipatedDto();
     _competition    = competition;
     _athlete        = athlete;
 }
Exemplo n.º 11
0
        public bool IsAthleteInComp(CompetitionDto competition, AthleteDto athlete)
        {
            var isAthlete = new IsAthleteInCompetition(ref _conn, competition, athlete);

            isAthlete.Execute();
            return(isAthlete.IsEnroll);
        }
        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);
        }
Exemplo n.º 13
0
        public PaymentMethodSelectionWindow(AthleteDto athlete, CompetitionDto competition)
        {
            InitializeComponent();

            _athlete     = athlete;
            _competition = competition;
        }
Exemplo n.º 14
0
        public DataTable SelectCompetitionTimes(CompetitionDto competition)
        {
            var selectCompetition = new SelectHasParticipatedTimeLogic(ref _conn, competition);

            selectCompetition.Execute();
            return(selectCompetition.Table);
        }
Exemplo n.º 15
0
        public int GetIdCompetition(CompetitionDto c)
        {
            var search = new GetIdCompetition(ref _conn, c);

            search.Execute();
            return(search.id);
        }
Exemplo n.º 16
0
        public string GetCategory(AthleteDto athlete, CompetitionDto competition)
        {
            var getCategory = new GetCategoryLogic(ref _conn, competition, athlete);

            getCategory.Execute();
            return(getCategory.Category);
        }
Exemplo n.º 17
0
        //public void InsertAthletesTable(AthleteDto athleteP) {
        //    AddAthleteLogic add = new AddAthleteLogic(ref _conn, athleteP);
        //    add.Execute();
        //}

        //public List<CompetitionDto> SelectAthleteTable() {
        //    SelectCompetitionLogic select = new SelectCompetitionLogic(ref _conn, c => c.Km > 50);
        //    select.Execute();
        //    return select.List;
        //}

        //public void DeleteAthleteTable(AthleteDto athleteP) {
        //    DeleteAthleteLogic delete = new DeleteAthleteLogic(ref _conn, athleteP);
        //    delete.Execute();
        //}

        //public static void PrintAthletes(IEnumerable<AthleteDto> list) {
        //    Console.WriteLine(string.Join("\n", list));
        //}

        //public static void PrintAthletes(IEnumerable<Athlete> list) {
        //    Console.WriteLine(string.Join("\n", list));
        //}
        public IEnumerable <AbsoluteCategory> SelectAllCategoriesByCompetitionId(CompetitionDto competition)
        {
            var categories = new SelectAllCategoriesByCompetitionId(ref _conn, competition);

            categories.Execute();
            return(categories.Categories);
        }
Exemplo n.º 18
0
        public bool IsDorsalsInCompetition(CompetitionDto competition)
        {
            var dorsals = new IsDorsalsByCompetition(ref _conn, competition);

            dorsals.Execute();
            return(dorsals.IsDorsals);
        }
Exemplo n.º 19
0
        /// <inheritdoc/>
        public async Task UpdateAsync(
            IWho who,
            IAuditHeaderWithAuditDetails auditHeader,
            ICompetition competition)
        {
            this.logger.LogTrace(
                "ENTRY {Method}(who, host) {@Who} {@Competition}",
                nameof(this.UpdateAsync),
                who,
                competition);

            CompetitionDto dto      = CompetitionDto.ToDto(competition);
            CompetitionDto original = await this.context.FindAsync <CompetitionDto>(competition.Id)
                                      .ConfigureAwait(false);

            Audit.AuditUpdate(auditHeader, dto.Id, original, dto);

            this.context.Entry(original).CurrentValues.SetValues(dto);
            await this.context.SaveChangesAsync().ConfigureAwait(false);

            this.logger.LogTrace(
                "EXIT {Method}(who) {@Who}",
                nameof(this.UpdateAsync),
                who);
        }
Exemplo n.º 20
0
        public CreditCardWindow(AthleteDto athlete, CompetitionDto competition)
        {
            InitializeComponent();

            _athlete     = athlete;
            _competition = competition;
        }
Exemplo n.º 21
0
        public async Task <IActionResult> Modify_Test([FromRoute] string type, [FromForm] CompetitionDto source)
        {
            bool t;

            if (type.ToLower().Equals("daily"))
            {
                t = false;
            }
            else if (type.ToLower().Equals("monthly"))
            {
                t = true;
            }
            else
            {
                return(BadRequest($"there is not Competition Type named {type} "));
            }
            var compel = _mapper.Map <CompetitionDto, Competition>(source);

            compel.Type = t;
            var state = await _service.ModifyNextCompetition_Test(compel,
                                                                  new DateTime(2020, 8, 23, 2, 3, 14));

            if (!state.Success)
            {
                return(BadRequest(state.Error));
            }
            return(Ok(_mapper.Map <Competition, CompetitionDto>(state.Source)));
        }
        private void clearAll()
        {
            InitializeComponent();
            GridMountain.Visibility           = Visibility.Collapsed;
            GridInscription.Visibility        = Visibility.Visible;
            InicioPlazo.IsEnabled             = false;
            FinPlazo.IsEnabled                = false;
            FechaCompeticion.SelectedDate     = null;
            FechaCompeticion.DisplayDateStart = DateTime.Now;
            Categories.Items.Clear();
            list = _serviceCompCat.SelectAllCategories();

            _competition = new CompetitionDto();
            Plazos_list.Items.Clear();
            Km.Text                = "";
            Hitos.Text             = "";
            NumeroPlazas.Text      = "";
            Nombre.Text            = "";
            DPos.Text              = "";
            DNeg.Text              = "";
            DTotal.Text            = "";
            PrecioInscripcion.Text = "";
            Reglamento.Text        = "";
            BtReset_Click(null, null);
        }
Exemplo n.º 23
0
 public IsCategoryInCompetitionLogic(ref DBConnection conn, CompetitionDto competitionP, AthleteDto athlete)
 {
     _conn        = conn;
     _competition = competitionP;
     _athlete     = athlete;
     IsCorrect    = false;
 }
 public void Execute()
 {
     try {
         using (var command = new SQLiteCommand(Resources.SQL_SELECT_COMPETITION, _conn.DbConnection)) {
             using (var reader = command.ExecuteReader()) {
                 while (reader.Read())
                 {
                     var competition = new CompetitionDto {
                         ID           = reader.GetInt32(0),
                         Name         = reader.GetString(1),
                         Km           = reader.GetInt32(3),
                         Price        = reader.GetDouble(4),
                         Date         = reader.GetDateTime(5),
                         NumberPlaces = reader.GetInt32(6),
                         Status       = reader.GetString(7)
                     };
                     Enum.TryParse(reader.GetString(2), out competition.Type);
                     List.Add(competition);
                 }
             }
         }
     }
     catch (SQLiteException) {
         _conn.DbConnection?.Close();
         throw;
     }
 }
Exemplo n.º 25
0
 public SelectPartialTimes(ref DBConnection conn, AthleteDto athlete, CompetitionDto competition)
 {
     _conn        = conn;
     PartialTimes = new PartialTimesDto();
     _athlete     = athlete;
     _competition = competition;
 }
Exemplo n.º 26
0
        public CompetitionDto SearchCompetitionById(CompetitionDto competition)
        {
            var searchCompetition = new SearchCompetitionByIdLogic(ref _conn, competition);

            searchCompetition.Execute();
            return(searchCompetition.Competition);
        }
Exemplo n.º 27
0
        private void BtFinish_Click(object sender, RoutedEventArgs e)
        {
            if (CompetitionsToSelect.SelectedItem == null)
            {
                MessageBox.Show(Properties.Resources.NothingSelected);
                return;
            }

            /*try {*/
            _competition = _competitionService.ListCompetitionsToInscribeObject(_athlete)
                           .ElementAt(CompetitionsToSelect.SelectedIndex);

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

            new DialogPayment(_athlete, _competition).ShowDialog();
            LoadData(TxDni.Text);

            /*} catch (ApplicationException) {
             *  MessageBox.Show(Properties.Resources.PreviouslyEnrolled);
             * }*/
        }
Exemplo n.º 28
0
        public CategoryDto SelectCompetitionByAthleteAndCompetition(CompetitionDto competition, AthleteDto athlete)
        {
            var category = new SelectCategoryByAthleteAndCompetition(ref _conn, competition, athlete);

            category.Execute();
            return(category.Category);
        }
 public void Execute()
 {
     try {
         using (var command = new SQLiteCommand(Resources.SQL_SELECT_COMPETITIONS_TO_INSCRIBE_CLUBS,
                                                _conn.DbConnection)) {
             command.Parameters.AddWithValue("@COUNT", _count);
             var da = new SQLiteDataAdapter(command);
             da.Fill(Table);
             using (var reader = command.ExecuteReader()) {
                 while (reader.Read())
                 {
                     var competitionDto = new CompetitionDto {
                         ID    = reader.GetInt64(0),
                         Name  = reader.GetString(1),
                         Km    = reader.GetDouble(3),
                         Price = reader.GetDouble(4)
                     };
                     Competitions.Add(competitionDto);
                 }
             }
         }
     }
     catch (SQLiteException) {
         _conn.DbConnection?.Close();
         throw;
     }
 }
Exemplo n.º 30
0
        public IEnumerable <PartialTimesDto> SelectPartialTimes(CompetitionDto competition)
        {
            var partial = new SelectAllPartialTimes(ref _conn, competition);

            partial.Execute();
            return(partial.List);
        }