Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
487 changes: 487 additions & 0 deletions .gitignore

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions TournamentTracker.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TrackerLibrary", "TrackerLi
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TrackerUI", "TrackerUI\TrackerUI.csproj", "{8EB74BF4-C68D-42F8-A891-51A2DFCB9BB1}"
EndProject
Project("{00D1A9C2-B5F0-4AF3-8072-F6C62B433612}") = "TournamentsDB", "TournamentsDB\TournamentsDB.sqlproj", "{597714D5-8069-4CDA-9919-DB5775FB027B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -21,6 +23,12 @@ Global
{8EB74BF4-C68D-42F8-A891-51A2DFCB9BB1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8EB74BF4-C68D-42F8-A891-51A2DFCB9BB1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8EB74BF4-C68D-42F8-A891-51A2DFCB9BB1}.Release|Any CPU.Build.0 = Release|Any CPU
{597714D5-8069-4CDA-9919-DB5775FB027B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{597714D5-8069-4CDA-9919-DB5775FB027B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{597714D5-8069-4CDA-9919-DB5775FB027B}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
{597714D5-8069-4CDA-9919-DB5775FB027B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{597714D5-8069-4CDA-9919-DB5775FB027B}.Release|Any CPU.Build.0 = Release|Any CPU
{597714D5-8069-4CDA-9919-DB5775FB027B}.Release|Any CPU.Deploy.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
98 changes: 98 additions & 0 deletions TournamentsDB/TournamentsDB.sqlproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<Name>TournamentsDB</Name>
<SchemaVersion>2.0</SchemaVersion>
<ProjectVersion>4.1</ProjectVersion>
<ProjectGuid>{597714d5-8069-4cda-9919-db5775fb027b}</ProjectGuid>
<DSP>Microsoft.Data.Tools.Schema.Sql.Sql160DatabaseSchemaProvider</DSP>
<OutputType>Database</OutputType>
<RootPath>
</RootPath>
<RootNamespace>TournamentsDB</RootNamespace>
<AssemblyName>TournamentsDB</AssemblyName>
<ModelCollation>1033, CI</ModelCollation>
<DefaultFileStructure>BySchemaAndSchemaType</DefaultFileStructure>
<DeployToDatabase>True</DeployToDatabase>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<TargetLanguage>CS</TargetLanguage>
<AppDesignerFolder>Properties</AppDesignerFolder>
<SqlServerVerification>False</SqlServerVerification>
<IncludeCompositeObjects>True</IncludeCompositeObjects>
<TargetDatabaseSet>True</TargetDatabaseSet>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<OutputPath>bin\Release\</OutputPath>
<BuildScriptName>$(MSBuildProjectName).sql</BuildScriptName>
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<DefineDebug>false</DefineDebug>
<DefineTrace>true</DefineTrace>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<OutputPath>bin\Debug\</OutputPath>
<BuildScriptName>$(MSBuildProjectName).sql</BuildScriptName>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<DefineDebug>true</DefineDebug>
<DefineTrace>true</DefineTrace>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">11.0</VisualStudioVersion>
<!-- Default to the v11.0 targets path if the targets file for the current VS version is not found -->
<SSDTExists Condition="Exists('$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets')">True</SSDTExists>
<VisualStudioVersion Condition="'$(SSDTExists)' == ''">11.0</VisualStudioVersion>
</PropertyGroup>
<Import Condition="'$(SQLDBExtensionsRefPath)' != ''" Project="$(SQLDBExtensionsRefPath)\Microsoft.Data.Tools.Schema.SqlTasks.targets" />
<Import Condition="'$(SQLDBExtensionsRefPath)' == ''" Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets" />
<ItemGroup>
<Folder Include="Properties" />
<Folder Include="dbo\" />
<Folder Include="dbo\Tables\" />
<Folder Include="dbo\Stored Procedures\" />
<Folder Include="PublishProfiles" />
</ItemGroup>
<ItemGroup>
<Build Include="dbo\Tables\Tournaments.sql" />
<Build Include="dbo\Tables\TournamentPrizes.sql" />
<Build Include="dbo\Tables\TournamentEntries.sql" />
<Build Include="dbo\Tables\Teams.sql" />
<Build Include="dbo\Tables\TeamMembers.sql" />
<Build Include="dbo\Tables\Prizes.sql" />
<Build Include="dbo\Tables\People.sql" />
<Build Include="dbo\Tables\Matchups.sql" />
<Build Include="dbo\Tables\MatchupEntries.sql" />
<Build Include="dbo\Stored Procedures\spTournaments_Insert.sql" />
<Build Include="dbo\Stored Procedures\spTournaments_GetAll.sql" />
<Build Include="dbo\Stored Procedures\spTournaments_Complete.sql" />
<Build Include="dbo\Stored Procedures\spTournamentPrizes_Insert.sql" />
<Build Include="dbo\Stored Procedures\spTournamentEntries_Insert.sql" />
<Build Include="dbo\Stored Procedures\spTeams_Insert.sql" />
<Build Include="dbo\Stored Procedures\spTeams_GetByTournament.sql" />
<Build Include="dbo\Stored Procedures\spTeamMembers_Insert.sql" />
<Build Include="dbo\Stored Procedures\spTeamMembers_GetByTeam.sql" />
<Build Include="dbo\Stored Procedures\spTeam_GetAll.sql" />
<Build Include="dbo\Stored Procedures\spPrizes_Insert.sql" />
<Build Include="dbo\Stored Procedures\spPrizes_GetByTournament.sql" />
<Build Include="dbo\Stored Procedures\spPeople_Insert.sql" />
<Build Include="dbo\Stored Procedures\spPeople_GetAll.sql" />
<Build Include="dbo\Stored Procedures\spMatchups_Update.sql" />
<Build Include="dbo\Stored Procedures\spMatchups_Insert.sql" />
<Build Include="dbo\Stored Procedures\spMatchups_GetByTournament.sql" />
<Build Include="dbo\Stored Procedures\spMatchupEntries_Update.sql" />
<Build Include="dbo\Stored Procedures\spMatchupEntries_Insert.sql" />
<Build Include="dbo\Stored Procedures\spMatchupEntries_GetByMatchup.sql" />
</ItemGroup>
<ItemGroup>
<None Include="PublishProfiles\TournamentsDBToPc.publish.xml" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
CREATE PROCEDURE [spMatchupEntries_GetByMatchup]
@MatchupId int

AS
BEGIN

SET NOCOUNT ON;

select me.*
from MatchupEntries me
inner join Matchups m on me.MatchupId = m.id
where m.id = @MatchupId;

END
19 changes: 19 additions & 0 deletions TournamentsDB/dbo/Stored Procedures/spMatchupEntries_Insert.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
-- =============================================
-- Author: Alejandro
-- Create date: 2/4/2024
-- Description: Inserts a new matchup entry.
-- =============================================
CREATE PROCEDURE dbo.spMatchupEntries_Insert
@MatchupId int,
@ParentMatchupId int,
@TeamCompetingId int,
@id int = 0 output
AS
BEGIN
SET NOCOUNT ON;

insert into MatchupEntries(MatchupId,ParentMatchupId,TeamCompetingId)
values (@MatchupId,@ParentMatchupId,@TeamCompetingId);

select @id = SCOPE_IDENTITY();
END
18 changes: 18 additions & 0 deletions TournamentsDB/dbo/Stored Procedures/spMatchupEntries_Update.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
-- =============================================
-- Author: Alejandro
-- Create date: 4/2/2024
-- Description: Updates the team competing id or the score of a matchup entry.
-- =============================================
CREATE PROCEDURE dbo.spMatchupEntries_Update
@id int,
@TeamCompetingId int = null,
@Score float = null
AS
BEGIN
SET NOCOUNT ON;

update dbo.MatchupEntries
set TeamCompetingId = @TeamCompetingId, Score = @Score
where id = @Id;

END
14 changes: 14 additions & 0 deletions TournamentsDB/dbo/Stored Procedures/spMatchups_GetByTournament.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
CREATE PROCEDURE [spMatchups_GetByTournament]
@TournamentId int

AS
BEGIN

SET NOCOUNT ON;

select m.*
from Matchups as m
where m.TournamentId = @TournamentId
order by MatchupRound;

END
18 changes: 18 additions & 0 deletions TournamentsDB/dbo/Stored Procedures/spMatchups_Insert.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
-- =============================================
-- Author: Alejandro
-- Create date: 2/4/2024
-- Description: Inserts a new matchup.
-- =============================================
CREATE PROCEDURE dbo.spMatchups_Insert
@TournamentId int,
@MatchupRound int,
@id int = 0 output
AS
BEGIN
SET NOCOUNT ON;

insert into Matchups(TournamentId,MatchupRound)
values (@TournamentId,@MatchupRound);

select @id = SCOPE_IDENTITY();
END
17 changes: 17 additions & 0 deletions TournamentsDB/dbo/Stored Procedures/spMatchups_Update.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
-- =============================================
-- Author: Alejandro
-- Create date: 4/2/2024
-- Description: Updates the winner id of a matchup.
-- =============================================
CREATE PROCEDURE dbo.spMatchups_Update
@id int,
@WinnerId int
AS
BEGIN
SET NOCOUNT ON;

update dbo.Matchups
set WinnerId = @WinnerId
where id = @Id;

END
11 changes: 11 additions & 0 deletions TournamentsDB/dbo/Stored Procedures/spPeople_GetAll.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
CREATE PROCEDURE [spPeople_GetAll]

AS
BEGIN

SET NOCOUNT ON;

select *
from People;

END
24 changes: 24 additions & 0 deletions TournamentsDB/dbo/Stored Procedures/spPeople_Insert.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@


-- =============================================
-- Author: Alejandro
-- Create date: 9/18/2023
-- Description: Inserts a person in the People tables and returns the id of that record.
-- =============================================
CREATE PROCEDURE dbo.spPeople_Insert
@FirstName nvarchar(50),
@LastName nvarchar(50),
@EmailAddress nvarchar(50),
@CellPhoneNumber nvarchar(50),
@id int = 0 output

AS
BEGIN
SET NOCOUNT ON;

insert into People(FirstName, LastName, EmailAddress, CellPhoneNumber)
values(@FirstName, @LastName, @EmailAddress, @CellPhoneNumber);

select @id = SCOPE_IDENTITY();

END
14 changes: 14 additions & 0 deletions TournamentsDB/dbo/Stored Procedures/spPrizes_GetByTournament.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
CREATE PROCEDURE [spPrizes_GetByTournament]
@TournamentId int

AS
BEGIN

SET NOCOUNT ON;

select p.*
from Prizes p
inner join TournamentPrizes t on p.id = t.PrizeId
where t.tournamentId = @TournamentId;

END
21 changes: 21 additions & 0 deletions TournamentsDB/dbo/Stored Procedures/spPrizes_Insert.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
-- =============================================
-- Author: Alejandro
-- Create date: 9/10/2023
-- Description: Inserts a prize in the Prizes tables and returns the id of that record.
-- =============================================
CREATE PROCEDURE dbo.spPrizes_Insert
@PlaceNumber int,
@PlaceName nvarchar(50),
@PrizeAmount money,
@PrizePercentage float,
@id int = 0 output
AS
BEGIN
SET NOCOUNT ON;

insert into dbo.Prizes (PlaceNumber, PlaceName, PrizeAmount, PrizePercentage)
values (@PlaceNumber, @PlaceName, @PrizeAmount, @PrizePercentage);

select @id = SCOPE_IDENTITY();

END
16 changes: 16 additions & 0 deletions TournamentsDB/dbo/Stored Procedures/spTeamMembers_GetByTeam.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
CREATE PROCEDURE [spTeamMembers_GetByTeam]
@TeamId int

AS
BEGIN

SET NOCOUNT ON;

select p.*
from People as p
inner join TeamMembers as tm on p.id = tm.PersonId
inner join Teams as t on tm.TeamId = t.id
where t.id = @TeamId


END
21 changes: 21 additions & 0 deletions TournamentsDB/dbo/Stored Procedures/spTeamMembers_Insert.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@


-- =============================================
-- Author: Alejandro
-- Create date: 10/9/2023
-- Description: Inserts the relation between a team and a team member in the TeamMembers tables
-- and returns the id of that relation.
-- =============================================
CREATE PROCEDURE dbo.spTeamMembers_Insert
@TeamId int,
@PersonId int,
@id int = 0 output
AS
BEGIN
SET NOCOUNT ON;

insert into TeamMembers (TeamId,PersonId)
values (@TeamId,@PersonId);

select @id = SCOPE_IDENTITY();
END
15 changes: 15 additions & 0 deletions TournamentsDB/dbo/Stored Procedures/spTeam_GetAll.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

-- =============================================
-- Author: Alejandro
-- Create date: 11/1/2023
-- Description: Returns all the teams stored in the database.
-- =============================================
CREATE PROCEDURE dbo.spTeam_GetAll

AS
BEGIN
SET NOCOUNT ON;

select *
from dbo.Teams;
END
14 changes: 14 additions & 0 deletions TournamentsDB/dbo/Stored Procedures/spTeams_GetByTournament.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
CREATE PROCEDURE [spTeams_GetByTournament]
@TournamentId int

AS
BEGIN

SET NOCOUNT ON;

select t.*
from Teams as t
inner join TournamentEntries as e on t.id = e.TeamId
where e.TournamentId = @TournamentId;

END
Loading
Loading