rounds in model.Rounds)
118 | {
119 | if (rounds.All(x => x.Winner != null))
120 | {
121 | output += 1;
122 | }
123 | else
124 | {
125 | return output;
126 | }
127 | }
128 |
129 | CompleteTournament(model);
130 |
131 | return output - 1;
132 | }
133 |
134 | private static void CompleteTournament(TournamentModel model)
135 | {
136 | GlobalConfig.Connection.CompleteTournament(model);
137 | TeamModel winners = model.Rounds.Last().First().Winner;
138 | TeamModel runnerUp = model.Rounds.Last().First().Entries.Where(x => x.TeamCompeting != winners).First().TeamCompeting;
139 |
140 | decimal winnerPrize = 0;
141 | decimal runnerUpPrize = 0;
142 |
143 | if (model.Prizes.Count > 0)
144 | {
145 | decimal totalIncome = model.EnteredTeams.Count * model.EntryFee;
146 |
147 | PrizeModel firstPlacePrize = model.Prizes.Where(x => x.PlaceNumber == 1).FirstOrDefault();
148 | PrizeModel secondPlacePrize = model.Prizes.Where(x => x.PlaceNumber == 2).FirstOrDefault();
149 |
150 | if (firstPlacePrize != null)
151 | {
152 | winnerPrize = firstPlacePrize.CalculatePrizePayout(totalIncome);
153 | }
154 |
155 | if (secondPlacePrize != null)
156 | {
157 | runnerUpPrize = secondPlacePrize.CalculatePrizePayout(totalIncome);
158 | }
159 | }
160 |
161 | // Send Email to all tournament
162 | string subject = "";
163 | StringBuilder body = new StringBuilder();
164 |
165 | subject = $"In { model.TournamnetName }, { winners.TeamName } has won!";
166 |
167 | body.AppendLine("We have a WINNER!
");
168 | body.AppendLine("Congratulations to our winner on a great tournament.
");
169 | body.AppendLine("");
170 |
171 | if (winnerPrize > 0)
172 | {
173 | body.AppendLine($"{ winners.TeamName } will receive ${ winnerPrize }");
174 | }
175 |
176 | if (runnerUpPrize > 0)
177 | {
178 | body.AppendLine($"
{ runnerUp.TeamName } will receive ${ runnerUpPrize }");
179 | }
180 |
181 | body.AppendLine("
Thanks for a great tournament everyone!
");
182 | body.AppendLine("~Tournament Tracker");
183 |
184 | List bccAddresses = new List();
185 | foreach (TeamModel t in model.EnteredTeams)
186 | {
187 | foreach (PersonModel p in t.TeamMembers)
188 | {
189 | if (p.EmailAddress.Length > 0)
190 | {
191 | bccAddresses.Add(p.EmailAddress);
192 | }
193 | }
194 | }
195 |
196 | EmailLogic.SendEmail(new List(), bccAddresses, subject, body.ToString());
197 |
198 | // Complete Tournament
199 | model.CompleteTournament();
200 | }
201 |
202 | private static decimal CalculatePrizePayout(this PrizeModel prize, decimal totalIncome)
203 | {
204 | decimal output = 0;
205 |
206 | if (prize.PrizeAmount > 0)
207 | {
208 | output = prize.PrizeAmount;
209 | }
210 | else
211 | {
212 | output = Decimal.Multiply(totalIncome, Convert.ToDecimal(prize.PrizeAmount / 100));
213 | }
214 |
215 | return output;
216 | }
217 |
218 | private static void AdvancedWinners(List models, TournamentModel tournament)
219 | {
220 | foreach (MatchupModel m in models)
221 | {
222 | foreach (List round in tournament.Rounds)
223 | {
224 | foreach (MatchupModel rm in round)
225 | {
226 | foreach (MatchupEntryModel me in rm.Entries)
227 | {
228 | if (me.ParentMatchup != null)
229 | {
230 | if (me.ParentMatchup.Id == m.Id)
231 | {
232 | me.TeamCompeting = m.Winner;
233 | GlobalConfig.Connection.UpdateMatchup(rm);
234 | }
235 | }
236 | }
237 | }
238 | }
239 | }
240 | }
241 |
242 | private static void MarkWinnersInMatchups(List models)
243 | {
244 | // greater or lesser
245 | string greaterWins = ConfigurationManager.AppSettings["greaterWins"];
246 |
247 | foreach (MatchupModel m in models)
248 | {
249 | // Checks for bye week entry
250 | if (m.Entries.Count == 1)
251 | {
252 | m.Winner = m.Entries[0].TeamCompeting;
253 | continue;
254 | }
255 |
256 | // 0 means false, or low score wins
257 | if (greaterWins == "0")
258 | {
259 | if (m.Entries[0].Score < m.Entries[1].Score)
260 | {
261 | m.Winner = m.Entries[0].TeamCompeting;
262 | }
263 | else if (m.Entries[1].Score < m.Entries[0].Score)
264 | {
265 | m.Winner = m.Entries[1].TeamCompeting;
266 | }
267 | else
268 | {
269 | throw new Exception("We do not allow ties in this application.");
270 | }
271 | }
272 | else
273 | {
274 | // 1 means true, or high score wins
275 | if (m.Entries[0].Score > m.Entries[1].Score)
276 | {
277 | m.Winner = m.Entries[0].TeamCompeting;
278 | }
279 | else if (m.Entries[1].Score > m.Entries[0].Score)
280 | {
281 | m.Winner = m.Entries[1].TeamCompeting;
282 | }
283 | else
284 | {
285 | throw new Exception("We do not allow ties in this application.");
286 | }
287 | }
288 | }
289 | }
290 |
291 | private static void CreateOtherRounds(TournamentModel model, int rounds)
292 | {
293 | int round = 2;
294 | List previousRound = model.Rounds[0];
295 | List currRound = new List();
296 | MatchupModel currMatchup = new MatchupModel();
297 |
298 | while (round <= rounds)
299 | {
300 | foreach (MatchupModel match in previousRound)
301 | {
302 | currMatchup.Entries.Add(new MatchupEntryModel { ParentMatchup = match });
303 |
304 | if (currMatchup.Entries.Count > 1)
305 | {
306 | currMatchup.MatchupRound = round;
307 | currRound.Add(currMatchup);
308 | currMatchup = new MatchupModel();
309 | }
310 | }
311 |
312 | model.Rounds.Add(currRound);
313 | previousRound = currRound;
314 |
315 | currRound = new List();
316 | round++;
317 | }
318 | }
319 |
320 | private static List CreateFirstround(int byes, List teams)
321 | {
322 | List output = new List();
323 | MatchupModel curr = new MatchupModel();
324 |
325 | foreach (TeamModel team in teams)
326 | {
327 | curr.Entries.Add(new MatchupEntryModel { TeamCompeting = team });
328 |
329 | if (byes > 0 || curr.Entries.Count > 1)
330 | {
331 | curr.MatchupRound = 1;
332 | output.Add(curr);
333 | curr = new MatchupModel();
334 |
335 | if (byes > 0)
336 | {
337 | byes--;
338 | }
339 | }
340 | }
341 |
342 | return output;
343 | }
344 |
345 | private static int NumberOfByes(int rounds, int numberOfTeams)
346 | {
347 | int output = 0;
348 | int totalTeams = 1;
349 |
350 | for (int i = 1; i < rounds; i++)
351 | {
352 | totalTeams *= 2;
353 | }
354 |
355 | output = totalTeams - numberOfTeams;
356 |
357 | return output;
358 | }
359 |
360 | private static int FindNumberOfRounds(int teamCount)
361 | {
362 | int output = 1;
363 | int val = 2;
364 |
365 | while (val < teamCount)
366 | {
367 | output++;
368 | val *= 2;
369 | }
370 |
371 | return output;
372 | }
373 |
374 | private static List RandomizeTeamOrder(List teams)
375 | {
376 | return teams.OrderBy(x => Guid.NewGuid()).ToList();
377 | }
378 | }
379 | }
380 |
--------------------------------------------------------------------------------
/TrackerLibrary/DataAccess/SqlConnector.cs:
--------------------------------------------------------------------------------
1 | using Dapper;
2 | using System.Collections.Generic;
3 | using System.Data;
4 | using System.Data.SqlClient;
5 | using System.Linq;
6 | using TrackerLibrary.Models;
7 |
8 | namespace TrackerLibrary.DataAccess
9 | {
10 | public class SqlConnector : IDataConnection
11 | {
12 | private const string db = "Tournament";
13 |
14 | ///
15 | /// Saves a new person to the database
16 | ///
17 | /// The person information
18 | /// The person information plus the unique identifier.
19 | public void CreatePerson(PersonModel model)
20 | {
21 | using (IDbConnection connection = new SqlConnection(GlobalConfig.CnnString(db)))
22 | {
23 | var p = new DynamicParameters();
24 | p.Add("@FirstName", model.FirstName);
25 | p.Add("@LastName", model.LastName);
26 | p.Add("@EmailAddress", model.EmailAddress);
27 | p.Add("@CellPhoneNumber", model.CellPhoneNumber);
28 | p.Add("@Id", 0, dbType: DbType.Int32, direction: ParameterDirection.Output);
29 |
30 | connection.Execute("[dbo].[spPeople_Insert]", p, commandType: CommandType.StoredProcedure);
31 |
32 | model.Id = p.Get("@Id");
33 | }
34 | }
35 |
36 | ///
37 | /// Saves a new prize to the database
38 | ///
39 | /// The prize information
40 | /// The prize information plus the unique identifier.
41 | public void CreatePrize(PrizeModel model)
42 | {
43 | using (IDbConnection connection = new SqlConnection(GlobalConfig.CnnString(db)))
44 | {
45 | var p = new DynamicParameters();
46 | p.Add("@PlaceNumber", model.PlaceNumber);
47 | p.Add("@PlaceName", model.PlaceName);
48 | p.Add("@PrizeAmount", model.PrizeAmount);
49 | p.Add("@PrizePercentage", model.PrizePercentage);
50 | p.Add("@Id", 0, dbType: DbType.Int32, direction: ParameterDirection.Output);
51 |
52 | connection.Execute("[dbo].[spPrizes_Insert]", p, commandType: CommandType.StoredProcedure);
53 |
54 | model.Id = p.Get("@Id");
55 | }
56 | }
57 |
58 | ///
59 | /// Saves a new team to the database
60 | ///
61 | /// The team information<
62 | /// The team information plus the unique identifier.
63 | public void CreateTeam(TeamModel model)
64 | {
65 | using (IDbConnection connection = new SqlConnection(GlobalConfig.CnnString(db)))
66 | {
67 | var p = new DynamicParameters();
68 | p.Add("@TeamName", model.TeamName);
69 | p.Add("@Id", 0, dbType: DbType.Int32, direction: ParameterDirection.Output);
70 |
71 | connection.Execute("[dbo].[spTeams_Insert]", p, commandType: CommandType.StoredProcedure);
72 |
73 | model.Id = p.Get("@Id");
74 |
75 | foreach (PersonModel tm in model.TeamMembers)
76 | {
77 | p = new DynamicParameters();
78 | p.Add("@TeamId", model.Id);
79 | p.Add("@PersonId", tm.Id);
80 |
81 | connection.Execute("[dbo].[spTeamMembers_Insert]", p, commandType: CommandType.StoredProcedure);
82 | }
83 | }
84 | }
85 |
86 | public void CreateTournament(TournamentModel model)
87 | {
88 | using (IDbConnection connection = new SqlConnection(GlobalConfig.CnnString(db)))
89 | {
90 | SaveTournament(connection, model);
91 |
92 | SaveTournamentPrizes(connection, model);
93 |
94 | SaveTournamentEntries(connection, model);
95 |
96 | SaveTournamentRounds(connection, model);
97 |
98 | TournamentLogic.UpdateTournamentResults(model);
99 | }
100 | }
101 |
102 | private void SaveTournament(IDbConnection connection, TournamentModel model)
103 | {
104 | var p = new DynamicParameters();
105 | p.Add("@TournamentName", model.TournamnetName);
106 | p.Add("@EntryFee", model.EntryFee);
107 | p.Add("@Id", 0, dbType: DbType.Int32, direction: ParameterDirection.Output);
108 |
109 | connection.Execute("[dbo].[spTournaments_Insert]", p, commandType: CommandType.StoredProcedure);
110 |
111 | model.Id = p.Get("@Id");
112 | }
113 |
114 | private void SaveTournamentPrizes(IDbConnection connection, TournamentModel model)
115 | {
116 | foreach (PrizeModel pz in model.Prizes)
117 | {
118 | var p = new DynamicParameters();
119 | p.Add("@TournamentId", model.Id);
120 | p.Add("@PrizeId", pz.Id);
121 | p.Add("@Id", 0, dbType: DbType.Int32, direction: ParameterDirection.Output);
122 |
123 | connection.Execute("[dbo].[spTournamentPrizes_Insert]", p, commandType: CommandType.StoredProcedure);
124 | }
125 | }
126 |
127 | private void SaveTournamentEntries(IDbConnection connection, TournamentModel model)
128 | {
129 | foreach (TeamModel tm in model.EnteredTeams)
130 | {
131 | var p = new DynamicParameters();
132 | p.Add("@TournamentId", model.Id);
133 | p.Add("@TeamId", tm.Id);
134 | p.Add("@Id", 0, dbType: DbType.Int32, direction: ParameterDirection.Output);
135 |
136 | connection.Execute("[dbo].[spTournamentEntries_Insert]", p, commandType: CommandType.StoredProcedure);
137 | }
138 | }
139 |
140 | private void SaveTournamentRounds(IDbConnection connection, TournamentModel model)
141 | {
142 | foreach (List round in model.Rounds)
143 | {
144 | foreach (MatchupModel matchup in round)
145 | {
146 | var p = new DynamicParameters();
147 | p.Add("@TournamentId", model.Id);
148 | p.Add("@MatchupRound", matchup.MatchupRound);
149 | p.Add("@Id", 0, dbType: DbType.Int32, direction: ParameterDirection.Output);
150 |
151 | connection.Execute("[dbo].[spMatchups_Insert]", p, commandType: CommandType.StoredProcedure);
152 |
153 | matchup.Id = p.Get("@Id");
154 |
155 | foreach (MatchupEntryModel entry in matchup.Entries)
156 | {
157 | p = new DynamicParameters();
158 |
159 | p.Add("@MatchupId", matchup.Id);
160 |
161 | if (entry.ParentMatchup == null)
162 | {
163 | p.Add("@ParentMatchupId", null);
164 | }
165 | else
166 | {
167 | p.Add("@ParentMatchupId", entry.ParentMatchup.Id);
168 | }
169 |
170 | if (entry.TeamCompeting == null)
171 | {
172 | p.Add("@TeamCompetingId", null);
173 | }
174 | else
175 | {
176 | p.Add("@TeamCompetingId", entry.TeamCompeting.Id);
177 | }
178 |
179 | p.Add("@Id", 0, dbType: DbType.Int32, direction: ParameterDirection.Output);
180 |
181 | connection.Execute("[dbo].[spMatchupEntries_Insert]", p, commandType: CommandType.StoredProcedure);
182 | }
183 | }
184 | }
185 | }
186 |
187 | ///
188 | /// Returns a list of all people from the database
189 | ///
190 | /// List of person information
191 | public List GetPerson_All()
192 | {
193 | List output;
194 |
195 | using (IDbConnection connection = new SqlConnection(GlobalConfig.CnnString(db)))
196 | {
197 | output = connection.Query("[dbo].[spPeople_GetAll]", new { }, commandType: CommandType.StoredProcedure).ToList();
198 | }
199 |
200 | return output;
201 | }
202 |
203 | ///
204 | /// Returns a list of all teams from the database
205 | ///
206 | /// List of teams information
207 | public List GetTeam_All()
208 | {
209 | List output;
210 |
211 | using (IDbConnection connection = new SqlConnection(GlobalConfig.CnnString(db)))
212 | {
213 | output = connection.Query("[dbo].[spTeams_GetAll]", new { }, commandType: CommandType.StoredProcedure).ToList();
214 |
215 | foreach (TeamModel team in output)
216 | {
217 | var p = new DynamicParameters();
218 | p.Add("@TeamId", team.Id);
219 |
220 | team.TeamMembers = connection.Query("[dbo].[spTeamMembers_GetByTeam]", p, commandType: CommandType.StoredProcedure).ToList();
221 | }
222 | }
223 |
224 | return output;
225 | }
226 |
227 | public List GetTournament_All()
228 | {
229 | List output;
230 | var p = new DynamicParameters();
231 |
232 | using (IDbConnection connection = new SqlConnection(GlobalConfig.CnnString(db)))
233 | {
234 | output = connection.Query("[dbo].[spTournaments_GetAll]", commandType: CommandType.StoredProcedure).ToList();
235 |
236 | foreach (TournamentModel t in output)
237 | {
238 | // Populate Prizes
239 | p = new DynamicParameters();
240 | p.Add("@TournamentId", t.Id);
241 |
242 | t.Prizes = connection.Query("[dbo].[spPrizes_GetByTournament]", p, commandType: CommandType.StoredProcedure).ToList();
243 |
244 | // Populate Teams
245 | p = new DynamicParameters();
246 | p.Add("@TournamentId", t.Id);
247 |
248 | t.EnteredTeams = connection.Query("[dbo].[spTeam_getByTournament]", p, commandType: CommandType.StoredProcedure).ToList();
249 |
250 | foreach (TeamModel team in t.EnteredTeams)
251 | {
252 | p = new DynamicParameters();
253 | p.Add("@TeamId", team.Id);
254 |
255 | team.TeamMembers = connection.Query("[dbo].[spTeamMembers_GetByTeam]", p, commandType: CommandType.StoredProcedure).ToList();
256 | }
257 |
258 | p = new DynamicParameters();
259 | p.Add("@TournamentId", t.Id);
260 |
261 | // Populate Rounds
262 | List matchups = connection.Query("[dbo].[spMatchups_GetByTournament]", p, commandType: CommandType.StoredProcedure).ToList();
263 |
264 | foreach (MatchupModel m in matchups)
265 | {
266 | p = new DynamicParameters();
267 | p.Add("@MatchupId", m.Id);
268 |
269 | // Populate Rounds
270 | m.Entries = connection.Query("[dbo].[spMatchupEntries_GetByMatchup]", p, commandType: CommandType.StoredProcedure).ToList();
271 |
272 | // Populate each entry (2 models)
273 | // Populate each matchup (1 model)
274 | List allTeams = GetTeam_All();
275 |
276 | if (m.WinnerId > 0)
277 | {
278 | m.Winner = allTeams.Where(x => x.Id == m.WinnerId).First();
279 | }
280 |
281 | foreach (var me in m.Entries)
282 | {
283 | if (me.TeamCompetingId > 0)
284 | {
285 | me.TeamCompeting = allTeams.Where(x => x.Id == me.TeamCompetingId).First();
286 | }
287 |
288 | if (me.ParentMatchupId > 0)
289 | {
290 | me.ParentMatchup = matchups.Where(x => x.Id == me.ParentMatchupId).First();
291 | }
292 | }
293 | }
294 |
295 | // List>
296 | List currRow = new List();
297 | int currRound = 1;
298 |
299 | foreach (MatchupModel m in matchups)
300 | {
301 | if (m.MatchupRound > currRound)
302 | {
303 | t.Rounds.Add(currRow);
304 | currRow = new List();
305 | currRound += 1;
306 | }
307 |
308 | currRow.Add(m);
309 | }
310 |
311 | t.Rounds.Add(currRow);
312 | }
313 | }
314 |
315 | return output;
316 | }
317 |
318 | public void UpdateMatchup(MatchupModel model)
319 | {
320 | using (IDbConnection connection = new SqlConnection(GlobalConfig.CnnString(db)))
321 | {
322 | var p = new DynamicParameters();
323 |
324 | if (model.Winner != null)
325 | {
326 | p.Add("@Id", model.Id);
327 | p.Add("@WinnerId", model.Winner.Id);
328 |
329 | connection.Execute("[dbo].[spMatchups_Update]", p, commandType: CommandType.StoredProcedure);
330 | }
331 |
332 | foreach (MatchupEntryModel me in model.Entries)
333 | {
334 | if (me.TeamCompeting != null)
335 | {
336 | p = new DynamicParameters();
337 | p.Add("@Id", me.Id);
338 | p.Add("@TeamCompetingId", me.TeamCompeting.Id);
339 | p.Add("@Score", me.Score);
340 |
341 | connection.Execute("[dbo].[spMatchupEntries_Update]", p, commandType: CommandType.StoredProcedure);
342 | }
343 | }
344 | }
345 | }
346 |
347 | public void CompleteTournament(TournamentModel model)
348 | {
349 | using (IDbConnection connection = new SqlConnection(GlobalConfig.CnnString(db)))
350 | {
351 | var p = new DynamicParameters();
352 | p.Add("@Id", model.Id);
353 |
354 | connection.Execute("[dbo].[spTournaments_Complete]", p, commandType: CommandType.StoredProcedure);
355 | }
356 | }
357 | }
358 | }
359 |
--------------------------------------------------------------------------------
/TrackerUI/TournamentViewerForm.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace TrackerUI
2 | {
3 | partial class TournamentViewerForm
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.headerLabel = new System.Windows.Forms.Label();
32 | this.tournamentName = new System.Windows.Forms.Label();
33 | this.roundLabel = new System.Windows.Forms.Label();
34 | this.roundDropDown = new System.Windows.Forms.ComboBox();
35 | this.unplayedOnlyCheckbox = new System.Windows.Forms.CheckBox();
36 | this.matchupListBox = new System.Windows.Forms.ListBox();
37 | this.teamOneName = new System.Windows.Forms.Label();
38 | this.teamOneScoreLabel = new System.Windows.Forms.Label();
39 | this.teamOneScoreValue = new System.Windows.Forms.TextBox();
40 | this.teamTwoScoreValue = new System.Windows.Forms.TextBox();
41 | this.teamTwoScoreLabel = new System.Windows.Forms.Label();
42 | this.teamTwoName = new System.Windows.Forms.Label();
43 | this.versusLabel = new System.Windows.Forms.Label();
44 | this.scoreButton = new System.Windows.Forms.Button();
45 | this.SuspendLayout();
46 | //
47 | // headerLabel
48 | //
49 | this.headerLabel.AutoSize = true;
50 | this.headerLabel.Font = new System.Drawing.Font("Segoe UI Light", 28.125F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
51 | this.headerLabel.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(153)))), ((int)(((byte)(255)))));
52 | this.headerLabel.Location = new System.Drawing.Point(51, 51);
53 | this.headerLabel.Name = "headerLabel";
54 | this.headerLabel.Size = new System.Drawing.Size(431, 100);
55 | this.headerLabel.TabIndex = 0;
56 | this.headerLabel.Text = "Tournament:";
57 | //
58 | // tournamentName
59 | //
60 | this.tournamentName.AutoSize = true;
61 | this.tournamentName.Font = new System.Drawing.Font("Segoe UI Light", 28.125F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
62 | this.tournamentName.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(153)))), ((int)(((byte)(255)))));
63 | this.tournamentName.Location = new System.Drawing.Point(488, 51);
64 | this.tournamentName.Name = "tournamentName";
65 | this.tournamentName.Size = new System.Drawing.Size(300, 100);
66 | this.tournamentName.TabIndex = 1;
67 | this.tournamentName.Text = "";
68 | //
69 | // roundLabel
70 | //
71 | this.roundLabel.AutoSize = true;
72 | this.roundLabel.Font = new System.Drawing.Font("Segoe UI", 19.875F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
73 | this.roundLabel.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(153)))), ((int)(((byte)(255)))));
74 | this.roundLabel.Location = new System.Drawing.Point(56, 201);
75 | this.roundLabel.Name = "roundLabel";
76 | this.roundLabel.Size = new System.Drawing.Size(182, 71);
77 | this.roundLabel.TabIndex = 2;
78 | this.roundLabel.Text = "Round";
79 | //
80 | // roundDropDown
81 | //
82 | this.roundDropDown.FormattingEnabled = true;
83 | this.roundDropDown.Location = new System.Drawing.Point(244, 205);
84 | this.roundDropDown.Name = "roundDropDown";
85 | this.roundDropDown.Size = new System.Drawing.Size(403, 67);
86 | this.roundDropDown.TabIndex = 3;
87 | this.roundDropDown.SelectedIndexChanged += new System.EventHandler(this.roundDropDown_SelectedIndexChanged);
88 | //
89 | // unplayedOnlyCheckbox
90 | //
91 | this.unplayedOnlyCheckbox.AutoSize = true;
92 | this.unplayedOnlyCheckbox.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
93 | this.unplayedOnlyCheckbox.Font = new System.Drawing.Font("Segoe UI", 19.875F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
94 | this.unplayedOnlyCheckbox.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(153)))), ((int)(((byte)(255)))));
95 | this.unplayedOnlyCheckbox.Location = new System.Drawing.Point(244, 289);
96 | this.unplayedOnlyCheckbox.Name = "unplayedOnlyCheckbox";
97 | this.unplayedOnlyCheckbox.Size = new System.Drawing.Size(403, 75);
98 | this.unplayedOnlyCheckbox.TabIndex = 4;
99 | this.unplayedOnlyCheckbox.Text = "Unplayed Only";
100 | this.unplayedOnlyCheckbox.UseVisualStyleBackColor = true;
101 | this.unplayedOnlyCheckbox.CheckedChanged += new System.EventHandler(this.unplayedOnlyCheckbox_CheckedChanged);
102 | //
103 | // matchupListBox
104 | //
105 | this.matchupListBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
106 | this.matchupListBox.FormattingEnabled = true;
107 | this.matchupListBox.ItemHeight = 59;
108 | this.matchupListBox.Location = new System.Drawing.Point(68, 392);
109 | this.matchupListBox.Name = "matchupListBox";
110 | this.matchupListBox.Size = new System.Drawing.Size(587, 533);
111 | this.matchupListBox.TabIndex = 5;
112 | this.matchupListBox.SelectedIndexChanged += new System.EventHandler(this.matchupListBox_SelectedIndexChanged);
113 | //
114 | // teamOneName
115 | //
116 | this.teamOneName.AutoSize = true;
117 | this.teamOneName.Font = new System.Drawing.Font("Segoe UI", 19.875F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
118 | this.teamOneName.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(153)))), ((int)(((byte)(255)))));
119 | this.teamOneName.Location = new System.Drawing.Point(754, 392);
120 | this.teamOneName.Name = "teamOneName";
121 | this.teamOneName.Size = new System.Drawing.Size(325, 71);
122 | this.teamOneName.TabIndex = 6;
123 | this.teamOneName.Text = "";
124 | //
125 | // teamOneScoreLabel
126 | //
127 | this.teamOneScoreLabel.AutoSize = true;
128 | this.teamOneScoreLabel.Font = new System.Drawing.Font("Segoe UI", 19.875F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
129 | this.teamOneScoreLabel.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(153)))), ((int)(((byte)(255)))));
130 | this.teamOneScoreLabel.Location = new System.Drawing.Point(754, 486);
131 | this.teamOneScoreLabel.Name = "teamOneScoreLabel";
132 | this.teamOneScoreLabel.Size = new System.Drawing.Size(159, 71);
133 | this.teamOneScoreLabel.TabIndex = 7;
134 | this.teamOneScoreLabel.Text = "Score";
135 | //
136 | // teamOneScoreValue
137 | //
138 | this.teamOneScoreValue.Location = new System.Drawing.Point(955, 492);
139 | this.teamOneScoreValue.Name = "teamOneScoreValue";
140 | this.teamOneScoreValue.Size = new System.Drawing.Size(361, 65);
141 | this.teamOneScoreValue.TabIndex = 8;
142 | //
143 | // teamTwoScoreValue
144 | //
145 | this.teamTwoScoreValue.Location = new System.Drawing.Point(955, 849);
146 | this.teamTwoScoreValue.Name = "teamTwoScoreValue";
147 | this.teamTwoScoreValue.Size = new System.Drawing.Size(361, 65);
148 | this.teamTwoScoreValue.TabIndex = 11;
149 | //
150 | // teamTwoScoreLabel
151 | //
152 | this.teamTwoScoreLabel.AutoSize = true;
153 | this.teamTwoScoreLabel.Font = new System.Drawing.Font("Segoe UI", 19.875F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
154 | this.teamTwoScoreLabel.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(153)))), ((int)(((byte)(255)))));
155 | this.teamTwoScoreLabel.Location = new System.Drawing.Point(754, 843);
156 | this.teamTwoScoreLabel.Name = "teamTwoScoreLabel";
157 | this.teamTwoScoreLabel.Size = new System.Drawing.Size(159, 71);
158 | this.teamTwoScoreLabel.TabIndex = 10;
159 | this.teamTwoScoreLabel.Text = "Score";
160 | //
161 | // teamTwoName
162 | //
163 | this.teamTwoName.AutoSize = true;
164 | this.teamTwoName.Font = new System.Drawing.Font("Segoe UI", 19.875F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
165 | this.teamTwoName.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(153)))), ((int)(((byte)(255)))));
166 | this.teamTwoName.Location = new System.Drawing.Point(754, 749);
167 | this.teamTwoName.Name = "teamTwoName";
168 | this.teamTwoName.Size = new System.Drawing.Size(323, 71);
169 | this.teamTwoName.TabIndex = 9;
170 | this.teamTwoName.Text = "";
171 | //
172 | // versusLabel
173 | //
174 | this.versusLabel.AutoSize = true;
175 | this.versusLabel.Font = new System.Drawing.Font("Segoe UI", 19.875F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
176 | this.versusLabel.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(153)))), ((int)(((byte)(255)))));
177 | this.versusLabel.Location = new System.Drawing.Point(943, 631);
178 | this.versusLabel.Name = "versusLabel";
179 | this.versusLabel.Size = new System.Drawing.Size(133, 71);
180 | this.versusLabel.TabIndex = 12;
181 | this.versusLabel.Text = "-VS-";
182 | //
183 | // scoreButton
184 | //
185 | this.scoreButton.FlatAppearance.BorderColor = System.Drawing.Color.Silver;
186 | this.scoreButton.FlatAppearance.MouseDownBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(102)))), ((int)(((byte)(102)))), ((int)(((byte)(202)))));
187 | this.scoreButton.FlatAppearance.MouseOverBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(242)))), ((int)(((byte)(242)))), ((int)(((byte)(242)))));
188 | this.scoreButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
189 | this.scoreButton.Font = new System.Drawing.Font("Segoe UI Semibold", 16.125F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
190 | this.scoreButton.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(153)))), ((int)(((byte)(255)))));
191 | this.scoreButton.Location = new System.Drawing.Point(1317, 617);
192 | this.scoreButton.Name = "scoreButton";
193 | this.scoreButton.Size = new System.Drawing.Size(242, 106);
194 | this.scoreButton.TabIndex = 13;
195 | this.scoreButton.Text = "Score";
196 | this.scoreButton.UseVisualStyleBackColor = true;
197 | this.scoreButton.Click += new System.EventHandler(this.scoreButton_Click);
198 | //
199 | // TournamentViewerForm
200 | //
201 | this.AutoScaleDimensions = new System.Drawing.SizeF(192F, 192F);
202 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
203 | this.BackColor = System.Drawing.Color.White;
204 | this.ClientSize = new System.Drawing.Size(1612, 1082);
205 | this.Controls.Add(this.scoreButton);
206 | this.Controls.Add(this.versusLabel);
207 | this.Controls.Add(this.teamTwoScoreValue);
208 | this.Controls.Add(this.teamTwoScoreLabel);
209 | this.Controls.Add(this.teamTwoName);
210 | this.Controls.Add(this.teamOneScoreValue);
211 | this.Controls.Add(this.teamOneScoreLabel);
212 | this.Controls.Add(this.teamOneName);
213 | this.Controls.Add(this.matchupListBox);
214 | this.Controls.Add(this.unplayedOnlyCheckbox);
215 | this.Controls.Add(this.roundDropDown);
216 | this.Controls.Add(this.roundLabel);
217 | this.Controls.Add(this.tournamentName);
218 | this.Controls.Add(this.headerLabel);
219 | this.Font = new System.Drawing.Font("Segoe UI", 16.125F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
220 | this.Margin = new System.Windows.Forms.Padding(6, 7, 6, 7);
221 | this.Name = "TournamentViewerForm";
222 | this.Text = "Tournament Viewer";
223 | this.ResumeLayout(false);
224 | this.PerformLayout();
225 |
226 | }
227 |
228 | #endregion
229 |
230 | private System.Windows.Forms.Label headerLabel;
231 | private System.Windows.Forms.Label tournamentName;
232 | private System.Windows.Forms.Label roundLabel;
233 | private System.Windows.Forms.ComboBox roundDropDown;
234 | private System.Windows.Forms.CheckBox unplayedOnlyCheckbox;
235 | private System.Windows.Forms.ListBox matchupListBox;
236 | private System.Windows.Forms.Label teamOneName;
237 | private System.Windows.Forms.Label teamOneScoreLabel;
238 | private System.Windows.Forms.TextBox teamOneScoreValue;
239 | private System.Windows.Forms.TextBox teamTwoScoreValue;
240 | private System.Windows.Forms.Label teamTwoScoreLabel;
241 | private System.Windows.Forms.Label teamTwoName;
242 | private System.Windows.Forms.Label versusLabel;
243 | private System.Windows.Forms.Button scoreButton;
244 | }
245 | }
246 |
247 |
--------------------------------------------------------------------------------
/TrackerLibrary/DataAccess/TextConnectorProcessor.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Configuration;
3 | using System.IO;
4 | using System.Linq;
5 | using TrackerLibrary.Models;
6 |
7 | namespace TrackerLibrary.DataAccess.TextHelpers
8 | {
9 | public static class TextConnectorProcessor
10 | {
11 | public static string FullFilePath(this string fileName)
12 | {
13 | // C:\data\TournamnetTracker\PrizeModels.csv
14 | return $"{ ConfigurationManager.AppSettings["filePath"] }\\{ fileName }";
15 | }
16 |
17 | public static List LoadFile(this string file)
18 | {
19 | if (!File.Exists(file))
20 | {
21 | return new List();
22 | }
23 |
24 | return File.ReadAllLines(file).ToList();
25 | }
26 |
27 | public static List ConvertToPrizeModels(this List lines)
28 | {
29 | List output = new List();
30 |
31 | foreach (string line in lines)
32 | {
33 | string[] cols = line.Split(',');
34 |
35 | PrizeModel p = new PrizeModel
36 | {
37 | Id = int.Parse(cols[0]),
38 | PlaceNumber = int.Parse(cols[1]),
39 | PlaceName = cols[2],
40 | PrizeAmount = decimal.Parse(cols[3]),
41 | PrizePercentage = double.Parse(cols[4])
42 | };
43 |
44 | output.Add(p);
45 | }
46 |
47 | return output;
48 | }
49 |
50 | public static List ConvertToPersonModels(this List lines)
51 | {
52 | List output = new List();
53 |
54 | foreach (string line in lines)
55 | {
56 | string[] cols = line.Split(',');
57 |
58 | PersonModel p = new PersonModel
59 | {
60 | Id = int.Parse(cols[0]),
61 | FirstName = cols[1],
62 | LastName = cols[2],
63 | EmailAddress = cols[3],
64 | CellPhoneNumber = cols[4]
65 | };
66 |
67 | output.Add(p);
68 | }
69 |
70 | return output;
71 | }
72 |
73 | public static List ConvertToTeamModels(this List lines)
74 | {
75 | //Id, Team Name, list of IDs separated by pipe
76 | //3, Fred's Team, 1|3|5
77 | List output = new List();
78 | List people = GlobalConfig.PeopleFile.FullFilePath().LoadFile().ConvertToPersonModels();
79 |
80 | foreach (string line in lines)
81 | {
82 | string[] cols = line.Split(',');
83 |
84 | TeamModel t = new TeamModel
85 | {
86 | Id = int.Parse(cols[0]),
87 | TeamName = cols[1],
88 | };
89 |
90 | string[] personIds = cols[2].Split('|');
91 |
92 | foreach (string id in personIds)
93 | {
94 | t.TeamMembers.Add(people.Where(x => x.Id == int.Parse(id)).First());
95 | }
96 |
97 | output.Add(t);
98 | }
99 |
100 | return output;
101 | }
102 |
103 | public static List ConvertToTournamentModels(this List lines)
104 | {
105 | // Id = 0
106 | // TournamentName = 1
107 | // EntryFee = 2
108 | // EnteredTeams = 3
109 | // Prizes = 4
110 | // Rounds = 5
111 | //Id, TournamentName, EntryFee, (Id|Id|Id - Entered Teams), (Id|Id|Id - Prizes), (Rounds - Id^Id^Id^|Id^Id^Id|Id^Id^Id)
112 | List output = new List();
113 | List teams = GlobalConfig.TeamFile.FullFilePath().LoadFile().ConvertToTeamModels();
114 | List prizes = GlobalConfig.PrizesFile.FullFilePath().LoadFile().ConvertToPrizeModels();
115 | List matchups = GlobalConfig.MatchupFile.FullFilePath().LoadFile().ConvertToMatchupModels();
116 |
117 | foreach (string line in lines)
118 | {
119 | string[] cols = line.Split(',');
120 |
121 | TournamentModel tm = new TournamentModel();
122 | tm.Id = int.Parse(cols[0]);
123 | tm.TournamnetName = cols[1];
124 | tm.EntryFee = decimal.Parse(cols[2]);
125 |
126 | string[] teamIds = cols[3].Split('|');
127 |
128 | foreach (string Id in teamIds)
129 | {
130 | tm.EnteredTeams.Add(teams.Where(x => x.Id == int.Parse(Id)).First());
131 | }
132 |
133 | if (cols[4].Length > 0)
134 | {
135 | string[] prizeIds = cols[4].Split('|');
136 |
137 | foreach (string Id in prizeIds)
138 | {
139 | tm.Prizes.Add(prizes.Where(x => x.Id == int.Parse(Id)).First());
140 | }
141 | }
142 |
143 | // Capture Rounds information
144 | string[] rounds = cols[5].Split('|');
145 |
146 | foreach (string round in rounds)
147 | {
148 | string[] msText = round.Split('^');
149 | List ms = new List();
150 |
151 | foreach (string matchupModelTextId in msText)
152 | {
153 | ms.Add(matchups.Where(x => x.Id == int.Parse(matchupModelTextId)).First());
154 | }
155 |
156 | tm.Rounds.Add(ms);
157 | }
158 |
159 | output.Add(tm);
160 | }
161 |
162 | return output;
163 | }
164 | public static void SaveToPrizeFile(this List models)
165 | {
166 | List lines = new List();
167 |
168 | foreach (PrizeModel p in models)
169 | {
170 | lines.Add($"{ p.Id },{ p.PlaceNumber },{ p.PlaceName },{ p.PrizeAmount },{ p.PrizePercentage }");
171 | }
172 |
173 | File.WriteAllLines(GlobalConfig.PrizesFile.FullFilePath(), lines);
174 | }
175 |
176 | public static void SaveToPeopleFile(this List models)
177 | {
178 | List lines = new List();
179 |
180 | foreach (PersonModel p in models)
181 | {
182 | lines.Add($"{ p.Id },{ p.FirstName },{ p.LastName },{ p.EmailAddress },{ p.CellPhoneNumber }");
183 | }
184 |
185 | File.WriteAllLines(GlobalConfig.PeopleFile.FullFilePath(), lines);
186 | }
187 |
188 | public static void SaveToTeamFile(this List models)
189 | {
190 | List lines = new List();
191 |
192 | foreach (TeamModel t in models)
193 | {
194 | lines.Add($"{ t.Id },{ t.TeamName },{ ConvertPeopleListToString(t.TeamMembers) }");
195 | }
196 |
197 | File.WriteAllLines(GlobalConfig.TeamFile.FullFilePath(), lines);
198 | }
199 |
200 | public static void SaveRoundsToFile(this TournamentModel model)
201 | {
202 | // Loop through each round
203 | // Loop through each matchup
204 | // Get the id for the new matchup and save the record
205 | // Loop through each entry, get the id, and save it
206 |
207 | foreach (List round in model.Rounds)
208 | {
209 | foreach (MatchupModel matchup in round)
210 | {
211 | // Load all of the matchups from the file
212 | // Get the top id and add one
213 | // Store the if
214 | // Save the matchup record
215 | matchup.SaveMatchupToFile();
216 | }
217 | }
218 | }
219 |
220 | public static List ConvertToMatchupEntryModels(this List lines)
221 | {
222 | // Id = 0, TeamCompeting = 1, Score = 2, ParentMatchup = 3
223 | List output = new List();
224 |
225 | foreach (string line in lines)
226 | {
227 | string[] cols = line.Split(',');
228 |
229 | MatchupEntryModel me = new MatchupEntryModel();
230 |
231 | me.Id = int.Parse(cols[0]);
232 |
233 | if (cols[1].Length == 0)
234 | {
235 | me.TeamCompeting = null;
236 | }
237 | else
238 | {
239 | me.TeamCompeting = LookupTeamById(int.Parse(cols[1]));
240 | }
241 |
242 | me.Score = double.Parse(cols[2]);
243 |
244 | int parentId = 0;
245 | if (int.TryParse(cols[3], out parentId))
246 | {
247 | me.ParentMatchup = LookupMatchupById(parentId);
248 | }
249 | else
250 | {
251 | me.ParentMatchup = null;
252 | }
253 |
254 | output.Add(me);
255 | }
256 |
257 | return output;
258 | }
259 |
260 | private static List ConvertStingToMatchupEntryModels(string input)
261 | {
262 | string[] ids = input.Split('|');
263 | List output = new List();
264 | List entries = GlobalConfig.MatchupEntryFile.FullFilePath().LoadFile();
265 | List matchingEntries = new List();
266 |
267 | foreach (string id in ids)
268 | {
269 | foreach (string entry in entries)
270 | {
271 | string[] cols = entry.Split(',');
272 |
273 | if (cols[0] == id)
274 | {
275 | matchingEntries.Add(entry);
276 | }
277 | }
278 | }
279 |
280 | output = matchingEntries.ConvertToMatchupEntryModels();
281 |
282 | return output;
283 | }
284 |
285 | private static TeamModel LookupTeamById(int id)
286 | {
287 | List teams = GlobalConfig.TeamFile.FullFilePath().LoadFile();
288 |
289 | foreach (string team in teams)
290 | {
291 | string[] cols = team.Split(',');
292 |
293 | if (cols[0] == id.ToString())
294 | {
295 | List matchingTeams = new List();
296 | matchingTeams.Add(team);
297 | return matchingTeams.ConvertToTeamModels().First();
298 | }
299 | }
300 |
301 | return null;
302 | }
303 |
304 | private static MatchupModel LookupMatchupById(int id)
305 | {
306 | List matchups = GlobalConfig.MatchupFile.FullFilePath().LoadFile();
307 |
308 | foreach (string matchup in matchups)
309 | {
310 | string[] cols = matchup.Split(',');
311 |
312 | if (cols[0] == id.ToString())
313 | {
314 | List matchingMatchups = new List();
315 | matchingMatchups.Add(matchup);
316 | return matchingMatchups.ConvertToMatchupModels().First();
317 | }
318 | }
319 |
320 | return null;
321 | }
322 |
323 | public static List ConvertToMatchupModels(this List lines)
324 | {
325 | // Id = 0, Entries = 1(pipe delimited by Id), Winner = 2, MatchupRound = 3
326 | List output = new List();
327 |
328 | foreach (string line in lines)
329 | {
330 | string[] cols = line.Split(',');
331 |
332 | MatchupModel m = new MatchupModel();
333 |
334 | m.Id = int.Parse(cols[0]); ;
335 | m.Entries = ConvertStingToMatchupEntryModels(cols[1]);
336 |
337 | if (cols[2].Length == 0)
338 | {
339 | m.Winner = null;
340 | }
341 | else
342 | {
343 | m.Winner = LookupTeamById(int.Parse(cols[2]));
344 | }
345 |
346 | m.MatchupRound = int.Parse(cols[3]);
347 |
348 | output.Add(m);
349 | }
350 |
351 | return output;
352 | }
353 |
354 | public static void SaveMatchupToFile(this MatchupModel matchup)
355 | {
356 | List matchups = GlobalConfig.MatchupFile.FullFilePath().LoadFile().ConvertToMatchupModels();
357 |
358 | int currentId = 1;
359 |
360 | if (matchups.Count > 0)
361 | {
362 | currentId = matchups.OrderByDescending(x => x.Id).First().Id + 1;
363 | }
364 |
365 | matchup.Id = currentId;
366 |
367 | matchups.Add(matchup);
368 |
369 | foreach (MatchupEntryModel entry in matchup.Entries)
370 | {
371 | entry.SaveEntryToFile();
372 | }
373 |
374 | List lines = new List();
375 |
376 | foreach (MatchupModel m in matchups)
377 | {
378 | string winner = "";
379 | if (m.Winner != null)
380 | {
381 | winner = m.Winner.Id.ToString();
382 | }
383 | lines.Add($"{ m.Id },{ ConvertMatchupEntryListToString(m.Entries) },{ winner },{ m.MatchupRound }");
384 | }
385 |
386 | File.WriteAllLines(GlobalConfig.MatchupFile.FullFilePath(), lines);
387 | }
388 |
389 | public static void UpdateMatchupToFile(this MatchupModel matchup)
390 | {
391 | List matchups = GlobalConfig.MatchupFile.FullFilePath().LoadFile().ConvertToMatchupModels();
392 |
393 | MatchupModel oldMatchup = new MatchupModel();
394 |
395 | foreach (MatchupModel m in matchups)
396 | {
397 | if (m.Id == matchup.Id)
398 | {
399 | oldMatchup = m;
400 | }
401 | }
402 |
403 | matchups.Remove(oldMatchup);
404 |
405 | matchups.Add(matchup);
406 |
407 | foreach (MatchupEntryModel entry in matchup.Entries)
408 | {
409 | entry.UpdateEntryToFile();
410 | }
411 |
412 | List lines = new List();
413 |
414 | foreach (MatchupModel m in matchups)
415 | {
416 | string winner = "";
417 | if (m.Winner != null)
418 | {
419 | winner = m.Winner.Id.ToString();
420 | }
421 | lines.Add($"{ m.Id },{ ConvertMatchupEntryListToString(m.Entries) },{ winner },{ m.MatchupRound }");
422 | }
423 |
424 | File.WriteAllLines(GlobalConfig.MatchupFile.FullFilePath(), lines);
425 | }
426 |
427 | public static void SaveEntryToFile(this MatchupEntryModel entry)
428 | {
429 | List entries = GlobalConfig.MatchupEntryFile.FullFilePath().LoadFile().ConvertToMatchupEntryModels();
430 |
431 | int currentId = 1;
432 |
433 | if (entries.Count > 0)
434 | {
435 | currentId = entries.OrderByDescending(x => x.Id).First().Id + 1; ;
436 | }
437 |
438 | entry.Id = currentId;
439 | entries.Add(entry);
440 |
441 | List lines = new List();
442 |
443 | foreach (MatchupEntryModel e in entries)
444 | {
445 | string parent = "";
446 | if (e.ParentMatchup != null)
447 | {
448 | parent = e.ParentMatchup.Id.ToString();
449 | }
450 |
451 | string teamCompeting = "";
452 | if(e.TeamCompeting != null)
453 | {
454 | teamCompeting = e.TeamCompeting.Id.ToString();
455 | }
456 |
457 | lines.Add($"{ e.Id },{ teamCompeting },{ e.Score },{ parent }");
458 | }
459 |
460 | File.WriteAllLines(GlobalConfig.MatchupEntryFile.FullFilePath(), lines);
461 | }
462 |
463 | public static void UpdateEntryToFile(this MatchupEntryModel entry)
464 | {
465 | List entries = GlobalConfig.MatchupEntryFile.FullFilePath().LoadFile().ConvertToMatchupEntryModels();
466 | MatchupEntryModel oldEntry = new MatchupEntryModel();
467 |
468 | foreach (MatchupEntryModel e in entries)
469 | {
470 | if (e.Id == entry.Id)
471 | {
472 | oldEntry = e;
473 | }
474 | }
475 |
476 | entries.Remove(oldEntry);
477 |
478 | entries.Add(entry);
479 |
480 | List lines = new List();
481 |
482 | foreach (MatchupEntryModel e in entries)
483 | {
484 | string parent = "";
485 | if (e.ParentMatchup != null)
486 | {
487 | parent = e.ParentMatchup.Id.ToString();
488 | }
489 |
490 | string teamCompeting = "";
491 | if (e.TeamCompeting != null)
492 | {
493 | teamCompeting = e.TeamCompeting.Id.ToString();
494 | }
495 |
496 | lines.Add($"{ e.Id },{ teamCompeting },{ e.Score },{ parent }");
497 | }
498 |
499 | File.WriteAllLines(GlobalConfig.MatchupEntryFile.FullFilePath(), lines);
500 | }
501 |
502 | public static void SaveToTournamentFile(this List models)
503 | {
504 | // Id = 0
505 | // TournamentName = 1
506 | // EntryFee = 2
507 | // EnteredTeams = 3
508 | // Prizes = 4
509 | // Rounds = 5 (Id^Id^Id^|Id^Id^Id|Id^Id^Id)
510 | List lines = new List();
511 |
512 | foreach (TournamentModel tm in models)
513 | {
514 | lines.Add($"{ tm.Id },{ tm.TournamnetName },{ tm.EntryFee },{ ConvertTeamListToString(tm.EnteredTeams) },{ ConvertPrizeListToString(tm.Prizes) },{ ConvertRoundListToString(tm.Rounds) }");
515 | }
516 |
517 | File.WriteAllLines(GlobalConfig.TournamentFile.FullFilePath(), lines);
518 | }
519 |
520 | private static string ConvertRoundListToString(List> rounds)
521 | {
522 | // (Id^Id^Id^|Id^Id^Id|Id^Id^Id)
523 | string output = string.Empty;
524 |
525 | if (rounds.Count == 0)
526 | {
527 | return "";
528 | }
529 |
530 | foreach (List r in rounds)
531 | {
532 | output += $"{ ConvertMatchupListToString(r) }|";
533 | }
534 |
535 | output = output.Substring(0, output.Length - 1);
536 |
537 | return output.Trim('|');
538 | }
539 |
540 | private static string ConvertMatchupListToString(List matchups)
541 | {
542 | string output = string.Empty;
543 |
544 | if (matchups.Count == 0)
545 | {
546 | return "";
547 | }
548 |
549 | foreach (MatchupModel m in matchups)
550 | {
551 | output += $"{ m.Id }^";
552 | }
553 |
554 | output = output.Substring(0, output.Length - 1);
555 |
556 | return output.Trim('|');
557 | }
558 |
559 | private static string ConvertPrizeListToString(List prizes)
560 | {
561 | string output = string.Empty;
562 |
563 | if (prizes.Count == 0)
564 | {
565 | return "";
566 | }
567 |
568 | foreach (PrizeModel p in prizes)
569 | {
570 | output += $"{ p.Id }|";
571 | }
572 |
573 | output = output.Substring(0, output.Length - 1);
574 |
575 | return output.Trim('|');
576 | }
577 |
578 | private static string ConvertTeamListToString(List teams)
579 | {
580 | string output = string.Empty;
581 |
582 | if (teams.Count == 0)
583 | {
584 | return "";
585 | }
586 |
587 | foreach (TeamModel t in teams)
588 | {
589 | output += $"{ t.Id }|";
590 | }
591 |
592 | output = output.Substring(0, output.Length - 1);
593 |
594 | return output.Trim('|');
595 | }
596 |
597 | private static string ConvertPeopleListToString(List people)
598 | {
599 | string output = string.Empty;
600 |
601 | if (people.Count == 0)
602 | {
603 | return "";
604 | }
605 |
606 | foreach (PersonModel p in people)
607 | {
608 | output += $"{ p.Id }|";
609 | }
610 |
611 | output = output.Substring(0, output.Length - 1);
612 |
613 | return output.Trim('|');
614 | }
615 |
616 | private static string ConvertMatchupEntryListToString(List entries)
617 | {
618 | string output = string.Empty;
619 |
620 | if (entries.Count == 0)
621 | {
622 | return "";
623 | }
624 |
625 | foreach (MatchupEntryModel e in entries)
626 | {
627 | output += $"{ e.Id }|";
628 | }
629 |
630 | output = output.Substring(0, output.Length - 1);
631 |
632 | return output.Trim('|');
633 | }
634 | }
635 | }
636 |
--------------------------------------------------------------------------------
/TrackerUI/CreateTournamentForm.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace TrackerUI
2 | {
3 | partial class CreateTournamentForm
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.headerLabel = new System.Windows.Forms.Label();
32 | this.tournamentNameValue = new System.Windows.Forms.TextBox();
33 | this.tournamentNameLabel = new System.Windows.Forms.Label();
34 | this.entryFeeValue = new System.Windows.Forms.TextBox();
35 | this.entryFeeLabel = new System.Windows.Forms.Label();
36 | this.selectTeamDropDown = new System.Windows.Forms.ComboBox();
37 | this.selectTeamLabel = new System.Windows.Forms.Label();
38 | this.createNewTeamLink = new System.Windows.Forms.LinkLabel();
39 | this.addTeamButton = new System.Windows.Forms.Button();
40 | this.createPrizeButton = new System.Windows.Forms.Button();
41 | this.tournamentTeamsListBox = new System.Windows.Forms.ListBox();
42 | this.tournamentTeamsLabel = new System.Windows.Forms.Label();
43 | this.removeSelectedPlayersButton = new System.Windows.Forms.Button();
44 | this.removeSelectedPrizesButton = new System.Windows.Forms.Button();
45 | this.prizesLabel = new System.Windows.Forms.Label();
46 | this.prizesListBox = new System.Windows.Forms.ListBox();
47 | this.createTournamentButton = new System.Windows.Forms.Button();
48 | this.SuspendLayout();
49 | //
50 | // headerLabel
51 | //
52 | this.headerLabel.AutoSize = true;
53 | this.headerLabel.Font = new System.Drawing.Font("Segoe UI Light", 28.125F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
54 | this.headerLabel.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(153)))), ((int)(((byte)(255)))));
55 | this.headerLabel.Location = new System.Drawing.Point(20, 20);
56 | this.headerLabel.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
57 | this.headerLabel.Name = "headerLabel";
58 | this.headerLabel.Size = new System.Drawing.Size(323, 51);
59 | this.headerLabel.TabIndex = 1;
60 | this.headerLabel.Text = "Create Tournament";
61 | //
62 | // tournamentNameValue
63 | //
64 | this.tournamentNameValue.Location = new System.Drawing.Point(26, 161);
65 | this.tournamentNameValue.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
66 | this.tournamentNameValue.Name = "tournamentNameValue";
67 | this.tournamentNameValue.Size = new System.Drawing.Size(316, 36);
68 | this.tournamentNameValue.TabIndex = 10;
69 | //
70 | // tournamentNameLabel
71 | //
72 | this.tournamentNameLabel.AutoSize = true;
73 | this.tournamentNameLabel.Font = new System.Drawing.Font("Segoe UI", 19.875F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
74 | this.tournamentNameLabel.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(153)))), ((int)(((byte)(255)))));
75 | this.tournamentNameLabel.Location = new System.Drawing.Point(20, 112);
76 | this.tournamentNameLabel.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
77 | this.tournamentNameLabel.Name = "tournamentNameLabel";
78 | this.tournamentNameLabel.Size = new System.Drawing.Size(236, 37);
79 | this.tournamentNameLabel.TabIndex = 9;
80 | this.tournamentNameLabel.Text = "Tournament Name";
81 | //
82 | // entryFeeValue
83 | //
84 | this.entryFeeValue.Location = new System.Drawing.Point(149, 210);
85 | this.entryFeeValue.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
86 | this.entryFeeValue.Name = "entryFeeValue";
87 | this.entryFeeValue.Size = new System.Drawing.Size(117, 36);
88 | this.entryFeeValue.TabIndex = 12;
89 | this.entryFeeValue.Text = "0";
90 | //
91 | // entryFeeLabel
92 | //
93 | this.entryFeeLabel.AutoSize = true;
94 | this.entryFeeLabel.Font = new System.Drawing.Font("Segoe UI", 19.875F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
95 | this.entryFeeLabel.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(153)))), ((int)(((byte)(255)))));
96 | this.entryFeeLabel.Location = new System.Drawing.Point(23, 207);
97 | this.entryFeeLabel.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
98 | this.entryFeeLabel.Name = "entryFeeLabel";
99 | this.entryFeeLabel.Size = new System.Drawing.Size(125, 37);
100 | this.entryFeeLabel.TabIndex = 11;
101 | this.entryFeeLabel.Text = "Entry Fee";
102 | //
103 | // selectTeamDropDown
104 | //
105 | this.selectTeamDropDown.FormattingEnabled = true;
106 | this.selectTeamDropDown.Location = new System.Drawing.Point(26, 307);
107 | this.selectTeamDropDown.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
108 | this.selectTeamDropDown.Name = "selectTeamDropDown";
109 | this.selectTeamDropDown.Size = new System.Drawing.Size(316, 38);
110 | this.selectTeamDropDown.TabIndex = 14;
111 | //
112 | // selectTeamLabel
113 | //
114 | this.selectTeamLabel.AutoSize = true;
115 | this.selectTeamLabel.Font = new System.Drawing.Font("Segoe UI", 19.875F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
116 | this.selectTeamLabel.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(153)))), ((int)(((byte)(255)))));
117 | this.selectTeamLabel.Location = new System.Drawing.Point(23, 264);
118 | this.selectTeamLabel.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
119 | this.selectTeamLabel.Name = "selectTeamLabel";
120 | this.selectTeamLabel.Size = new System.Drawing.Size(156, 37);
121 | this.selectTeamLabel.TabIndex = 13;
122 | this.selectTeamLabel.Text = "Select Team";
123 | //
124 | // createNewTeamLink
125 | //
126 | this.createNewTeamLink.AutoSize = true;
127 | this.createNewTeamLink.Location = new System.Drawing.Point(218, 269);
128 | this.createNewTeamLink.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
129 | this.createNewTeamLink.Name = "createNewTeamLink";
130 | this.createNewTeamLink.Size = new System.Drawing.Size(127, 30);
131 | this.createNewTeamLink.TabIndex = 15;
132 | this.createNewTeamLink.TabStop = true;
133 | this.createNewTeamLink.Text = "Create New";
134 | this.createNewTeamLink.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.createNewTeamLink_LinkClicked);
135 | //
136 | // addTeamButton
137 | //
138 | this.addTeamButton.FlatAppearance.BorderColor = System.Drawing.Color.Silver;
139 | this.addTeamButton.FlatAppearance.MouseDownBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(102)))), ((int)(((byte)(102)))), ((int)(((byte)(202)))));
140 | this.addTeamButton.FlatAppearance.MouseOverBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(242)))), ((int)(((byte)(242)))), ((int)(((byte)(242)))));
141 | this.addTeamButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
142 | this.addTeamButton.Font = new System.Drawing.Font("Segoe UI Semibold", 16.125F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
143 | this.addTeamButton.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(153)))), ((int)(((byte)(255)))));
144 | this.addTeamButton.Location = new System.Drawing.Point(26, 388);
145 | this.addTeamButton.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
146 | this.addTeamButton.Name = "addTeamButton";
147 | this.addTeamButton.Size = new System.Drawing.Size(314, 53);
148 | this.addTeamButton.TabIndex = 16;
149 | this.addTeamButton.Text = "Add Team";
150 | this.addTeamButton.UseVisualStyleBackColor = true;
151 | this.addTeamButton.Click += new System.EventHandler(this.addTeamButton_Click);
152 | //
153 | // createPrizeButton
154 | //
155 | this.createPrizeButton.FlatAppearance.BorderColor = System.Drawing.Color.Silver;
156 | this.createPrizeButton.FlatAppearance.MouseDownBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(102)))), ((int)(((byte)(102)))), ((int)(((byte)(202)))));
157 | this.createPrizeButton.FlatAppearance.MouseOverBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(242)))), ((int)(((byte)(242)))), ((int)(((byte)(242)))));
158 | this.createPrizeButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
159 | this.createPrizeButton.Font = new System.Drawing.Font("Segoe UI Semibold", 16.125F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
160 | this.createPrizeButton.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(153)))), ((int)(((byte)(255)))));
161 | this.createPrizeButton.Location = new System.Drawing.Point(26, 450);
162 | this.createPrizeButton.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
163 | this.createPrizeButton.Name = "createPrizeButton";
164 | this.createPrizeButton.Size = new System.Drawing.Size(314, 53);
165 | this.createPrizeButton.TabIndex = 17;
166 | this.createPrizeButton.Text = "Create Prize";
167 | this.createPrizeButton.UseVisualStyleBackColor = true;
168 | this.createPrizeButton.Click += new System.EventHandler(this.createPrizeButton_Click);
169 | //
170 | // tournamentTeamsListBox
171 | //
172 | this.tournamentTeamsListBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
173 | this.tournamentTeamsListBox.FormattingEnabled = true;
174 | this.tournamentTeamsListBox.ItemHeight = 30;
175 | this.tournamentTeamsListBox.Location = new System.Drawing.Point(420, 161);
176 | this.tournamentTeamsListBox.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
177 | this.tournamentTeamsListBox.Name = "tournamentTeamsListBox";
178 | this.tournamentTeamsListBox.Size = new System.Drawing.Size(335, 122);
179 | this.tournamentTeamsListBox.TabIndex = 18;
180 | //
181 | // tournamentTeamsLabel
182 | //
183 | this.tournamentTeamsLabel.AutoSize = true;
184 | this.tournamentTeamsLabel.Font = new System.Drawing.Font("Segoe UI", 19.875F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
185 | this.tournamentTeamsLabel.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(153)))), ((int)(((byte)(255)))));
186 | this.tournamentTeamsLabel.Location = new System.Drawing.Point(414, 112);
187 | this.tournamentTeamsLabel.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
188 | this.tournamentTeamsLabel.Name = "tournamentTeamsLabel";
189 | this.tournamentTeamsLabel.Size = new System.Drawing.Size(187, 37);
190 | this.tournamentTeamsLabel.TabIndex = 19;
191 | this.tournamentTeamsLabel.Text = "Team / Players";
192 | //
193 | // removeSelectedPlayersButton
194 | //
195 | this.removeSelectedPlayersButton.FlatAppearance.BorderColor = System.Drawing.Color.Silver;
196 | this.removeSelectedPlayersButton.FlatAppearance.MouseDownBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(102)))), ((int)(((byte)(102)))), ((int)(((byte)(202)))));
197 | this.removeSelectedPlayersButton.FlatAppearance.MouseOverBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(242)))), ((int)(((byte)(242)))), ((int)(((byte)(242)))));
198 | this.removeSelectedPlayersButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
199 | this.removeSelectedPlayersButton.Font = new System.Drawing.Font("Segoe UI Semibold", 16.125F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
200 | this.removeSelectedPlayersButton.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(153)))), ((int)(((byte)(255)))));
201 | this.removeSelectedPlayersButton.Location = new System.Drawing.Point(786, 189);
202 | this.removeSelectedPlayersButton.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
203 | this.removeSelectedPlayersButton.Name = "removeSelectedPlayersButton";
204 | this.removeSelectedPlayersButton.Size = new System.Drawing.Size(128, 77);
205 | this.removeSelectedPlayersButton.TabIndex = 20;
206 | this.removeSelectedPlayersButton.Text = "Remove Selected";
207 | this.removeSelectedPlayersButton.UseVisualStyleBackColor = true;
208 | this.removeSelectedPlayersButton.Click += new System.EventHandler(this.removeSelectedPlayersButton_Click);
209 | //
210 | // removeSelectedPrizesButton
211 | //
212 | this.removeSelectedPrizesButton.FlatAppearance.BorderColor = System.Drawing.Color.Silver;
213 | this.removeSelectedPrizesButton.FlatAppearance.MouseDownBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(102)))), ((int)(((byte)(102)))), ((int)(((byte)(202)))));
214 | this.removeSelectedPrizesButton.FlatAppearance.MouseOverBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(242)))), ((int)(((byte)(242)))), ((int)(((byte)(242)))));
215 | this.removeSelectedPrizesButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
216 | this.removeSelectedPrizesButton.Font = new System.Drawing.Font("Segoe UI Semibold", 16.125F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
217 | this.removeSelectedPrizesButton.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(153)))), ((int)(((byte)(255)))));
218 | this.removeSelectedPrizesButton.Location = new System.Drawing.Point(786, 388);
219 | this.removeSelectedPrizesButton.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
220 | this.removeSelectedPrizesButton.Name = "removeSelectedPrizesButton";
221 | this.removeSelectedPrizesButton.Size = new System.Drawing.Size(128, 77);
222 | this.removeSelectedPrizesButton.TabIndex = 23;
223 | this.removeSelectedPrizesButton.Text = "Remove Selected";
224 | this.removeSelectedPrizesButton.UseVisualStyleBackColor = true;
225 | this.removeSelectedPrizesButton.Click += new System.EventHandler(this.removeSelectedPrizesButton_Click);
226 | //
227 | // prizesLabel
228 | //
229 | this.prizesLabel.AutoSize = true;
230 | this.prizesLabel.Font = new System.Drawing.Font("Segoe UI", 19.875F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
231 | this.prizesLabel.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(153)))), ((int)(((byte)(255)))));
232 | this.prizesLabel.Location = new System.Drawing.Point(414, 322);
233 | this.prizesLabel.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
234 | this.prizesLabel.Name = "prizesLabel";
235 | this.prizesLabel.Size = new System.Drawing.Size(85, 37);
236 | this.prizesLabel.TabIndex = 22;
237 | this.prizesLabel.Text = "Prizes";
238 | //
239 | // prizesListBox
240 | //
241 | this.prizesListBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
242 | this.prizesListBox.FormattingEnabled = true;
243 | this.prizesListBox.ItemHeight = 30;
244 | this.prizesListBox.Location = new System.Drawing.Point(420, 371);
245 | this.prizesListBox.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
246 | this.prizesListBox.Name = "prizesListBox";
247 | this.prizesListBox.Size = new System.Drawing.Size(335, 122);
248 | this.prizesListBox.TabIndex = 21;
249 | //
250 | // createTournamentButton
251 | //
252 | this.createTournamentButton.FlatAppearance.BorderColor = System.Drawing.Color.Silver;
253 | this.createTournamentButton.FlatAppearance.MouseDownBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(102)))), ((int)(((byte)(102)))), ((int)(((byte)(202)))));
254 | this.createTournamentButton.FlatAppearance.MouseOverBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(242)))), ((int)(((byte)(242)))), ((int)(((byte)(242)))));
255 | this.createTournamentButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
256 | this.createTournamentButton.Font = new System.Drawing.Font("Segoe UI Semibold", 16.125F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
257 | this.createTournamentButton.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(153)))), ((int)(((byte)(255)))));
258 | this.createTournamentButton.Location = new System.Drawing.Point(285, 564);
259 | this.createTournamentButton.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
260 | this.createTournamentButton.Name = "createTournamentButton";
261 | this.createTournamentButton.Size = new System.Drawing.Size(314, 53);
262 | this.createTournamentButton.TabIndex = 24;
263 | this.createTournamentButton.Text = "Create Tournament";
264 | this.createTournamentButton.UseVisualStyleBackColor = true;
265 | this.createTournamentButton.Click += new System.EventHandler(this.createTournamentButton_Click);
266 | //
267 | // CreateTournamentForm
268 | //
269 | this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
270 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
271 | this.BackColor = System.Drawing.Color.White;
272 | this.ClientSize = new System.Drawing.Size(952, 665);
273 | this.Controls.Add(this.createTournamentButton);
274 | this.Controls.Add(this.removeSelectedPrizesButton);
275 | this.Controls.Add(this.prizesLabel);
276 | this.Controls.Add(this.prizesListBox);
277 | this.Controls.Add(this.removeSelectedPlayersButton);
278 | this.Controls.Add(this.tournamentTeamsLabel);
279 | this.Controls.Add(this.tournamentTeamsListBox);
280 | this.Controls.Add(this.createPrizeButton);
281 | this.Controls.Add(this.addTeamButton);
282 | this.Controls.Add(this.createNewTeamLink);
283 | this.Controls.Add(this.selectTeamDropDown);
284 | this.Controls.Add(this.selectTeamLabel);
285 | this.Controls.Add(this.entryFeeValue);
286 | this.Controls.Add(this.entryFeeLabel);
287 | this.Controls.Add(this.tournamentNameValue);
288 | this.Controls.Add(this.tournamentNameLabel);
289 | this.Controls.Add(this.headerLabel);
290 | this.Font = new System.Drawing.Font("Segoe UI", 16.125F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
291 | this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
292 | this.Name = "CreateTournamentForm";
293 | this.Text = "Create Tournament";
294 | this.ResumeLayout(false);
295 | this.PerformLayout();
296 |
297 | }
298 |
299 | #endregion
300 |
301 | private System.Windows.Forms.Label headerLabel;
302 | private System.Windows.Forms.TextBox tournamentNameValue;
303 | private System.Windows.Forms.Label tournamentNameLabel;
304 | private System.Windows.Forms.TextBox entryFeeValue;
305 | private System.Windows.Forms.Label entryFeeLabel;
306 | private System.Windows.Forms.ComboBox selectTeamDropDown;
307 | private System.Windows.Forms.Label selectTeamLabel;
308 | private System.Windows.Forms.LinkLabel createNewTeamLink;
309 | private System.Windows.Forms.Button addTeamButton;
310 | private System.Windows.Forms.Button createPrizeButton;
311 | private System.Windows.Forms.ListBox tournamentTeamsListBox;
312 | private System.Windows.Forms.Label tournamentTeamsLabel;
313 | private System.Windows.Forms.Button removeSelectedPlayersButton;
314 | private System.Windows.Forms.Button removeSelectedPrizesButton;
315 | private System.Windows.Forms.Label prizesLabel;
316 | private System.Windows.Forms.ListBox prizesListBox;
317 | private System.Windows.Forms.Button createTournamentButton;
318 | }
319 | }
--------------------------------------------------------------------------------