TournamentForm . populated teams list

This commit is contained in:
2020-04-03 00:05:25 +02:00
parent eecd527e69
commit 8ac467e2f0
6 changed files with 52 additions and 15 deletions

View File

@ -10,6 +10,7 @@ namespace TrackerLibrary.DataAccess
PrizeModel CreatePrize(PrizeModel model);
PersonModel CreatePerson(PersonModel model);
TeamModel CreateTeam(TeamModel model);
List<TeamModel> GetTeam_All();
List<PersonModel> GetPerson_All();
}
}

View File

@ -99,5 +99,22 @@ namespace TrackerLibrary.DataAccess
}
return output;
}
public List<TeamModel> GetTeam_All()
{
List<TeamModel> output;
using (IDbConnection connection = new System.Data.SqlClient.SqlConnection(GlobalConfig.CnnString(db)))
{
output = connection.Query<TeamModel>("dbo.spTeam_GetAll").ToList();
foreach(TeamModel team in output)
{
var p = new DynamicParameters();
p.Add("@TeamId", team.Id);
team.TeamMembers = connection.Query<PersonModel>("dbo.spTeamMembers_GetByTeam",p, commandType: CommandType.StoredProcedure).ToList();
}
}
return output;
}
}
}

View File

@ -93,5 +93,10 @@ namespace TrackerLibrary.DataAccess
{
return PeopleFile.FullFilePath().LoadFile().ConvertToPersonModels();
}
public List<TeamModel> GetTeam_All()
{
throw new NotImplementedException();
}
}
}

View File

@ -39,7 +39,7 @@
this.createNewTeamLink = new System.Windows.Forms.LinkLabel();
this.addTeamButton = new System.Windows.Forms.Button();
this.cratePrizeButton = new System.Windows.Forms.Button();
this.tournamentPlayersListBox = new System.Windows.Forms.ListBox();
this.tournamentTeamsListBox = new System.Windows.Forms.ListBox();
this.tournamentPlayersLabel = new System.Windows.Forms.Label();
this.deleteSelectedPlayerButton = new System.Windows.Forms.Button();
this.deleteSelectedPrizeButton = new System.Windows.Forms.Button();
@ -153,15 +153,15 @@
this.cratePrizeButton.Text = "Create Prize";
this.cratePrizeButton.UseVisualStyleBackColor = true;
//
// tournamentPlayersListBox
// tournamentTeamsListBox
//
this.tournamentPlayersListBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.tournamentPlayersListBox.FormattingEnabled = true;
this.tournamentPlayersListBox.ItemHeight = 30;
this.tournamentPlayersListBox.Location = new System.Drawing.Point(431, 119);
this.tournamentPlayersListBox.Name = "tournamentPlayersListBox";
this.tournamentPlayersListBox.Size = new System.Drawing.Size(338, 152);
this.tournamentPlayersListBox.TabIndex = 18;
this.tournamentTeamsListBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.tournamentTeamsListBox.FormattingEnabled = true;
this.tournamentTeamsListBox.ItemHeight = 30;
this.tournamentTeamsListBox.Location = new System.Drawing.Point(431, 119);
this.tournamentTeamsListBox.Name = "tournamentTeamsListBox";
this.tournamentTeamsListBox.Size = new System.Drawing.Size(338, 152);
this.tournamentTeamsListBox.TabIndex = 18;
//
// tournamentPlayersLabel
//
@ -209,9 +209,9 @@
this.prizesLabel.ForeColor = System.Drawing.Color.DodgerBlue;
this.prizesLabel.Location = new System.Drawing.Point(424, 287);
this.prizesLabel.Name = "prizesLabel";
this.prizesLabel.Size = new System.Drawing.Size(198, 37);
this.prizesLabel.Size = new System.Drawing.Size(85, 37);
this.prizesLabel.TabIndex = 22;
this.prizesLabel.Text = "Teams / Players";
this.prizesLabel.Text = "Prizes";
//
// prizesListBox
//
@ -249,7 +249,7 @@
this.Controls.Add(this.prizesListBox);
this.Controls.Add(this.deleteSelectedPlayerButton);
this.Controls.Add(this.tournamentPlayersLabel);
this.Controls.Add(this.tournamentPlayersListBox);
this.Controls.Add(this.tournamentTeamsListBox);
this.Controls.Add(this.cratePrizeButton);
this.Controls.Add(this.addTeamButton);
this.Controls.Add(this.createNewTeamLink);
@ -282,7 +282,7 @@
private System.Windows.Forms.LinkLabel createNewTeamLink;
private System.Windows.Forms.Button addTeamButton;
private System.Windows.Forms.Button cratePrizeButton;
private System.Windows.Forms.ListBox tournamentPlayersListBox;
private System.Windows.Forms.ListBox tournamentTeamsListBox;
private System.Windows.Forms.Label tournamentPlayersLabel;
private System.Windows.Forms.Button deleteSelectedPlayerButton;
private System.Windows.Forms.Button deleteSelectedPrizeButton;

View File

@ -7,14 +7,28 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using TrackerLibrary;
using TrackerLibrary.Models;
namespace TrackerUI
{
public partial class CreateTournamentForm : Form
{
List<TeamModel> availableTeams = GlobalConfig.Connection.GetTeam_All();
List<TeamModel> selectedTeams = new List<TeamModel>();
public CreateTournamentForm()
{
InitializeComponent();
InitializeLists();
}
private void InitializeLists()
{
selectTeamDropDown.DataSource = availableTeams;
selectTeamDropDown.DisplayMember = "TeamName";
tournamentTeamsListBox.DataSource = selectedTeams;
tournamentTeamsListBox.DisplayMember = "TeamName";
}
}
}

View File

@ -19,8 +19,8 @@ namespace TrackerUI
Application.SetCompatibleTextRenderingDefault(false);
// Initialize the database connections
GlobalConfig.InitializeConnections(DatabaseType.TextFile);
Application.Run(new CreateTeamForm());
GlobalConfig.InitializeConnections(DatabaseType.Sql);
Application.Run(new CreateTournamentForm());
//Application.Run(new TournamentDashboardForm());
}