This commit is contained in:
2
.vscode/launch.json
vendored
2
.vscode/launch.json
vendored
@@ -35,7 +35,7 @@
|
|||||||
"SOCKEYE_DB_CONNECTION": "Server=localhost;Username=postgres;Password=sockeye;Database=sockeye;CommandTimeout=300;",
|
"SOCKEYE_DB_CONNECTION": "Server=localhost;Username=postgres;Password=sockeye;Database=sockeye;CommandTimeout=300;",
|
||||||
"SOCKEYE_DATA_PATH": "c:\\temp\\sockeye",
|
"SOCKEYE_DATA_PATH": "c:\\temp\\sockeye",
|
||||||
"SOCKEYE_USE_URLS": "http://*:7676;",
|
"SOCKEYE_USE_URLS": "http://*:7676;",
|
||||||
//"SOCKEYE_PERMANENTLY_ERASE_DATABASE":"true",
|
"SOCKEYE_PERMANENTLY_ERASE_DATABASE":"true",
|
||||||
//"SOCKEYE_REPORT_RENDERING_TIMEOUT":"1",
|
//"SOCKEYE_REPORT_RENDERING_TIMEOUT":"1",
|
||||||
"SOCKEYE_BACKUP_PG_DUMP_PATH": "C:\\data\\code\\postgres_14\\bin"
|
"SOCKEYE_BACKUP_PG_DUMP_PATH": "C:\\data\\code\\postgres_14\\bin"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -351,106 +351,106 @@ namespace Sockeye.Biz
|
|||||||
|
|
||||||
#region CASES
|
#region CASES
|
||||||
|
|
||||||
log.LogInformation("RFImport Cases");
|
// log.LogInformation("RFImport Cases");
|
||||||
//case projects to be tags
|
// //case projects to be tags
|
||||||
List<NameIdItem> CaseProjectList = new List<NameIdItem>();
|
// List<NameIdItem> CaseProjectList = new List<NameIdItem>();
|
||||||
{
|
// {
|
||||||
res = await client.GetAsync($"{URL_ROCKFISH}api/rfcaseproject");
|
// res = await client.GetAsync($"{URL_ROCKFISH}api/rfcaseproject");
|
||||||
responseText = await res.Content.ReadAsStringAsync();
|
// responseText = await res.Content.ReadAsStringAsync();
|
||||||
|
|
||||||
var jaRFCaseProjectList = JArray.Parse(responseText);
|
// var jaRFCaseProjectList = JArray.Parse(responseText);
|
||||||
foreach (JObject jRFCaseProject in jaRFCaseProjectList)
|
// foreach (JObject jRFCaseProject in jaRFCaseProjectList)
|
||||||
{
|
// {
|
||||||
CaseProjectList.Add(new NameIdItem() { Name = jRFCaseProject["name"].Value<string>(), Id = jRFCaseProject["id"].Value<long>() });
|
// CaseProjectList.Add(new NameIdItem() { Name = jRFCaseProject["name"].Value<string>(), Id = jRFCaseProject["id"].Value<long>() });
|
||||||
|
|
||||||
}
|
// }
|
||||||
|
|
||||||
}
|
// }
|
||||||
{
|
// {
|
||||||
res = await client.GetAsync($"{URL_ROCKFISH}api/rfcase/list");
|
// res = await client.GetAsync($"{URL_ROCKFISH}api/rfcase/list");
|
||||||
responseText = await res.Content.ReadAsStringAsync();
|
// responseText = await res.Content.ReadAsStringAsync();
|
||||||
var jaRFCaseList = JArray.Parse(responseText);
|
// var jaRFCaseList = JArray.Parse(responseText);
|
||||||
//some cases are missing the start date so substitute a close other case date (not critical but sb at least in the ballpark for list viewing purposes)
|
// //some cases are missing the start date so substitute a close other case date (not critical but sb at least in the ballpark for list viewing purposes)
|
||||||
DateTime dtTempCreated = new DateTime(2000, 1, 1, 0, 0, 0, DateTimeKind.Utc);
|
// DateTime dtTempCreated = new DateTime(2000, 1, 1, 0, 0, 0, DateTimeKind.Utc);
|
||||||
foreach (JObject jRFCase in jaRFCaseList.Reverse())
|
// foreach (JObject jRFCase in jaRFCaseList.Reverse())
|
||||||
{
|
// {
|
||||||
|
|
||||||
var g = new GZCase();
|
// var g = new GZCase();
|
||||||
g.CaseId = jRFCase["id"].Value<long>();
|
// g.CaseId = jRFCase["id"].Value<long>();
|
||||||
g.Closed = DateUtil.EpochToDateNullIsNull(jRFCase["dtClosed"].Value<long?>());
|
// g.Closed = DateUtil.EpochToDateNullIsNull(jRFCase["dtClosed"].Value<long?>());
|
||||||
//NOTE: closed in rockfish was the date at midnight in GMT
|
// //NOTE: closed in rockfish was the date at midnight in GMT
|
||||||
//so to be in the same day as here need to add a few hours, let's say 8 am for each so add 8 hours
|
// //so to be in the same day as here need to add a few hours, let's say 8 am for each so add 8 hours
|
||||||
if (g.Closed != null)
|
// if (g.Closed != null)
|
||||||
{
|
// {
|
||||||
g.Closed = ((DateTime)g.Closed).AddHours(16);
|
// g.Closed = ((DateTime)g.Closed).AddHours(16);
|
||||||
}
|
// }
|
||||||
|
|
||||||
//fuckery to try to insert a at least semi close date when created date is missing
|
// //fuckery to try to insert a at least semi close date when created date is missing
|
||||||
DateTime? dtTemp = DateUtil.EpochToDateNullIsNull(jRFCase["dtCreated"].Value<long?>());
|
// DateTime? dtTemp = DateUtil.EpochToDateNullIsNull(jRFCase["dtCreated"].Value<long?>());
|
||||||
if (dtTemp == null)
|
// if (dtTemp == null)
|
||||||
{
|
// {
|
||||||
dtTemp = dtTempCreated;
|
// dtTemp = dtTempCreated;
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
dtTempCreated = (DateTime)dtTemp;
|
// dtTempCreated = (DateTime)dtTemp;
|
||||||
}
|
// }
|
||||||
g.Created = (DateTime)dtTemp;
|
// g.Created = (DateTime)dtTemp;
|
||||||
g.Name = jRFCase["title"].Value<string>();
|
// g.Name = jRFCase["title"].Value<string>();
|
||||||
g.Notes = jRFCase["notes"].Value<string>();
|
// g.Notes = jRFCase["notes"].Value<string>();
|
||||||
|
|
||||||
var ver = jRFCase["releaseVersion"].Value<string>();
|
// var ver = jRFCase["releaseVersion"].Value<string>();
|
||||||
if (!string.IsNullOrWhiteSpace(ver))
|
// if (!string.IsNullOrWhiteSpace(ver))
|
||||||
g.Notes += $"\n-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\nReleased on version:{ver}";
|
// g.Notes += $"\n-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\nReleased on version:{ver}";
|
||||||
|
|
||||||
var releaseNotes = jRFCase["releaseNotes"].Value<string>();
|
// var releaseNotes = jRFCase["releaseNotes"].Value<string>();
|
||||||
if (!string.IsNullOrWhiteSpace(releaseNotes))
|
// if (!string.IsNullOrWhiteSpace(releaseNotes))
|
||||||
g.Notes += $"\nRelease notes:{releaseNotes}";
|
// g.Notes += $"\nRelease notes:{releaseNotes}";
|
||||||
|
|
||||||
//Project name to tags
|
// //Project name to tags
|
||||||
g.Tags.Add(CaseProjectList.FirstOrDefault(z => z.Id == jRFCase["rfCaseProjectId"].Value<long>()).Name.Replace("z_", "legacy-"));
|
// g.Tags.Add(CaseProjectList.FirstOrDefault(z => z.Id == jRFCase["rfCaseProjectId"].Value<long>()).Name.Replace("z_", "legacy-"));
|
||||||
|
|
||||||
//priority to tags
|
// //priority to tags
|
||||||
g.Tags.Add($"{jRFCase["priority"].Value<long>()}-priority");
|
// g.Tags.Add($"{jRFCase["priority"].Value<long>()}-priority");
|
||||||
|
|
||||||
//check for attachments and just add as a note, don't bother with actual transfer of attachment, there aren't a lot and most are way in the past and not required for anything
|
// //check for attachments and just add as a note, don't bother with actual transfer of attachment, there aren't a lot and most are way in the past and not required for anything
|
||||||
//if needed in future can manually xfer it over from the rockfish.sqlite db directly using DB BRowser for sqlite which allows opening the blob from the rfcaseblob table and saving it
|
// //if needed in future can manually xfer it over from the rockfish.sqlite db directly using DB BRowser for sqlite which allows opening the blob from the rfcaseblob table and saving it
|
||||||
res = await client.GetAsync($"{URL_ROCKFISH}api/rfcase/{g.CaseId}/attachments");
|
// res = await client.GetAsync($"{URL_ROCKFISH}api/rfcase/{g.CaseId}/attachments");
|
||||||
responseText = await res.Content.ReadAsStringAsync();
|
// responseText = await res.Content.ReadAsStringAsync();
|
||||||
var jAttachments = JObject.Parse(responseText);
|
// var jAttachments = JObject.Parse(responseText);
|
||||||
if (jAttachments["attach"].Count() > 0)
|
// if (jAttachments["attach"].Count() > 0)
|
||||||
{
|
// {
|
||||||
g.Notes += "\n********\nRockfish attachments\n";
|
// g.Notes += "\n********\nRockfish attachments\n";
|
||||||
foreach (JObject jAttachmentRecord in jAttachments["attach"])
|
// foreach (JObject jAttachmentRecord in jAttachments["attach"])
|
||||||
{
|
// {
|
||||||
g.Notes += $"File: \"{jAttachmentRecord["name"].Value<string>()}\", rfcaseblob table id: {jAttachmentRecord["id"].Value<long>()}\n";
|
// g.Notes += $"File: \"{jAttachmentRecord["name"].Value<string>()}\", rfcaseblob table id: {jAttachmentRecord["id"].Value<long>()}\n";
|
||||||
|
|
||||||
}
|
// }
|
||||||
g.Notes += "\n********\n";
|
// g.Notes += "\n********\n";
|
||||||
}
|
// }
|
||||||
|
|
||||||
GZCaseBiz biz = GZCaseBiz.GetBiz(ct);
|
// GZCaseBiz biz = GZCaseBiz.GetBiz(ct);
|
||||||
await biz.CreateAsync(g);
|
// await biz.CreateAsync(g);
|
||||||
|
|
||||||
//attachments example 86400000
|
// //attachments example 86400000
|
||||||
// /api/rfcase/4360/attachments
|
// // /api/rfcase/4360/attachments
|
||||||
//{"dlkey":"ZFkAUpo1L0Gi3Q9aO5szkA","attach":[{"id":259,"name":"desired weight calcs.txt"}]}
|
// //{"dlkey":"ZFkAUpo1L0Gi3Q9aO5szkA","attach":[{"id":259,"name":"desired weight calcs.txt"}]}
|
||||||
//{"dlkey":"iR6ncD70CkzkozyT0otA","attach":[]}
|
// //{"dlkey":"iR6ncD70CkzkozyT0otA","attach":[]}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}// all cases loop
|
// }// all cases loop
|
||||||
|
|
||||||
//Start next case with a new sequence caseid of 4444
|
// //Start next case with a new sequence caseid of 4444
|
||||||
using (var command = ct.Database.GetDbConnection().CreateCommand())
|
// using (var command = ct.Database.GetDbConnection().CreateCommand())
|
||||||
{
|
// {
|
||||||
command.CommandText = $"ALTER SEQUENCE agzcase_caseid_seq RESTART WITH 4444;";
|
// command.CommandText = $"ALTER SEQUENCE agzcase_caseid_seq RESTART WITH 4444;";
|
||||||
await ct.Database.OpenConnectionAsync();
|
// await ct.Database.OpenConnectionAsync();
|
||||||
await command.ExecuteNonQueryAsync();
|
// await command.ExecuteNonQueryAsync();
|
||||||
await ct.Database.CloseConnectionAsync();
|
// await ct.Database.CloseConnectionAsync();
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
#endregion cases
|
#endregion cases
|
||||||
|
|
||||||
@@ -620,7 +620,7 @@ 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 biz = LicenseBiz.GetBiz(ct);
|
LicenseBiz biz = LicenseBiz.GetBiz(ct);
|
||||||
await biz.CreateAsync(l);
|
await biz.CreateAsync(l, true);
|
||||||
|
|
||||||
}// all licenses loop
|
}// all licenses loop
|
||||||
|
|
||||||
@@ -659,23 +659,54 @@ namespace Sockeye.Biz
|
|||||||
"dtFetched": 1672257635
|
"dtFetched": 1672257635
|
||||||
},
|
},
|
||||||
*/
|
*/
|
||||||
var l = new TrialLicenseRequest();
|
|
||||||
l.DbId = jTrialRequestItem["dbId"].Value<string>();
|
|
||||||
l.Perpetual = jTrialRequestItem["perpetual"].Value<bool>();
|
|
||||||
l.CompanyName = jTrialRequestItem["companyName"].Value<string>();
|
|
||||||
l.ContactName = jTrialRequestItem["contactName"].Value<string>();
|
|
||||||
l.Email = jTrialRequestItem["email"].Value<string>();
|
|
||||||
l.EmailConfirmCode = jTrialRequestItem["emailConfirmCode"].Value<string>();
|
|
||||||
l.EmailValidated = jTrialRequestItem["emailValidated"].Value<bool>();
|
|
||||||
l.Requested = (DateTime)DateUtil.EpochToDateNullIsNull(jTrialRequestItem["dtRequested"].Value<long>());
|
|
||||||
l.Processed = DateUtil.EpochToDateNullIsNull(jTrialRequestItem["dtProcessed"].Value<long?>());
|
|
||||||
l.FetchedOn = DateUtil.EpochToDateNullIsNull(jTrialRequestItem["dtFetched"].Value<long?>());
|
|
||||||
l.Status = (TrialRequestStatus)jTrialRequestItem["status"].Value<int>();
|
|
||||||
l.RejectReason = jTrialRequestItem["rejectReason"].Value<string>();
|
|
||||||
l.Key = jTrialRequestItem["key"].Value<string>();
|
|
||||||
|
|
||||||
var biz = TrialLicenseRequestBiz.GetBiz(ct);
|
|
||||||
await biz.CreateAsync(l);
|
//Save Key first then can set keyid on tlr
|
||||||
|
{
|
||||||
|
License l = new License();
|
||||||
|
l.TrialMode = true;
|
||||||
|
l.Key = jTrialRequestItem["key"].Value<string>();
|
||||||
|
|
||||||
|
//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");
|
||||||
|
var jKey = JObject.Parse(keyNoWS);
|
||||||
|
l.DbId = jKey["Key"]["DBID"].Value<string>();
|
||||||
|
l.LicenseExpire = jKey["Key"]["LicenseExpiration"].Value<DateTime>().ToUniversalTime();
|
||||||
|
if ((bool?)jKey["Key"]["Perpetual"] ?? true)
|
||||||
|
l.PGroup = ProductGroup.RavenPerpetual;
|
||||||
|
else
|
||||||
|
l.PGroup = ProductGroup.RavenSubscription;
|
||||||
|
l.MaintenanceExpire = jKey["Key"]["MaintenanceExpiration"].Value<DateTime>().ToUniversalTime();
|
||||||
|
l.Tags.Add("raven");
|
||||||
|
l.Tags.Add("trial");
|
||||||
|
l.Created = DateUtil.EpochToDateNullIsMin(jTrialRequestItem["dtProcessed"].Value<long>());
|
||||||
|
l.FetchedOn = DateUtil.EpochToDateNullIsNull(jTrialRequestItem["dtFetched"].Value<long?>());
|
||||||
|
l.FetchEmail = jTrialRequestItem["email"].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 lbiz = LicenseBiz.GetBiz(ct);
|
||||||
|
await lbiz.CreateAsync(l, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
var tlr = new TrialLicenseRequest();
|
||||||
|
tlr.DbId = jTrialRequestItem["dbId"].Value<string>();
|
||||||
|
tlr.PGroup = (jTrialRequestItem["perpetual"].Value<bool>() ? ProductGroup.RavenPerpetual : ProductGroup.RavenSubscription);
|
||||||
|
tlr.CompanyName = jTrialRequestItem["companyName"].Value<string>();
|
||||||
|
tlr.ContactName = jTrialRequestItem["contactName"].Value<string>();
|
||||||
|
tlr.Email = jTrialRequestItem["email"].Value<string>();
|
||||||
|
tlr.EmailConfirmCode = jTrialRequestItem["emailConfirmCode"].Value<string>();
|
||||||
|
tlr.EmailValidated = jTrialRequestItem["emailValidated"].Value<bool>();
|
||||||
|
tlr.Requested = (DateTime)DateUtil.EpochToDateNullIsNull(jTrialRequestItem["dtRequested"].Value<long>());
|
||||||
|
tlr.Processed = DateUtil.EpochToDateNullIsNull(jTrialRequestItem["dtProcessed"].Value<long?>());
|
||||||
|
tlr.Status = (TrialRequestStatus)jTrialRequestItem["status"].Value<int>();
|
||||||
|
tlr.RejectReason = jTrialRequestItem["rejectReason"].Value<string>();
|
||||||
|
|
||||||
|
var biz = TrialLicenseRequestBiz.GetBiz(ct);
|
||||||
|
await biz.CreateAsync(tlr);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}// all trial requests loop
|
}// all trial requests loop
|
||||||
|
|
||||||
|
|||||||
@@ -41,14 +41,15 @@ namespace Sockeye.Biz
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
//CREATE
|
//CREATE
|
||||||
//
|
//
|
||||||
internal async Task<License> CreateAsync(License newObject)
|
internal async Task<License> CreateAsync(License newObject, bool importedWithKeyDoNotGenerate = false)
|
||||||
{
|
{
|
||||||
await ValidateAsync(newObject, null);
|
await ValidateAsync(newObject, null);
|
||||||
if (HasErrors)
|
if (HasErrors)
|
||||||
return null;
|
return null;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
await GenerateKey(newObject);
|
if (!importedWithKeyDoNotGenerate)//do not generate is used for initial import only from rockfish, could be removed after the initial import
|
||||||
|
await GenerateKey(newObject);
|
||||||
if (HasErrors) return null;
|
if (HasErrors) return null;
|
||||||
newObject.Tags = TagBiz.NormalizeTags(newObject.Tags);
|
newObject.Tags = TagBiz.NormalizeTags(newObject.Tags);
|
||||||
await ct.License.AddAsync(newObject);
|
await ct.License.AddAsync(newObject);
|
||||||
|
|||||||
Reference in New Issue
Block a user