├── TrackerLibrary ├── Enums.cs ├── packages.config ├── Models │ ├── TeamModel.cs │ ├── PersonModel.cs │ ├── MatchupEntryModel.cs │ ├── TournamentModel.cs │ ├── MatchupModel.cs │ └── PrizeModel.cs ├── DataAccess │ ├── IDataConnection.cs │ ├── TextConnector.cs │ ├── SqlConnector.cs │ └── TextConnectorProcessor.cs ├── EmailLogic.cs ├── GlobalConfig.cs ├── Properties │ └── AssemblyInfo.cs ├── TrackerLibrary.csproj └── TournamentLogic.cs ├── TrackerData ├── dbo │ ├── Tables │ │ ├── Teams.sql │ │ ├── Tournaments.sql │ │ ├── Prizes.sql │ │ ├── People.sql │ │ ├── TeamMembers.sql │ │ ├── TournamentEntries.sql │ │ ├── TournamentPrizes.sql │ │ ├── Matchups.sql │ │ └── MatchupEntries.sql │ └── Stored Procedures │ │ ├── spTeams_GetAll.sql │ │ ├── spTournaments_Complete.sql │ │ ├── spMatchups_Update.sql │ │ ├── spTeams_Insert.sql │ │ ├── spPeople_GetAll.sql │ │ ├── spTournaments_GetAll.sql │ │ ├── spTeamMembers_Insert.sql │ │ ├── spMatchupEntries_Update.sql │ │ ├── spMatchups_Insert.sql │ │ ├── spTournamentPrizes_Insert.sql │ │ ├── spTournamentEntries_Insert.sql │ │ ├── spTournaments_Insert.sql │ │ ├── spTeam_getByTournament.sql │ │ ├── spMatchups_GetByTournament.sql │ │ ├── spMatchupEntries_Insert.sql │ │ ├── spMatchupEntries_GetByMatchup.sql │ │ ├── spPrizes_Insert.sql │ │ ├── spPeople_Insert.sql │ │ ├── spTeamMembers_GetByTeam.sql │ │ └── spPrizes_GetByTournament.sql ├── TrackerData.refactorlog └── TrackerData.sqlproj ├── TrackerUI ├── IPrizeRequester.cs ├── ITeamRequester.cs ├── Properties │ ├── Settings.settings │ ├── Settings.Designer.cs │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ └── Resources.resx ├── Program.cs ├── App.config ├── TournamentDashboardForm.cs ├── CreatePrizeForm.cs ├── CreateTeamForm.cs ├── CreateTournamentForm.cs ├── TrackerUI.csproj ├── CreatePrizeForm.resx ├── CreateTeamForm.resx ├── CreateTournamentForm.resx ├── TournamentViewerForm.resx ├── TournamentDashboardForm.resx ├── TournamentViewerForm.cs ├── TournamentDashboardForm.Designer.cs ├── CreatePrizeForm.Designer.cs ├── TournamentViewerForm.Designer.cs └── CreateTournamentForm.Designer.cs ├── TournamentTracker.sln ├── README.md └── .gitignore /TrackerLibrary/Enums.cs: -------------------------------------------------------------------------------- 1 | namespace TrackerLibrary 2 | { 3 | public enum DatabaseType 4 | { 5 | Sql, 6 | TextFile 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /TrackerData/dbo/Tables/Teams.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE [dbo].[Teams] 2 | ( 3 | [Id] INT NOT NULL PRIMARY KEY IDENTITY, 4 | [TeamName] NVARCHAR(100) NOT NULL 5 | ) 6 | -------------------------------------------------------------------------------- /TrackerLibrary/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /TrackerUI/IPrizeRequester.cs: -------------------------------------------------------------------------------- 1 | using TrackerLibrary.Models; 2 | 3 | namespace TrackerUI 4 | { 5 | public interface IPrizeRequester 6 | { 7 | void PrizeComplete(PrizeModel model); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /TrackerUI/ITeamRequester.cs: -------------------------------------------------------------------------------- 1 | using TrackerLibrary.Models; 2 | 3 | namespace TrackerUI 4 | { 5 | public interface ITeamRequester 6 | { 7 | void TeamComplete(TeamModel model); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /TrackerData/dbo/Stored Procedures/spTeams_GetAll.sql: -------------------------------------------------------------------------------- 1 | CREATE PROCEDURE [dbo].[spTeams_GetAll] 2 | AS 3 | BEGIN 4 | SET NOCOUNT ON; 5 | 6 | SELECT [Teams].[Id], 7 | [Teams].[TeamName] 8 | FROM [dbo].[Teams]; 9 | 10 | END -------------------------------------------------------------------------------- /TrackerData/dbo/Tables/Tournaments.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE [dbo].[Tournaments] 2 | ( 3 | [Id] INT NOT NULL PRIMARY KEY IDENTITY, 4 | [TournamentName] NVARCHAR(200) NOT NULL, 5 | [EntryFee] MONEY NOT NULL, 6 | [Active] BIT NOT NULL 7 | ) 8 | -------------------------------------------------------------------------------- /TrackerData/dbo/Stored Procedures/spTournaments_Complete.sql: -------------------------------------------------------------------------------- 1 | CREATE PROCEDURE [dbo].[spTournaments_Complete] 2 | @Id int 3 | AS 4 | BEGIN 5 | SET NOCOUNT ON; 6 | 7 | UPDATE [dbo].[Tournaments] 8 | SET Active = 0 9 | WHERE Id = @Id; 10 | 11 | END -------------------------------------------------------------------------------- /TrackerData/dbo/Stored Procedures/spMatchups_Update.sql: -------------------------------------------------------------------------------- 1 | CREATE PROCEDURE [dbo].[spMatchups_Update] 2 | @Id int, 3 | @WinnerId int 4 | AS 5 | BEGIN 6 | SET NOCOUNT ON; 7 | 8 | UPDATE [dbo].[Matchups] 9 | SET WinnerId = @WinnerId 10 | WHERE id = @id; 11 | 12 | END 13 | -------------------------------------------------------------------------------- /TrackerData/dbo/Tables/Prizes.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE [dbo].[Prizes] 2 | ( 3 | [Id] INT NOT NULL PRIMARY KEY IDENTITY, 4 | [PlaceNumber] INT NOT NULL, 5 | [PlaceName] NVARCHAR(50) NOT NULL, 6 | [PrizeAmount] MONEY NOT NULL, 7 | [PrizePercentage] FLOAT NOT NULL 8 | ) 9 | -------------------------------------------------------------------------------- /TrackerData/dbo/Tables/People.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE [dbo].[People] 2 | ( 3 | [Id] INT NOT NULL PRIMARY KEY IDENTITY, 4 | [FirstName] NVARCHAR(100) NOT NULL, 5 | [LastName] NVARCHAR(100) NOT NULL, 6 | [EmailAddress] NVARCHAR(200) NOT NULL, 7 | [CellphoneNumber] NVARCHAR(20) NULL 8 | ) 9 | -------------------------------------------------------------------------------- /TrackerUI/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /TrackerData/dbo/Stored Procedures/spTeams_Insert.sql: -------------------------------------------------------------------------------- 1 | CREATE PROCEDURE [dbo].[spTeams_Insert] 2 | @TeamName nvarchar(100), 3 | @Id int = 0 output 4 | AS 5 | BEGIN 6 | SET NOCOUNT ON; 7 | 8 | INSERT INTO [dbo].[Teams] (TeamName) 9 | VALUES (@TeamName) 10 | 11 | SELECT @Id = SCOPE_IDENTITY(); 12 | END 13 | GO -------------------------------------------------------------------------------- /TrackerData/dbo/Stored Procedures/spPeople_GetAll.sql: -------------------------------------------------------------------------------- 1 | CREATE PROCEDURE [dbo].[spPeople_GetAll] 2 | AS 3 | BEGIN 4 | SET NOCOUNT ON; 5 | 6 | SELECT [People].[Id], 7 | [People].[FirstName], 8 | [People].[LastName], 9 | [People].[EmailAddress], 10 | [People].[CellphoneNumber] 11 | FROM [dbo].[People]; 12 | END 13 | -------------------------------------------------------------------------------- /TrackerLibrary/Models/TeamModel.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace TrackerLibrary.Models 4 | { 5 | public class TeamModel 6 | { 7 | public int Id { get; set; } 8 | public List TeamMembers { get; set; } = new List(); 9 | public string TeamName { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /TrackerData/dbo/Stored Procedures/spTournaments_GetAll.sql: -------------------------------------------------------------------------------- 1 | CREATE PROCEDURE [dbo].[spTournaments_GetAll] 2 | AS 3 | BEGIN 4 | 5 | SET NOCOUNT ON; 6 | 7 | SELECT Tournaments.Id, 8 | Tournaments.TournamentName, 9 | Tournaments.EntryFee, 10 | Tournaments.Active 11 | FROM [dbo].[Tournaments] 12 | WHERE Active = 1; 13 | 14 | END -------------------------------------------------------------------------------- /TrackerData/dbo/Stored Procedures/spTeamMembers_Insert.sql: -------------------------------------------------------------------------------- 1 | CREATE PROCEDURE [dbo].[spTeamMembers_Insert] 2 | @TeamId int, 3 | @PersonId int, 4 | @id int = 0 output 5 | AS 6 | BEGIN 7 | SET NOCOUNT ON; 8 | 9 | INSERT INTO [dbo].[TeamMembers] (TeamId, PersonId) 10 | VALUES (@TeamId, @PersonId) 11 | 12 | SELECT @Id = SCOPE_IDENTITY(); 13 | END 14 | GO 15 | -------------------------------------------------------------------------------- /TrackerData/dbo/Stored Procedures/spMatchupEntries_Update.sql: -------------------------------------------------------------------------------- 1 | CREATE PROCEDURE [dbo].[spMatchupEntries_Update] 2 | @Id int, 3 | @TeamCompetingId int = null, 4 | @Score float = null 5 | AS 6 | BEGIN 7 | SET NOCOUNT ON; 8 | 9 | UPDATE [dbo].[MatchupEntries] 10 | SET TeamCompetingId = @TeamCompetingId, 11 | Score = @Score 12 | WHERE Id = @Id; 13 | 14 | END 15 | -------------------------------------------------------------------------------- /TrackerData/dbo/Stored Procedures/spMatchups_Insert.sql: -------------------------------------------------------------------------------- 1 | CREATE PROCEDURE [dbo].[spMatchups_Insert] 2 | @TournamentId int, 3 | @MatchupRound int, 4 | @Id int = 0 output 5 | AS 6 | BEGIN 7 | SET NOCOUNT ON; 8 | 9 | INSERT INTO [dbo].[Matchups] (TournamentId, MatchupRound) 10 | VALUES(@TournamentId, @MatchupRound); 11 | 12 | SELECT @Id = SCOPE_IDENTITY(); 13 | 14 | END 15 | -------------------------------------------------------------------------------- /TrackerData/dbo/Tables/TeamMembers.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE [dbo].[TeamMembers] 2 | ( 3 | [Id] INT NOT NULL PRIMARY KEY IDENTITY, 4 | [TeamId] INT NOT NULL, 5 | [PersonId] INT NOT NULL, 6 | CONSTRAINT [FK_TeamMembers_ToTeams] FOREIGN KEY ([TeamId]) REFERENCES [Teams]([Id]), 7 | CONSTRAINT [FK_TeamMembers_ToPeople] FOREIGN KEY ([PersonId]) REFERENCES [People]([Id]) 8 | ) 9 | -------------------------------------------------------------------------------- /TrackerData/dbo/Stored Procedures/spTournamentPrizes_Insert.sql: -------------------------------------------------------------------------------- 1 | CREATE PROCEDURE [dbo].[spTournamentPrizes_Insert] 2 | @TournamentId int, 3 | @PrizeId int, 4 | @Id int = 0 output 5 | AS 6 | BEGIN 7 | SET NOCOUNT ON; 8 | 9 | INSERT INTO [dbo].[TournamentPrizes] (TournamentId, PrizeId) 10 | VALUES (@TournamentId, @PrizeId); 11 | 12 | SELECT @Id = SCOPE_IDENTITY(); 13 | END 14 | -------------------------------------------------------------------------------- /TrackerData/dbo/Stored Procedures/spTournamentEntries_Insert.sql: -------------------------------------------------------------------------------- 1 | CREATE PROCEDURE [dbo].[spTournamentEntries_Insert] 2 | @TournamentId int, 3 | @TeamId int, 4 | @Id int = 0 output 5 | AS 6 | BEGIN 7 | SET NOCOUNT ON; 8 | 9 | INSERT INTO [dbo].[TournamentEntries] (TournamentId, TeamId) 10 | VALUES (@TournamentId, @TeamId) 11 | 12 | SELECT @Id = SCOPE_IDENTITY(); 13 | 14 | END 15 | -------------------------------------------------------------------------------- /TrackerData/dbo/Stored Procedures/spTournaments_Insert.sql: -------------------------------------------------------------------------------- 1 | CREATE PROCEDURE [dbo].[spTournaments_Insert] 2 | @TournamentName nvarchar(200), 3 | @EntryFee money, 4 | @id int = 0 output 5 | AS 6 | BEGIN 7 | SET NOCOUNT ON; 8 | 9 | INSERT INTO [dbo].[Tournaments] (TournamentName, EntryFee, Active) 10 | VALUES(@TournamentName, @EntryFee, 1); 11 | 12 | SELECT @Id = SCOPE_IDENTITY(); 13 | END 14 | GO 15 | -------------------------------------------------------------------------------- /TrackerData/dbo/Stored Procedures/spTeam_getByTournament.sql: -------------------------------------------------------------------------------- 1 | CREATE PROCEDURE [dbo].[spTeam_getByTournament] 2 | @TournamentId int 3 | AS 4 | BEGIN 5 | SET NOCOUNT ON; 6 | 7 | SELECT [Teams].[Id], 8 | [Teams].[TeamName] 9 | FROM [dbo].[Teams] 10 | INNER JOIN [dbo].[TournamentEntries] 11 | ON TournamentEntries.TeamId = Teams.Id 12 | WHERE [TournamentEntries].[TournamentId] = @TournamentId; 13 | 14 | END -------------------------------------------------------------------------------- /TrackerData/dbo/Tables/TournamentEntries.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE [dbo].[TournamentEntries] 2 | ( 3 | [Id] INT NOT NULL PRIMARY KEY IDENTITY, 4 | [TournamentId] INT NOT NULL, 5 | [TeamId] INT NOT NULL, 6 | CONSTRAINT [FK_TournamentEntries_ToTournaments] FOREIGN KEY ([TournamentId]) REFERENCES Tournaments([Id]), 7 | CONSTRAINT [FK_TournamentEntries_ToTeams] FOREIGN KEY ([TeamId]) REFERENCES [Teams]([Id]) 8 | ) 9 | -------------------------------------------------------------------------------- /TrackerData/dbo/Tables/TournamentPrizes.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE [dbo].[TournamentPrizes] 2 | ( 3 | [Id] INT NOT NULL PRIMARY KEY IDENTITY, 4 | [TournamentId] INT NOT NULL, 5 | [PrizeId] INT NOT NULL, 6 | CONSTRAINT [FK_TournamentPrizes_ToTournaments] FOREIGN KEY ([TournamentId]) REFERENCES [Tournaments]([Id]), 7 | CONSTRAINT [FK_TournamentPrizes_ToPrizes] FOREIGN KEY ([PrizeId]) REFERENCES [Prizes]([Id]) 8 | ) 9 | -------------------------------------------------------------------------------- /TrackerData/dbo/Tables/Matchups.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE [dbo].[Matchups] 2 | ( 3 | [Id] INT NOT NULL PRIMARY KEY IDENTITY, 4 | [TournamentId] INT NOT NULL, 5 | [WinnerId] INT NULL, 6 | [MatchupRound] INT NOT NULL, 7 | CONSTRAINT [FK_Matchups_ToTeams] FOREIGN KEY ([WinnerId]) REFERENCES [Teams]([Id]), 8 | CONSTRAINT [FK_Matchups_ToTournaments] FOREIGN KEY ([TournamentId]) REFERENCES [Tournaments]([Id]) 9 | ) 10 | -------------------------------------------------------------------------------- /TrackerData/dbo/Stored Procedures/spMatchups_GetByTournament.sql: -------------------------------------------------------------------------------- 1 | CREATE PROCEDURE [dbo].[spMatchups_GetByTournament] 2 | @TournamentId int 3 | AS 4 | BEGIN 5 | 6 | SET NOCOUNT ON; 7 | 8 | SELECT [Matchups].[Id], 9 | [Matchups].[TournamentId], 10 | [Matchups].[WinnerId], 11 | [Matchups].[MatchupRound] 12 | FROM [dbo].[Matchups] 13 | WHERE Matchups.TournamentId = @TournamentId 14 | ORDER BY Matchups.MatchupRound; 15 | 16 | END 17 | -------------------------------------------------------------------------------- /TrackerData/dbo/Stored Procedures/spMatchupEntries_Insert.sql: -------------------------------------------------------------------------------- 1 | CREATE PROCEDURE [dbo].[spMatchupEntries_Insert] 2 | @MatchupId int, 3 | @ParentMatchupId int, 4 | @TeamCompetingId int, 5 | @Id int = 0 output 6 | AS 7 | BEGIN 8 | 9 | SET NOCOUNT ON; 10 | 11 | INSERT INTO [dbo].[MatchupEntries] (MatchupId, ParentMatchupId, TeamCompetingId) 12 | VALUES (@MatchupId, @ParentMatchupId, @TeamCompetingId); 13 | 14 | SELECT @Id = SCOPE_IDENTITY(); 15 | 16 | END -------------------------------------------------------------------------------- /TrackerData/dbo/Stored Procedures/spMatchupEntries_GetByMatchup.sql: -------------------------------------------------------------------------------- 1 | CREATE PROCEDURE [dbo].[spMatchupEntries_GetByMatchup] 2 | @MatchupId int 3 | AS 4 | BEGIN 5 | SET NOCOUNT ON; 6 | 7 | SELECT [MatchupEntries].[Id], 8 | [MatchupEntries].[MatchupId], 9 | [MatchupEntries].[ParentMatchupId], 10 | [MatchupEntries].[TeamCompetingId], 11 | [MatchupEntries].[Score] 12 | FROM [dbo].[MatchupEntries] 13 | WHERE [MatchupEntries].[MatchupId] = @MatchupId; 14 | 15 | END 16 | -------------------------------------------------------------------------------- /TrackerData/dbo/Stored Procedures/spPrizes_Insert.sql: -------------------------------------------------------------------------------- 1 | CREATE PROCEDURE [dbo].[spPrizes_Insert] 2 | @PlaceNumber int, 3 | @PlaceName nvarchar(50), 4 | @PrizeAmount money, 5 | @PrizePercentage float, 6 | @Id int = 0 output 7 | AS 8 | BEGIN 9 | SET NOCOUNT ON; 10 | 11 | INSERT INTO [dbo].[Prizes] (PlaceNumber, PlaceName, PrizeAmount, PrizePercentage) 12 | VALUES (@PlaceNumber, @PlaceName, @PrizeAmount, @PrizePercentage); 13 | 14 | SELECT @Id = SCOPE_IDENTITY(); 15 | 16 | END -------------------------------------------------------------------------------- /TrackerData/dbo/Stored Procedures/spPeople_Insert.sql: -------------------------------------------------------------------------------- 1 | CREATE PROCEDURE [dbo].[spPeople_Insert] 2 | @FirstName nvarchar(100), 3 | @LastName nvarchar(100), 4 | @EmailAddress nvarchar(100), 5 | @CellphoneNumber nvarchar(20), 6 | @Id int = 0 output 7 | AS 8 | BEGIN 9 | SET NOCOUNT ON; 10 | 11 | INSERT INTO [dbo].[People] (FirstName, LastName, EmailAddress, CellphoneNumber) 12 | VALUES (@FirstName, @LastName, @EmailAddress, @CellphoneNumber); 13 | 14 | SELECT @Id = SCOPE_IDENTITY(); 15 | END -------------------------------------------------------------------------------- /TrackerData/dbo/Stored Procedures/spTeamMembers_GetByTeam.sql: -------------------------------------------------------------------------------- 1 | CREATE PROCEDURE [dbo].[spTeamMembers_GetByTeam] 2 | @TeamId int 3 | AS 4 | BEGIN 5 | SET NOCOUNT ON; 6 | 7 | SELECT [People].[Id], 8 | [People].[FirstName], 9 | [People].[LastName], 10 | [People].[EmailAddress], 11 | [People].[CellphoneNumber] 12 | FROM [dbo].[TeamMembers] 13 | INNER JOIN [dbo].[People] 14 | ON [People].[Id] = [TeamMembers].[PersonId] 15 | WHERE [TeamMembers].[TeamId] = @TeamId; 16 | 17 | END -------------------------------------------------------------------------------- /TrackerData/dbo/Stored Procedures/spPrizes_GetByTournament.sql: -------------------------------------------------------------------------------- 1 | CREATE PROCEDURE [dbo].[spPrizes_GetByTournament] 2 | @TournamentId int 3 | AS 4 | BEGIN 5 | SET NOCOUNT ON; 6 | 7 | SELECT [Prizes].[Id], 8 | [Prizes].[PlaceNumber], 9 | [Prizes].[PlaceName], 10 | [Prizes].[PrizeAmount], 11 | [Prizes].[PrizePercentage] 12 | FROM [dbo].[Prizes] 13 | INNER JOIN [dbo].[TournamentPrizes] 14 | ON TournamentPrizes.PrizeId = Prizes.Id 15 | WHERE TournamentPrizes.TournamentId = @TournamentId; 16 | 17 | END -------------------------------------------------------------------------------- /TrackerData/dbo/Tables/MatchupEntries.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE [dbo].[MatchupEntries] 2 | ( 3 | [Id] INT NOT NULL PRIMARY KEY IDENTITY, 4 | [MatchupId] INT NOT NULL, 5 | [ParentMatchupId] INT NULL, 6 | [TeamCompetingId] INT NULL, 7 | [Score] DECIMAL NULL, 8 | CONSTRAINT [FK_MatchupEntries_ToMatchups] FOREIGN KEY ([MatchupId]) REFERENCES [Matchups]([Id]), 9 | CONSTRAINT [FK_MatchupEntries_ToParentMatchups] FOREIGN KEY ([ParentMatchupId]) REFERENCES [Matchups]([Id]), 10 | CONSTRAINT [FK_MatchupEntries_ToTeams] FOREIGN KEY ([TeamCompetingId]) REFERENCES [Teams]([Id]) 11 | ) 12 | -------------------------------------------------------------------------------- /TrackerUI/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Forms; 3 | using TrackerLibrary; 4 | 5 | namespace TrackerUI 6 | { 7 | static class Program 8 | { 9 | /// 10 | /// The main entry point for the application. 11 | /// 12 | [STAThread] 13 | static void Main() 14 | { 15 | Application.EnableVisualStyles(); 16 | Application.SetCompatibleTextRenderingDefault(false); 17 | 18 | // Initialize the database connection 19 | GlobalConfig.InitializeConnection(DatabaseType.TextFile); 20 | Application.Run(new TournamentDashboardForm()); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /TrackerLibrary/DataAccess/IDataConnection.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using TrackerLibrary.Models; 3 | 4 | namespace TrackerLibrary.DataAccess 5 | { 6 | public interface IDataConnection 7 | { 8 | void CreatePrize(PrizeModel model); 9 | void CreatePerson(PersonModel model); 10 | void CreateTeam(TeamModel model); 11 | void CreateTournament(TournamentModel model); 12 | void UpdateMatchup(MatchupModel model); 13 | void CompleteTournament(TournamentModel model); 14 | List GetTeam_All(); 15 | List GetPerson_All(); 16 | List GetTournament_All(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /TrackerUI/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /TrackerLibrary/EmailLogic.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Net.Mail; 3 | 4 | namespace TrackerLibrary 5 | { 6 | public static class EmailLogic 7 | { 8 | public static void SendEmail(string toAddress, string subject, string body) 9 | { 10 | SendEmail(new List { toAddress }, new List(), subject, body); 11 | } 12 | 13 | public static void SendEmail(List toAddresses, List bccAddresses, string subject, string body) 14 | { 15 | MailAddress fromMailAddress = new MailAddress(GlobalConfig.AppKeyLookup("senderEmail"), GlobalConfig.AppKeyLookup("senderDisplayName")); 16 | 17 | MailMessage mail = new MailMessage(); 18 | foreach (var toAddress in toAddresses) 19 | { 20 | mail.To.Add(toAddress); 21 | } 22 | foreach (var bccAddress in bccAddresses) 23 | { 24 | mail.To.Add(bccAddress); 25 | } 26 | mail.From = fromMailAddress; 27 | mail.Subject = subject; 28 | mail.Body = body; 29 | mail.IsBodyHtml = true; 30 | 31 | SmtpClient client = new SmtpClient(); 32 | 33 | client.Send(mail); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /TrackerLibrary/Models/PersonModel.cs: -------------------------------------------------------------------------------- 1 | namespace TrackerLibrary.Models 2 | { 3 | /// 4 | /// Represents one person. 5 | /// 6 | public class PersonModel 7 | { 8 | /// 9 | /// The unique identifier for the person. 10 | /// 11 | public int Id { get; set; } 12 | 13 | /// 14 | /// The first name of the person. 15 | /// 16 | public string FirstName { get; set; } 17 | 18 | /// 19 | /// The last name of the person. 20 | /// 21 | public string LastName { get; set; } 22 | 23 | /// 24 | /// The primary email address of the person. 25 | /// 26 | public string EmailAddress { get; set; } 27 | 28 | /// 29 | /// The primary cell phone number of the person. 30 | /// 31 | public string CellPhoneNumber { get; set; } 32 | 33 | /// 34 | /// The first name and last name combined as one string. 35 | /// 36 | public string FullName 37 | { 38 | get 39 | { 40 | return $"{ FirstName } { LastName }"; 41 | } 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /TrackerLibrary/Models/MatchupEntryModel.cs: -------------------------------------------------------------------------------- 1 | namespace TrackerLibrary.Models 2 | { 3 | /// 4 | /// Represents one team in a matchup. 5 | /// 6 | public class MatchupEntryModel 7 | { 8 | /// 9 | /// The unique identifier for the matchup entry. 10 | /// 11 | public int Id { get; set; } 12 | 13 | /// 14 | /// The unique identifier for the team. 15 | /// 16 | public int TeamCompetingId { get; set; } 17 | 18 | /// 19 | /// Represents one team in the matchup. 20 | /// 21 | public TeamModel TeamCompeting { get; set; } 22 | 23 | /// 24 | /// Represents the score for this particular team. 25 | /// 26 | public double Score { get; set; } 27 | 28 | /// 29 | /// The unique identifier for the parent matchup (team). 30 | /// 31 | public int ParentMatchupId { get; set; } 32 | 33 | /// 34 | /// Represents the matchup that this team came 35 | /// from as the winner. 36 | /// 37 | public MatchupModel ParentMatchup { get; set; } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /TrackerUI/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace TrackerUI.Properties 12 | { 13 | 14 | 15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] 17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase 18 | { 19 | 20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 21 | 22 | public static Settings Default 23 | { 24 | get 25 | { 26 | return defaultInstance; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /TrackerUI/TournamentDashboardForm.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using System.Windows.Forms; 10 | using TrackerLibrary; 11 | using TrackerLibrary.Models; 12 | 13 | namespace TrackerUI 14 | { 15 | public partial class TournamentDashboardForm : Form 16 | { 17 | List tournaments = GlobalConfig.Connection.GetTournament_All(); 18 | 19 | public TournamentDashboardForm() 20 | { 21 | InitializeComponent(); 22 | 23 | WireUpLists(); 24 | } 25 | 26 | private void WireUpLists() 27 | { 28 | loadExistingTournamentDropDown.DataSource = tournaments; 29 | loadExistingTournamentDropDown.DisplayMember = "TournamentName"; 30 | } 31 | 32 | private void createTournamentButton_Click(object sender, EventArgs e) 33 | { 34 | CreateTournamentForm frm = new CreateTournamentForm(); 35 | frm.Show(); 36 | } 37 | 38 | private void loadTournamentButton_Click(object sender, EventArgs e) 39 | { 40 | TournamentModel tm = (TournamentModel)loadExistingTournamentDropDown.SelectedItem; 41 | TournamentViewerForm frm = new TournamentViewerForm(tm); 42 | frm.Show(); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /TrackerLibrary/GlobalConfig.cs: -------------------------------------------------------------------------------- 1 | using System.Configuration; 2 | using TrackerLibrary.DataAccess; 3 | 4 | namespace TrackerLibrary 5 | { 6 | public static class GlobalConfig 7 | { 8 | public const string PrizesFile = "PrizeModel.csv"; 9 | public const string PeopleFile = "PersonModel.csv"; 10 | public const string TeamFile = "TeamModel.csv"; 11 | public const string TournamentFile = "TournamentModel.csv"; 12 | public const string MatchupFile = "MatchupModel.csv"; 13 | public const string MatchupEntryFile = "MatchupEntryModel.csv"; 14 | 15 | public static IDataConnection Connection { get; private set; } 16 | 17 | public static void InitializeConnection(DatabaseType db) 18 | { 19 | switch (db) 20 | { 21 | case DatabaseType.Sql: 22 | SqlConnector sql = new SqlConnector(); 23 | Connection = sql; 24 | break; 25 | case DatabaseType.TextFile: 26 | TextConnector text = new TextConnector(); 27 | Connection = text; 28 | break; 29 | default: 30 | break; 31 | } 32 | } 33 | 34 | public static string CnnString(string name) 35 | { 36 | return ConfigurationManager.ConnectionStrings[name].ConnectionString; 37 | } 38 | 39 | public static string AppKeyLookup(string key) 40 | { 41 | return ConfigurationManager.AppSettings[key]; 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /TrackerLibrary/Models/TournamentModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace TrackerLibrary.Models 5 | { 6 | /// 7 | /// Represents one tournament, with all of the rounds, matchups, prizes and outcomes. 8 | /// 9 | public class TournamentModel 10 | { 11 | public event EventHandler OnTournamentComplete; 12 | 13 | /// 14 | /// The unique identifier for the tournament. 15 | /// 16 | public int Id { get; set; } 17 | /// 18 | /// The name given to this tournament. 19 | /// 20 | public string TournamnetName { get; set; } 21 | /// 22 | /// The amount of money each team needs to put up to enter. 23 | /// 24 | public decimal EntryFee { get; set; } 25 | /// 26 | /// The set of teams that have been entered. 27 | /// 28 | public List EnteredTeams { get; set; } = new List(); 29 | /// 30 | /// The list of prizes for the various places. 31 | /// 32 | public List Prizes { get; set; } = new List(); 33 | /// 34 | /// The matchups per round 35 | /// 36 | public List> Rounds { get; set; } = new List>(); 37 | 38 | public void CompleteTournament() 39 | { 40 | OnTournamentComplete?.Invoke(this, DateTime.Now); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /TrackerUI/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("TrackerUI")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("TrackerUI")] 13 | [assembly: AssemblyCopyright("Copyright © 2020")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("09766391-c433-488b-9460-df2433f7d3d7")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /TrackerLibrary/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("TrackerLibrary")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("TrackerLibrary")] 13 | [assembly: AssemblyCopyright("Copyright © 2020")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("ce70082a-e676-4369-b3a8-96a22bea69f7")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /TrackerLibrary/Models/MatchupModel.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace TrackerLibrary.Models 4 | { 5 | /// 6 | /// Represents one match in the tournament. 7 | /// 8 | public class MatchupModel 9 | { 10 | /// 11 | /// The unique identifier for the match. 12 | /// 13 | public int Id { get; set; } 14 | 15 | /// 16 | /// The set of teams that were involved in this match. 17 | /// 18 | public List Entries { get; set; } = new List(); 19 | 20 | /// 21 | /// The ID from the database that will be used to identify the winner. 22 | /// 23 | public int WinnerId { get; set; } 24 | 25 | /// 26 | /// The winner of the match. 27 | /// 28 | public TeamModel Winner { get; set; } 29 | 30 | /// 31 | /// Which round this match is part of. 32 | /// 33 | public int MatchupRound { get; set; } 34 | 35 | public string DisplayName 36 | { 37 | get 38 | { 39 | string output = ""; 40 | 41 | foreach (MatchupEntryModel me in Entries) 42 | { 43 | if (me.TeamCompeting != null) 44 | { 45 | if (output.Length == 0) 46 | { 47 | output = me.TeamCompeting.TeamName; 48 | } 49 | else 50 | { 51 | output += $" vs. { me.TeamCompeting.TeamName }"; 52 | } 53 | } 54 | else 55 | { 56 | output = "Matchup Not Yet Determined"; 57 | break; 58 | } 59 | } 60 | 61 | return output; 62 | } 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /TrackerLibrary/Models/PrizeModel.cs: -------------------------------------------------------------------------------- 1 | namespace TrackerLibrary.Models 2 | { 3 | /// 4 | /// Represents what the prize is for the given place. 5 | /// 6 | public class PrizeModel 7 | { 8 | /// 9 | /// The unique identifier for the prize. 10 | /// 11 | public int Id { get; set; } 12 | /// 13 | /// The numeric identifier for the place (2 for the second place etc.) 14 | /// 15 | public int PlaceNumber { get; set; } 16 | /// 17 | /// The friendly name for the place (second place, first runner up, etc.) 18 | /// 19 | public string PlaceName { get; set; } 20 | /// 21 | /// The fixed amount this place earns or zero if it is not used. 22 | /// 23 | public decimal PrizeAmount { get; set; } 24 | /// 25 | /// The number that represent the percentage of the overall take or 26 | /// zero if it is not used. The percentage is a fraction of 1 (so 0.5 for 27 | /// 50%) 28 | /// 29 | public double PrizePercentage { get; set; } 30 | 31 | /// 32 | /// Blank Constructor 33 | /// 34 | public PrizeModel() 35 | { 36 | } 37 | 38 | /// 39 | /// Takes the string representation of a PrizeModel field and 40 | /// converts it to it's expected type 41 | /// 42 | /// 43 | /// 44 | /// 45 | /// 46 | public PrizeModel(string placeName, string placeNumber, string prizeAmount, string prizePercentage) 47 | { 48 | PlaceName = placeName; 49 | 50 | int.TryParse(placeNumber, out int placeNumberValue); 51 | PlaceNumber = placeNumberValue; 52 | 53 | decimal.TryParse(prizeAmount, out decimal prizeAmountValue); 54 | PrizeAmount = prizeAmountValue; 55 | 56 | double.TryParse(prizePercentage, out double prizePercentageValue); 57 | PrizePercentage = prizePercentageValue; 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /TrackerUI/CreatePrizeForm.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Forms; 3 | using TrackerLibrary; 4 | using TrackerLibrary.Models; 5 | 6 | namespace TrackerUI 7 | { 8 | public partial class CreatePrizeForm : Form 9 | { 10 | IPrizeRequester callingForm; 11 | public CreatePrizeForm(IPrizeRequester caller) 12 | { 13 | InitializeComponent(); 14 | 15 | callingForm = caller; 16 | } 17 | 18 | private void createPrizeButton_Click(object sender, EventArgs e) 19 | { 20 | if (ValidateForm()) 21 | { 22 | PrizeModel model = new PrizeModel( 23 | placeNameValue.Text, 24 | placeNumberValue.Text, 25 | prizeAmountValue.Text, 26 | prizePercentageValue.Text); 27 | 28 | GlobalConfig.Connection.CreatePrize(model); 29 | 30 | callingForm.PrizeComplete(model); 31 | 32 | this.Close(); 33 | 34 | //placeNameValue.Text = String.Empty; 35 | //placeNumberValue.Text = String.Empty; 36 | //prizeAmountValue.Text = "0"; 37 | //prizePercentageValue.Text = "0"; 38 | } 39 | else 40 | { 41 | MessageBox.Show("This form has invalid information. Please check it and try again."); 42 | } 43 | } 44 | 45 | private bool ValidateForm() 46 | { 47 | bool output = true; 48 | bool placeNumberValidNumber = int.TryParse(placeNumberValue.Text, out int placeNumber); 49 | 50 | if (placeNumberValidNumber == false) 51 | { 52 | output = false; 53 | } 54 | 55 | if (placeNumber < 1) 56 | { 57 | output = false; 58 | } 59 | 60 | if (placeNameValue.Text.Length == 0) 61 | { 62 | output = false; 63 | } 64 | 65 | bool prizeAmountValid = decimal.TryParse(prizeAmountValue.Text, out decimal prizeAmount); 66 | bool prizePercentageValid = int.TryParse(prizePercentageValue.Text, out int prizePercentage); 67 | 68 | if (prizeAmountValid == false || prizePercentageValid == false) 69 | { 70 | output = false; 71 | } 72 | 73 | if (prizeAmount <= 0 && prizePercentage <= 0) 74 | { 75 | output = false; 76 | } 77 | 78 | if (prizePercentage < 0 || prizePercentage > 100) 79 | { 80 | output = false; 81 | } 82 | 83 | return output; 84 | } 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /TournamentTracker.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.29728.190 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TrackerLibrary", "TrackerLibrary\TrackerLibrary.csproj", "{CE70082A-E676-4369-B3A8-96A22BEA69F7}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TrackerUI", "TrackerUI\TrackerUI.csproj", "{09766391-C433-488B-9460-DF2433F7D3D7}" 9 | EndProject 10 | Project("{00D1A9C2-B5F0-4AF3-8072-F6C62B433612}") = "TrackerData", "TrackerData\TrackerData.sqlproj", "{7B36DBBF-2639-4D62-B9C3-00B5C7877D0C}" 11 | EndProject 12 | Global 13 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 14 | Debug|Any CPU = Debug|Any CPU 15 | Release|Any CPU = Release|Any CPU 16 | EndGlobalSection 17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 18 | {CE70082A-E676-4369-B3A8-96A22BEA69F7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 19 | {CE70082A-E676-4369-B3A8-96A22BEA69F7}.Debug|Any CPU.Build.0 = Debug|Any CPU 20 | {CE70082A-E676-4369-B3A8-96A22BEA69F7}.Release|Any CPU.ActiveCfg = Release|Any CPU 21 | {CE70082A-E676-4369-B3A8-96A22BEA69F7}.Release|Any CPU.Build.0 = Release|Any CPU 22 | {09766391-C433-488B-9460-DF2433F7D3D7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 23 | {09766391-C433-488B-9460-DF2433F7D3D7}.Debug|Any CPU.Build.0 = Debug|Any CPU 24 | {09766391-C433-488B-9460-DF2433F7D3D7}.Release|Any CPU.ActiveCfg = Release|Any CPU 25 | {09766391-C433-488B-9460-DF2433F7D3D7}.Release|Any CPU.Build.0 = Release|Any CPU 26 | {7B36DBBF-2639-4D62-B9C3-00B5C7877D0C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 27 | {7B36DBBF-2639-4D62-B9C3-00B5C7877D0C}.Debug|Any CPU.Build.0 = Debug|Any CPU 28 | {7B36DBBF-2639-4D62-B9C3-00B5C7877D0C}.Debug|Any CPU.Deploy.0 = Debug|Any CPU 29 | {7B36DBBF-2639-4D62-B9C3-00B5C7877D0C}.Release|Any CPU.ActiveCfg = Release|Any CPU 30 | {7B36DBBF-2639-4D62-B9C3-00B5C7877D0C}.Release|Any CPU.Build.0 = Release|Any CPU 31 | {7B36DBBF-2639-4D62-B9C3-00B5C7877D0C}.Release|Any CPU.Deploy.0 = Release|Any CPU 32 | EndGlobalSection 33 | GlobalSection(SolutionProperties) = preSolution 34 | HideSolutionNode = FALSE 35 | EndGlobalSection 36 | GlobalSection(ExtensibilityGlobals) = postSolution 37 | SolutionGuid = {B18F3952-1F81-4DCD-A351-F97C63951082} 38 | EndGlobalSection 39 | EndGlobal 40 | -------------------------------------------------------------------------------- /TrackerData/TrackerData.refactorlog: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /TrackerUI/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace TrackerUI.Properties 12 | { 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources 26 | { 27 | 28 | private static global::System.Resources.ResourceManager resourceMan; 29 | 30 | private static global::System.Globalization.CultureInfo resourceCulture; 31 | 32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 33 | internal Resources() 34 | { 35 | } 36 | 37 | /// 38 | /// Returns the cached ResourceManager instance used by this class. 39 | /// 40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 41 | internal static global::System.Resources.ResourceManager ResourceManager 42 | { 43 | get 44 | { 45 | if ((resourceMan == null)) 46 | { 47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("TrackerUI.Properties.Resources", typeof(Resources).Assembly); 48 | resourceMan = temp; 49 | } 50 | return resourceMan; 51 | } 52 | } 53 | 54 | /// 55 | /// Overrides the current thread's CurrentUICulture property for all 56 | /// resource lookups using this strongly typed resource class. 57 | /// 58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 59 | internal static global::System.Globalization.CultureInfo Culture 60 | { 61 | get 62 | { 63 | return resourceCulture; 64 | } 65 | set 66 | { 67 | resourceCulture = value; 68 | } 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /TrackerLibrary/TrackerLibrary.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {CE70082A-E676-4369-B3A8-96A22BEA69F7} 8 | Library 9 | Properties 10 | TrackerLibrary 11 | TrackerLibrary 12 | v4.7.2 13 | 512 14 | true 15 | 16 | 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | pdbonly 27 | true 28 | bin\Release\ 29 | TRACE 30 | prompt 31 | 4 32 | 33 | 34 | 35 | ..\packages\Dapper.2.0.30\lib\net461\Dapper.dll 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Tournament Tracker 2 | 3 | C# application from start to finish. See a real-world application built from scratch… and learn to do it yourself. 4 | 5 | ### Featured technologies used include: 6 | - Interfaces 7 | - Email 8 | - SQL 9 | - Text Files 10 | - App.config data storage and retrieval 11 | - OOP 12 | 13 | ## Planning 14 | [Initial Planning](https://www.youtube.com/watch?v=HalXZUHfKLA&list=PLLWMQd6PeGY3t63w-8MMIjIyYS7MsFcCi&index=1) 15 | [Overview Planning](https://www.youtube.com/watch?v=HalXZUHfKLA&list=PLLWMQd6PeGY3t63w-8MMIjIyYS7MsFcCi&index=2) 16 | [Data Design](https://www.youtube.com/watch?v=HalXZUHfKLA&list=PLLWMQd6PeGY3t63w-8MMIjIyYS7MsFcCi&index=3) 17 | [User Interface Design](https://www.youtube.com/watch?v=HalXZUHfKLA&list=PLLWMQd6PeGY3t63w-8MMIjIyYS7MsFcCi&index=4) 18 | [Logic Planning](https://www.youtube.com/watch?v=HalXZUHfKLA&list=PLLWMQd6PeGY3t63w-8MMIjIyYS7MsFcCi&index=5) 19 | ## Project Setup 20 | [Class Library Creation](https://www.youtube.com/watch?v=HalXZUHfKLA&list=PLLWMQd6PeGY3t63w-8MMIjIyYS7MsFcCi&index=6) 21 | [Form Building](https://www.youtube.com/watch?v=HalXZUHfKLA&list=PLLWMQd6PeGY3t63w-8MMIjIyYS7MsFcCi&index=7) 22 | [SQL Database Design](https://www.youtube.com/watch?v=HalXZUHfKLA&list=PLLWMQd6PeGY3t63w-8MMIjIyYS7MsFcCi&index=8) 23 | [Prize Form Wire Up](https://www.youtube.com/watch?v=HalXZUHfKLA&list=PLLWMQd6PeGY3t63w-8MMIjIyYS7MsFcCi&index=9) 24 | [SQL Connection](https://www.youtube.com/watch?v=HalXZUHfKLA&list=PLLWMQd6PeGY3t63w-8MMIjIyYS7MsFcCi&index=10) 25 | [Text Connection](https://www.youtube.com/watch?v=HalXZUHfKLA&list=PLLWMQd6PeGY3t63w-8MMIjIyYS7MsFcCi&index=11) 26 | ## Form Development 27 | [Create Team Form Part 1](https://www.youtube.com/watch?v=HalXZUHfKLA&list=PLLWMQd6PeGY3t63w-8MMIjIyYS7MsFcCi&index=12) 28 | [Create Team Form Part 2](https://www.youtube.com/watch?v=HalXZUHfKLA&list=PLLWMQd6PeGY3t63w-8MMIjIyYS7MsFcCi&index=13) 29 | [Create Team Form Part 3](https://www.youtube.com/watch?v=HalXZUHfKLA&list=PLLWMQd6PeGY3t63w-8MMIjIyYS7MsFcCi&index=14) 30 | [Create Tournament Part 1](https://www.youtube.com/watch?v=HalXZUHfKLA&list=PLLWMQd6PeGY3t63w-8MMIjIyYS7MsFcCi&index=15) 31 | [Create Tournament Part 2](https://www.youtube.com/watch?v=HalXZUHfKLA&list=PLLWMQd6PeGY3t63w-8MMIjIyYS7MsFcCi&index=16) 32 | [Create Tournament Part 3](https://www.youtube.com/watch?v=HalXZUHfKLA&list=PLLWMQd6PeGY3t63w-8MMIjIyYS7MsFcCi&index=17) 33 | [Create Tournament Part 4](https://www.youtube.com/watch?v=HalXZUHfKLA&list=PLLWMQd6PeGY3t63w-8MMIjIyYS7MsFcCi&index=18) 34 | [Create Tournament Part 5](https://www.youtube.com/watch?v=HalXZUHfKLA&list=PLLWMQd6PeGY3t63w-8MMIjIyYS7MsFcCi&index=19) 35 | [Debugging](https://www.youtube.com/watch?v=HalXZUHfKLA&list=PLLWMQd6PeGY3t63w-8MMIjIyYS7MsFcCi&index=20) 36 | [Dashboard Form](https://www.youtube.com/watch?v=HalXZUHfKLA&list=PLLWMQd6PeGY3t63w-8MMIjIyYS7MsFcCi&index=21) 37 | [Tournament Viewer Part 1](https://www.youtube.com/watch?v=HalXZUHfKLA&list=PLLWMQd6PeGY3t63w-8MMIjIyYS7MsFcCi&index=22) 38 | [Tournament Viewer Part 2](https://www.youtube.com/watch?v=HalXZUHfKLA&list=PLLWMQd6PeGY3t63w-8MMIjIyYS7MsFcCi&index=23) 39 | ## Refactoring and Additional Features 40 | [Refactoring](https://www.youtube.com/watch?v=HalXZUHfKLA&list=PLLWMQd6PeGY3t63w-8MMIjIyYS7MsFcCi&index=24) 41 | [Error Handling](https://www.youtube.com/watch?v=HalXZUHfKLA&list=PLLWMQd6PeGY3t63w-8MMIjIyYS7MsFcCi&index=25) 42 | [Emailing Users](https://www.youtube.com/watch?v=HalXZUHfKLA&list=PLLWMQd6PeGY3t63w-8MMIjIyYS7MsFcCi&index=26) 43 | [Wrapping Up](https://www.youtube.com/watch?v=HalXZUHfKLA&list=PLLWMQd6PeGY3t63w-8MMIjIyYS7MsFcCi&index=27) 44 | -------------------------------------------------------------------------------- /TrackerUI/CreateTeamForm.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Windows.Forms; 4 | using TrackerLibrary; 5 | using TrackerLibrary.Models; 6 | 7 | namespace TrackerUI 8 | { 9 | public partial class CreateTeamForm : Form 10 | { 11 | private List availableTeamMembers = GlobalConfig.Connection.GetPerson_All(); 12 | private List selectedTeamMembers = new List(); 13 | private ITeamRequester callingForm; 14 | 15 | public CreateTeamForm(ITeamRequester caller) 16 | { 17 | InitializeComponent(); 18 | 19 | callingForm = caller; 20 | 21 | //CreateSampleData(); 22 | 23 | WireUpLists(); 24 | } 25 | 26 | private void CreateSampleData() 27 | { 28 | availableTeamMembers.Add(new PersonModel { FirstName = "Tim", LastName = "Corey" }); 29 | availableTeamMembers.Add(new PersonModel { FirstName = "Sue", LastName = "Storm" }); 30 | 31 | selectedTeamMembers.Add(new PersonModel { FirstName = "Jane", LastName = "Smith" }); 32 | selectedTeamMembers.Add(new PersonModel { FirstName = "Bill", LastName = "Jones" }); 33 | } 34 | 35 | private void WireUpLists() 36 | { 37 | selectTeamMemberDropDown.DataSource = null; 38 | 39 | selectTeamMemberDropDown.DataSource = availableTeamMembers; 40 | selectTeamMemberDropDown.DisplayMember = "FullName"; 41 | 42 | teamMembersListBox.DataSource = null; 43 | 44 | teamMembersListBox.DataSource = selectedTeamMembers; 45 | teamMembersListBox.DisplayMember = "FullName"; 46 | } 47 | 48 | private void createMemberButton_Click(object sender, EventArgs e) 49 | { 50 | if (ValidateForm()) 51 | { 52 | PersonModel p = new PersonModel(); 53 | 54 | p.FirstName = firstNameValue.Text; 55 | p.LastName = lastNameValue.Text; 56 | p.EmailAddress = emailValue.Text; 57 | p.CellPhoneNumber = cellphoneValue.Text; 58 | 59 | GlobalConfig.Connection.CreatePerson(p); 60 | 61 | selectedTeamMembers.Add(p); 62 | 63 | WireUpLists(); 64 | 65 | firstNameValue.Text = string.Empty; 66 | lastNameValue.Text = string.Empty; 67 | emailValue.Text = string.Empty; 68 | cellphoneValue.Text = string.Empty; 69 | } 70 | else 71 | { 72 | MessageBox.Show("You need to fill in all of the fields."); 73 | } 74 | } 75 | 76 | private bool ValidateForm() 77 | { 78 | if (firstNameValue.Text.Length == 0) 79 | { 80 | return false; 81 | } 82 | 83 | if (lastNameValue.Text.Length == 0) 84 | { 85 | return false; 86 | } 87 | 88 | if (emailValue.Text.Length == 0) 89 | { 90 | return false; 91 | } 92 | 93 | if (cellphoneValue.Text.Length == 0) 94 | { 95 | return false; 96 | } 97 | 98 | return true; 99 | } 100 | 101 | private void addMemberButton_Click(object sender, EventArgs e) 102 | { 103 | PersonModel p = (PersonModel)selectTeamMemberDropDown.SelectedItem; 104 | 105 | if (p != null) 106 | { 107 | availableTeamMembers.Remove(p); 108 | selectedTeamMembers.Add(p); 109 | 110 | WireUpLists(); 111 | } 112 | } 113 | 114 | private void removeSelectedMemberButton_Click(object sender, EventArgs e) 115 | { 116 | PersonModel p = (PersonModel)teamMembersListBox.SelectedItem; 117 | 118 | if (p != null) 119 | { 120 | selectedTeamMembers.Remove(p); 121 | availableTeamMembers.Add(p); 122 | 123 | WireUpLists(); 124 | } 125 | } 126 | 127 | private void createTeamButton_Click(object sender, EventArgs e) 128 | { 129 | TeamModel t = new TeamModel(); 130 | 131 | t.TeamName = teamNameValue.Text; 132 | t.TeamMembers = selectedTeamMembers; 133 | 134 | GlobalConfig.Connection.CreateTeam(t); 135 | 136 | callingForm.TeamComplete(t); 137 | 138 | this.Close(); 139 | } 140 | } 141 | } 142 | -------------------------------------------------------------------------------- /TrackerUI/CreateTournamentForm.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Windows.Forms; 3 | using TrackerLibrary; 4 | using TrackerLibrary.Models; 5 | 6 | namespace TrackerUI 7 | { 8 | public partial class CreateTournamentForm : Form, IPrizeRequester, ITeamRequester 9 | { 10 | List availableTeams = GlobalConfig.Connection.GetTeam_All(); 11 | List selectedTeams = new List(); 12 | List selectedPrizes = new List(); 13 | 14 | public CreateTournamentForm() 15 | { 16 | InitializeComponent(); 17 | 18 | WireUpLists(); 19 | } 20 | 21 | private void WireUpLists() 22 | { 23 | selectTeamDropDown.DataSource = null; 24 | selectTeamDropDown.DataSource = availableTeams; 25 | selectTeamDropDown.DisplayMember = "TeamName"; 26 | 27 | tournamentTeamsListBox.DataSource = null; 28 | tournamentTeamsListBox.DataSource = selectedTeams; 29 | tournamentTeamsListBox.DisplayMember = "TeamName"; 30 | 31 | prizesListBox.DataSource = null; 32 | prizesListBox.DataSource = selectedPrizes; 33 | prizesListBox.DisplayMember = "PlaceName"; 34 | } 35 | 36 | private void addTeamButton_Click(object sender, System.EventArgs e) 37 | { 38 | TeamModel t = (TeamModel)selectTeamDropDown.SelectedItem; 39 | 40 | if (t != null) 41 | { 42 | availableTeams.Remove(t); 43 | selectedTeams.Add(t); 44 | 45 | WireUpLists(); 46 | } 47 | } 48 | 49 | private void createPrizeButton_Click(object sender, System.EventArgs e) 50 | { 51 | // Call the CreatePrizeForm 52 | CreatePrizeForm frm = new CreatePrizeForm(this); 53 | 54 | frm.Show(); 55 | } 56 | 57 | public void PrizeComplete(PrizeModel model) 58 | { 59 | // Get back from the form a PrizeModel 60 | // Take the PrizeModel and put it into our list of selected prizes 61 | selectedPrizes.Add(model); 62 | WireUpLists(); 63 | } 64 | 65 | public void TeamComplete(TeamModel model) 66 | { 67 | selectedTeams.Add(model); 68 | WireUpLists(); 69 | } 70 | 71 | private void createNewTeamLink_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) 72 | { 73 | CreateTeamForm frm = new CreateTeamForm(this); 74 | frm.Show(); 75 | } 76 | 77 | private void removeSelectedPlayersButton_Click(object sender, System.EventArgs e) 78 | { 79 | TeamModel t = (TeamModel)tournamentTeamsListBox.SelectedItem; 80 | 81 | if (t != null) 82 | { 83 | selectedTeams.Remove(t); 84 | availableTeams.Add(t); 85 | 86 | WireUpLists(); 87 | } 88 | } 89 | 90 | private void removeSelectedPrizesButton_Click(object sender, System.EventArgs e) 91 | { 92 | PrizeModel p = (PrizeModel)prizesListBox.SelectedItem; 93 | 94 | if (p != null) 95 | { 96 | selectedPrizes.Remove(p); 97 | 98 | WireUpLists(); 99 | } 100 | } 101 | 102 | private void createTournamentButton_Click(object sender, System.EventArgs e) 103 | { 104 | // Validate data 105 | decimal fee = 0; 106 | 107 | bool feeAcceptable = decimal.TryParse(entryFeeValue.Text, out fee); 108 | 109 | if (!feeAcceptable) 110 | { 111 | MessageBox.Show("You need to enter a valid Entry Fee.", 112 | "Invalid Fee", 113 | MessageBoxButtons.OK, 114 | MessageBoxIcon.Error); 115 | return; 116 | } 117 | 118 | // Create our Tournament 119 | TournamentModel tm = new TournamentModel 120 | { 121 | TournamnetName = tournamentNameValue.Text, 122 | EntryFee = fee, 123 | Prizes = selectedPrizes, 124 | EnteredTeams = selectedTeams 125 | }; 126 | 127 | // Wire our matchups 128 | TournamentLogic.CreateRounds(tm); 129 | 130 | // Create Tournament entry 131 | // Create all of the Prize entries 132 | // Create all of the Team entries 133 | GlobalConfig.Connection.CreateTournament(tm); 134 | 135 | tm.AlertUsersToNewRound(); 136 | 137 | TournamentViewerForm frm = new TournamentViewerForm(tm); 138 | frm.Show(); 139 | this.Close(); 140 | } 141 | } 142 | } 143 | -------------------------------------------------------------------------------- /TrackerLibrary/DataAccess/TextConnector.cs: -------------------------------------------------------------------------------- 1 | using TrackerLibrary.Models; 2 | using TrackerLibrary.DataAccess.TextHelpers; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | 6 | namespace TrackerLibrary.DataAccess 7 | { 8 | public class TextConnector : IDataConnection 9 | { 10 | /// 11 | /// Saves a new person to a text file 12 | /// 13 | /// The person information 14 | /// The person information plus the unique identifier. 15 | public void CreatePerson(PersonModel model) 16 | { 17 | // Load the text file 18 | // Convert the text to a List 19 | List people = GlobalConfig.PeopleFile.FullFilePath().LoadFile().ConvertToPersonModels(); 20 | 21 | int currentId = 1; 22 | 23 | if (people.Count > 0) 24 | { 25 | currentId = people.OrderByDescending(x => x.Id).First().Id + 1; 26 | } 27 | 28 | model.Id = currentId; 29 | 30 | // Add the new record with the new ID 31 | people.Add(model); 32 | 33 | // Convert the people to List 34 | // Save the list to the text file 35 | people.SaveToPeopleFile(); 36 | } 37 | 38 | /// 39 | /// Saves a new prize to a text file 40 | /// 41 | /// The prize information 42 | /// The prize information plus the unique identifier. 43 | public void CreatePrize(PrizeModel model) 44 | { 45 | // Load the text file 46 | // Convert the text to a List 47 | List prizes = GlobalConfig.PrizesFile.FullFilePath().LoadFile().ConvertToPrizeModels(); 48 | 49 | // Find the ID 50 | int currentId = 1; 51 | 52 | if (prizes.Count > 0) 53 | { 54 | currentId = prizes.OrderByDescending(x => x.Id).First().Id + 1; 55 | } 56 | 57 | model.Id = currentId; 58 | 59 | // Add the new record with the new ID 60 | prizes.Add(model); 61 | 62 | // Convert the prizes to List 63 | // Save the list to the text file 64 | prizes.SaveToPrizeFile(); 65 | } 66 | 67 | /// 68 | /// aves a new team to a text file 69 | /// 70 | /// The team information 71 | /// The team information plus the unique identifier. 72 | public void CreateTeam(TeamModel model) 73 | { 74 | List teams = GlobalConfig.TeamFile.FullFilePath().LoadFile().ConvertToTeamModels(); 75 | 76 | // Find the ID 77 | int currentId = 1; 78 | 79 | if (teams.Count > 0) 80 | { 81 | currentId = teams.OrderByDescending(x => x.Id).First().Id + 1; 82 | } 83 | 84 | model.Id = currentId; 85 | 86 | teams.Add(model); 87 | 88 | teams.SaveToTeamFile(); 89 | } 90 | 91 | /// 92 | /// Returns a list of all people from a text file 93 | /// 94 | /// List of person information 95 | public List GetPerson_All() 96 | { 97 | return GlobalConfig.PeopleFile.FullFilePath().LoadFile().ConvertToPersonModels(); 98 | } 99 | 100 | /// 101 | /// Returns a list of all teams from a text file 102 | /// 103 | /// List of team information 104 | public List GetTeam_All() 105 | { 106 | return GlobalConfig.TeamFile.FullFilePath().LoadFile().ConvertToTeamModels(); 107 | } 108 | 109 | public void CreateTournament(TournamentModel model) 110 | { 111 | List tournaments = GlobalConfig.TournamentFile 112 | .FullFilePath() 113 | .LoadFile() 114 | .ConvertToTournamentModels(); 115 | 116 | int currentId = 1; 117 | 118 | if (tournaments.Count > 0) 119 | { 120 | currentId = tournaments.OrderByDescending(x => x.Id).First().Id + 1; 121 | } 122 | 123 | model.Id = currentId; 124 | 125 | model.SaveRoundsToFile(); 126 | 127 | tournaments.Add(model); 128 | 129 | tournaments.SaveToTournamentFile(); 130 | 131 | TournamentLogic.UpdateTournamentResults(model); 132 | } 133 | 134 | public List GetTournament_All() 135 | { 136 | return GlobalConfig.TournamentFile 137 | .FullFilePath() 138 | .LoadFile() 139 | .ConvertToTournamentModels(); 140 | } 141 | 142 | public void UpdateMatchup(MatchupModel model) 143 | { 144 | model.UpdateMatchupToFile(); 145 | } 146 | 147 | public void CompleteTournament(TournamentModel model) 148 | { 149 | List tournaments = GlobalConfig.TournamentFile 150 | .FullFilePath() 151 | .LoadFile() 152 | .ConvertToTournamentModels(); 153 | 154 | tournaments.Remove(model); 155 | 156 | tournaments.SaveToTournamentFile(); 157 | 158 | TournamentLogic.UpdateTournamentResults(model); 159 | } 160 | } 161 | } 162 | -------------------------------------------------------------------------------- /TrackerData/TrackerData.sqlproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug 5 | AnyCPU 6 | TrackerData 7 | 2.0 8 | 4.1 9 | {7b36dbbf-2639-4d62-b9c3-00b5c7877d0c} 10 | Microsoft.Data.Tools.Schema.Sql.Sql130DatabaseSchemaProvider 11 | Database 12 | 13 | 14 | TrackerData 15 | TrackerData 16 | 1033, CI 17 | BySchemaAndSchemaType 18 | True 19 | v4.5 20 | CS 21 | Properties 22 | False 23 | True 24 | True 25 | 26 | 27 | bin\Release\ 28 | $(MSBuildProjectName).sql 29 | False 30 | pdbonly 31 | true 32 | false 33 | true 34 | prompt 35 | 4 36 | 37 | 38 | bin\Debug\ 39 | $(MSBuildProjectName).sql 40 | false 41 | true 42 | full 43 | false 44 | true 45 | true 46 | prompt 47 | 4 48 | 49 | 50 | 11.0 51 | 52 | True 53 | 11.0 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | -------------------------------------------------------------------------------- /TrackerUI/TrackerUI.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {09766391-C433-488B-9460-DF2433F7D3D7} 8 | WinExe 9 | TrackerUI 10 | TrackerUI 11 | v4.7.2 12 | 512 13 | true 14 | true 15 | 16 | 17 | AnyCPU 18 | true 19 | full 20 | false 21 | bin\Debug\ 22 | DEBUG;TRACE 23 | prompt 24 | 4 25 | 26 | 27 | AnyCPU 28 | pdbonly 29 | true 30 | bin\Release\ 31 | TRACE 32 | prompt 33 | 4 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | Form 51 | 52 | 53 | CreatePrizeForm.cs 54 | 55 | 56 | Form 57 | 58 | 59 | CreateTeamForm.cs 60 | 61 | 62 | Form 63 | 64 | 65 | CreateTournamentForm.cs 66 | 67 | 68 | 69 | 70 | Form 71 | 72 | 73 | TournamentDashboardForm.cs 74 | 75 | 76 | Form 77 | 78 | 79 | TournamentViewerForm.cs 80 | 81 | 82 | 83 | 84 | CreatePrizeForm.cs 85 | 86 | 87 | CreateTeamForm.cs 88 | 89 | 90 | CreateTournamentForm.cs 91 | 92 | 93 | ResXFileCodeGenerator 94 | Resources.Designer.cs 95 | Designer 96 | 97 | 98 | True 99 | Resources.resx 100 | 101 | 102 | TournamentDashboardForm.cs 103 | 104 | 105 | TournamentViewerForm.cs 106 | 107 | 108 | SettingsSingleFileGenerator 109 | Settings.Designer.cs 110 | 111 | 112 | True 113 | Settings.settings 114 | True 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | {ce70082a-e676-4369-b3a8-96a22bea69f7} 123 | TrackerLibrary 124 | 125 | 126 | 127 | -------------------------------------------------------------------------------- /TrackerUI/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | text/microsoft-resx 107 | 108 | 109 | 2.0 110 | 111 | 112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 113 | 114 | 115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | -------------------------------------------------------------------------------- /TrackerUI/CreatePrizeForm.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /TrackerUI/CreateTeamForm.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /TrackerUI/CreateTournamentForm.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /TrackerUI/TournamentViewerForm.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /TrackerUI/TournamentDashboardForm.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /TrackerUI/TournamentViewerForm.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Linq; 5 | using System.Windows.Forms; 6 | using TrackerLibrary; 7 | using TrackerLibrary.Models; 8 | 9 | namespace TrackerUI 10 | { 11 | public partial class TournamentViewerForm : Form 12 | { 13 | private TournamentModel tournament; 14 | BindingList rounds = new BindingList(); 15 | BindingList selectedMatchups = new BindingList(); 16 | 17 | public TournamentViewerForm(TournamentModel tournamentModel) 18 | { 19 | InitializeComponent(); 20 | 21 | tournament = tournamentModel; 22 | 23 | tournament.OnTournamentComplete += Tournament_OnTournamentComplete; 24 | 25 | WireUpLists(); 26 | 27 | LoadFormData(); 28 | 29 | LoadRounds(); 30 | } 31 | 32 | private void Tournament_OnTournamentComplete(object sender, DateTime e) 33 | { 34 | this.Close(); 35 | } 36 | 37 | private void LoadFormData() 38 | { 39 | tournamentName.Text = tournament.TournamnetName; 40 | } 41 | 42 | private void WireUpLists() 43 | { 44 | roundDropDown.DataSource = rounds; 45 | matchupListBox.DataSource = selectedMatchups; 46 | matchupListBox.DisplayMember = "DisplayName"; 47 | } 48 | 49 | private void LoadRounds() 50 | { 51 | rounds.Clear(); 52 | 53 | rounds.Add(1); 54 | int currRound = 1; 55 | 56 | foreach (List matchups in tournament.Rounds) 57 | { 58 | if (matchups.First().MatchupRound > currRound) 59 | { 60 | currRound = matchups.First().MatchupRound; 61 | rounds.Add(currRound); 62 | } 63 | } 64 | 65 | LoadMatchups(1); 66 | } 67 | 68 | private void roundDropDown_SelectedIndexChanged(object sender, EventArgs e) 69 | { 70 | LoadMatchups((int)roundDropDown.SelectedItem); 71 | } 72 | 73 | private void LoadMatchups(int round) 74 | { 75 | foreach (List matchups in tournament.Rounds) 76 | { 77 | if (matchups.First().MatchupRound == round) 78 | { 79 | selectedMatchups.Clear(); 80 | foreach (MatchupModel m in matchups) 81 | { 82 | if (m.Winner == null || !unplayedOnlyCheckbox.Checked) 83 | { 84 | selectedMatchups.Add(m); 85 | } 86 | } 87 | } 88 | } 89 | 90 | if (selectedMatchups.Count > 0) 91 | { 92 | LoadMatchup(selectedMatchups.First()); 93 | } 94 | 95 | DisplayMatchupInfo(); 96 | } 97 | 98 | private void DisplayMatchupInfo() 99 | { 100 | bool isVisible = (selectedMatchups.Count > 0); 101 | 102 | teamOneName.Visible = isVisible; 103 | teamOneScoreLabel.Visible = isVisible; 104 | teamOneScoreValue.Visible = isVisible; 105 | teamTwoName.Visible = isVisible; 106 | teamTwoScoreLabel.Visible = isVisible; 107 | teamTwoScoreValue.Visible = isVisible; 108 | versusLabel.Visible = isVisible; 109 | scoreButton.Visible = isVisible; 110 | } 111 | 112 | private void LoadMatchup(MatchupModel m) 113 | { 114 | for (int i = 0; i < m.Entries.Count; i++) 115 | { 116 | if (i == 0) 117 | { 118 | if (m.Entries[0].TeamCompeting != null) 119 | { 120 | teamOneName.Text = m.Entries[0].TeamCompeting.TeamName; 121 | teamOneScoreValue.Text = m.Entries[0].Score.ToString(); 122 | 123 | teamTwoName.Text = ""; 124 | teamTwoScoreValue.Text = "0"; 125 | } 126 | else 127 | { 128 | teamOneName.Text = "Not Yet Set"; 129 | teamOneScoreValue.Text = ""; 130 | } 131 | } 132 | 133 | if (i == 1) 134 | { 135 | if (m.Entries[1].TeamCompeting != null) 136 | { 137 | teamTwoName.Text = m.Entries[1].TeamCompeting.TeamName; 138 | teamTwoScoreValue.Text = m.Entries[1].Score.ToString(); 139 | } 140 | else 141 | { 142 | teamTwoName.Text = "Not Yet Set"; 143 | teamTwoScoreValue.Text = ""; 144 | } 145 | } 146 | } 147 | } 148 | 149 | private void matchupListBox_SelectedIndexChanged(object sender, EventArgs e) 150 | { 151 | LoadMatchup((MatchupModel)matchupListBox.SelectedItem); 152 | } 153 | 154 | private void unplayedOnlyCheckbox_CheckedChanged(object sender, EventArgs e) 155 | { 156 | LoadMatchups((int)roundDropDown.SelectedItem); 157 | } 158 | 159 | private string ValidateData() 160 | { 161 | string output = ""; 162 | 163 | double teamOneScore = 0; 164 | double teamTwoScore = 0; 165 | 166 | bool scoreOneValid = double.TryParse(teamOneScoreValue.Text, out teamOneScore); 167 | bool scoreTwoValid = double.TryParse(teamTwoScoreValue.Text, out teamTwoScore); 168 | 169 | if (!scoreOneValid) 170 | { 171 | output = "The score One value is not a valid number."; 172 | } 173 | else if (!scoreTwoValid) 174 | { 175 | output = "The score Two value is not a valid number."; 176 | } 177 | else if (teamOneScore == 0 && teamTwoScore == 0) 178 | { 179 | output = "You did not enter a score for either team."; 180 | } 181 | else if (teamOneScore == teamTwoScore) 182 | { 183 | output = "We do not allow ties in this application."; 184 | } 185 | 186 | return output; 187 | } 188 | 189 | private void scoreButton_Click(object sender, EventArgs e) 190 | { 191 | string errorMessage = ValidateData(); 192 | 193 | if (errorMessage.Length > 0) 194 | { 195 | MessageBox.Show($"Input Error: { errorMessage }"); 196 | return; 197 | } 198 | 199 | MatchupModel m = (MatchupModel)matchupListBox.SelectedItem; 200 | double teamOneScore = 0; 201 | double teamTwoScore = 0; 202 | 203 | for (int i = 0; i < m.Entries.Count; i++) 204 | { 205 | if (i == 0) 206 | { 207 | if (m.Entries[0].TeamCompeting != null) 208 | { 209 | bool scoreValid = double.TryParse(teamOneScoreValue.Text, out teamOneScore); 210 | 211 | if (scoreValid) 212 | { 213 | m.Entries[0].Score = teamOneScore; 214 | } 215 | else 216 | { 217 | MessageBox.Show("Please enter a valid score for team 1."); 218 | return; 219 | } 220 | } 221 | } 222 | 223 | if (i == 1) 224 | { 225 | if (m.Entries[1].TeamCompeting != null) 226 | { 227 | bool scoreValid = double.TryParse(teamTwoScoreValue.Text, out teamTwoScore); 228 | 229 | if (scoreValid) 230 | { 231 | m.Entries[1].Score = teamTwoScore; 232 | } 233 | else 234 | { 235 | MessageBox.Show("Please enter a valid score for team 2."); 236 | return; 237 | } 238 | } 239 | } 240 | } 241 | 242 | try 243 | { 244 | TournamentLogic.UpdateTournamentResults(tournament); 245 | } 246 | catch (Exception ex) 247 | { 248 | MessageBox.Show($"The application had the following error: { ex.Message }"); 249 | return; 250 | } 251 | 252 | LoadMatchups((int)roundDropDown.SelectedItem); 253 | } 254 | } 255 | } 256 | -------------------------------------------------------------------------------- /TrackerUI/TournamentDashboardForm.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace TrackerUI 2 | { 3 | partial class TournamentDashboardForm 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.loadExistingTournamentDropDown = new System.Windows.Forms.ComboBox(); 33 | this.loadExistingTournamentLabel = new System.Windows.Forms.Label(); 34 | this.loadTournamentButton = new System.Windows.Forms.Button(); 35 | this.createTournamentButton = new System.Windows.Forms.Button(); 36 | this.SuspendLayout(); 37 | // 38 | // headerLabel 39 | // 40 | this.headerLabel.AutoSize = true; 41 | this.headerLabel.Font = new System.Drawing.Font("Segoe UI Light", 28.125F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 42 | this.headerLabel.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(153)))), ((int)(((byte)(255))))); 43 | this.headerLabel.Location = new System.Drawing.Point(302, 47); 44 | this.headerLabel.Name = "headerLabel"; 45 | this.headerLabel.Size = new System.Drawing.Size(778, 100); 46 | this.headerLabel.TabIndex = 13; 47 | this.headerLabel.Text = "Tournament Dashboard"; 48 | // 49 | // loadExistingTournamentDropDown 50 | // 51 | this.loadExistingTournamentDropDown.FormattingEnabled = true; 52 | this.loadExistingTournamentDropDown.Location = new System.Drawing.Point(235, 308); 53 | this.loadExistingTournamentDropDown.Name = "loadExistingTournamentDropDown"; 54 | this.loadExistingTournamentDropDown.Size = new System.Drawing.Size(920, 67); 55 | this.loadExistingTournamentDropDown.TabIndex = 20; 56 | // 57 | // loadExistingTournamentLabel 58 | // 59 | this.loadExistingTournamentLabel.AutoSize = true; 60 | this.loadExistingTournamentLabel.Font = new System.Drawing.Font("Segoe UI", 19.875F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 61 | this.loadExistingTournamentLabel.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(153)))), ((int)(((byte)(255))))); 62 | this.loadExistingTournamentLabel.Location = new System.Drawing.Point(375, 222); 63 | this.loadExistingTournamentLabel.Name = "loadExistingTournamentLabel"; 64 | this.loadExistingTournamentLabel.Size = new System.Drawing.Size(633, 71); 65 | this.loadExistingTournamentLabel.TabIndex = 19; 66 | this.loadExistingTournamentLabel.Text = "Load Existing Tournament"; 67 | // 68 | // loadTournamentButton 69 | // 70 | this.loadTournamentButton.FlatAppearance.BorderColor = System.Drawing.Color.Silver; 71 | this.loadTournamentButton.FlatAppearance.MouseDownBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(102)))), ((int)(((byte)(102)))), ((int)(((byte)(202))))); 72 | this.loadTournamentButton.FlatAppearance.MouseOverBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(242)))), ((int)(((byte)(242)))), ((int)(((byte)(242))))); 73 | this.loadTournamentButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat; 74 | this.loadTournamentButton.Font = new System.Drawing.Font("Segoe UI Semibold", 16.125F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 75 | this.loadTournamentButton.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(153)))), ((int)(((byte)(255))))); 76 | this.loadTournamentButton.Location = new System.Drawing.Point(387, 402); 77 | this.loadTournamentButton.Name = "loadTournamentButton"; 78 | this.loadTournamentButton.Size = new System.Drawing.Size(628, 106); 79 | this.loadTournamentButton.TabIndex = 21; 80 | this.loadTournamentButton.Text = "Load Tournament"; 81 | this.loadTournamentButton.UseVisualStyleBackColor = true; 82 | this.loadTournamentButton.Click += new System.EventHandler(this.loadTournamentButton_Click); 83 | // 84 | // createTournamentButton 85 | // 86 | this.createTournamentButton.FlatAppearance.BorderColor = System.Drawing.Color.Silver; 87 | this.createTournamentButton.FlatAppearance.MouseDownBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(102)))), ((int)(((byte)(102)))), ((int)(((byte)(202))))); 88 | this.createTournamentButton.FlatAppearance.MouseOverBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(242)))), ((int)(((byte)(242)))), ((int)(((byte)(242))))); 89 | this.createTournamentButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat; 90 | this.createTournamentButton.Font = new System.Drawing.Font("Segoe UI Semibold", 16.125F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 91 | this.createTournamentButton.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(153)))), ((int)(((byte)(255))))); 92 | this.createTournamentButton.Location = new System.Drawing.Point(352, 567); 93 | this.createTournamentButton.Name = "createTournamentButton"; 94 | this.createTournamentButton.Size = new System.Drawing.Size(679, 172); 95 | this.createTournamentButton.TabIndex = 26; 96 | this.createTournamentButton.Text = "Create Tournament"; 97 | this.createTournamentButton.UseVisualStyleBackColor = true; 98 | this.createTournamentButton.Click += new System.EventHandler(this.createTournamentButton_Click); 99 | // 100 | // TournamentDashboardForm 101 | // 102 | this.AutoScaleDimensions = new System.Drawing.SizeF(192F, 192F); 103 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; 104 | this.BackColor = System.Drawing.Color.White; 105 | this.ClientSize = new System.Drawing.Size(1390, 806); 106 | this.Controls.Add(this.createTournamentButton); 107 | this.Controls.Add(this.loadTournamentButton); 108 | this.Controls.Add(this.loadExistingTournamentDropDown); 109 | this.Controls.Add(this.loadExistingTournamentLabel); 110 | this.Controls.Add(this.headerLabel); 111 | this.Font = new System.Drawing.Font("Segoe UI", 16.125F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 112 | this.Margin = new System.Windows.Forms.Padding(6, 7, 6, 7); 113 | this.Name = "TournamentDashboardForm"; 114 | this.Text = "Tournament Dashboard"; 115 | this.ResumeLayout(false); 116 | this.PerformLayout(); 117 | 118 | } 119 | 120 | #endregion 121 | 122 | private System.Windows.Forms.Label headerLabel; 123 | private System.Windows.Forms.ComboBox loadExistingTournamentDropDown; 124 | private System.Windows.Forms.Label loadExistingTournamentLabel; 125 | private System.Windows.Forms.Button loadTournamentButton; 126 | private System.Windows.Forms.Button createTournamentButton; 127 | } 128 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.rsuser 8 | *.suo 9 | *.user 10 | *.userosscache 11 | *.sln.docstates 12 | 13 | # User-specific files (MonoDevelop/Xamarin Studio) 14 | *.userprefs 15 | 16 | # Mono auto generated files 17 | mono_crash.* 18 | 19 | # Build results 20 | [Dd]ebug/ 21 | [Dd]ebugPublic/ 22 | [Rr]elease/ 23 | [Rr]eleases/ 24 | x64/ 25 | x86/ 26 | [Aa][Rr][Mm]/ 27 | [Aa][Rr][Mm]64/ 28 | bld/ 29 | [Bb]in/ 30 | [Oo]bj/ 31 | [Ll]og/ 32 | [Ll]ogs/ 33 | 34 | # Visual Studio 2015/2017 cache/options directory 35 | .vs/ 36 | # Uncomment if you have tasks that create the project's static files in wwwroot 37 | #wwwroot/ 38 | 39 | # Visual Studio 2017 auto generated files 40 | Generated\ Files/ 41 | 42 | # MSTest test Results 43 | [Tt]est[Rr]esult*/ 44 | [Bb]uild[Ll]og.* 45 | 46 | # NUnit 47 | *.VisualState.xml 48 | TestResult.xml 49 | nunit-*.xml 50 | 51 | # Build Results of an ATL Project 52 | [Dd]ebugPS/ 53 | [Rr]eleasePS/ 54 | dlldata.c 55 | 56 | # Benchmark Results 57 | BenchmarkDotNet.Artifacts/ 58 | 59 | # .NET Core 60 | project.lock.json 61 | project.fragment.lock.json 62 | artifacts/ 63 | 64 | # StyleCop 65 | StyleCopReport.xml 66 | 67 | # Files built by Visual Studio 68 | *_i.c 69 | *_p.c 70 | *_h.h 71 | *.ilk 72 | *.meta 73 | *.obj 74 | *.iobj 75 | *.pch 76 | *.pdb 77 | *.ipdb 78 | *.pgc 79 | *.pgd 80 | *.rsp 81 | *.sbr 82 | *.tlb 83 | *.tli 84 | *.tlh 85 | *.tmp 86 | *.tmp_proj 87 | *_wpftmp.csproj 88 | *.log 89 | *.vspscc 90 | *.vssscc 91 | .builds 92 | *.pidb 93 | *.svclog 94 | *.scc 95 | 96 | # Chutzpah Test files 97 | _Chutzpah* 98 | 99 | # Visual C++ cache files 100 | ipch/ 101 | *.aps 102 | *.ncb 103 | *.opendb 104 | *.opensdf 105 | *.sdf 106 | *.cachefile 107 | *.VC.db 108 | *.VC.VC.opendb 109 | 110 | # Visual Studio profiler 111 | *.psess 112 | *.vsp 113 | *.vspx 114 | *.sap 115 | 116 | # Visual Studio Trace Files 117 | *.e2e 118 | 119 | # TFS 2012 Local Workspace 120 | $tf/ 121 | 122 | # Guidance Automation Toolkit 123 | *.gpState 124 | 125 | # ReSharper is a .NET coding add-in 126 | _ReSharper*/ 127 | *.[Rr]e[Ss]harper 128 | *.DotSettings.user 129 | 130 | # TeamCity is a build add-in 131 | _TeamCity* 132 | 133 | # DotCover is a Code Coverage Tool 134 | *.dotCover 135 | 136 | # AxoCover is a Code Coverage Tool 137 | .axoCover/* 138 | !.axoCover/settings.json 139 | 140 | # Visual Studio code coverage results 141 | *.coverage 142 | *.coveragexml 143 | 144 | # NCrunch 145 | _NCrunch_* 146 | .*crunch*.local.xml 147 | nCrunchTemp_* 148 | 149 | # MightyMoose 150 | *.mm.* 151 | AutoTest.Net/ 152 | 153 | # Web workbench (sass) 154 | .sass-cache/ 155 | 156 | # Installshield output folder 157 | [Ee]xpress/ 158 | 159 | # DocProject is a documentation generator add-in 160 | DocProject/buildhelp/ 161 | DocProject/Help/*.HxT 162 | DocProject/Help/*.HxC 163 | DocProject/Help/*.hhc 164 | DocProject/Help/*.hhk 165 | DocProject/Help/*.hhp 166 | DocProject/Help/Html2 167 | DocProject/Help/html 168 | 169 | # Click-Once directory 170 | publish/ 171 | 172 | # Publish Web Output 173 | *.[Pp]ublish.xml 174 | *.azurePubxml 175 | # Note: Comment the next line if you want to checkin your web deploy settings, 176 | # but database connection strings (with potential passwords) will be unencrypted 177 | *.pubxml 178 | *.publishproj 179 | 180 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 181 | # checkin your Azure Web App publish settings, but sensitive information contained 182 | # in these scripts will be unencrypted 183 | PublishScripts/ 184 | 185 | # NuGet Packages 186 | *.nupkg 187 | # NuGet Symbol Packages 188 | *.snupkg 189 | # The packages folder can be ignored because of Package Restore 190 | **/[Pp]ackages/* 191 | # except build/, which is used as an MSBuild target. 192 | !**/[Pp]ackages/build/ 193 | # Uncomment if necessary however generally it will be regenerated when needed 194 | #!**/[Pp]ackages/repositories.config 195 | # NuGet v3's project.json files produces more ignorable files 196 | *.nuget.props 197 | *.nuget.targets 198 | 199 | # Microsoft Azure Build Output 200 | csx/ 201 | *.build.csdef 202 | 203 | # Microsoft Azure Emulator 204 | ecf/ 205 | rcf/ 206 | 207 | # Windows Store app package directories and files 208 | AppPackages/ 209 | BundleArtifacts/ 210 | Package.StoreAssociation.xml 211 | _pkginfo.txt 212 | *.appx 213 | *.appxbundle 214 | *.appxupload 215 | 216 | # Visual Studio cache files 217 | # files ending in .cache can be ignored 218 | *.[Cc]ache 219 | # but keep track of directories ending in .cache 220 | !?*.[Cc]ache/ 221 | 222 | # Others 223 | ClientBin/ 224 | ~$* 225 | *~ 226 | *.dbmdl 227 | *.dbproj.schemaview 228 | *.jfm 229 | *.pfx 230 | *.publishsettings 231 | orleans.codegen.cs 232 | 233 | # Including strong name files can present a security risk 234 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 235 | #*.snk 236 | 237 | # Since there are multiple workflows, uncomment next line to ignore bower_components 238 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 239 | #bower_components/ 240 | 241 | # RIA/Silverlight projects 242 | Generated_Code/ 243 | 244 | # Backup & report files from converting an old project file 245 | # to a newer Visual Studio version. Backup files are not needed, 246 | # because we have git ;-) 247 | _UpgradeReport_Files/ 248 | Backup*/ 249 | UpgradeLog*.XML 250 | UpgradeLog*.htm 251 | ServiceFabricBackup/ 252 | *.rptproj.bak 253 | 254 | # SQL Server files 255 | *.mdf 256 | *.ldf 257 | *.ndf 258 | 259 | # Business Intelligence projects 260 | *.rdl.data 261 | *.bim.layout 262 | *.bim_*.settings 263 | *.rptproj.rsuser 264 | *- [Bb]ackup.rdl 265 | *- [Bb]ackup ([0-9]).rdl 266 | *- [Bb]ackup ([0-9][0-9]).rdl 267 | 268 | # Microsoft Fakes 269 | FakesAssemblies/ 270 | 271 | # GhostDoc plugin setting file 272 | *.GhostDoc.xml 273 | 274 | # Node.js Tools for Visual Studio 275 | .ntvs_analysis.dat 276 | node_modules/ 277 | 278 | # Visual Studio 6 build log 279 | *.plg 280 | 281 | # Visual Studio 6 workspace options file 282 | *.opt 283 | 284 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 285 | *.vbw 286 | 287 | # Visual Studio LightSwitch build output 288 | **/*.HTMLClient/GeneratedArtifacts 289 | **/*.DesktopClient/GeneratedArtifacts 290 | **/*.DesktopClient/ModelManifest.xml 291 | **/*.Server/GeneratedArtifacts 292 | **/*.Server/ModelManifest.xml 293 | _Pvt_Extensions 294 | 295 | # Paket dependency manager 296 | .paket/paket.exe 297 | paket-files/ 298 | 299 | # FAKE - F# Make 300 | .fake/ 301 | 302 | # CodeRush personal settings 303 | .cr/personal 304 | 305 | # Python Tools for Visual Studio (PTVS) 306 | __pycache__/ 307 | *.pyc 308 | 309 | # Cake - Uncomment if you are using it 310 | # tools/** 311 | # !tools/packages.config 312 | 313 | # Tabs Studio 314 | *.tss 315 | 316 | # Telerik's JustMock configuration file 317 | *.jmconfig 318 | 319 | # BizTalk build output 320 | *.btp.cs 321 | *.btm.cs 322 | *.odx.cs 323 | *.xsd.cs 324 | 325 | # OpenCover UI analysis results 326 | OpenCover/ 327 | 328 | # Azure Stream Analytics local run output 329 | ASALocalRun/ 330 | 331 | # MSBuild Binary and Structured Log 332 | *.binlog 333 | 334 | # NVidia Nsight GPU debugger configuration file 335 | *.nvuser 336 | 337 | # MFractors (Xamarin productivity tool) working folder 338 | .mfractor/ 339 | 340 | # Local History for Visual Studio 341 | .localhistory/ 342 | 343 | # BeatPulse healthcheck temp database 344 | healthchecksdb 345 | 346 | # Backup folder for Package Reference Convert tool in Visual Studio 2017 347 | MigrationBackup/ 348 | 349 | # Ionide (cross platform F# VS Code tools) working folder 350 | .ionide/ 351 | -------------------------------------------------------------------------------- /TrackerUI/CreatePrizeForm.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace TrackerUI 2 | { 3 | partial class CreatePrizeForm 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.placeNumberValue = new System.Windows.Forms.TextBox(); 33 | this.placeNumberLabel = new System.Windows.Forms.Label(); 34 | this.placeNameValue = new System.Windows.Forms.TextBox(); 35 | this.placeNameLabel = new System.Windows.Forms.Label(); 36 | this.prizeAmountValue = new System.Windows.Forms.TextBox(); 37 | this.prizeAmountLabel = new System.Windows.Forms.Label(); 38 | this.prizePercentageValue = new System.Windows.Forms.TextBox(); 39 | this.prizePercentageLabel = new System.Windows.Forms.Label(); 40 | this.orLabel = new System.Windows.Forms.Label(); 41 | this.createPrizeButton = new System.Windows.Forms.Button(); 42 | this.SuspendLayout(); 43 | // 44 | // headerLabel 45 | // 46 | this.headerLabel.AutoSize = true; 47 | this.headerLabel.Font = new System.Drawing.Font("Segoe UI Light", 28.125F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 48 | this.headerLabel.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(153)))), ((int)(((byte)(255))))); 49 | this.headerLabel.Location = new System.Drawing.Point(53, 38); 50 | this.headerLabel.Name = "headerLabel"; 51 | this.headerLabel.Size = new System.Drawing.Size(422, 100); 52 | this.headerLabel.TabIndex = 12; 53 | this.headerLabel.Text = "Create Prize"; 54 | // 55 | // placeNumberValue 56 | // 57 | this.placeNumberValue.Location = new System.Drawing.Point(495, 195); 58 | this.placeNumberValue.Name = "placeNumberValue"; 59 | this.placeNumberValue.Size = new System.Drawing.Size(535, 65); 60 | this.placeNumberValue.TabIndex = 14; 61 | // 62 | // placeNumberLabel 63 | // 64 | this.placeNumberLabel.AutoSize = true; 65 | this.placeNumberLabel.Font = new System.Drawing.Font("Segoe UI", 19.875F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 66 | this.placeNumberLabel.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(153)))), ((int)(((byte)(255))))); 67 | this.placeNumberLabel.Location = new System.Drawing.Point(62, 189); 68 | this.placeNumberLabel.Name = "placeNumberLabel"; 69 | this.placeNumberLabel.Size = new System.Drawing.Size(360, 71); 70 | this.placeNumberLabel.TabIndex = 13; 71 | this.placeNumberLabel.Text = "Place Number"; 72 | // 73 | // placeNameValue 74 | // 75 | this.placeNameValue.Location = new System.Drawing.Point(495, 309); 76 | this.placeNameValue.Name = "placeNameValue"; 77 | this.placeNameValue.Size = new System.Drawing.Size(535, 65); 78 | this.placeNameValue.TabIndex = 16; 79 | // 80 | // placeNameLabel 81 | // 82 | this.placeNameLabel.AutoSize = true; 83 | this.placeNameLabel.Font = new System.Drawing.Font("Segoe UI", 19.875F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 84 | this.placeNameLabel.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(153)))), ((int)(((byte)(255))))); 85 | this.placeNameLabel.Location = new System.Drawing.Point(62, 303); 86 | this.placeNameLabel.Name = "placeNameLabel"; 87 | this.placeNameLabel.Size = new System.Drawing.Size(308, 71); 88 | this.placeNameLabel.TabIndex = 15; 89 | this.placeNameLabel.Text = "Place Name"; 90 | // 91 | // prizeAmountValue 92 | // 93 | this.prizeAmountValue.Location = new System.Drawing.Point(495, 427); 94 | this.prizeAmountValue.Name = "prizeAmountValue"; 95 | this.prizeAmountValue.Size = new System.Drawing.Size(535, 65); 96 | this.prizeAmountValue.TabIndex = 18; 97 | this.prizeAmountValue.Text = "0"; 98 | // 99 | // prizeAmountLabel 100 | // 101 | this.prizeAmountLabel.AutoSize = true; 102 | this.prizeAmountLabel.Font = new System.Drawing.Font("Segoe UI", 19.875F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 103 | this.prizeAmountLabel.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(153)))), ((int)(((byte)(255))))); 104 | this.prizeAmountLabel.Location = new System.Drawing.Point(62, 421); 105 | this.prizeAmountLabel.Name = "prizeAmountLabel"; 106 | this.prizeAmountLabel.Size = new System.Drawing.Size(347, 71); 107 | this.prizeAmountLabel.TabIndex = 17; 108 | this.prizeAmountLabel.Text = "Prize Amount"; 109 | // 110 | // prizePercentageValue 111 | // 112 | this.prizePercentageValue.Location = new System.Drawing.Point(495, 656); 113 | this.prizePercentageValue.Name = "prizePercentageValue"; 114 | this.prizePercentageValue.Size = new System.Drawing.Size(535, 65); 115 | this.prizePercentageValue.TabIndex = 20; 116 | this.prizePercentageValue.Text = "0"; 117 | // 118 | // prizePercentageLabel 119 | // 120 | this.prizePercentageLabel.AutoSize = true; 121 | this.prizePercentageLabel.Font = new System.Drawing.Font("Segoe UI", 19.875F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 122 | this.prizePercentageLabel.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(153)))), ((int)(((byte)(255))))); 123 | this.prizePercentageLabel.Location = new System.Drawing.Point(62, 650); 124 | this.prizePercentageLabel.Name = "prizePercentageLabel"; 125 | this.prizePercentageLabel.Size = new System.Drawing.Size(418, 71); 126 | this.prizePercentageLabel.TabIndex = 19; 127 | this.prizePercentageLabel.Text = "Prize Percentage"; 128 | // 129 | // orLabel 130 | // 131 | this.orLabel.AutoSize = true; 132 | this.orLabel.Font = new System.Drawing.Font("Segoe UI", 19.875F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 133 | this.orLabel.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(153)))), ((int)(((byte)(255))))); 134 | this.orLabel.Location = new System.Drawing.Point(483, 539); 135 | this.orLabel.Name = "orLabel"; 136 | this.orLabel.Size = new System.Drawing.Size(121, 71); 137 | this.orLabel.TabIndex = 21; 138 | this.orLabel.Text = "-or-"; 139 | // 140 | // createPrizeButton 141 | // 142 | this.createPrizeButton.FlatAppearance.BorderColor = System.Drawing.Color.Silver; 143 | this.createPrizeButton.FlatAppearance.MouseDownBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(102)))), ((int)(((byte)(102)))), ((int)(((byte)(202))))); 144 | this.createPrizeButton.FlatAppearance.MouseOverBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(242)))), ((int)(((byte)(242)))), ((int)(((byte)(242))))); 145 | this.createPrizeButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat; 146 | this.createPrizeButton.Font = new System.Drawing.Font("Segoe UI Semibold", 16.125F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 147 | this.createPrizeButton.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(153)))), ((int)(((byte)(255))))); 148 | this.createPrizeButton.Location = new System.Drawing.Point(271, 865); 149 | this.createPrizeButton.Name = "createPrizeButton"; 150 | this.createPrizeButton.Size = new System.Drawing.Size(628, 106); 151 | this.createPrizeButton.TabIndex = 26; 152 | this.createPrizeButton.Text = "Create Prize"; 153 | this.createPrizeButton.UseVisualStyleBackColor = true; 154 | this.createPrizeButton.Click += new System.EventHandler(this.createPrizeButton_Click); 155 | // 156 | // CreatePrizeForm 157 | // 158 | this.AutoScaleDimensions = new System.Drawing.SizeF(192F, 192F); 159 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; 160 | this.BackColor = System.Drawing.Color.White; 161 | this.ClientSize = new System.Drawing.Size(1160, 1062); 162 | this.Controls.Add(this.createPrizeButton); 163 | this.Controls.Add(this.orLabel); 164 | this.Controls.Add(this.prizePercentageValue); 165 | this.Controls.Add(this.prizePercentageLabel); 166 | this.Controls.Add(this.prizeAmountValue); 167 | this.Controls.Add(this.prizeAmountLabel); 168 | this.Controls.Add(this.placeNameValue); 169 | this.Controls.Add(this.placeNameLabel); 170 | this.Controls.Add(this.placeNumberValue); 171 | this.Controls.Add(this.placeNumberLabel); 172 | this.Controls.Add(this.headerLabel); 173 | this.Font = new System.Drawing.Font("Segoe UI", 16.125F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 174 | this.Margin = new System.Windows.Forms.Padding(6, 7, 6, 7); 175 | this.Name = "CreatePrizeForm"; 176 | this.Text = "Create Prize"; 177 | this.ResumeLayout(false); 178 | this.PerformLayout(); 179 | 180 | } 181 | 182 | #endregion 183 | 184 | private System.Windows.Forms.Label headerLabel; 185 | private System.Windows.Forms.TextBox placeNumberValue; 186 | private System.Windows.Forms.Label placeNumberLabel; 187 | private System.Windows.Forms.TextBox placeNameValue; 188 | private System.Windows.Forms.Label placeNameLabel; 189 | private System.Windows.Forms.TextBox prizeAmountValue; 190 | private System.Windows.Forms.Label prizeAmountLabel; 191 | private System.Windows.Forms.TextBox prizePercentageValue; 192 | private System.Windows.Forms.Label prizePercentageLabel; 193 | private System.Windows.Forms.Label orLabel; 194 | private System.Windows.Forms.Button createPrizeButton; 195 | } 196 | } -------------------------------------------------------------------------------- /TrackerLibrary/TournamentLogic.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Configuration; 4 | using System.Linq; 5 | using System.Text; 6 | using TrackerLibrary.Models; 7 | 8 | namespace TrackerLibrary 9 | { 10 | public static class TournamentLogic 11 | { 12 | // Order our list randomly of teams 13 | // Check if it is big enough - if not, add in byes - 2*2*2*2 - 2^4 14 | // Create our first round of matchups 15 | // Create every round after that - 8 matchups - 4 matchups - 2 matchups - 1 matchup 16 | 17 | public static void CreateRounds(TournamentModel model) 18 | { 19 | List randomizedTeams = RandomizeTeamOrder(model.EnteredTeams); 20 | int rounds = FindNumberOfRounds(randomizedTeams.Count); 21 | int byes = NumberOfByes(rounds, randomizedTeams.Count); 22 | 23 | model.Rounds.Add(CreateFirstround(byes, randomizedTeams)); 24 | 25 | CreateOtherRounds(model, rounds); 26 | 27 | UpdateTournamentResults(model); 28 | } 29 | 30 | public static void UpdateTournamentResults(TournamentModel model) 31 | { 32 | int startingRound = model.CheckCurrentRound(); 33 | List toScore = new List(); 34 | 35 | foreach (List round in model.Rounds) 36 | { 37 | foreach (MatchupModel rm in round) 38 | { 39 | if (rm.Winner == null && (rm.Entries.Any(x => x.Score != 0) || rm.Entries.Count == 1)) 40 | { 41 | toScore.Add(rm); 42 | } 43 | } 44 | } 45 | 46 | MarkWinnersInMatchups(toScore); 47 | 48 | AdvancedWinners(toScore, model); 49 | 50 | toScore.ForEach(x => GlobalConfig.Connection.UpdateMatchup(x)); 51 | 52 | int endingRound = model.CheckCurrentRound(); 53 | 54 | if (endingRound > startingRound) 55 | { 56 | model.AlertUsersToNewRound(); 57 | } 58 | } 59 | 60 | public static void AlertUsersToNewRound(this TournamentModel model) 61 | { 62 | int currentRoundNumber = model.CheckCurrentRound(); 63 | List currentRound = model.Rounds.Where(x => x.First().MatchupRound == currentRoundNumber).First(); 64 | 65 | foreach (MatchupModel matchup in currentRound) 66 | { 67 | foreach (MatchupEntryModel me in matchup.Entries) 68 | { 69 | foreach (PersonModel p in me.TeamCompeting.TeamMembers) 70 | { 71 | AlertPersonToNewRound(p, me.TeamCompeting.TeamName, matchup.Entries.Where(x => x.TeamCompeting != me.TeamCompeting).FirstOrDefault()); 72 | } 73 | } 74 | } 75 | } 76 | 77 | private static void AlertPersonToNewRound(PersonModel p, string teamName, MatchupEntryModel competitor) 78 | { 79 | if (p.EmailAddress.Length == 0) 80 | { 81 | return; 82 | } 83 | 84 | string toAddress = ""; 85 | string subject = ""; 86 | StringBuilder body = new StringBuilder(); 87 | 88 | if (competitor != null) 89 | { 90 | subject = $"You have a new matchup with { competitor.TeamCompeting.TeamName }"; 91 | 92 | body.AppendLine("

You have a new matchup

"); 93 | body.Append("Competitor: "); 94 | body.AppendLine(competitor.TeamCompeting.TeamName); 95 | body.AppendLine(); 96 | body.AppendLine(); 97 | body.AppendLine("Have a great time!"); 98 | body.AppendLine("~Tournament Tracker"); 99 | } 100 | else 101 | { 102 | subject = "You have a bye week this round"; 103 | 104 | body.AppendLine("Enjoy your round off!"); 105 | body.AppendLine("~Tournament Tracker"); 106 | } 107 | 108 | toAddress = p.EmailAddress; 109 | 110 | EmailLogic.SendEmail(toAddress, subject, body.ToString()); 111 | } 112 | 113 | private static int CheckCurrentRound(this TournamentModel model) 114 | { 115 | int output = 1; 116 | 117 | foreach (List 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 | } --------------------------------------------------------------------------------