This commit is contained in:
2020-06-16 22:17:25 +00:00
parent e48dff80b2
commit 50b9f873d9
2 changed files with 31 additions and 7 deletions

View File

@@ -4,6 +4,7 @@ using AyaNova.Models;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using System.Linq;
namespace AyaNova.Util
{
@@ -407,11 +408,34 @@ namespace AyaNova.Util
if (await ct.Part.AnyAsync()) return false;
if (await ct.Project.AnyAsync()) return false;
if (await ct.PurchaseOrder.AnyAsync()) return false;
return true;
}
///////////////////////////////////////////
// Check if DB has evaluation user accounts
// CALLED BY by login ping from licent via notify controller
internal static async Task<bool> DBHasTrialUsersAsync(AyContext ct, ILogger _log)
{
_log.LogDebug("DB trial users presence check");
//There are 22 trial users (more but for internal use) in a trial database
if (await ct.User.LongCountAsync() < 22) return false;
//just check for a few for testing
if(await ct.User.AsNoTracking()
.Where(z =>
z.Login == "BizAdminFull" ||
z.Login == "DispatchFull" ||
z.Login == "InventoryFull" ||
z.Login == "Accounting" ||
z.Login == "TechFull"
).LongCountAsync() < 5) return false;
return true;
}
///////////////////////////////////////////
// Ensure the db is not modified
//