From 87a433b13af67722f24134aace03a9f1ba6f4004 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=B2=E8=8F=AF?= <42814579+yunwah@users.noreply.github.com> Date: Fri, 22 Apr 2022 18:46:17 -0400 Subject: [PATCH] Adds backup to offsite facility command --- OpheliasOasis/Program.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/OpheliasOasis/Program.cs b/OpheliasOasis/Program.cs index e74b171..0729ad6 100644 --- a/OpheliasOasis/Program.cs +++ b/OpheliasOasis/Program.cs @@ -1332,6 +1332,9 @@ internal class Program * rate takes effect on the date set. For more information see the SetFutureBaseRate() * function. * + * backup: + * Creates a backup to be saved in an off-site storage facility. + * * Q or Q: * Returns to the main loop for choosing either the Guest or Admin flow. */ @@ -1348,6 +1351,16 @@ internal class Program case "checkin guest": CheckIn(); break; // Checks a guest in and assigns a room case "checkout guest": CheckOut(); break; // Checks out a guest and marks their reservation as ended case "set rate": SetFutureBaseRate(); break; // Allows employees to configure base rates + case "backup": + Directory.CreateDirectory("offsite-storage"); + File.Copy("database.sqlite3", "offsite-storage\\database.sqlite3.bak", true); + Console.WriteLine("Backup was created. Move this to offsite storage facility."); + if (File.Exists("offsite-storage\\database.sqlite3.bak")) + { + FileInfo f = new("offsite-storage\\database.sqlite3.bak"); + Console.WriteLine($"Database has been backed up to {f.FullName}"); + } + break; // Create a backup case "Q": return; // Quit to mode loop case "q": return; // Quit to mode loop default: Console.WriteLine("Unknown command, enter help for more inforamtion."); break;