Exemple #1
0
 public Character(CharacterParameters parameters)
 {
     _name = parameters.Name;
     _experienceKRD = parameters.ExK;
     _experienceOverall = parameters.ExO;
     _skills = parameters.Skills;
 }
 public List<Character> GetCharacters()
 {
     List<Character> characters = new List<Character>();
     SqlConnection sqlConnection = new SqlConnection(connectioString);
     SqlDataReader dataReader = null;
     try
     {
         sqlConnection.Open();
         SqlCommand command = new SqlCommand(sqlSelectAll, sqlConnection);
         dataReader = command.ExecuteReader();
         while (dataReader.Read())
         {
             var ignore = dataReader[0];
             var charParam = new CharacterParameters((string)dataReader[1], (int)dataReader[2], (int)dataReader[3], Character.DefaultSkills());
             characters.Add(new Character(charParam));
         }
     }
     finally
     {
         if (dataReader != null)
         {
             dataReader.Close();
         }
         if (sqlConnection != null)
         {
             sqlConnection.Close();
         }
     }
     return characters;
 }