public KnockOutPhase readKnockout(string filename, int sheet, ExcelReadSettings settings) { Initialise(filename, sheet); KnockOutPhase ko = new KnockOutPhase(); int p = 0; foreach (var phase in settings.phases) { for (int i = 0; i < phase.size; i++) { int row = phase.startrow + (phase.gapsize * i); if (i >= phase.size / 2) { row++; } string team = xlRange.Cells[row, phase.column].value2; if (team == null) { team = ""; } ko.Stages.ElementAt(p).Value.teams.Add(team.ToLower()); } p++; } Clean(); return(ko); }
public List <PoolMatchResult> ReadGroupPhase(string filename, int sheet, ExcelReadSettings Settings) { Initialise(filename, sheet); List <PoolMatchResult> res = new List <PoolMatchResult>(); int Groupschecked = 0; while (Groupschecked < Settings.TotalGroups) { int rowschecked = 0; while (rowschecked < Settings.GroupSize) { double x = 99; double y = 99; int currentRow = Settings.GroupStartRow + rowschecked; if (xlRange.Cells[currentRow, Settings.GroupHomeColumn].Value2 != null && xlRange.Cells[currentRow, Settings.GroupOutColumn].Value2 != null) { x = xlRange.Cells[currentRow, Settings.GroupHomeColumn].Value2; y = xlRange.Cells[currentRow, Settings.GroupOutColumn].Value2; } PoolMatchResult pmr = new PoolMatchResult(Convert.ToInt32(x), Convert.ToInt32(y)); res.Add(pmr); rowschecked++; } Settings.GroupStartRow += Settings.GroupSize + 1; Groupschecked++; } Clean(); return(res); }
private void btnFile_Click(object sender, EventArgs e) { string file = tbFile.Text; ExcelManager em = new ExcelManager(); ExcelReadSettings settings = new ExcelReadSettings(); Player player = new Player(tbName.Text, tbTown.Text, em.ReadGroupPhase(file, 1, settings), em.readKnockout(file, 1, settings), em.readBonus(file, 1)); MessageBox.Show("player sucesfully created!"); loadPlayer(player); }