Adds backup to offsite facility command

This commit is contained in:
雲華
2022-04-22 18:46:17 -04:00
parent 0a5fa3e402
commit 87a433b13a

View File

@@ -1332,6 +1332,9 @@ internal class Program
* rate takes effect on the date set. For more information see the SetFutureBaseRate() * rate takes effect on the date set. For more information see the SetFutureBaseRate()
* function. * function.
* *
* backup:
* Creates a backup to be saved in an off-site storage facility.
*
* Q or Q: * Q or Q:
* Returns to the main loop for choosing either the Guest or Admin flow. * 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 "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 "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 "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
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; default: Console.WriteLine("Unknown command, enter help for more inforamtion."); break;