예제 #1
0
        private void LoadFormTeams()
        {
            new Thread(() =>
            {
                UtilsNotification.StartLoadingAnimation();

                //Get competitions
                var teamList = teamService.GetTeams().OrderBy(x => x.Name).Skip((pagNumber - 1) * IPP).Take(IPP);

                DataGridTeams.Dispatcher.BeginInvoke((Action)(() => DataGridTeams.ItemsSource = null));
                ObservableCollection <TeamDataModel> teamItems = new ObservableCollection <TeamDataModel>();

                if (teamList != null && teamList.Count() > 0)
                {
                    foreach (var item in teamList)
                    {
                        teamItems.Add(new TeamDataModel()
                        {
                            TeamId          = item.TeamId,
                            TeamName        = item.Name,
                            CompetitionName = competitionService.GetCompetitionName(item.CompetitionId),
                            SeasonName      = competitionService.GetCompetitionSeasonName(item.CompetitionId),
                            FavStarPath     = item.IsFavorite? "pack://application:,,/Resources/ImageFiles/unnamed_star.png" :
                                              "pack://application:,,/Resources/ImageFiles/black_tilde_arrow.png",
                            CreateDate = Utils.FormatDateTimeToGrid(item.CreateDate)
                        });
                    }

                    //BINDING
                    DataGridTeams.Dispatcher.BeginInvoke((Action)(() => DataGridTeams.ItemsSource = teamItems));
                }

                //PAGINATION TEXT
                ShowPaginationText();


                //Load other data
                var competitionList = competitionService.GetCompetitions();

                ObservableCollection <CompetitionComboModel> compsBox = new ObservableCollection <CompetitionComboModel>();
                foreach (var item in competitionList)
                {
                    compsBox.Add(new CompetitionComboModel()
                    {
                        CompetitionId   = item.CompetitionId,
                        CompetitionName = item.Name + " - " + competitionService.GetCompetitionSeasonName(item.CompetitionId)
                    });
                }

                ComboBoxCompetition.Dispatcher.BeginInvoke((Action)(() => ComboBoxCompetition.ItemsSource = compsBox));
                ComboBoxCompetition.Dispatcher.BeginInvoke((Action)(() => ComboBoxCompetition.SelectedValue = compsBox.FirstOrDefault()));

                //Enable Ui
                ComboBoxCompetition.Dispatcher.BeginInvoke((Action)(() => ComboBoxCompetition.IsEnabled = true));

                UtilsNotification.StopLoadingAnimation();
            }).Start();
        }
        private void LoadFormCompetitions()
        {
            new Thread(() =>
            {
                UtilsNotification.StartLoadingAnimation();

                //Get competitions
                var competitionList = competitionService.GetCompetitions();

                DataGridCompetitions.Dispatcher.BeginInvoke((Action)(() => DataGridCompetitions.ItemsSource = null));
                ObservableCollection <CompetitionDataModel> compItems = new ObservableCollection <CompetitionDataModel>();

                if (competitionList != null && competitionList.Count() > 0)
                {
                    foreach (var item in competitionList)
                    {
                        compItems.Add(new CompetitionDataModel()
                        {
                            CompetitionId   = item.CompetitionId,
                            CompetitionName = item.Name,
                            SeasonName      = seasonService.GetSeasonName(item.SeasonId),
                            CreateDate      = Utils.FormatDateTimeToGrid(item.CreateDate)
                        });
                    }

                    //BINDING
                    DataGridCompetitions.Dispatcher.BeginInvoke((Action)(() => DataGridCompetitions.ItemsSource = compItems));
                }


                //Load other data
                var seasonList = seasonService.GetSeasons();

                ObservableCollection <SeasonComboModel> seasonsBox = new ObservableCollection <SeasonComboModel>();
                foreach (var item in seasonList)
                {
                    seasonsBox.Add(new SeasonComboModel()
                    {
                        SeasonId   = item.SeasonId,
                        SeasonName = item.Name
                    });
                }

                ComboBoxSeason.Dispatcher.BeginInvoke((Action)(() => ComboBoxSeason.ItemsSource = seasonsBox));
                ComboBoxSeason.Dispatcher.BeginInvoke((Action)(() => ComboBoxSeason.SelectedValue = seasonsBox.FirstOrDefault()));

                //Enable Ui
                ComboBoxSeason.Dispatcher.BeginInvoke((Action)(() => ComboBoxSeason.IsEnabled = true));

                UtilsNotification.StopLoadingAnimation();
            }).Start();
        }
