示例#1
0
        public void RefreshGrid()
        {
            season = DAFunctions.ReadSeason(seasonName);
            SeasonHandler.FillGridd(grid, season);

            grid.Columns[1].Width = 200;
            grid.Controls.Add(dtp);
            dtp.Visible              = false;
            dtp.Format               = DateTimePickerFormat.Long;
            dtp.TextChanged         += new EventHandler(dtp_TextChange);
            grid.Columns[2].Selected = false;
        }
示例#2
0
        public static Season ViewSeasonDates(DataGridView grid_SeasonDates, string seasonName)
        {
            if (DAFunctions.ReadSeason(seasonName) != null)
            {
                if (seasonName.Equals(""))
                {
                    MessageBox.Show("Please Enter Season Name");
                }
                else
                {
                    season = DAFunctions.ReadSeason(seasonName);
                    FillGridd(grid_SeasonDates, season);
                }
            }
            else
            {
                MessageBox.Show("Season Does Not Exists");
            }

            return(season);
        }
示例#3
0
        public static Season GenerateSeasonDates(string seasonName, DateTime startDate,
                                                 DataGridView grid_SeasonDates, int num_Rounds)
        {
            DialogResult dialogResult;

            if (DAFunctions.ReadSeason(seasonName) != null)
            {
                MessageBox.Show("Season Exists");
                return(null);
            }
            if (seasonName.Equals(""))
            {
                MessageBox.Show("Please Enter Season Name");
                return(null);
            }
            if (num_Rounds == 0)
            {
                MessageBox.Show("Enter Number of Rounds");
                return(null);
            }
            if (startDate.Date.ToShortDateString().Equals(DateTime.Now.Date.ToShortDateString()))
            {
                dialogResult = MessageBox.Show("Are you sure you want to Start Season from Today?", "", MessageBoxButtons.YesNo);
                if (dialogResult == DialogResult.No)
                {
                    MessageBox.Show("Select a New Start Date");
                    return(null);
                }
                else
                {
                    season = new Season(DAFunctions.seasons.Count + 1, seasonName, startDate, Convert.ToInt32(num_Rounds));
                    FillGridd(grid_SeasonDates, season);
                    SaveSeasonDates();
                }
            }

            return(season);
        }
示例#4
0
        public static void GetGames(string seasName, string divName)
        {
            Division      division = DAFunctions.ReadDivision(divName);
            Season        season   = DAFunctions.ReadSeason(seasName);
            List <string> teams    = DAFunctions.GetDivisionTeams(division.DivisionID);

            var random = new Random();

            teams = teams.OrderBy(item => random.Next()).ToList();

            List <Game> fixtures = CalculateFixtures(teams);

            DAFunctions.fixtures = fixtures.OrderBy(o => o.GameNo).ToList();

            List <Round> rounds = new List <Round>();

            int round = 0;

            for (int i = 0; i < season.SeasonDates.Count; i++)
            {
                rounds.Add(new Round(i + 1, season.SeasonDates[i], 1));
                for (int j = 0; j < 5; j++)
                {
                    rounds[i].GameList.Add(new Game(false));
                }
            }

            foreach (var batch in fixtures.Batch(5))
            {
                if (batch.ToList().Count == 5)
                {
                    rounds[round].GameList = batch.ToList();
                    round += 1;
                }
            }

            DAFunctions.allDraws.Add(rounds);
        }