Skip to content

Commit

Permalink
fix: full backup check (#191)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexsee authored May 6, 2023
1 parent ace0bf0 commit 3ba189c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 deletions.
24 changes: 12 additions & 12 deletions src/BSH.Main/Dialogs/frmBrowser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1480,13 +1480,13 @@ private async void cmdTakeMeBack_Click(object sender, EventArgs e)
}

// Version suchen, in der die Datei ist
string Result = await BackupLogic.GlobalBackup.QueryManager.GetBackVersionWhereFileAsync(selectedVersion.Id, txtSearch.Text);
if (Result is null)
var backupVersion = await BackupLogic.GlobalBackup.QueryManager.GetBackVersionWhereFileAsync(selectedVersion.Id, txtSearch.Text);
if (backupVersion == null)
{
return;
}

selectedVersion = await BackupLogic.GlobalBackup.QueryManager.GetVersionByIdAsync(Result);
selectedVersion = await BackupLogic.GlobalBackup.QueryManager.GetVersionByIdAsync(backupVersion);

// Alles leeren
lvFiles.Items.Clear();
Expand All @@ -1499,13 +1499,13 @@ private async void cmdTakeMeBack_Click(object sender, EventArgs e)
}
else
{
string Result = await BackupLogic.GlobalBackup.QueryManager.GetBackVersionWhereFilesInFolderAsync(selectedVersion.Id, selectedFolder);
if (Result is null)
var backupVersion = await BackupLogic.GlobalBackup.QueryManager.GetBackVersionWhereFilesInFolderAsync(selectedVersion.Id, selectedFolder);
if (backupVersion == null)
{
return;
}

AVersionList1.SelectItem(Result);
AVersionList1.SelectItem(backupVersion);
}
}

Expand All @@ -1526,13 +1526,13 @@ private async void cmdTakeMeLater_Click(object sender, EventArgs e)
}

// Version suchen, in der die Datei ist
string Result = await BackupLogic.GlobalBackup.QueryManager.GetNextVersionWhereFileAsync(selectedVersion.Id, txtSearch.Text);
if (Result is null)
var backupVersion = await BackupLogic.GlobalBackup.QueryManager.GetNextVersionWhereFileAsync(selectedVersion.Id, txtSearch.Text);
if (backupVersion == null)
{
return;
}

selectedVersion = await BackupLogic.GlobalBackup.QueryManager.GetVersionByIdAsync(Result);
selectedVersion = await BackupLogic.GlobalBackup.QueryManager.GetVersionByIdAsync(backupVersion);
lvFiles.Items.Clear();

// Nun neuen Prozess starten
Expand All @@ -1543,13 +1543,13 @@ private async void cmdTakeMeLater_Click(object sender, EventArgs e)
}
else
{
string Result = await BackupLogic.GlobalBackup.QueryManager.GetNextVersionWhereFilesInFolderAsync(selectedVersion.Id, selectedFolder);
if (Result is null)
var backupVersion = await BackupLogic.GlobalBackup.QueryManager.GetNextVersionWhereFilesInFolderAsync(selectedVersion.Id, selectedFolder);
if (backupVersion == null)
{
return;
}

AVersionList1.SelectItem(Result);
AVersionList1.SelectItem(backupVersion);
}
}

Expand Down
7 changes: 5 additions & 2 deletions src/BSH.Main/Modules/BackupLogic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -651,8 +651,11 @@ public async static Task thScheduleSysRunBackup()
if (Item[0] == "day")
{
var lastFullBackup = await GlobalBackup.QueryManager.GetLastFullBackupAsync();
var Diff = DateTime.Now.Subtract(lastFullBackup.CreationDate);
FullBackup = Diff.Days >= Convert.ToInt32(Item[1]);
if (lastFullBackup != null)
{
var Diff = DateTime.Now.Subtract(lastFullBackup.CreationDate);
FullBackup = Diff.Days >= Convert.ToInt32(Item[1]);
}
}
}

Expand Down

0 comments on commit 3ba189c

Please sign in to comment.