This commit is contained in:
2022-08-17 00:05:27 +00:00
parent 07653bda93
commit abc59bae07
2 changed files with 11 additions and 14 deletions

View File

@@ -59,7 +59,7 @@ namespace AyaNova.Core
private const string TRIAL_FEATURE_NAME = "TrialMode";
//This feature name means it's a SAAS or rental mode key for month to month hosted service
private const string RENTAL_FEATURE_NAME = "Subscription";
// private const string RENTAL_FEATURE_NAME = "Subscription";
//Trial key magic number for development and testing, all other guids will be fully licensed
@@ -243,18 +243,13 @@ namespace AyaNova.Core
}
}
public bool RentalLicense
{
get
{
return HasLicenseFeature(RENTAL_FEATURE_NAME);
}
}
public string LicenseFormat { get; set; }
public string Id { get; set; }
public string RegisteredTo { get; set; }
public string DbId { get; set; }
public bool Perpetual { get; set; }
public DateTime LicenseExpiration { get; set; }
public DateTime MaintenanceExpiration { get; set; }
public List<LicenseFeature> Features { get; set; }
@@ -332,7 +327,7 @@ namespace AyaNova.Core
sb.AppendLine($"Registered to: {ActiveKey.RegisteredTo}");
//sb.AppendLine($"Key ID: {ActiveKey.Id}");
//sb.AppendLine($"Server DB ID: {ServerDbId}");
sb.AppendLine($"Type: {(ActiveKey.RentalLicense ? "Subscription" : "Perpetual")}");
sb.AppendLine($"Type: {(ActiveKey.Perpetual ? "Perpetual" : "Subscription")}");
if (ActiveKey.WillExpire)
sb.AppendLine($"License expires: {DateUtil.ServerDateTimeString(ActiveKey.LicenseExpiration)}");
sb.AppendLine($"Maintenance subscription expires: {DateUtil.ServerDateTimeString(ActiveKey.MaintenanceExpiration)}");
@@ -340,7 +335,7 @@ namespace AyaNova.Core
foreach (LicenseFeature l in ActiveKey.Features)
{
//don't show the rental or trial features
if (l.Feature != TRIAL_FEATURE_NAME && l.Feature != RENTAL_FEATURE_NAME)
if (l.Feature != TRIAL_FEATURE_NAME)
{
if (l.Count != 0)
sb.AppendLine($"{l.Feature} - {l.Count}");
@@ -379,7 +374,7 @@ namespace AyaNova.Core
sb.Append($"keyid: {ActiveKey.Id}, ");
sb.Append($"dbid: {LicenseDbId}, ");
// sb.Append($"serverdbid: {ServerDbId}");
sb.Append($"type: {(ActiveKey.RentalLicense ? "subscription" : "perpetual")}, ");
sb.Append($"type: {(ActiveKey.Perpetual ? "perpetual" : "subscription")}, ");
if (ActiveKey.WillExpire)
sb.Append($"exp: {DateUtil.ServerDateTimeString(ActiveKey.LicenseExpiration)} (utc), ");
sb.Append($"maint. sub. exps: {DateUtil.ServerDateTimeString(ActiveKey.MaintenanceExpiration)} (utc), ");
@@ -387,7 +382,7 @@ namespace AyaNova.Core
foreach (LicenseFeature l in ActiveKey.Features)
{
//don't show the rental or trial features
if (l.Feature != TRIAL_FEATURE_NAME && l.Feature != RENTAL_FEATURE_NAME)
if (l.Feature != TRIAL_FEATURE_NAME)
{
if (l.Count != 0)
sb.Append($"{l.Feature} - {l.Count}, ");
@@ -958,8 +953,8 @@ EQIDAQAB
//users can upgrade them any time
if (k.TrialLicense) return false;
//Do not worry about rental SAAS licenses, only we can upgrade them
if(k.RentalLicense) return false;
//Do not worry about subscription licenses, only we can upgrade them adn they are always valid to be upgraded
if (!k.Perpetual) return false;
//Ok, it's a perpetual license and not a trial so check away
return k.MaintenanceExpiration < dtB;