예제 #1
0
파일: DBWrapper.cs 프로젝트: shalse/HARE_ET
 public void AddMazeData(MazeORM maze)
 {
     connection.Open();
     string commandText = @"INSERT INTO Maze (Collisions, Difficulty, Start, Stop, GameId)
                         VALUES (@Collisions, @Difficulty, @Start, @Stop, @GameId)";
     SqlCeCommand command = new SqlCeCommand(commandText, connection);
     command.Parameters.AddWithValue("@Collisions", maze.Collisions);
     command.Parameters.AddWithValue("@Difficulty", maze.Difficulty);
     command.Parameters.AddWithValue("@Start", maze.Start);
     command.Parameters.AddWithValue("@Stop", maze.Stop);
     command.Parameters.AddWithValue("@GameId", maze.GameId);
     command.ExecuteNonQuery();
     connection.Close();
 }
예제 #2
0
파일: MainForm.cs 프로젝트: shalse/HARE_ET
 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;
         }
     }
 }