TournamentViewer is working but no save yet
Interface cganged
This commit is contained in:
@ -4,8 +4,8 @@
|
||||
<add key="filePath" value="D:\data\TournamentTracker"/>
|
||||
</appSettings>
|
||||
<connectionStrings>
|
||||
<!--<add name="Tournaments" connectionString="Server=TOMMYASUS\SQLEXPR2017;Database=Tournaments;Trusted_Connection=True;" providerName="System.Data.SqlClient"/>-->
|
||||
<add name="Tournaments" connectionString="Server=.\SQLEXPR2017;Database=Tournaments;Trusted_Connection=True;" providerName="System.Data.SqlClient"/>
|
||||
<add name="Tournaments" connectionString="Server=TOMMYASUS\SQLEXPR2017;Database=Tournaments;Trusted_Connection=True;" providerName="System.Data.SqlClient"/>
|
||||
<!--<add name="Tournaments" connectionString="Server=.\SQLEXPR2017;Database=Tournaments;Trusted_Connection=True;" providerName="System.Data.SqlClient"/>-->
|
||||
<!--Data Source=TOMMYASUS\SQLEXPR2017;Initial Catalog=Tournaments;Integrated Security=True-->
|
||||
</connectionStrings>
|
||||
<startup>
|
||||
|
||||
64
TrackerUI/TournamentViewerForm.Designer.cs
generated
64
TrackerUI/TournamentViewerForm.Designer.cs
generated
@ -37,12 +37,12 @@
|
||||
this.MatchUpListBox = new System.Windows.Forms.ListBox();
|
||||
this.teamOneName = new System.Windows.Forms.Label();
|
||||
this.teamOneScoreLabel = new System.Windows.Forms.Label();
|
||||
this.teamOneScoeValue = new System.Windows.Forms.TextBox();
|
||||
this.teamTwoScoeValue = new System.Windows.Forms.TextBox();
|
||||
this.teamOneScoreValue = new System.Windows.Forms.TextBox();
|
||||
this.teamTwoScoreValue = new System.Windows.Forms.TextBox();
|
||||
this.teamTwoScoreLabel = new System.Windows.Forms.Label();
|
||||
this.teamTwoName = new System.Windows.Forms.Label();
|
||||
this.versusLabel = new System.Windows.Forms.Label();
|
||||
this.button1 = new System.Windows.Forms.Button();
|
||||
this.scoreButton = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// headerLabel
|
||||
@ -99,6 +99,7 @@
|
||||
this.unplayedOnlyCheckbox.TabIndex = 4;
|
||||
this.unplayedOnlyCheckbox.Text = "Unplayed Only";
|
||||
this.unplayedOnlyCheckbox.UseVisualStyleBackColor = true;
|
||||
this.unplayedOnlyCheckbox.CheckedChanged += new System.EventHandler(this.unplayedOnlyCheckbox_CheckedChanged);
|
||||
//
|
||||
// MatchUpListBox
|
||||
//
|
||||
@ -133,19 +134,19 @@
|
||||
this.teamOneScoreLabel.TabIndex = 7;
|
||||
this.teamOneScoreLabel.Text = "Score";
|
||||
//
|
||||
// teamOneScoeValue
|
||||
// teamOneScoreValue
|
||||
//
|
||||
this.teamOneScoeValue.Location = new System.Drawing.Point(498, 250);
|
||||
this.teamOneScoeValue.Name = "teamOneScoeValue";
|
||||
this.teamOneScoeValue.Size = new System.Drawing.Size(100, 35);
|
||||
this.teamOneScoeValue.TabIndex = 8;
|
||||
this.teamOneScoreValue.Location = new System.Drawing.Point(498, 250);
|
||||
this.teamOneScoreValue.Name = "teamOneScoreValue";
|
||||
this.teamOneScoreValue.Size = new System.Drawing.Size(100, 35);
|
||||
this.teamOneScoreValue.TabIndex = 8;
|
||||
//
|
||||
// teamTwoScoeValue
|
||||
// teamTwoScoreValue
|
||||
//
|
||||
this.teamTwoScoeValue.Location = new System.Drawing.Point(498, 389);
|
||||
this.teamTwoScoeValue.Name = "teamTwoScoeValue";
|
||||
this.teamTwoScoeValue.Size = new System.Drawing.Size(100, 35);
|
||||
this.teamTwoScoeValue.TabIndex = 11;
|
||||
this.teamTwoScoreValue.Location = new System.Drawing.Point(498, 389);
|
||||
this.teamTwoScoreValue.Name = "teamTwoScoreValue";
|
||||
this.teamTwoScoreValue.Size = new System.Drawing.Size(100, 35);
|
||||
this.teamTwoScoreValue.TabIndex = 11;
|
||||
//
|
||||
// teamTwoScoreLabel
|
||||
//
|
||||
@ -180,19 +181,20 @@
|
||||
this.versusLabel.TabIndex = 12;
|
||||
this.versusLabel.Text = "- VS -";
|
||||
//
|
||||
// button1
|
||||
// scoreButton
|
||||
//
|
||||
this.button1.FlatAppearance.BorderColor = System.Drawing.Color.Silver;
|
||||
this.button1.FlatAppearance.MouseDownBackColor = System.Drawing.Color.DimGray;
|
||||
this.button1.FlatAppearance.MouseOverBackColor = System.Drawing.Color.WhiteSmoke;
|
||||
this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.button1.ForeColor = System.Drawing.Color.DodgerBlue;
|
||||
this.button1.Location = new System.Drawing.Point(616, 286);
|
||||
this.button1.Name = "button1";
|
||||
this.button1.Size = new System.Drawing.Size(125, 58);
|
||||
this.button1.TabIndex = 13;
|
||||
this.button1.Text = "Score";
|
||||
this.button1.UseVisualStyleBackColor = true;
|
||||
this.scoreButton.FlatAppearance.BorderColor = System.Drawing.Color.Silver;
|
||||
this.scoreButton.FlatAppearance.MouseDownBackColor = System.Drawing.Color.DimGray;
|
||||
this.scoreButton.FlatAppearance.MouseOverBackColor = System.Drawing.Color.WhiteSmoke;
|
||||
this.scoreButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.scoreButton.ForeColor = System.Drawing.Color.DodgerBlue;
|
||||
this.scoreButton.Location = new System.Drawing.Point(616, 286);
|
||||
this.scoreButton.Name = "scoreButton";
|
||||
this.scoreButton.Size = new System.Drawing.Size(125, 58);
|
||||
this.scoreButton.TabIndex = 13;
|
||||
this.scoreButton.Text = "Score";
|
||||
this.scoreButton.UseVisualStyleBackColor = true;
|
||||
this.scoreButton.Click += new System.EventHandler(this.scoreButton_Click);
|
||||
//
|
||||
// TournamentViewerForm
|
||||
//
|
||||
@ -200,12 +202,12 @@
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.Color.White;
|
||||
this.ClientSize = new System.Drawing.Size(763, 487);
|
||||
this.Controls.Add(this.button1);
|
||||
this.Controls.Add(this.scoreButton);
|
||||
this.Controls.Add(this.versusLabel);
|
||||
this.Controls.Add(this.teamTwoScoeValue);
|
||||
this.Controls.Add(this.teamTwoScoreValue);
|
||||
this.Controls.Add(this.teamTwoScoreLabel);
|
||||
this.Controls.Add(this.teamTwoName);
|
||||
this.Controls.Add(this.teamOneScoeValue);
|
||||
this.Controls.Add(this.teamOneScoreValue);
|
||||
this.Controls.Add(this.teamOneScoreLabel);
|
||||
this.Controls.Add(this.teamOneName);
|
||||
this.Controls.Add(this.MatchUpListBox);
|
||||
@ -234,12 +236,12 @@
|
||||
private System.Windows.Forms.ListBox MatchUpListBox;
|
||||
private System.Windows.Forms.Label teamOneName;
|
||||
private System.Windows.Forms.Label teamOneScoreLabel;
|
||||
private System.Windows.Forms.TextBox teamOneScoeValue;
|
||||
private System.Windows.Forms.TextBox teamTwoScoeValue;
|
||||
private System.Windows.Forms.TextBox teamOneScoreValue;
|
||||
private System.Windows.Forms.TextBox teamTwoScoreValue;
|
||||
private System.Windows.Forms.Label teamTwoScoreLabel;
|
||||
private System.Windows.Forms.Label teamTwoName;
|
||||
private System.Windows.Forms.Label versusLabel;
|
||||
private System.Windows.Forms.Button button1;
|
||||
private System.Windows.Forms.Button scoreButton;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -59,7 +59,7 @@ namespace TrackerUI
|
||||
|
||||
private void roundDropDown_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
LoadMatchups( (int)roundDropDown.SelectedItem);
|
||||
LoadMatchups((int)roundDropDown.SelectedItem);
|
||||
}
|
||||
|
||||
|
||||
@ -73,13 +73,34 @@ namespace TrackerUI
|
||||
selectedMatchups.Clear();
|
||||
foreach (MatchupModel mm in matchups)
|
||||
{
|
||||
selectedMatchups.Add(mm);
|
||||
if (mm.Winner == null || !unplayedOnlyCheckbox.Checked)
|
||||
{
|
||||
selectedMatchups.Add(mm);
|
||||
}
|
||||
}
|
||||
loading = false;
|
||||
}
|
||||
}
|
||||
|
||||
LoadMatchup(selectedMatchups.First());
|
||||
if (selectedMatchups.Count > 0)
|
||||
{
|
||||
LoadMatchup(selectedMatchups.First());
|
||||
}
|
||||
|
||||
DisplayMatchupInfo();
|
||||
}
|
||||
|
||||
private void DisplayMatchupInfo()
|
||||
{
|
||||
bool isVisible = (selectedMatchups.Count > 0);
|
||||
teamOneName.Visible = isVisible;
|
||||
teamOneScoreLabel.Visible = isVisible;
|
||||
teamOneScoreValue.Visible = isVisible;
|
||||
teamTwoName.Visible = isVisible;
|
||||
teamTwoScoreLabel.Visible = isVisible;
|
||||
teamTwoScoreValue.Visible = isVisible;
|
||||
versusLabel.Visible = isVisible;
|
||||
scoreButton.Visible = isVisible;
|
||||
}
|
||||
|
||||
private void LoadMatchup(MatchupModel m)
|
||||
@ -93,15 +114,15 @@ namespace TrackerUI
|
||||
if (m.Entries[0].TeamCompeting != null)
|
||||
{
|
||||
teamOneName.Text = m.Entries[0].TeamCompeting.TeamName;
|
||||
teamOneScoeValue.Text = m.Entries[0].Score.ToString();
|
||||
teamOneScoreValue.Text = m.Entries[0].Score.ToString();
|
||||
|
||||
teamTwoName.Text = "<bye>";
|
||||
teamTwoScoeValue.Text = "0";
|
||||
teamTwoScoreValue.Text = "0";
|
||||
}
|
||||
else
|
||||
{
|
||||
teamOneName.Text = "Not Yet Set";
|
||||
teamOneScoeValue.Text = "";
|
||||
teamOneScoreValue.Text = "";
|
||||
}
|
||||
}
|
||||
|
||||
@ -110,21 +131,90 @@ namespace TrackerUI
|
||||
if (m.Entries[1].TeamCompeting != null)
|
||||
{
|
||||
teamTwoName.Text = m.Entries[1].TeamCompeting.TeamName;
|
||||
teamTwoScoeValue.Text = m.Entries[1].Score.ToString();
|
||||
teamTwoScoreValue.Text = m.Entries[1].Score.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
teamTwoName.Text = "Not Yet Set";
|
||||
teamTwoScoeValue.Text = "";
|
||||
teamTwoScoreValue.Text = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void MatchUpListBox_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
LoadMatchup((MatchupModel)MatchUpListBox.SelectedItem);
|
||||
}
|
||||
|
||||
private void unplayedOnlyCheckbox_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
LoadMatchups((int)roundDropDown.SelectedItem);
|
||||
}
|
||||
|
||||
|
||||
private void scoreButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
MatchupModel m = (MatchupModel)MatchUpListBox.SelectedItem;
|
||||
double teamOneScore = 0;
|
||||
double teamTwoScore = 0;
|
||||
|
||||
for (int i = 0; i < m.Entries.Count; i++)
|
||||
{
|
||||
if (i == 0)
|
||||
{
|
||||
if (m.Entries[0].TeamCompeting != null)
|
||||
{
|
||||
var scoreValid = double.TryParse(teamOneScoreValue.Text, out teamOneScore);
|
||||
if (scoreValid)
|
||||
{
|
||||
m.Entries[0].Score = teamOneScore;
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Please enter a valid score for team 1.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (i == 1)
|
||||
{
|
||||
if (m.Entries[1].TeamCompeting != null)
|
||||
{
|
||||
var scoreValid = double.TryParse(teamTwoScoreValue.Text, out teamTwoScore);
|
||||
if (scoreValid)
|
||||
{
|
||||
m.Entries[1].Score = teamTwoScore;
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Please enter a valid score for team 2.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (teamOneScore > teamTwoScore)
|
||||
{
|
||||
// Team one winns
|
||||
m.Winner = m.Entries[0].TeamCompeting;
|
||||
}
|
||||
else
|
||||
if (teamTwoScore > teamOneScore)
|
||||
{
|
||||
// Team one winns
|
||||
m.Winner = m.Entries[1].TeamCompeting;
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("I dont handle tie games.");
|
||||
}
|
||||
|
||||
LoadMatchups((int)roundDropDown.SelectedItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user