This commit is contained in:
@@ -476,6 +476,7 @@ namespace Sockeye.Biz
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
var l = new License();
|
var l = new License();
|
||||||
|
l.Active = true;
|
||||||
l.RegTo = jLicense["regTo"].Value<string>();
|
l.RegTo = jLicense["regTo"].Value<string>();
|
||||||
|
|
||||||
//try to match customer; rockfish didn't track customer id in the license so this is a bit wishy washy
|
//try to match customer; rockfish didn't track customer id in the license so this is a bit wishy washy
|
||||||
@@ -489,6 +490,9 @@ namespace Sockeye.Biz
|
|||||||
|
|
||||||
|
|
||||||
var KeyText = jLicense["key"].Value<string>();
|
var KeyText = jLicense["key"].Value<string>();
|
||||||
|
|
||||||
|
l.Key = KeyText;
|
||||||
|
LicenseBiz.ParseKeySetDTOFields(l);
|
||||||
if (KeyText.Contains("AyaNovaLicenseKey"))
|
if (KeyText.Contains("AyaNovaLicenseKey"))
|
||||||
{
|
{
|
||||||
//v7 key
|
//v7 key
|
||||||
@@ -548,8 +552,8 @@ namespace Sockeye.Biz
|
|||||||
if (jKey["AyaNovaLicenseKey"]["LockDate"] != null)
|
if (jKey["AyaNovaLicenseKey"]["LockDate"] != null)
|
||||||
l.LicenseExpire = jKey["AyaNovaLicenseKey"]["LockDate"].Value<DateTime>().ToUniversalTime();
|
l.LicenseExpire = jKey["AyaNovaLicenseKey"]["LockDate"].Value<DateTime>().ToUniversalTime();
|
||||||
|
|
||||||
|
|
||||||
l.MaintenanceExpire = jKey["AyaNovaLicenseKey"]["Expires"].Value<DateTime>().ToUniversalTime();
|
l.MaintenanceExpire = jKey["AyaNovaLicenseKey"]["Expires"].Value<DateTime>().ToUniversalTime();
|
||||||
|
//l.Users=jKey["AyaNovaLicenseKey"]["TotalScheduleableUsers"].Value<int>();
|
||||||
l.PGroup = ProductGroup.AyaNova7;
|
l.PGroup = ProductGroup.AyaNova7;
|
||||||
l.FetchCode = jLicense["code"].Value<string>();
|
l.FetchCode = jLicense["code"].Value<string>();
|
||||||
l.Tags.Add("v7");
|
l.Tags.Add("v7");
|
||||||
@@ -572,6 +576,7 @@ namespace Sockeye.Biz
|
|||||||
l.LicenseExpire = jKey["AyaNovaLiteLicenseKey"]["LockDate"].Value<DateTime>().ToUniversalTime();
|
l.LicenseExpire = jKey["AyaNovaLiteLicenseKey"]["LockDate"].Value<DateTime>().ToUniversalTime();
|
||||||
|
|
||||||
l.MaintenanceExpire = jKey["AyaNovaLiteLicenseKey"]["Expires"].Value<DateTime>().ToUniversalTime();
|
l.MaintenanceExpire = jKey["AyaNovaLiteLicenseKey"]["Expires"].Value<DateTime>().ToUniversalTime();
|
||||||
|
|
||||||
l.PGroup = ProductGroup.AyaNova7;
|
l.PGroup = ProductGroup.AyaNova7;
|
||||||
l.FetchCode = jLicense["code"].Value<string>();
|
l.FetchCode = jLicense["code"].Value<string>();
|
||||||
l.Tags.Add("v7");
|
l.Tags.Add("v7");
|
||||||
@@ -615,7 +620,7 @@ namespace Sockeye.Biz
|
|||||||
l.Created = (DateTime)DateUtil.EpochToDateNullIsNull(jLicense["dtcreated"].Value<long>());
|
l.Created = (DateTime)DateUtil.EpochToDateNullIsNull(jLicense["dtcreated"].Value<long>());
|
||||||
l.FetchedOn = DateUtil.EpochToDateNullIsNull(jLicense["dtfetched"].Value<long?>());
|
l.FetchedOn = DateUtil.EpochToDateNullIsNull(jLicense["dtfetched"].Value<long?>());
|
||||||
l.FetchEmail = jLicense["email"].Value<string>();
|
l.FetchEmail = jLicense["email"].Value<string>();
|
||||||
l.Key = jLicense["key"].Value<string>();
|
// 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.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;
|
l.NotificationSent = true;
|
||||||
@@ -662,14 +667,31 @@ namespace Sockeye.Biz
|
|||||||
|
|
||||||
|
|
||||||
//Save Key first then can set keyid on tlr
|
//Save Key first then can set keyid on tlr
|
||||||
|
long? TrialKeyId = null;
|
||||||
|
{
|
||||||
|
string sKey = jTrialRequestItem["key"].Value<string>();
|
||||||
|
if (!string.IsNullOrWhiteSpace(sKey))
|
||||||
{
|
{
|
||||||
License l = new License();
|
License l = new License();
|
||||||
l.TrialMode = true;
|
l.TrialMode = true;
|
||||||
l.Key = jTrialRequestItem["key"].Value<string>();
|
|
||||||
|
|
||||||
|
l.Key = sKey;
|
||||||
//Parse key as we need the expiry dates and they are only stored in the key not the trial request
|
//Parse key as we need the expiry dates and they are only stored in the key not the trial request
|
||||||
string keyNoWS = System.Text.RegularExpressions.Regex.Replace(StringUtil.Extract(l.Key, "[KEY", "KEY]").Trim(), "(\"(?:[^\"\\\\]|\\\\.)*\")|\\s+", "$1");
|
string keyNoWS = System.Text.RegularExpressions.Regex.Replace(StringUtil.Extract(l.Key, "[KEY", "KEY]").Trim(), "(\"(?:[^\"\\\\]|\\\\.)*\")|\\s+", "$1");
|
||||||
var jKey = JObject.Parse(keyNoWS);
|
var jKey = JObject.Parse(keyNoWS);
|
||||||
|
|
||||||
|
|
||||||
|
l.RegTo = jKey["Key"]["RegisteredTo"].Value<string>();
|
||||||
|
|
||||||
|
//try to match customer; rockfish didn't track customer id in the license so this is a bit wishy washy
|
||||||
|
Customer cust = null;
|
||||||
|
cust = await ct.Customer.AsNoTracking().FirstOrDefaultAsync(z => z.Name == l.RegTo);
|
||||||
|
if (cust == null)//email?
|
||||||
|
cust = await ct.Customer.AsNoTracking().FirstOrDefaultAsync(z => z.EmailAddress.Contains(jTrialRequestItem["email"].Value<string>()));
|
||||||
|
if (cust != null)
|
||||||
|
l.CustomerId = cust.Id;
|
||||||
|
|
||||||
|
|
||||||
l.DbId = jKey["Key"]["DBID"].Value<string>();
|
l.DbId = jKey["Key"]["DBID"].Value<string>();
|
||||||
l.LicenseExpire = jKey["Key"]["LicenseExpiration"].Value<DateTime>().ToUniversalTime();
|
l.LicenseExpire = jKey["Key"]["LicenseExpiration"].Value<DateTime>().ToUniversalTime();
|
||||||
if ((bool?)jKey["Key"]["Perpetual"] ?? true)
|
if ((bool?)jKey["Key"]["Perpetual"] ?? true)
|
||||||
@@ -686,7 +708,13 @@ namespace Sockeye.Biz
|
|||||||
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.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;
|
l.NotificationSent = true;
|
||||||
LicenseBiz lbiz = LicenseBiz.GetBiz(ct);
|
LicenseBiz lbiz = LicenseBiz.GetBiz(ct);
|
||||||
await lbiz.CreateAsync(l, true);
|
var newLicenseObject = await lbiz.CreateAsync(l, true);
|
||||||
|
if (newLicenseObject == null)
|
||||||
|
;
|
||||||
|
else
|
||||||
|
TrialKeyId = newLicenseObject.Id;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -702,7 +730,7 @@ namespace Sockeye.Biz
|
|||||||
tlr.Processed = DateUtil.EpochToDateNullIsNull(jTrialRequestItem["dtProcessed"].Value<long?>());
|
tlr.Processed = DateUtil.EpochToDateNullIsNull(jTrialRequestItem["dtProcessed"].Value<long?>());
|
||||||
tlr.Status = (TrialRequestStatus)jTrialRequestItem["status"].Value<int>();
|
tlr.Status = (TrialRequestStatus)jTrialRequestItem["status"].Value<int>();
|
||||||
tlr.RejectReason = jTrialRequestItem["rejectReason"].Value<string>();
|
tlr.RejectReason = jTrialRequestItem["rejectReason"].Value<string>();
|
||||||
|
tlr.KeyId = TrialKeyId;
|
||||||
var biz = TrialLicenseRequestBiz.GetBiz(ct);
|
var biz = TrialLicenseRequestBiz.GetBiz(ct);
|
||||||
await biz.CreateAsync(tlr);
|
await biz.CreateAsync(tlr);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ namespace Sockeye.Biz
|
|||||||
|
|
||||||
#region PARSE KEY SET DTO FIELDS
|
#region PARSE KEY SET DTO FIELDS
|
||||||
//Read the license key text, parse it and set the dto fields accordingly
|
//Read the license key text, parse it and set the dto fields accordingly
|
||||||
internal License ParseKeySetDTOFields(License l)
|
public static License ParseKeySetDTOFields(License l)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (l == null || string.IsNullOrWhiteSpace(l.Key))
|
if (l == null || string.IsNullOrWhiteSpace(l.Key))
|
||||||
@@ -411,11 +411,12 @@ namespace Sockeye.Biz
|
|||||||
var feature = jFeature["Name"].Value<string>();
|
var feature = jFeature["Name"].Value<string>();
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
if (feature != "TrialMode")
|
if (feature == "TrialMode")
|
||||||
count = jFeature["Count"].Value<int>();
|
|
||||||
else
|
|
||||||
l.TrialMode = true;
|
l.TrialMode = true;
|
||||||
|
|
||||||
|
if (jFeature["Count"] != null)
|
||||||
|
count = jFeature["Count"].Value<int>();
|
||||||
|
|
||||||
if (feature == "ActiveInternalUsers")
|
if (feature == "ActiveInternalUsers")
|
||||||
l.Users = count;
|
l.Users = count;
|
||||||
|
|
||||||
@@ -600,14 +601,15 @@ namespace Sockeye.Biz
|
|||||||
bool isNew = currentObj == null;
|
bool isNew = currentObj == null;
|
||||||
|
|
||||||
//fetched keys are never editable, must be duped if re-issue
|
//fetched keys are never editable, must be duped if re-issue
|
||||||
if (currentObj.FetchedOn != null)
|
//I'LL PROBABLY NEED TO CHANGE THIS LATER FOR SOME REASON BUT FOR NOW IT'S DEFENSIVE
|
||||||
|
if (!isNew && currentObj.FetchedOn != null)
|
||||||
{
|
{
|
||||||
AddError(ApiErrorCode.VALIDATION_NOT_CHANGEABLE, "generalerror", "Fetched, not changeable, duplicate instead");
|
AddError(ApiErrorCode.VALIDATION_NOT_CHANGEABLE, "generalerror", "Fetched, not changeable, duplicate instead");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//MISC product group is not valid for keys
|
//MISC product group is not valid for keys
|
||||||
if (currentObj.PGroup == ProductGroup.Misc)
|
if (proposedObj.PGroup == ProductGroup.Misc)
|
||||||
{
|
{
|
||||||
AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "pGroup");
|
AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "pGroup");
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -195,7 +195,6 @@ namespace Sockeye.Biz
|
|||||||
.AddText(obj.Email)
|
.AddText(obj.Email)
|
||||||
.AddText(obj.EmailConfirmCode)
|
.AddText(obj.EmailConfirmCode)
|
||||||
.AddText(obj.RejectReason)
|
.AddText(obj.RejectReason)
|
||||||
.AddText(obj.Key)
|
|
||||||
.AddText(obj.Tags);
|
.AddText(obj.Tags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,16 +22,16 @@ namespace Sockeye.Util
|
|||||||
//!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImportingAsync WHEN NEW TABLES ADDED!!!!
|
//!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImportingAsync WHEN NEW TABLES ADDED!!!!
|
||||||
private const int DESIRED_SCHEMA_LEVEL = 17;
|
private const int DESIRED_SCHEMA_LEVEL = 17;
|
||||||
|
|
||||||
internal const long EXPECTED_COLUMN_COUNT = 504;
|
internal const long EXPECTED_COLUMN_COUNT = 505;
|
||||||
internal const long EXPECTED_INDEX_COUNT = 74;
|
internal const long EXPECTED_INDEX_COUNT = 74;
|
||||||
internal const long EXPECTED_CHECK_CONSTRAINTS = 240;
|
internal const long EXPECTED_CHECK_CONSTRAINTS = 242;
|
||||||
internal const long EXPECTED_FOREIGN_KEY_CONSTRAINTS = 32;
|
internal const long EXPECTED_FOREIGN_KEY_CONSTRAINTS = 33;
|
||||||
internal const long EXPECTED_VIEWS = 0;
|
internal const long EXPECTED_VIEWS = 0;
|
||||||
internal const long EXPECTED_ROUTINES = 2;
|
internal const long EXPECTED_ROUTINES = 2;
|
||||||
|
|
||||||
//!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImportingAsync WHEN NEW TABLES ADDED!!!!
|
//!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImportingAsync WHEN NEW TABLES ADDED!!!!
|
||||||
|
|
||||||
///////////////////////////////////////// C504:I74:CC241:FC32:V0:R2)
|
///////////////////////////////////////// (C505:I74:CC242:FC33:V0:R2)
|
||||||
/*
|
/*
|
||||||
|
|
||||||
MAXIMUM POSTGRES OBJECT NAME LENGTH: 63 CHARACTERS
|
MAXIMUM POSTGRES OBJECT NAME LENGTH: 63 CHARACTERS
|
||||||
|
|||||||
Reference in New Issue
Block a user