This commit is contained in:
2023-01-09 02:03:14 +00:00
parent 146d17a865
commit 37b0cfa54d
6 changed files with 43 additions and 33 deletions

View File

@@ -566,7 +566,7 @@ namespace Sockeye.Biz
*/
string keyNoWS = System.Text.RegularExpressions.Regex.Replace(StringUtil.Extract(KeyText, "[KEY", "KEY]").Trim(), "(\"(?:[^\"\\\\]|\\\\.)*\")|\\s+", "$1");
var jKey = JObject.Parse(keyNoWS);
//In v7 the license expires is an optional property set called "LockDate"
//In v7 the license expires is an optional property set called "LockDate"
l.LicenseExpire = null;
if (jKey["AyaNovaLiteLicenseKey"]["LockDate"] != null)
l.LicenseExpire = jKey["AyaNovaLiteLicenseKey"]["LockDate"].Value<DateTime>().ToUniversalTime();
@@ -618,7 +618,7 @@ namespace Sockeye.Biz
l.Key = jLicense["key"].Value<string>();
l.Active = true;//active here means it's been fully prepared and is viable for use, all prior licenses fit this description so all are active
l.NotificationSent = true;
LicenseBiz biz = LicenseBiz.GetBiz(ct);
await biz.CreateAsync(l);

View File

@@ -50,8 +50,6 @@ namespace Sockeye.Biz
{
await GenerateKey(newObject);
if (HasErrors) return null;
newObject.Tags = TagBiz.NormalizeTags(newObject.Tags);
await ct.License.AddAsync(newObject);
await ct.SaveChangesAsync();
@@ -487,22 +485,24 @@ namespace Sockeye.Biz
internal async Task GenerateKey(License l)
{
if(l.CustomerId!=null){
l.CustomerViz=await ct.Customer.AsNoTracking().Where(x => x.Id == l.CustomerId).Select(x => x.Name).FirstOrDefaultAsync();
if (l.CustomerId != null)
{
l.CustomerViz = await ct.Customer.AsNoTracking().Where(x => x.Id == l.CustomerId).Select(x => x.Name).FirstOrDefaultAsync();
}
switch(l.PGroup){
case ProductGroup.RavenPerpetual:
switch (l.PGroup)
{
case ProductGroup.RavenPerpetual:
case ProductGroup.RavenSubscription:
{
RavenKeyFactory.GenerateAndSetRavenKey(l);
}
break;
{
RavenKeyFactory.GenerateAndSetRavenKey(l);
}
break;
case ProductGroup.AyaNova7:
{
KeyFactory.GenerateAndSetV7Key(l);
}
break;
{
KeyFactory.GenerateAndSetV7Key(l);
}
break;
}
}