Exemplo n.º 1
0
 public void AddSimonData(SimonORM simon)
 {
     connection.Open();
     string commandText = @"INSERT INTO Simon (Increment_Level, Level_1_Fail, Level_1_Fail_Time, Level_2_Fail, Level_2_Fail_Time, Level_3_Fail, Level_3_Fail_Time, Color, Position, Start, Stop, GameId)
                         VALUES (@Increment_Level, @Level_1_Fail, @Level_1_Fail_Time, @Level_2_Fail, @Level_2_Fail_Time, @Level_3_Fail, @Level_3_Fail_Time, @Color, @Position, @Start, @Stop, @GameId)";
     SqlCeCommand command = new SqlCeCommand(commandText, connection);
     command.Parameters.AddWithValue("@Increment_Level", simon.IncrementLevel);
     command.Parameters.AddWithValue("@Level_1_Fail", simon.Level_1_Fail);
     command.Parameters.AddWithValue("@Level_1_Fail_Time", simon.Level_1_Fail_Time);
     command.Parameters.AddWithValue("@Level_2_Fail", simon.Level_2_Fail);
     command.Parameters.AddWithValue("@Level_2_Fail_Time", simon.Level_2_Fail_Time);
     command.Parameters.AddWithValue("@Level_3_Fail", simon.Level_3_Fail);
     command.Parameters.AddWithValue("@Level_3_Fail_Time", simon.Level_3_Fail_Time);
     command.Parameters.AddWithValue("@Color", simon.Color);
     command.Parameters.AddWithValue("@Position", simon.Position);
     command.Parameters.AddWithValue("@Start", simon.Start);
     command.Parameters.AddWithValue("@Stop", simon.Stop);
     command.Parameters.AddWithValue("@GameId", simon.GameId);
     command.ExecuteNonQuery();
     connection.Close();
 }
Exemplo n.º 2
0
 private void handleData(Dictionary<string, string> dictionary)
 {
     Console.WriteLine("Data parsed and receive succesful");
     if (dictionary.ContainsKey("Game Type"))
     {
         string title = dictionary["Game Type"];
         DBWrapper db = new DBWrapper();
         switch (title)
         {
             case "!SAY":
                 SimonORM sayData = new SimonORM(dictionary);
                 db.AddSimonData(sayData);
                 break;
             case "!MAZ":
                 MazeORM mazData = new MazeORM(dictionary);
                 db.AddMazeData(mazData);
                 break;
         }
     }
 }