Example #1
0
        private bool ParseImport(string filename)
        {
            IImporter importer = Importer.GetImporter(filename);

            if (importer != null && importer.Open(filename))
            {
                mainTreeView.Nodes.Clear();
                PlayerInfo[] players = importer.GetPlayers();
                if (players != null && players.Length > 0)
                {
                    TreeNode node = new TreeNode(Localizator.Dictionary.GetString("PLAYER_LIST"));
                    node.Tag = players;
                    mainTreeView.Nodes.Add(node);
                }
                TypeOfSport[] games = importer.GetTypesOfSport();
                if (games != null && games.Length > 0)
                {
                    TreeNode node = new TreeNode(Localizator.Dictionary.GetString("RATING_LISTS"));
                    node.Tag = games;
                    mainTreeView.Nodes.Add(node);
                    foreach (TypeOfSport sport in games)
                    {
                        TreeNode child = new TreeNode();
                        child.Text = sport.Name;
                        XmlExporter.RatingNode rating_node = new XmlExporter.RatingNode();
                        rating_node.Game = sport;
                        rating_node.Ratings.AddRange(importer.GetPlayersRatings(sport));
                        child.Tag = rating_node;
                        node.Nodes.Add(child);
                    }
                }

                Tournament[] tourns = importer.GetTournaments();
                if (tourns != null && tourns.Length > 0)
                {
                    TreeNode node = new TreeNode();
                    node.Text = Localizator.Dictionary.GetString("TOURNAMENTS");// "Турниры";
                    node.Tag  = tourns;
                    mainTreeView.Nodes.Add(node);
                    CompetitionList comps = new CompetitionList();
                    foreach (Tournament tour in tourns)
                    {
                        TreeNode child = new TreeNode();
                        child.Text = String.Format("{0} - {1}", tour.Info.DateBegin.ToString("dd.MM.yyyy"), tour.Info.Name);
                        child.Tag  = tour;
                        node.Nodes.Add(child);
                        foreach (Competition comp in tour.Competitions.Values)
                        {
                            TreeNode sub_child = new TreeNode();
                            sub_child.Text = comp.Info.Name;
                            sub_child.Tag  = comp;
                            child.Nodes.Add(sub_child);
                        }
                    }
                    mainTreeView.ExpandAll();
                }
                return(true);
            }
            return(false);
        }
Example #2
0
        private bool OpenDatabase()
        {
            TreeNode node = new TreeNode();

            node.Text = Localizator.Dictionary.GetString("PLAYER_LIST");// "Список игроков";

            node.Tag = new PlayerList();
            mainTreeView.Nodes.Add(node);
#if FEDITION || DEBUG
            node      = new TreeNode();
            node.Text = Localizator.Dictionary.GetString("RATING_LISTS");// "Рейтинговые листы";
            mainTreeView.Nodes.Add(node);
            DatabaseManager.CurrentDb.ReadTypeOfSportList(Globals.Games);
            foreach (TypeOfSport sport in Globals.Games.Values)
            {
                TreeNode child = new TreeNode();
                child.Text = sport.Name;
                child.Tag  = sport;
                node.Nodes.Add(child);
            }
#endif
            node      = new TreeNode();
            node.Text = Localizator.Dictionary.GetString("TOURNAMENTS");// "Турниры";
            node.Tag  = 3;
            mainTreeView.Nodes.Add(node);
            TournamentList tourns = new TournamentList();
            DatabaseManager.CurrentDb.ReadTournamentList(tourns);
            CompetitionList comps = new CompetitionList();
            foreach (Tournament tour in tourns.Values)
            {
                TreeNode child = new TreeNode();
                child.Text = String.Format("{0} - {1}", tour.Info.DateBegin.ToString("dd.MM.yyyy"), tour.Info.Name);
                child.Tag  = tour;
                node.Nodes.Add(child);
                DatabaseManager.CurrentDb.ReadCompetitionList(tour);
                foreach (Competition comp in tour.Competitions.Values)
                {
                    TreeNode sub_child = new TreeNode();
                    sub_child.Text = comp.Info.Name;
                    sub_child.Tag  = comp;
                    DatabaseManager.CurrentDb.ReadCompetitionPlayersList(comp, CompetitionPlayerList.SortByField.SeedNo);
                    DatabaseManager.CurrentDb.ReadCompetitionMatchesList(comp);
                    child.Nodes.Add(sub_child);
                }
            }
            mainTreeView.ExpandAll();
            return(true);
        }
Example #3
0
        public AddNewAchievment(int studentId)
        {
            InitializeComponent();
            var student = _db.Students.Find(studentId);

            studentIdBox.Text = studentId.ToString();

            var subjects = _db.Subjects.ToList();

            SubjectList.DataSource = subjects;
            SubjectList.Refresh();

            var competition = _db.Competitions.ToList();

            CompetitionList.DataSource = competition;
            CompetitionList.Refresh();
        }
        /// <summary>
        /// loads all the countries leagues and matches ready to sort into the grouped list
        /// </summary>
        private async void LoadCountries()
        {
            try
            {
                LeagueLogoList = repository.LoadLeagueLogos();
                FederationList = await repository.LoadFederation();

                CompetitionList = await repository.LoadCompetition();

                CompetitionList = CompetitionList.OrderBy(c => c.id).ToList();
                CountryList     = await repository.LoadCountry();

                CheckDate();
                CountriesLoaded = true;
            }
            catch (Exception ex)
            {
                errorHandler.CheckErrorMessage(ex);
            }
        }