Пример #1
0
        public static void Main(string[] args)
        {
            var httpClient = new HttpClient();

            var apiKey = Environment.GetEnvironmentVariable("ApiKey");

            if (!string.IsNullOrEmpty(apiKey))
            {
                httpClient.DefaultRequestHeaders.Add("X-Auth-Token", apiKey);
            }

            var competitionController = CompetitionProvider.Create()
                                        .With(httpClient)
                                        .Build();

            var matchController = MatchProvider.Create()
                                  .With(httpClient)
                                  .Build();

            //GetCompetitions(competitionController);
            //GetCompetitionsWithFilter(competitionController);
            //GetCompetitionById(competitionController, 2019);
            //GetAllMatchOfCompetition(matchController, 2019);
            //GetAllMatch(matchController);
            GetMatchById(matchController, 200033);

            Console.ReadKey();
        }
        /*
         * End of Instance constructor
         */


        public void OpenNewStudentGUI()
        {
            List <Competition> competitions = CompetitionProvider.getAllCompetitions();

            NewStudentGUI NewStudentGUIForm;

            NewStudentGUIForm = new NewStudentGUI();

            NewStudentGUIForm.ShowDialog();
        }
Пример #3
0
        private static async void GetCompetitions(CompetitionProvider competitionController)
        {
            var competitions = await competitionController.GetAvailableCompetition();

            lock (lockWrite)
            {
                Console.WriteLine("### All available competitions ###");
                Console.WriteLine(JsonConvert.SerializeObject(competitions));
                Console.WriteLine();
            }
        }
Пример #4
0
        private static async void GetCompetitionById(CompetitionProvider competitionController, int id)
        {
            var competition = await competitionController.GetCompetition(id);

            lock (lockWrite)
            {
                Console.WriteLine("### One particular competition ###");
                Console.WriteLine(JsonConvert.SerializeObject(competition));
                Console.WriteLine();
            }
        }
Пример #5
0
        private static async void GetCompetitionsWithFilter(CompetitionProvider competitionController)
        {
            var competitions = await competitionController.GetAvailableCompetitionByArea(2114);

            lock (lockWrite)
            {
                Console.WriteLine("### Competition of the area X ###");
                Console.WriteLine(JsonConvert.SerializeObject(competitions));
                Console.WriteLine();
            }
        }
Пример #6
0
        /*
         * End of Instance constructor
         */


        public void OpenNewSportsFestivalGUI()
        {
            List <Competition> competitions = CompetitionProvider.getAllCompetitions();

            NewSportsFestivalGUI NewSportsFestivalGUIForm;

            NewSportsFestivalGUIForm = new NewSportsFestivalGUI(this);
            NewSportsFestivalGUIForm.renderCompetitionsGrid(competitions);

            NewSportsFestivalGUIForm.ShowDialog();
        }
Пример #7
0
        internal void renderResultsGrid()
        {
            dgvResults.Rows.Clear();

            DataGridViewTextBoxColumn textBoxCompetition = new DataGridViewTextBoxColumn();

            textBoxCompetition.ReadOnly = true;
            dgvResults.Columns.Add(textBoxCompetition);


            DataGridViewTextBoxColumn textBoxDiscipline = new DataGridViewTextBoxColumn();

            textBoxCompetition.ReadOnly = true;
            dgvResults.Columns.Add(textBoxDiscipline);

            DataGridViewTextBoxColumn textBoxResult = new DataGridViewTextBoxColumn();

            dgvResults.Columns.Add(textBoxResult);

            foreach (Competition competition in CompetitionProvider.getCompetitionsBySportsFestival(m_SportsFestivalRef))
            {
                if (competition == null)
                {
                    continue;
                }

                List <DisciplineSet> disciplineSetsList = CompetitionDisciplineSetProvider.getDisciplineSetsByCompetition(competition);

                foreach (DisciplineSet disciplineSet in disciplineSetsList)
                {
                    foreach (Discipline discipline in DisciplineProvider.getDisciplinesByDisciplineSetId(disciplineSet))
                    {
                        object[] rowData = new object[]
                        {
                            competition.CompetitionName,
                            discipline.Name,
                            ""
                        };
                        dgvResults.Rows.Add(rowData);
                    }
                }
            }
        }
Пример #8
0
        public void createNewSportsFestival(DateTime sportsFestivalDate, List <Int32> competitionIds)
        {
            List <Competition> competitions = new List <Competition>();

            foreach (int competitionId in competitionIds)
            {
                Competition competition = CompetitionProvider.getCompetitionById(competitionId);
                competitions.Add(competition);
            }

            int sportsFestivalId = SportsFestivalProvider.createSportsFestival(sportsFestivalDate, competitions);

            SportsFestival sportsFestival = SportsFestivalProvider.getSportsFestivalById(sportsFestivalId);
            List <Student> students       = StudentProvider.getAllActiveStudents();

            foreach (Student student in students)
            {
                SportsFestivalSubscriptionProvider.createSportsFestivalSubscription(
                    sportsFestival,
                    student
                    );
            }
        }