This commit is contained in:
2020-05-02 20:16:10 +00:00
parent a432177405
commit 5fee0b6252

View File

@@ -314,7 +314,7 @@ namespace AyaNova.Util
await EraseTableAsync("aformcustom", conn);
await EraseTableAsync("asearchkey", conn);
await EraseTableAsync("asearchdictionary", conn);
await EraseTableAsync("atag", conn);
await EraseTableAsync("atag", conn);
await EraseTableAsync("acustomer", conn);
await EraseTableAsync("acontract", conn);
await EraseTableAsync("aheadoffice", conn);
@@ -377,27 +377,15 @@ namespace AyaNova.Util
// CALLED BY LICENSE CONTROLLER AND LICENSE.CS FOR TRIAL Request check
internal static async Task<bool> DBIsEmptyAsync(AyContext ct, ILogger _log)
{
//TODO: This needs to be way more thorough, only the main tables though, no need to get crazy with it
//just stuff that would be shitty to have to re-enter
//For efficiency just check a few main tables just stuff that would be shitty to have to re-enter
//Mostly user, customer and vendor cover it because nearly everything else requires those to have any sort of data at all
_log.LogDebug("DB empty check");
//An empty db contains only one User
if (await ct.User.LongCountAsync() > 1) return false;
//No clients
//if(ctx.Client.Count()>0) return false;
//No units
//if(ctx.Unit.Count()>0) return false;
//No parts
//if(ctx.Part.Count()>0) return false;
//No workorders
//if(ctx.Workorder.Count()>0) return false;
if (await ct.Customer.AnyAsync()) return false;
if (await ct.Vendor.AnyAsync()) return false;
return true;
}