Having difficulty finding any information that relates to UML's too coding examples.
(Insert Scores Method is missing from the UML - ignore this, I am changing it now)
The Choice class uses methods from the Scores class, does this mean that there is a link between the classes? There is plenty of information regarding inheritance however, it seems.
Choice to Score Link
Choice Method
//Attributes Check
public int CheckVariables(int optionR, int optionV, int TurnCount, string Username)
{
if (optionR >= 100 || optionV <= 0)
{
//return 2; //Win
var Score = new Score();
if(Score.InsertScores(TurnCount,Username) == true)
{
return 3;
}
else
{
return 2;
}
}
else if (optionR <= 0 || optionV >= 100)
{
return 1; //Lose
}
else
{
return 0; //Not Finished
}
}
Score Method
public bool InsertScores(int ScoreValue,string Username)
{
ShowScores(); //Populate Lists with Highscores
if(ScoreValue < Turns[9])
{
SqlCommand sql = new SqlCommand("UPDATE gameScores SET scoreValue = @scoreValue, username = @Username WHERE scoreid = @ScoreId;", con);
sql.Parameters.AddWithValue("@scoreValue", ScoreValue);
sql.Parameters.AddWithValue("@Username", Username);
sql.Parameters.AddWithValue("@ScoreId", ScoreID[9]);
//Insert
sql.ExecuteNonQuery();
return true;
}
else
{
return false;
}
}