diff --git a/ProjectB/Database/TourRepository.json b/ProjectB/Database/TourRepository.json new file mode 100644 index 0000000..e88814c --- /dev/null +++ b/ProjectB/Database/TourRepository.json @@ -0,0 +1 @@ +[{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363752+02:00","Guide":"a63b118c-89fc-4a81-9ce0-bfddb0fcc365"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363864+02:00","Guide":"ce6424e1-6403-4448-811d-938728990aa0"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363865+02:00","Guide":"aa31ab00-dfb1-4138-bf8a-c52d7e6c4cb0"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363866+02:00","Guide":"a3cc1224-4536-4709-aa90-c6c4a9839782"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363866+02:00","Guide":"274b06cd-5675-4384-8a54-65f6c87adc25"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363866+02:00","Guide":"fde16e38-e8c9-4276-ae01-5b0bf191c587"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363866+02:00","Guide":"cb4b7f71-ddaa-4ae2-9247-e40825aae7a6"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363867+02:00","Guide":"8b18c027-441d-4e64-9967-ab893deec0c9"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363867+02:00","Guide":"9c1ed6f4-bbc5-4588-9f7b-1716698d9e3f"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363867+02:00","Guide":"91ef24eb-8fc6-40d8-b36b-3d873f924523"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363867+02:00","Guide":"84526d33-ac01-48d6-b83a-73de48b2c9dc"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363868+02:00","Guide":"3c6d7ead-2319-4f0d-acb4-687d569f0e47"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363868+02:00","Guide":"a7fddbcf-c25c-41c2-87a0-d33e1c821b8c"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363868+02:00","Guide":"1c33a00d-4786-4770-9300-2daf128890a6"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363868+02:00","Guide":"2713581d-2f87-469c-ac14-a4b8da2a05fe"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363868+02:00","Guide":"56c4d454-2755-436f-b70c-7012afc201f4"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363869+02:00","Guide":"6cace389-80cb-4ffb-93f9-016a5dc95364"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363869+02:00","Guide":"c7bc7fe7-dd2c-4e12-ac35-c20fbeb03a72"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.36387+02:00","Guide":"4eca621b-2df7-4349-a288-ab7d74badfca"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.36387+02:00","Guide":"bf4fc887-9f70-4127-83c8-013c7e3ff942"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.36387+02:00","Guide":"a8137316-4d62-433c-ab9f-a41638edb45b"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.36387+02:00","Guide":"4641b86e-749a-4bc9-bfc9-78c7ec346fad"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.36387+02:00","Guide":"450f6738-1db5-4dac-a303-89fcbfec1a94"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363871+02:00","Guide":"853c61d3-be83-44de-9891-eb8d82ec1964"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363871+02:00","Guide":"3c2214cb-91b7-42d5-93fc-949f7773b185"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363871+02:00","Guide":"695486c1-f21c-46e9-8aeb-24e67ca8b61a"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363871+02:00","Guide":"5ff05ab7-0780-4905-b243-13a744522459"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363871+02:00","Guide":"6008f20b-99a1-4469-877c-8c04624f112f"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363872+02:00","Guide":"d02ab3c5-9360-492d-8531-462feca10155"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363872+02:00","Guide":"807960ae-1a1a-41fb-96b3-708511170e04"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363872+02:00","Guide":"96aef2e1-05c6-47f9-ade7-39d1484381a8"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363872+02:00","Guide":"3b57148c-cb31-4531-8b79-3768ddf65714"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363873+02:00","Guide":"12a29d6a-3b46-48a3-857f-e80ac8eafa1a"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363873+02:00","Guide":"08886036-059e-4a95-b88a-1a7c3a5f9020"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363873+02:00","Guide":"3d9ed080-3de4-468d-9b11-6d7d847a5d9b"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363873+02:00","Guide":"b47c326f-4daa-49b5-96cd-fba69691e9bf"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363873+02:00","Guide":"09d0058b-c9d8-4c0d-962d-8d89ac38b0d6"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363874+02:00","Guide":"0dd6eaad-e5a5-4084-92d2-d7ad8a5b6cf8"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363874+02:00","Guide":"3d87547b-4771-4b35-9a83-e7c31a92c27a"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363874+02:00","Guide":"5b4d5d92-7c5f-4a74-8d1d-e4bc7e35a24e"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363874+02:00","Guide":"ce24b494-2837-4223-9202-b23bb839095a"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363874+02:00","Guide":"94775352-25cc-412e-b4fe-5d3177d81ab2"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363875+02:00","Guide":"0f50c41f-7445-4c8a-965c-6e539938d1fd"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363875+02:00","Guide":"f793531f-47a6-4a27-be10-c7e82e88e739"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363875+02:00","Guide":"8bd7239f-231b-4fae-869a-43f815a9eb10"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363875+02:00","Guide":"aab609a3-1ad0-4a94-911e-23564774c118"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363876+02:00","Guide":"cd737d17-b936-4687-8833-147f8af9e0e6"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363876+02:00","Guide":"3c7ff4bd-0d79-44e3-b104-8fb0753c3f76"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363876+02:00","Guide":"93c49eac-c323-4e61-ba59-04a80bd98c3a"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363876+02:00","Guide":"f5217fc4-d4be-4b18-9dd1-c66a79f54867"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363876+02:00","Guide":"d94869fe-42a3-4151-94c1-85d0813c511e"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363877+02:00","Guide":"504fca8e-525b-48f5-89e2-9f3cf282236e"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363877+02:00","Guide":"3e77b715-99ea-462c-b8a4-520dd8dca12a"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363877+02:00","Guide":"4a8ce420-72d9-4116-89dd-22950fd83399"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363877+02:00","Guide":"8770c03b-21b0-4090-a952-46f03286e210"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363877+02:00","Guide":"89ed8e80-2beb-47d0-b4f6-f5236f962251"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363878+02:00","Guide":"6c8073a4-624e-4527-9cce-88b04a7bbc64"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363878+02:00","Guide":"97152aa4-3ffc-4ac7-80c3-0a49feb68924"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363878+02:00","Guide":"17b90dbc-85da-456d-a4ae-ea61253a1eb4"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363878+02:00","Guide":"3ad90f5c-3860-45bc-83e2-a99d9a4055f8"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363878+02:00","Guide":"86bea0c2-410d-4336-b559-d757c9b96711"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363879+02:00","Guide":"ac49d836-135e-4b8a-929d-8a404b8d11b2"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363879+02:00","Guide":"2d8c36ce-593c-4743-81af-4ea89a83e3af"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363879+02:00","Guide":"78e6a2ca-c9d9-4a89-9de4-7d1a0e22259f"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363879+02:00","Guide":"c5ab2f16-1842-4330-9431-cfcd331d56a2"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.36388+02:00","Guide":"4115f806-f234-4153-b4e6-0d114b15b4b6"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.36388+02:00","Guide":"7621916c-de4d-4ea0-8413-99c0a2698d73"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.36388+02:00","Guide":"ad4f8e01-227f-4b7b-8e6d-a5d6bb2fd7a6"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.36388+02:00","Guide":"0ad94ccd-ea2a-4846-a427-bce32f5e090b"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.36388+02:00","Guide":"00122a2d-896a-49f3-b1a4-1df4d0e1c3a9"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363881+02:00","Guide":"35cd09e3-e45e-44a3-b40a-62c27f49455c"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363881+02:00","Guide":"1609b76b-aa80-45c3-abd0-a2d6725519bf"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363881+02:00","Guide":"fc556597-3a08-4d36-8590-8479a2460b28"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363881+02:00","Guide":"8c52d21e-c726-42a5-9d10-23a315277d94"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363881+02:00","Guide":"265a2618-733e-49b8-957e-d12753cd2b02"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363882+02:00","Guide":"c0cb724f-a40b-49b8-a08d-10ba7b5a476e"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363882+02:00","Guide":"330eea1b-d730-42cd-9df0-7e2f3cacdacb"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363882+02:00","Guide":"33421772-5ee4-4cf9-a291-8431b1620008"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363882+02:00","Guide":"ab9b4975-b984-4103-847b-c18aeb339b7e"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363885+02:00","Guide":"ecbb27ec-b06d-4399-a09e-d4cf3931bc3e"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363885+02:00","Guide":"9790458d-1ce5-447e-aff0-d53f0579ae5e"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363885+02:00","Guide":"422c0502-4a6d-427a-beab-043c63930c30"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363885+02:00","Guide":"635d8d40-b8b4-4745-8c7c-1f5a735ad096"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363885+02:00","Guide":"d367a27b-0918-4bec-a613-8eee95931b90"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363886+02:00","Guide":"b719d998-65ce-4b7e-8f18-914967141104"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363886+02:00","Guide":"165e0fd6-44c2-400d-b635-d1a38839e7e2"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363886+02:00","Guide":"657664f3-56d9-4c43-83c8-e4c14116f93e"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363886+02:00","Guide":"65311d19-727c-4c30-9568-b0e5cf4f01d6"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363887+02:00","Guide":"3af710ba-a11b-4358-82f5-fc6e6c3696b5"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363887+02:00","Guide":"38efda4d-1122-4da2-b647-d0cada97ddcb"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363887+02:00","Guide":"c3e5fd5d-07af-40ae-a5e2-025cb6e92a0a"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363887+02:00","Guide":"23e2c3ec-c5b0-40be-bee1-1bde4cf6adad"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363887+02:00","Guide":"e6a0949f-dec3-408e-8fda-20973111aea1"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363888+02:00","Guide":"77c48a33-16fc-4759-a19d-dd72521db6a6"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363888+02:00","Guide":"117312de-dc98-4708-9574-be061470cc0a"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363888+02:00","Guide":"f43e818d-4ac6-4f6d-bc4b-8a88c4e68ca3"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363888+02:00","Guide":"e9418e1d-4e19-4935-95ea-e2bf3a621e4c"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363888+02:00","Guide":"bd35337e-2bfa-4d1d-b76e-2c9ed5e6d98b"},"RemainingCapacity":13},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363889+02:00","Guide":"a9cc093b-403b-4aef-8f8a-e71eac831a32"},"RemainingCapacity":12},{"_participants":[],"_capacity":13,"_key":{"Time":"2024-05-05T19:04:00.363889+02:00","Guide":"07d775a8-16e2-4ae8-b9a0-38a6bf28ef37"},"RemainingCapacity":12}] \ No newline at end of file diff --git a/ProjectB/Database/TranslationRepository.json b/ProjectB/Database/TranslationRepository.json new file mode 100644 index 0000000..d8512af --- /dev/null +++ b/ProjectB/Database/TranslationRepository.json @@ -0,0 +1,251 @@ +[ + { + "id": "FR", + "pairs": { + "loginTitle": "Connexion au système", + "welcome": "Bienvenue dans notre système de réservation de visites!", + "chooseOption": "Veuillez choisir une option:", + "signUp": "Inscrivez-vous à une visite", + "deleteSignUp": "Supprimer l'inscription à une visite", + "exit": "Quitter", + "availableTours": "Visites disponibles:", + "goBack": "Retour", + "enterTourNumber": "Entrez le numéro de la visite à laquelle vous souhaitez vous inscrire:", + "invalidInput": "Entrée invalide, veuillez réessayer.", + "tourFullyBooked": "Cette visite est complète.", + "enterUsername": "Entrez votre nom d'utilisateur:", + "usernameAlreadySignedUp": "Ce nom d'utilisateur est déjà inscrit à cette visite.", + "changeSignUp": "Voulez-vous modifier votre inscription? (O/N)", + "signUpSuccess": "Vous êtes inscrit avec succès à la visite.", + "enterUsernameToDelete": "Entrez le nom d'utilisateur de l'inscription à supprimer:", + "signUpDeleted": "L'inscription a été supprimée.", + "noSignUpFound": "Aucune inscription trouvée pour ce nom d'utilisateur.", + "goodbye": "Au revoir! Merci d'avoir utilisé notre système.", + "login": "Connexion", + "lang_name_en": "Anglais", + "lang_name_nl": "Néerlandais", + "spotsLeft": "places restantes.", + "test": "Ceci est un test.", + "loginOption": "Choisissez votre mode de connexion:", + "guestLogin": "Connexion invité", + "employeeLogin": "Connexion employé", + "switchLanguage": "Changer de langue", + "loadingData": "Chargement des données...", + "wait": "Veuillez patienter...", + "loginGuest": "Connexion en tant qu'invité", + "loginEmployee": "Connexion en tant qu'employé", + "enterTicketNumber": "Entrez le numéro de votre billet:", + "ticketNotFound": "Billet non trouvé. Veuillez réessayer.", + "choseTour": "Veuillez choisir une visite:", + "time": "Heure", + "spots": "Places", + "createReservationView": "Inscrivez-vous à une visite.", + "deleteReservationView": "Supprimer l'inscription à une visite.", + "editReservationView": "Modifier l'inscription à une visite.", + "return": "Retour", + "ticketNumber": "Numéro de billet", + "debug": "Menu de débogage", + "createGuest": "Créer un invité", + "createEmployee": "Créer un employé" + } + }, + { + "id": "ES", + "pairs": { + "loginTitle": "Acceso al sistema", + "welcome": "¡Bienvenido a nuestro sistema de reserva de tours!", + "chooseOption": "Por favor, elige una opción:", + "signUp": "Regístrese para un tour", + "deleteSignUp": "Eliminar inscripción para un tour", + "exit": "Salir", + "availableTours": "Tours disponibles:", + "goBack": "Regresar", + "enterTourNumber": "Ingrese el número del tour al que desea inscribirse:", + "invalidInput": "Entrada no válida, por favor intente de nuevo.", + "tourFullyBooked": "Este tour está completamente reservado.", + "enterUsername": "Ingrese su nombre de usuario:", + "usernameAlreadySignedUp": "Este nombre de usuario ya está inscrito en este tour.", + "changeSignUp": "¿Desea cambiar su inscripción? (S/N)", + "signUpSuccess": "Se ha inscrito exitosamente en el tour.", + "enterUsernameToDelete": "Ingrese el nombre de usuario de la inscripción que desea eliminar:", + "signUpDeleted": "La inscripción ha sido eliminada.", + "noSignUpFound": "No se encontró ninguna inscripción para este nombre de usuario.", + "goodbye": "¡Adiós! Gracias por usar nuestro sistema.", + "login": "Acceder", + "lang_name_en": "Inglés", + "lang_name_nl": "Holandés", + "spotsLeft": "lugares disponibles.", + "test": "Esto es una prueba.", + "loginOption": "Elija cómo desea acceder:", + "guestLogin": "Acceso de invitado", + "employeeLogin": "Acceso de empleado", + "switchLanguage": "Cambiar idioma", + "loadingData": "Cargando datos...", + "wait": "Por favor, espere...", + "loginGuest": "Acceder como invitado", + "loginEmployee": "Acceder como empleado", + "enterTicketNumber": "Ingrese el número de su ticket:", + "ticketNotFound": "Ticket no encontrado. Por favor, intente de nuevo.", + "choseTour": "Por favor, elija un tour:", + "time": "Hora", + "spots": "Plazas", + "createReservationView": "Inscribirse a un tour.", + "deleteReservationView": "Eliminar inscripción a un tour.", + "editReservationView": "Editar inscripción a un tour.", + "return": "Regresar", + "ticketNumber": "Número de ticket", + "debug": "Menú de depuración", + "createGuest": "Crear invitado", + "createEmployee": "Crear empleado" + } + }, + { + "id": "AR", + "pairs": { + "loginTitle": "تسجيل الدخول إلى النظام", + "welcome": "مرحبًا بك في نظام حجز الجولات!", + "chooseOption": "يرجى اختيار خيار:", + "signUp": "التسجيل لجولة", + "deleteSignUp": "حذف التسجيل لجولة", + "exit": "خروج", + "availableTours": "الجولات المتاحة:", + "goBack": "العودة", + "enterTourNumber": "أدخل رقم الجولة التي ترغب في التسجيل بها:", + "invalidInput": "مدخل غير صحيح، يرجى المحاولة مرة أخرى.", + "tourFullyBooked": "هذه الجولة محجوزة بالكامل.", + "enterUsername": "أدخل اسم المستخدم الخاص بك:", + "usernameAlreadySignedUp": "اسم المستخدم هذا مسجل بالفعل في هذه الجولة.", + "changeSignUp": "هل ترغب في تغيير تسجيلك؟ (نعم/لا)", + "signUpSuccess": "لقد تم تسجيلك في الجولة بنجاح.", + "enterUsernameToDelete": "أدخل اسم المستخدم للتسجيل الذي ترغب في حذفه:", + "signUpDeleted": "تم حذف التسجيل.", + "noSignUpFound": "لم يتم العثور على تسجيل لهذا المستخدم.", + "goodbye": "وداعًا! شكرًا لاستخدامك نظامنا.", + "login": "تسجيل الدخول", + "lang_name_en": "الإنجليزية", + "lang_name_nl": "الهولندية", + "spotsLeft": "مقاعد متبقية.", + "test": "هذا اختبار.", + "loginOption": "اختر كيفية تسجيل الدخول:", + "guestLogin": "تسجيل الدخول كضيف", + "employeeLogin": "تسجيل الدخول كموظف", + "switchLanguage": "تغيير اللغة", + "loadingData": "جارٍ تحميل البيانات...", + "wait": "يرجى الانتظار...", + "loginGuest": "تسجيل الدخول كضيف", + "loginEmployee": "تسجيل الدخول كموظف", + "enterTicketNumber": "أدخل رقم التذكرة الخاص بك:", + "ticketNotFound": "لم يتم العثور على التذكرة. يرجى المحاولة مرة أخرى.", + "choseTour": "يرجى اختيار جولة:", + "time": "الوقت", + "spots": "الأماكن", + "createReservationView": "التسجيل لجولة.", + "deleteReservationView": "حذف التسجيل لجولة.", + "editReservationView": "تعديل التسجيل لجولة.", + "return": "عودة", + "ticketNumber": "رقم التذكرة", + "debug": "قائمة التصحيح", + "createGuest": "إنشاء ضيف", + "createEmployee": "إنشاء موظف" + } + }, + + { + "id": "EN", + "pairs": { + "loginTitle": "Login to System", + "welcome": "Welcome to our tour booking system!", + "chooseOption": "Please choose an option:", + "signUp": "Sign up for a tour", + "deleteSignUp": "Delete sign-up for a tour", + "exit": "Exit", + "availableTours": "Available tours:", + "goBack": "Go back", + "enterTourNumber": "Enter the number of the tour you want to sign up for:", + "invalidInput": "Invalid input, please try again.", + "tourFullyBooked": "This tour is fully booked.", + "enterUsername": "Enter your username:", + "usernameAlreadySignedUp": "This username is already signed up for this tour.", + "changeSignUp": "Do you want to change your sign-up? (Y/N)", + "signUpSuccess": "You have successfully signed up for the tour.", + "enterUsernameToDelete": "Enter the username of the sign-up you want to delete:", + "signUpDeleted": "The sign-up has been deleted.", + "noSignUpFound": "No sign-up found for this username.", + "goodbye": "Goodbye! Thank you for using our system.", + "login": "Login", + "lang_name_en": "English", + "lang_name_nl": "Nederlands", + "spotsLeft": "spots left.", + "test": "This is a test.", + "loginOption": "Chose how you want to login:", + "guestLogin": "Guest login", + "employeeLogin": "Employee login", + "switchLanguage": "Switch language", + "loadingData": "Loading data...", + "wait": "Please wait...", + "loginGuest": "Login as guest", + "loginEmployee": "Login as employee", + "enterTicketNumber": "Enter the number of your ticket:", + "ticketNotFound": "Ticket not found. Please try again.", + "choseTour": "Please chose a tour:", + "time": "Time", + "spots": "Spots", + "createReservationView": "Sign up for a tour.", + "deleteReservationView": "Delete sign-up for a tour.", + "editReservationView": "Edit sign-up for a tour.", + "return": "Return", + "ticketNumber": "Ticket number", + "debug": "Debug Menu", + "createGuest": "Create guest", + "createEmployee": "Create employee", + } + }, + { + "id": "NL", + "pairs": { + "loginTitle": "Inloggen op systeem", + "enterUsername": "Voer uw gebruikersnaam in:", + "enterPassword": "Voer uw wachtwoord in:", + "loginSuccessful": "Inloggen succesvol!", + "invalidCredentials": "Ongeldige gebruikersnaam of wachtwoord! Poging {0} van 3.", + "tryAgain": "Probeer het opnieuw...", + "maxAttemptsReached": "Inloggen mislukt. Maximum aantal pogingen bereikt.", + "mainMenuTitle": "Hoofdmenu", + "warningApplicationIsInBeta": "Waarschuwing: Deze applicatie is in bèta en niet volledig functioneel.", + "welcome": "Welkom bij ons museum!", + "chooseOption": "Kies een optie:", + "signUp": "Schrijf je in voor een rondleiding", + "deleteSignUp": "Verwijder je inschrijving voor een rondleiding", + "exit": "Afsluiten", + "invalidInput": "Ongeldige invoer. Voer een getal in tussen 1 en 3.", + "goodbye": "Bedankt voor uw bezoek aan ons museum! Tot ziens.", + "login": "Inloggen", + "lang_name_en": "English", + "lang_name_nl": "Nederlands", + "spotsLeft": "plekken over.", + "test": "This is a test.", + "loginOption": "Kies hoe u wilt inloggen:", + "guestLogin": "Gast inloggen", + "employeeLogin": "Medewerker inloggen", + "switchLanguage": "Taal wijzigen", + "loadingData": "Gegevens laden...", + "wait": "Even geduld a.u.b...", + "loginGuest": "Inloggen als gast", + "loginEmployee": "Inloggen als medewerker", + "enterTicketNumber": "Voer het nummer van uw ticket in:", + "ticketNotFound": "Ticket niet gevonden. Probeer het opnieuw.", + "choseTour": "Kies een rondleiding:", + "time": "Tijd", + "spots": "Plekken", + "createReservationView": "Inschrijven voor een tour.", + "deleteReservationView": "Inschrijving verwijderen.", + "editReservationView": "Inschrijving bewerken.", + "return": "Terug", + "ticketNumber": "Ticketnummer", + "debug": "Debug Menu", + "createGuest": "Maak gast aan", + "createEmployee": "Maak medewerker aan", + + } + } +] \ No newline at end of file diff --git a/ProjectB/Database/database.json b/ProjectB/Database/database.json deleted file mode 100644 index 544b7b4..0000000 --- a/ProjectB/Database/database.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - -} \ No newline at end of file diff --git a/ProjectB/Models/Translation.cs b/ProjectB/Models/Translation.cs new file mode 100644 index 0000000..539f492 --- /dev/null +++ b/ProjectB/Models/Translation.cs @@ -0,0 +1,15 @@ +namespace ProjectB.Models; + +public class Translation(string id, Dictionary pairs) : IEntity +{ + + public Dictionary GetPairs() + { + return pairs; + } + + public string GetId() + { + return id; + } +} \ No newline at end of file diff --git a/ProjectB/Program.cs b/ProjectB/Program.cs index c2e21fb..46c5298 100644 --- a/ProjectB/Program.cs +++ b/ProjectB/Program.cs @@ -4,6 +4,7 @@ using ProjectB.Services; using ProjectB.Views.Admin; using ProjectB.Views.Debug; +using ProjectB.Views.Language; using ProjectB.Views.Login; using ProjectB.Views.Main; using ProjectB.Views.Reservation; @@ -30,6 +31,7 @@ builder.Services.AddSingleton(); builder.Services.AddSingleton(); builder.Services.AddSingleton(); +builder.Services.AddSingleton(); using IHost host = builder.Build(); diff --git a/ProjectB/ProjectB.csproj b/ProjectB/ProjectB.csproj index 4a9dc63..dde19aa 100644 --- a/ProjectB/ProjectB.csproj +++ b/ProjectB/ProjectB.csproj @@ -14,6 +14,8 @@ + + diff --git a/ProjectB/Repositories/AbstractRepository.cs b/ProjectB/Repositories/AbstractRepository.cs index 031018e..97b025e 100644 --- a/ProjectB/Repositories/AbstractRepository.cs +++ b/ProjectB/Repositories/AbstractRepository.cs @@ -48,7 +48,10 @@ public void Persist() writer.WriteObjects(GetFileLocation(), Repository.Values); } - public string GetFileLocation() => $".//{GetType().Name}.json"; + private string GetFileLocation() + { + return $".//../../../Database/{GetType().Name}.json"; + } public int Count() => Repository.Count; diff --git a/ProjectB/Repositories/GuestRepository.cs b/ProjectB/Repositories/GuestRepository.cs index e0fdc48..736b62b 100644 --- a/ProjectB/Repositories/GuestRepository.cs +++ b/ProjectB/Repositories/GuestRepository.cs @@ -9,4 +9,6 @@ public class GuestRepository : AbstractRepository return Repository.Values .FirstOrDefault(guest => guest.GetId() == id && guest.IsValid()); } + + } \ No newline at end of file diff --git a/ProjectB/Repositories/IRepository.cs b/ProjectB/Repositories/IRepository.cs index 188cdc1..b25d376 100644 --- a/ProjectB/Repositories/IRepository.cs +++ b/ProjectB/Repositories/IRepository.cs @@ -10,19 +10,11 @@ public interface IRepository where TId : notnull { - /** - * Saves the given entity to memory, and persist the data to the filesystem as a JSON-file. - */ + void Save(TEntity entity); - /** - * Finds the entity with the corresponding ID. Returns null if none exist. - */ TEntity? FindById(TId id); - /** - * Returns every entity registered to this repository. - */ IEnumerable FindAll(); void Remove(TId id); @@ -37,6 +29,4 @@ public interface IRepository int Count(); - string GetFileLocation(); - } \ No newline at end of file diff --git a/ProjectB/Repositories/TourRepository.cs b/ProjectB/Repositories/TourRepository.cs index dd60205..a966196 100644 --- a/ProjectB/Repositories/TourRepository.cs +++ b/ProjectB/Repositories/TourRepository.cs @@ -1,10 +1,9 @@ using ProjectB.Models; -using System; namespace ProjectB.Repositories { - public class TourRepository : AbstractRepository - { +public class TourRepository : AbstractRepository +{ public IEnumerable GetAllToursTodayAfterNow() => from tour in Repository.Values diff --git a/ProjectB/Repositories/TranslationRepository.cs b/ProjectB/Repositories/TranslationRepository.cs new file mode 100644 index 0000000..90fca59 --- /dev/null +++ b/ProjectB/Repositories/TranslationRepository.cs @@ -0,0 +1,12 @@ +using ProjectB.Models; + +namespace ProjectB.Repositories; + +public class TranslationRepository : AbstractRepository +{ + // not needed any more, will be deleted soon + // public override string GetFileLocation() + // { + // return $".//../../../Database/{GetType().Name}.json"; + // } +} \ No newline at end of file diff --git a/ProjectB/Repositories/UserRepository.cs b/ProjectB/Repositories/UserRepository.cs new file mode 100644 index 0000000..e69de29 diff --git a/ProjectB/Reservation.cs b/ProjectB/Reservation.cs index 7f6c460..96e9997 100644 --- a/ProjectB/Reservation.cs +++ b/ProjectB/Reservation.cs @@ -1,12 +1,3 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using Newtonsoft.Json; -using ProjectB.IO; -using ProjectB.Models; -using ProjectB.Repositories; - public class Reservation { // public static List tours = new List(); diff --git a/ProjectB/Resources/Translations.cs b/ProjectB/Resources/Translations.cs index 5aba14d..ec35869 100644 --- a/ProjectB/Resources/Translations.cs +++ b/ProjectB/Resources/Translations.cs @@ -30,7 +30,7 @@ public class Translations private const string LANGUAGE_CHANGED_NL = "Taal veranderd naar Nederlands.\n"; - private const string LANGUAGE_CHANGED_EN = "Language changed to English.\n"; + private const string LANGUAGE_CHANGED_EN = "Lanuage changed to English.\n"; private const string LOGIN_PROMPT_GUEST_NL = "Geef uw ticket-nummer in:"; @@ -46,7 +46,7 @@ public class Translations public static string translation(string name) { - if (Settings.Language == Language.NL) + if (Settings.Lanuage == Lanuage.NL) { switch(name) { @@ -67,7 +67,7 @@ public static string translation(string name) } } - if (Settings.Language == Language.EN) + if (Settings.Lanuage == Lanuage.EN) { switch (name) { diff --git a/ProjectB/Resources/lang/en.json b/ProjectB/Resources/lang/en.json new file mode 100644 index 0000000..98cfa2c --- /dev/null +++ b/ProjectB/Resources/lang/en.json @@ -0,0 +1,23 @@ +{ + "welcome": "Welcome to our tour booking system!", + "chooseOption": "Please choose an option:", + "signUp": "1. Sign up for a tour", + "deleteSignUp": "2. Delete sign-up for a tour", + "exit": "3. Exit", + "availableTours": "Available tours:", + "goBack": "Go back", + "enterTourNumber": "Enter the number of the tour you want to sign up for:", + "invalidInput": "Invalid input, please try again.", + "tourFullyBooked": "This tour is fully booked.", + "enterUsername": "Enter your username:", + "usernameAlreadySignedUp": "This username is already signed up for this tour.", + "changeSignUp": "Do you want to change your sign-up? (Y/N)", + "signUpSuccess": "You have successfully signed up for the tour.", + "enterUsernameToDelete": "Enter the username of the sign-up you want to delete:", + "signUpDeleted": "The sign-up has been deleted.", + "noSignUpFound": "No sign-up found for this username.", + "goodbye": "Goodbye! Thank you for using our system.", + "login": "Login", + "lang_name_en": "English", + "lang_name_nl": "Dutch" +} \ No newline at end of file diff --git a/ProjectB/Resources/lang/nl.json b/ProjectB/Resources/lang/nl.json new file mode 100644 index 0000000..b1a12d3 --- /dev/null +++ b/ProjectB/Resources/lang/nl.json @@ -0,0 +1,21 @@ +{ + "loginTitle": "Inloggen op systeem", + "enterUsername": "Voer uw gebruikersnaam in:", + "enterPassword": "Voer uw wachtwoord in:", + "loginSuccessful": "Inloggen succesvol!", + "invalidCredentials": "Ongeldige gebruikersnaam of wachtwoord! Poging {0} van 3.", + "tryAgain": "Probeer het opnieuw...", + "maxAttemptsReached": "Inloggen mislukt. Maximum aantal pogingen bereikt.", + "mainMenuTitle": "Hoofdmenu", + "warningApplicationIsInBeta": "Waarschuwing: Deze applicatie is in bèta en niet volledig functioneel.", + "welcome": "Welkom bij ons museum!", + "chooseOption": "Kies een optie:", + "signUp": "1. Schrijf je in voor een rondleiding", + "deleteSignUp": "2. Verwijder je inschrijving voor een rondleiding", + "exit": "3. Afsluiten", + "invalidInput": "Ongeldige invoer. Voer een getal in tussen 1 en 3.", + "goodbye": "Bedankt voor uw bezoek aan ons museum! Tot ziens.", + "login": "Inloggen", + "lang_name_en": "Engels", + "lang_name_nl": "Nederlands" +} \ No newline at end of file diff --git a/ProjectB/Services/EmployeeService.cs b/ProjectB/Services/EmployeeService.cs index 717e8f0..43a1a44 100644 --- a/ProjectB/Services/EmployeeService.cs +++ b/ProjectB/Services/EmployeeService.cs @@ -62,4 +62,8 @@ public void Delete(string id) return employee; } + public Employee Read(string read) + { + throw new NotImplementedException(); + } } \ No newline at end of file diff --git a/ProjectB/Services/GuestService.cs b/ProjectB/Services/GuestService.cs index 6430eda..1bb89c3 100644 --- a/ProjectB/Services/GuestService.cs +++ b/ProjectB/Services/GuestService.cs @@ -8,6 +8,8 @@ public class GuestService(GuestRepository repository) : IService { public void Create(Guest entity) { + var guest = entity; + if (!repository.Exists(entity)) { repository.Save(entity); @@ -35,4 +37,9 @@ public Guest FindValidGuestById(string id) return guest; } + + public Guest Read(string read) + { + throw new NotImplementedException(); + } } \ No newline at end of file diff --git a/ProjectB/Services/IService.cs b/ProjectB/Services/IService.cs index dd6431e..9170c96 100644 --- a/ProjectB/Services/IService.cs +++ b/ProjectB/Services/IService.cs @@ -16,4 +16,6 @@ public interface IService void Delete(TEntity entity) => Delete(entity.GetId()); + TEntity Read(TId read); + } \ No newline at end of file diff --git a/ProjectB/Services/TourService.cs b/ProjectB/Services/TourService.cs index 778cbe8..1d095d3 100644 --- a/ProjectB/Services/TourService.cs +++ b/ProjectB/Services/TourService.cs @@ -18,6 +18,11 @@ public void Delete(TourCompositeKey id) { repository.Remove(id); } + + public Tour Read(TourCompositeKey id) + { + throw new NotImplementedException(); + } public void Update(Tour entity, TourCompositeKey id) { @@ -27,6 +32,7 @@ public void Update(Tour entity, TourCompositeKey id) public IEnumerable GetAllToursTodayAfterNow() { return repository.GetAllToursTodayAfterNow(); } + public bool RegisterGuestForTour(Guest guest, Tour tour) { diff --git a/ProjectB/Services/TranslationService.cs b/ProjectB/Services/TranslationService.cs new file mode 100644 index 0000000..2cd2e41 --- /dev/null +++ b/ProjectB/Services/TranslationService.cs @@ -0,0 +1,48 @@ +using ProjectB.Models; +using ProjectB.Repositories; +using ProjectB.settings; + +namespace ProjectB.Services; + +public class TranslationService(IRepository repository) : IService +{ + public void Create(Translation entity) + { + repository.Save(entity); + } + + public void Update(Translation entity, string id) + { + repository.Save(entity); + } + + public void Delete(string id) + { + repository.Remove(id); + } + + public Translation Read(string key) + { + return repository.FindById(Settings.Lanuage.ToString())!; + } + + + public string GetTranslationString(string key) + { + var lang = Settings.Lanuage.ToString(); + + var translation = repository.FindById(lang); + + if (translation == null) + { + return $"Lanuage not found: {lang}"; + } + + if (!translation.GetPairs().ContainsKey(key)) + { + return $"Translation not found: {key}"; + } + + return translation.GetPairs()[key]; + } +} \ No newline at end of file diff --git a/ProjectB/Services/UserService.cs b/ProjectB/Services/UserService.cs new file mode 100644 index 0000000..e69de29 diff --git a/ProjectB/Settings/Settings.cs b/ProjectB/Settings/Settings.cs index d6706fd..c3b1cd5 100644 --- a/ProjectB/Settings/Settings.cs +++ b/ProjectB/Settings/Settings.cs @@ -4,6 +4,6 @@ namespace ProjectB.settings; public class Settings { - public static Language Language = Language.NL; + public static Lanuage Lanuage = Lanuage.EN; public static Session? CurrentSession; } \ No newline at end of file diff --git a/ProjectB/Views/Debug/DebugView.cs b/ProjectB/Views/Debug/DebugView.cs index bfe81d9..2a4b434 100644 --- a/ProjectB/Views/Debug/DebugView.cs +++ b/ProjectB/Views/Debug/DebugView.cs @@ -1,22 +1,36 @@ using ProjectB.Views.Admin; +using ProjectB.Models; +using ProjectB.Repositories; +using ProjectB.Services; +using Spectre.Console; namespace ProjectB.Views.Debug; public class DebugView(CreateGuestView createGuestView, CreateEmployeeView createEmployeeView) : AbstractView { - private const string DEBUG_VIEW = """ - Welcome to the DebugView. To continue, please select one of the options in the list below. - 1. Create Guest - 2. Create Employee - 3. Exit - """; + private static IService _translationService = new TranslationService(new TranslationRepository()); + public override void Output() { + + var options = new Dictionary + { + { 1, $"[blue]{((TranslationService) _translationService).GetTranslationString("createGuest")}[/]"}, + { 2, $"[blue]{((TranslationService) _translationService).GetTranslationString("createEmployee")}[/]" }, + { 3, $"[blue]{((TranslationService) _translationService).GetTranslationString("exit")}[/]" }, + }; + + var option = AnsiConsole.Prompt( + new SelectionPrompt() + .Title(((TranslationService) _translationService).GetTranslationString("chooseOption")) + .PageSize(10) + .AddChoices(options.Keys) + .UseConverter(choice => $"{choice}. {options[choice]}") + ); + while (true) { - Console.WriteLine(DEBUG_VIEW); - int option = ReadUserChoice(1, 3, DEBUG_VIEW); switch (option) { case 1: @@ -26,8 +40,10 @@ public override void Output() createEmployeeView.Output(); break; case 3: - return; + break; + } } + } } \ No newline at end of file diff --git a/ProjectB/Views/Language/LanguageSwitcher.cs b/ProjectB/Views/Language/LanguageSwitcher.cs new file mode 100644 index 0000000..8582494 --- /dev/null +++ b/ProjectB/Views/Language/LanguageSwitcher.cs @@ -0,0 +1,44 @@ +using Spectre.Console; +using ProjectB.Services; +using ProjectB.settings; +using ProjectB.Models; +using ProjectB.Repositories; + +namespace ProjectB.Views.Language; + +public class LanguageSwitcher() : AbstractView +{ + private static IService _translationService = new TranslationService(new TranslationRepository()); + + public override void Output() + { + AnsiConsole.Clear(); // Clear the console screen + + var options = Enum.GetValues(typeof(settings.Lanuage)) + .Cast() + .Select((value, index) => new { index, value }) + .ToDictionary(pair => pair.index + 1, pair => pair.value); + + var option = AnsiConsole.Prompt( + new SelectionPrompt() + .Title(((TranslationService) _translationService).GetTranslationString("chooseOption")) + .PageSize(10) + .AddChoices(options.Keys) + .UseConverter(choice => $"{choice}. {((TranslationService) _translationService).GetTranslationString("lang_name_" + options[choice].ToString().ToLower())}") + ); + + try + { + Settings.Lanuage = options[option]; // Attempt to switch the language + } + catch (Exception ex) + { + // Log the error + Console.WriteLine($"An error occurred while switching languages: {ex.Message}"); + + // Revert back to the original language + Settings.Lanuage = settings.Lanuage.NL; + } + + } +} \ No newline at end of file diff --git a/ProjectB/Views/Login/GuestLoginView.cs b/ProjectB/Views/Login/GuestLoginView.cs index 1bd4680..e3a8374 100644 --- a/ProjectB/Views/Login/GuestLoginView.cs +++ b/ProjectB/Views/Login/GuestLoginView.cs @@ -4,17 +4,19 @@ using ProjectB.Services; using ProjectB.settings; using ProjectB.Views.Reservation; +using ProjectB.Repositories; +using Spectre.Console; namespace ProjectB.Views.Login; public class GuestLoginView(GuestService service, ReservationView guestMenuView) : AbstractView { - - private const string LOGIN_TEXT = "Geef uw ticketnummer in:"; + private static IService _translationService = new TranslationService(new TranslationRepository()); public override void Output() { - Console.WriteLine(LOGIN_TEXT); + AnsiConsole.MarkupLine($"[blue]{((TranslationService) _translationService).GetTranslationString("enterTicketNumber")}[/]"); + Guest? guest = null; do { @@ -27,7 +29,10 @@ public override void Output() } catch (EntityNotFoundException exception) { - Console.WriteLine("Dat ticketnummer is niet herkend. Voor alstublieft nogmaals uw ticketnummer in:"); + AnsiConsole.Clear(); + // Console.WriteLine("Dat ticketnummer is niet herkend. Voor alstublieft nogmaals uw ticketnummer in:"); + AnsiConsole.MarkupLine($"[red]{((TranslationService) _translationService).GetTranslationString("ticketNotFound")}[/]"); + } } while (guest == null); @@ -35,6 +40,7 @@ public override void Output() private string? GetTicketNumber() { - return Console.ReadLine(); + // return Console.ReadLine(); + return AnsiConsole.Ask(((TranslationService) _translationService).GetTranslationString("ticketNumber")); } } \ No newline at end of file diff --git a/ProjectB/Views/Main/MainMenuView.cs b/ProjectB/Views/Main/MainMenuView.cs index 2e10975..513db2b 100644 --- a/ProjectB/Views/Main/MainMenuView.cs +++ b/ProjectB/Views/Main/MainMenuView.cs @@ -1,39 +1,62 @@ using ProjectB.settings; using ProjectB.Views.Debug; using ProjectB.Views.Login; +using ProjectB.Views.Language; + +using ProjectB.Models; +using ProjectB.Repositories; +using ProjectB.Services; +using Spectre.Console; namespace ProjectB.Views.Main; -public class MainMenuView(EmployeeLoginView employeeLoginView, GuestLoginView guestLoginView, DebugView debugView) : AbstractView +public class MainMenuView(EmployeeLoginView employeeLoginView, GuestLoginView guestLoginView, LanguageSwitcher languageSwitcher, DebugView debugView) : AbstractView { - private const string MENU_OPTIONS = """ - 1. Inloggen als met uw ticket. - 2. Inloggen als medewerker. - 3. Change the language to English. - """; - private const string MENU_TEXT = $""" - Welkom! Kies een van de onderstaande opties om verder te gaan. - {MENU_OPTIONS} - """; + private static IService _translationService = new TranslationService(new TranslationRepository()); + public override void Output() { - Console.WriteLine(MENU_TEXT); while (true) { - int option = ReadUserChoice(0, 3, $"Kies een van de onderstaande opties:\n{MENU_OPTIONS}"); + AnsiConsole.Clear(); + + // Display a status message for 5 seconds + AnsiConsole.Status().Start(((TranslationService) _translationService).GetTranslationString("wait"), ctx => + { + ctx.Spinner(Spinner.Known.Material); + ctx.Status($"\n {((TranslationService) _translationService).GetTranslationString("loadingData")}"); + Thread.Sleep(2000); + }); + + var options = new Dictionary + { + { 1, $"[blue]{((TranslationService) _translationService).GetTranslationString("loginGuest")}[/]"}, + { 2, $"[blue]{((TranslationService) _translationService).GetTranslationString("loginEmployee")}[/]" }, + { 3, $"[blue]{((TranslationService) _translationService).GetTranslationString("switchLanguage")}[/]" }, + { 0, $"[blue]{((TranslationService) _translationService).GetTranslationString("debug")}[/]" } + }; + + var option = AnsiConsole.Prompt( + new SelectionPrompt() + .Title(((TranslationService) _translationService).GetTranslationString("chooseOption")) + .PageSize(10) + .AddChoices(options.Keys) + .UseConverter(choice => $"{choice}. {options[choice]}") + ); + + switch (option) { case 1: - Console.Clear(); guestLoginView.Output(); break; case 2: employeeLoginView.Output(); break; case 3: - Settings.Language = Settings.Language == Language.EN ? Language.NL : Language.EN; + languageSwitcher.Output(); break; case 0: debugView.Output(); diff --git a/ProjectB/Views/Reservation/CreateReservationView.cs b/ProjectB/Views/Reservation/CreateReservationView.cs index 9d92647..8fc5dfb 100644 --- a/ProjectB/Views/Reservation/CreateReservationView.cs +++ b/ProjectB/Views/Reservation/CreateReservationView.cs @@ -2,11 +2,15 @@ using ProjectB.Models; using ProjectB.Services; using ProjectB.settings; +using ProjectB.Repositories; +using Spectre.Console; namespace ProjectB.Views.Reservation; public class CreateReservationView(TourService tourService, GuestService guestService) : AbstractView { + private static IService _translationService = new TranslationService(new TranslationRepository()); + public override void Output() { var tours = tourService.GetAllToursTodayAfterNow(); @@ -15,7 +19,9 @@ public override void Output() PrintAllTours(tours); // Get user input - int option = ReadUserChoice(1, tours.Count(), $"Kies een van de onderstaande tours:\n{PrintAllTours(tours)}"); + int option = ReadUserChoice(1, tours.Count(), $"{((TranslationService) _translationService).GetTranslationString("choseTour")}\n{PrintAllTours(tours)}"); + // AnsiConsole.MarkupLine($"[blue]{((TranslationService) _translationService).GetTranslationString("enterTicketNumber")}[/]"); + // Get tour corresponding to user choice Tour selectedTour = tours.ElementAt(option - 1); @@ -30,7 +36,7 @@ private string PrintAllTours(IEnumerable tours) for (int i = 0; i < tours.Count(); i++) { var tour = tours.ElementAt(i); - builder.Append($"{i + 1}. Tijd: {tour.GetTourTime().Hour:00}:{tour.GetTourTime():00}\t\tPlaatsen: {tour.GetRemainingCapacity()}\n"); + builder.Append($"{i + 1}. {((TranslationService) _translationService).GetTranslationString("time")} {tour.GetTourTime().Hour:00}:{tour.GetTourTime():00}\t\t{((TranslationService) _translationService).GetTranslationString("spots")} {tour.GetRemainingCapacity()}\n"); } return builder.ToString(); diff --git a/ProjectB/Views/Reservation/ReservationsView.cs b/ProjectB/Views/Reservation/ReservationsView.cs index 622f6b7..c7b98fe 100644 --- a/ProjectB/Views/Reservation/ReservationsView.cs +++ b/ProjectB/Views/Reservation/ReservationsView.cs @@ -1,3 +1,9 @@ + +using ProjectB.Models; +using ProjectB.Repositories; +using ProjectB.Services; +using Spectre.Console; + namespace ProjectB.Views.Reservation; public class ReservationView( @@ -5,37 +11,47 @@ public class ReservationView( EditReservationView editReservationView, DeleteReservationView deleteReservationView) : AbstractView { - private const string OPTIONS = """ - 1. Inschrijven voor een tour. - 2. Uw inschrijving voor een tour wijzigen. - 3. Verwijder uw inschrijving voor een tour. - 4. Exit - """; + private static IService _translationService = new TranslationService(new TranslationRepository()); + // ((TranslationService) _translationService).GetTranslationString("chooseOption") + // $"[blue]{((TranslationService) _translationService).GetTranslationString("createReservationView")}[/]" - private const string OUTPUT = $""" - Kies een van de onderstaande opties om verder te gaan: - {OPTIONS} - """; public override void Output() { while (true) { - Console.WriteLine(OUTPUT); - int option = ReadUserChoice(1, 4, OUTPUT); - switch (option) + var options = new Dictionary + { + { 1, $"[blue]{((TranslationService) _translationService).GetTranslationString("createReservationView")}[/]"}, + { 2, $"[blue]{((TranslationService) _translationService).GetTranslationString("editReservationView")}[/]" }, + { 3, $"[blue]{((TranslationService) _translationService).GetTranslationString("deleteReservationView")}[/]" }, + { 0, $"[blue]{((TranslationService) _translationService).GetTranslationString("return")}[/]" } + }; + + var option = AnsiConsole.Prompt( + new SelectionPrompt() + .Title(((TranslationService) _translationService).GetTranslationString("chooseOption")) + .PageSize(10) + .AddChoices(options.Keys) + .UseConverter(choice => $"{choice}. {options[choice]}") + ); + + while (true) { - case 1: - createReservationView.Output(); - break; - case 2: - editReservationView.Output(); - break; - case 3: - deleteReservationView.Output(); - break; - case 4: - return; + switch (option) + { + case 1: + createReservationView.Output(); + break; + case 2: + editReservationView.Output(); + break; + case 3: + deleteReservationView.Output(); + break; + case 4: + return; + } } } } diff --git a/ProjectB/login/EmployeeLoginStrategy.cs b/ProjectB/login/EmployeeLoginStrategy.cs index 7b39388..850bd40 100644 --- a/ProjectB/login/EmployeeLoginStrategy.cs +++ b/ProjectB/login/EmployeeLoginStrategy.cs @@ -1,16 +1,25 @@ using System.Security; -using ProjectB.Resources; using ProjectB.Models; +using ProjectB.Repositories; +using ProjectB.Resources; +using ProjectB.Services; +using Spectre.Console; namespace ProjectB.login; public class EmployeeLoginStrategy: ILoginStrategy { + private static IService _translationService = new TranslationService(new TranslationRepository()); + // ((TranslationService) _translationService).GetTranslationString("chooseOption") + // $"[blue]{((TranslationService) _translationService).GetTranslationString("createReservationView")}[/]" + + + + public Session Handle() { - Console.WriteLine(Translations.translation("LOGIN_PROMPT_EMPLOYEE")); - string? username = Console.ReadLine(); - Console.WriteLine(Translations.translation("LOGIN_PROMPT_EMPLOYEE_PASSWORD")); + string? username = AnsiConsole.Ask(((TranslationService) _translationService).GetTranslationString("enterUsername")); + AnsiConsole.MarkupLine($"[blue]{((TranslationService) _translationService).GetTranslationString("enterPassword")}[/]"); SecureString? password = GetPassword(); // TODO: Check password, and get UserRole from file. diff --git a/ProjectB/login/GuestLoginStrategy.cs b/ProjectB/login/GuestLoginStrategy.cs index 6455315..9ba532c 100644 --- a/ProjectB/login/GuestLoginStrategy.cs +++ b/ProjectB/login/GuestLoginStrategy.cs @@ -1,16 +1,22 @@ using ProjectB.Resources; using ProjectB.Models; +using ProjectB.Repositories; +using ProjectB.Services; + namespace ProjectB.login; public class GuestLoginStrategy: ILoginStrategy { - + private static IService _translationService = new TranslationService(new TranslationRepository()); + // ((TranslationService) _translationService).GetTranslationString("chooseOption") public Session Handle() { - Console.WriteLine(Translations.translation("LOGIN_PROMPT_GUEST")); + + Console.WriteLine(((TranslationService) _translationService).GetTranslationString("enterTicketNumber")); + string? ticketNumber = Console.ReadLine(); // TODO: Check whether ticket is valid diff --git a/ProjectB/Settings/Lanuage.cs b/ProjectB/settings/Lanuage.cs similarity index 59% rename from ProjectB/Settings/Lanuage.cs rename to ProjectB/settings/Lanuage.cs index 858971d..71ab3ac 100644 --- a/ProjectB/Settings/Lanuage.cs +++ b/ProjectB/settings/Lanuage.cs @@ -1,7 +1,7 @@ namespace ProjectB.settings; -public enum Language +public enum Lanuage { NL, - EN + EN, } \ No newline at end of file diff --git a/ProjectB/ui/MainMenu.cs b/ProjectB/ui/MainMenu.cs new file mode 100644 index 0000000..e69de29 diff --git a/ProjectBTest/Mocks/TourRepositoryMock.cs b/ProjectBTest/Mocks/TourRepositoryMock.cs new file mode 100644 index 0000000..8a478a8 --- /dev/null +++ b/ProjectBTest/Mocks/TourRepositoryMock.cs @@ -0,0 +1,81 @@ +using ProjectB.Models; +using ProjectB.Repositories; + +namespace ProjectBTest.Mocks; + +public class TourRepositoryMock : IRepository +{ + + private Dictionary _repository = new Dictionary(); + private List _fileSystem = new List(); + + + public void Save(Tour entity) + { + throw new NotImplementedException(); + } + + public Tour? FindById(TourCompositeKey id) + { + throw new NotImplementedException(); + } + + public Tour? FindById(int id) + { + return _repository[id]; + } + + public IEnumerable FindAll() + { + return _repository.Values; + } + + public void Remove(TourCompositeKey id) + { + throw new NotImplementedException(); + } + + public void Remove(int id) + { + _repository.Remove(id); + } + + public void RemoveAll() + { + _repository.Clear(); + } + + public void Refresh() + { + // _repository = new Dictionary() + // { + // {1, new Tour(1, DateTime.Now, new List())}, + // {2, new Tour(2, DateTime.Now.AddDays(1), new List())}, + // {3, new Tour(3, DateTime.Now.AddDays(2), new List())} + // }; + } + + public void Persist() + { + _fileSystem.Clear(); + foreach (var VARIABLE in _repository.Values) + { + _fileSystem.Add(VARIABLE); + } + } + + public int Count() + { + return _repository.Values.Count; + } + + public string GetFileLocation() + { + return ".//TourRepository.json"; + } + + public bool Exists(int id) + { + return _repository.ContainsKey(id); + } +} \ No newline at end of file diff --git a/ProjectBTest/Repositories/InMemoryRepository.cs b/ProjectBTest/Repositories/InMemoryRepository.cs new file mode 100644 index 0000000..df0e8b4 --- /dev/null +++ b/ProjectBTest/Repositories/InMemoryRepository.cs @@ -0,0 +1,48 @@ +using ProjectB.Models; +using ProjectB.Repositories; +using System.Collections.Generic; + +public class InMemoryRepository : IRepository where T : IEntity where TKey : class +{ + private List entities = new List(); + + public void Save(T entity) + { + entities.Add(entity); + } + + public void Remove(TKey id) + { + entities.RemoveAll(e => e.GetId().Equals(id)); + } + + public T FindById(TKey id) + { + return entities.Find(e => e.GetId().Equals(id)) ?? default(T); + } + + public IEnumerable FindAll() + { + return entities; + } + + public void RemoveAll() + { + entities.Clear(); + } + + public void Refresh() + { + // Implement this method if needed + } + + public void Persist() + { + // Implement this method if needed + } + + public int Count() + { + return entities.Count; + } +} \ No newline at end of file diff --git a/ProjectBTest/Repositories/TourRepositoryTest.cs b/ProjectBTest/Repositories/TourRepositoryTest.cs new file mode 100644 index 0000000..3a97d10 --- /dev/null +++ b/ProjectBTest/Repositories/TourRepositoryTest.cs @@ -0,0 +1,22 @@ +using ProjectB.Repositories; +using ProjectBTest.Fixtures; + +namespace ProjectBTest.Repositories; + +[TestClass] +public class TourRepositoryTest +{ + + [TestMethod] + public void Test() + { + var repo = new TourRepository(); + var entities = TourFixtures.GenerateCollection(12); + foreach (var VARIABLE in entities) + { + repo.Save(VARIABLE); + } + repo.Persist(); + } + +} \ No newline at end of file diff --git a/ProjectBTest/Services/TourServiceTest.cs b/ProjectBTest/Services/TourServiceTest.cs new file mode 100644 index 0000000..627ef9c --- /dev/null +++ b/ProjectBTest/Services/TourServiceTest.cs @@ -0,0 +1,35 @@ +using ProjectB.Services; + +namespace ProjectBTest.Services; + +[TestClass] +public class TourServiceTest +{ + + // private TourService _service; + // + // [TestMethod] + // public void TestCreate() + // { + // _repositoryMock = new TourRepositoryMock(); + // _service = new TourService(_repositoryMock); + // var tour = new Tour(25, DateTime.Now.AddDays(20), new List()); + // Assert.IsTrue(_repositoryMock.Count() == 0); + // + // _service.Create(tour); + // Assert.IsTrue(_repositoryMock.Count() == 1); + // } + // + // [TestMethod] + // public void TestCreateFailOnPrimaryKeyAlreadyExists() + // { + // _repositoryMock = new TourRepositoryMock(); + // _service = new TourService(_repositoryMock); + // var tour = new Tour(25, DateTime.Now.AddDays(20), new List()); + // Assert.IsTrue(_repositoryMock.Count() == 0); + // + // _service.Create(tour); + // Assert.IsTrue(_repositoryMock.Count() == 1); + // Assert.ThrowsException(() => _service.Create(tour)); + // } +} \ No newline at end of file diff --git a/ProjectBTest/UnitTestTranslations.cs b/ProjectBTest/UnitTestTranslations.cs new file mode 100644 index 0000000..3f26ce8 --- /dev/null +++ b/ProjectBTest/UnitTestTranslations.cs @@ -0,0 +1,52 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; +using ProjectB.Models; +using ProjectB.Repositories; +using ProjectB.Services; +using System.Collections.Generic; +using ProjectB.settings; + +namespace ProjectB.Tests +{ + [TestClass] + public class UnitTestTranslations + { + [TestMethod] + public void GetTranslationString_ReturnsCorrectTranslation_WhenKeyExists() + { + // Arrange + var lang = Settings.Lanuage.ToString(); + var translation = new Translation("NL", new Dictionary { { "test", "This is a test." } }); + var repository = new InMemoryRepository(); + repository.Save(translation); + + // Check if the translation is saved correctly + var savedTranslation = repository.FindById("NL"); + Assert.IsNotNull(savedTranslation); + Assert.AreEqual("This is a test.", savedTranslation.GetPairs()["test"]); + + var service = new TranslationService(repository); + + // Act + var result = service.GetTranslationString("test"); + + // Assert + Assert.AreEqual("This is a test.", result); + } + + [TestMethod] + public void GetTranslationString_ReturnsFallbackString_WhenKeyDoesNotExist() + { + // Arrange + var translation = new Translation("EN", new Dictionary { { "test", "This is a test." } }); + var repository = new InMemoryRepository(); + repository.Save(translation); + var service = new TranslationService(repository); + + // Act + var result = service.GetTranslationString("nonexistent"); + + // Assert + Assert.AreEqual("Translation not found: nonexistent", result); + } + } +} \ No newline at end of file diff --git a/ProjectBTest/Views/TourViewTest.cs b/ProjectBTest/Views/TourViewTest.cs new file mode 100644 index 0000000..7f1d469 --- /dev/null +++ b/ProjectBTest/Views/TourViewTest.cs @@ -0,0 +1,17 @@ +using ProjectB.Repositories; +using ProjectBTest.Fixtures; + +namespace ProjectBTest.Views; + +[TestClass] +public class TourViewTest +{ + + [TestMethod] + public void Test() + { + TourRepository repository = new(); + var tours = TourFixtures.GenerateCollection(100); + } + +} \ No newline at end of file diff --git a/ProjectBTest/ui/MainMenuTest.cs b/ProjectBTest/ui/MainMenuTest.cs index 76cf694..8295c8d 100644 --- a/ProjectBTest/ui/MainMenuTest.cs +++ b/ProjectBTest/ui/MainMenuTest.cs @@ -12,7 +12,7 @@ public class MainMenuTest [TestMethod] public void TestMainMenuPrintsInDutch() { - Settings.Language = Language.NL; + Settings.Lanuage = Lanuage.NL; MainMenu mainMenu = new(); using (ConsoleOutput consoleOutput = new ()) { @@ -24,7 +24,7 @@ public void TestMainMenuPrintsInDutch() [TestMethod] public void TestMainMenuPrintsInEnglish() { - Settings.Language = Language.EN; + Settings.Lanuage = Lanuage.EN; MainMenu mainMenu = new(); using (ConsoleOutput consoleOutput = new ()) {