Ejemplo n.º 1
0
        public static int SelectDraw(string seasonName)
        {
            int drawID = 0;

            switch (seasonName)
            {
            case "2017":
                drawID = 0;
                break;

            case "2018":
                drawID = 1;
                break;

            case "2019":
                drawID = 2;
                break;

            case "2020":
                drawID = 3;
                break;

            case "2021":
                drawID = 4;
                break;

            case "2022":
                drawID = 5;
                break;
            }

            DAFunctions.GetDraw(drawID);
            return(drawID);
        }
Ejemplo n.º 2
0
        private void btn_ViewLadder_Click(object sender, EventArgs e)
        {
            if (cbo_SelectSeason.Text == "" || cbo_SelectDivision.Text == "")
            {
                MessageBox.Show("Please Select Season & Division to View Ladder");
            }
            else
            {
                List <string> teams = DAFunctions.GetDivisionTeams(1);

                List <Ladder> ladder = new List <Ladder>();
                for (int i = 0; i < teams.Count; i++)
                {
                    ladder.Add(new Ladder(teams[i], CalcGoalsFor(teams[i]), CalcGoalsAgainst(teams[i]), GamePlayed(teams[i])));
                }

                lbl_Results.Text                    = "Ladder";
                dataGridView1.DataSource            = ladder;
                dataGridView1.Columns[4].HeaderText = "Goals For";
                dataGridView1.Columns[5].HeaderText = "Goals Against";
                dataGridView1.ReadOnly              = true;
                dataGridView1.AutoResizeColumns();
                dataGridView1.RowHeadersVisible = false;
            }
        }
Ejemplo n.º 3
0
 public EDSL_System()
 {
     InitializeComponent();
     pnl_System.BringToFront();
     btn_SelectDates.Enabled = false;
     btn_ViewDraw.Enabled    = false;
     DAFunctions.LoadData();
 }
Ejemplo n.º 4
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;
        }
Ejemplo n.º 5
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);
        }
Ejemplo n.º 6
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);
        }
Ejemplo n.º 7
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);
        }
Ejemplo n.º 8
0
 public static void SaveSeasonDates()
 {
     DAFunctions.WriteSeason(season);
 }
Ejemplo n.º 9
0
        private void GetDraw()
        {
            DAFunctions.GetDraw(SeasonHandler.SelectDraw(cbo_SelectSeason.Text));

            rounds = DAFunctions.draw;
        }