This commit is contained in:
2020-05-19 17:28:17 +00:00
parent dd6fb84bd4
commit d20bd3a50e
2 changed files with 14 additions and 11 deletions

View File

@@ -47,7 +47,7 @@ namespace AyaNova.Biz
//not in db then get the default //not in db then get the default
if (ret == null) if (ret == null)
{ {
throw new System.Exception("GlobalOpsSettingsBiz::GetAsync -> Global settings object not found in database!!"); throw new System.Exception("GlobalOpsSettingsBiz::GetAsync -> Global OPS settings object not found in database!!");
} }
return ret; return ret;
} }

View File

@@ -1,7 +1,4 @@
using System.Collections.Generic; using System;
using System.IO;
using Microsoft.Extensions.Configuration;
using Microsoft.EntityFrameworkCore;
using System.Linq; using System.Linq;
using AyaNova.Models; using AyaNova.Models;
@@ -17,28 +14,34 @@ namespace AyaNova.Util
internal static class ServerGlobalOpsSettings internal static class ServerGlobalOpsSettings
{ {
internal static bool SearchCaseSensitiveOnly { get; set; } internal static DateTime BackupTime { get; set; }
internal static DateTime LastBackup { get; set; }
internal static int BackupSetsToKeep { get; set; }
internal static bool BackupAttachments { get; set; }
/// <summary> /// <summary>
/// Populate and / or create the settings /// Populate and / or create the settings
/// </summary> /// </summary>
internal static void Initialize(GlobalBizSettings global, AyContext ct = null) internal static void Initialize(GlobalOpsSettings global, AyContext ct = null)
{ {
if (global == null) if (global == null)
{ {
//fetch or create as not provided (meaning this was called from Startup.cs) //fetch or create as not provided (meaning this was called from Startup.cs)
global = ct.GlobalBizSettings.FirstOrDefault(z => z.Id == 1); global = ct.GlobalOpsSettings.FirstOrDefault(z => z.Id == 1);
if (global == null) if (global == null)
{ {
global = new GlobalBizSettings(); global = new GlobalOpsSettings();
ct.GlobalBizSettings.Add(global); ct.GlobalOpsSettings.Add(global);
ct.SaveChanges(); ct.SaveChanges();
} }
} }
//We have the object, now copy the static values here //We have the object, now copy the static values here
SearchCaseSensitiveOnly = global.SearchCaseSensitiveOnly; BackupAttachments = global.BackupAttachments;
BackupSetsToKeep = global.BackupSetsToKeep;
BackupTime = global.BackupTime;
LastBackup = global.LastBackup;
} }