예제 #3
0
        //FUNCTIONS
        public void InitFilterForm()
        {
            //Load competitions
            var competitionList = competitionService.GetCompetitions();

            ObservableCollection <CompetitionComboModel> compsBox = new ObservableCollection <CompetitionComboModel>();

            compsBox.Add(new CompetitionComboModel()
            {
                CompetitionId   = 0,
                CompetitionName = "Selecionar competição"
            });

            foreach (var item in competitionList)
            {
                compsBox.Add(new CompetitionComboModel()
                {
                    CompetitionId   = item.CompetitionId,
                    CompetitionName = item.Name + " - " + competitionService.GetCompetitionSeasonName(item.CompetitionId)
                });
            }

            ComboBoxCompetition.ItemsSource   = compsBox;
            ComboBoxCompetition.SelectedValue = compsBox.FirstOrDefault();

            ComboBoxTeam.IsEnabled       = false;
            ButtonTeamsFilter.Visibility = Visibility.Hidden;
        }
예제 #4
0
        //FUNCTIONS
        private void IniForm()
        {
            new Thread(() =>
            {
                UtilsNotification.StartLoadingAnimation();

                //Load competitions
                var competitionList = competitionService.GetCompetitions();

                ObservableCollection <CompetitionComboModel> compsBox = new ObservableCollection <CompetitionComboModel>();
                compsBox.Add(new CompetitionComboModel()
                {
                    CompetitionId   = 0,
                    CompetitionName = "Selecionar competição"
                });

                foreach (var item in competitionList)
                {
                    compsBox.Add(new CompetitionComboModel()
                    {
                        CompetitionId   = item.CompetitionId,
                        CompetitionName = item.Name + " - " + competitionService.GetCompetitionSeasonName(item.CompetitionId)
                    });
                }

                ComboBoxCompetition.Dispatcher.BeginInvoke((Action)(() => ComboBoxCompetition.ItemsSource = compsBox));
                ComboBoxCompetition.Dispatcher.BeginInvoke((Action)(() => ComboBoxCompetition.SelectedValue = compsBox.FirstOrDefault()));

                comboBoxCompetionId = 0;
                numericBoxFixtureId = 0;
                ButtonLoadForm.Dispatcher.BeginInvoke((Action)(() => ButtonLoadForm.Visibility = Visibility.Hidden));

                UtilsNotification.StopLoadingAnimation();
            }).Start();
        }
        private void LoadFormTimeGoals()
        {
            new Thread(() =>
            {
                UtilsNotification.StartLoadingAnimation();

                //Load competition data
                var competitionList = competitionService.GetCompetitions();

                ObservableCollection <CompetitionComboModel> compsBox = new ObservableCollection <CompetitionComboModel>();
                compsBox.Add(new CompetitionComboModel()
                {
                    CompetitionId   = 0,
                    CompetitionName = "Selecionar competição"
                });

                foreach (var item in competitionList)
                {
                    compsBox.Add(new CompetitionComboModel()
                    {
                        CompetitionId   = item.CompetitionId,
                        CompetitionName = item.Name + " - " + competitionService.GetCompetitionSeasonName(item.CompetitionId)
                    });
                }

                ComboBoxFilterCompetition.Dispatcher.BeginInvoke((Action)(() => ComboBoxFilterCompetition.ItemsSource = compsBox));
                ComboBoxFilterCompetition.Dispatcher.BeginInvoke((Action)(() => ComboBoxFilterCompetition.SelectedValue = compsBox.FirstOrDefault()));

                ImageLogo.Dispatcher.BeginInvoke((Action)(() => ImageLogo.Visibility = Visibility.Visible));
                LabelInfo.Dispatcher.BeginInvoke((Action)(() => LabelInfo.Visibility = Visibility.Visible));
                LabelExtraInfo.Dispatcher.BeginInvoke((Action)(() => LabelExtraInfo.Visibility = Visibility.Visible));

                UtilsNotification.StopLoadingAnimation();
            }).Start();
        }
예제 #6
0
        public async Task <IActionResult> OnGetAsync(int?id, [FromServices] UserManager <User> userManager)
        {
            User = await userManager.GetUserAsync(HttpContext.User);

            if (id == null)
            {
                return(NotFound());
            }

            CompetitionDto = _competitionService.GetCompetitions().Single(c => c.Id == id);
            Participations = _participationService.GetParticipationById(id).ToList();
            if (CompetitionDto == null)
            {
                return(NotFound());
            }
            return(Page());
        }
        public async Task OnGetAsync([FromServices] UserManager <User> userManager)
        {
            User = await userManager.GetUserAsync(HttpContext.User);

            Competitons = _competitionService.GetCompetitions();
        }