This commit is contained in:
2022-12-28 23:50:26 +00:00
parent 92f97cbf8e
commit 03e7056c66

View File

@@ -298,6 +298,7 @@ namespace Sockeye.Biz
}//end of all customers iteration }//end of all customers iteration
#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>();
@@ -398,6 +399,7 @@ namespace Sockeye.Biz
await ct.Database.CloseConnectionAsync(); await ct.Database.CloseConnectionAsync();
} }
} }
*/
#endregion cases #endregion cases
@@ -433,72 +435,23 @@ namespace Sockeye.Biz
if (cust != null) if (cust != null)
l.CustomerId = cust.Id; l.CustomerId = cust.Id;
l.DbId = jLicense["DBID"].Value<string>(); l.DbId = jLicense["DBID"].Value<string>();
if (l.DbId == "na/v7" || l.DbId == "na/v7")
l.DbId = null;
l.FetchCode = jLicense["DBID"].Value<string>(); l.FetchCode = jLicense["DBID"].Value<string>();
if (l.FetchCode == "na") l.FetchCode = null; if (l.FetchCode == "na") l.FetchCode = null;
l.FetchedOn = DateUtil.EpochToDateNullIsNull(jLicense["dtCreated"].Value<long?>()); l.FetchedOn = DateUtil.EpochToDateNullIsNull(jLicense["dtCreated"].Value<long?>());
l.FetchEmail = jLicense["email"].Value<string>();
l.Key = jLicense["key"].Value<string>();
//-------
l.Closed = DateUtil.EpochToDateNullIsNull(jLicenseListItem["dtClosed"].Value<long?>());
//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
if (l.Closed != null)
{
l.Closed = ((DateTime)l.Closed).AddHours(16);
}
//fuckery to try to insert a at least semi close date when created date is missing
DateTime? dtTemp = DateUtil.EpochToDateNullIsNull(jLicenseListItem["dtCreated"].Value<long?>());
if (dtTemp == null)
{
dtTemp = dtTempCreated;
}
else
{
dtTempCreated = (DateTime)dtTemp;
}
l.Created = (DateTime)dtTemp;
l.Name = jLicenseListItem["title"].Value<string>();
l.Notes = jLicenseListItem["notes"].Value<string>();
var ver = jLicenseListItem["releaseVersion"].Value<string>();
if (!string.IsNullOrWhiteSpace(ver))
l.Notes += $"\n-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\nReleased on version:{ver}";
var releaseNotes = jLicenseListItem["releaseNotes"].Value<string>();
if (!string.IsNullOrWhiteSpace(releaseNotes))
l.Notes += $"\nRelease notes:{releaseNotes}";
//Project name to tags
l.Tags.Add(CaseProjectList.FirstOrDefault(z => z.Id == jLicenseListItem["rfCaseProjectId"].Value<long>()).Name.Replace("z_", "legacy-"));
//priority to tags //priority to tags
l.Tags.Add($"{jLicenseListItem["priority"].Value<long>()}-priority"); if (l.FetchCode == null)
l.Tags.Add("raven");
else
l.Tags.Add("v7");
//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 LicenseBiz biz = LicenseBiz.GetBiz(ct);
//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/{l.CaseId}/attachments");
responseText = await res.Content.ReadAsStringAsync();
var jAttachments = JObject.Parse(responseText);
if (jAttachments["attach"].Count() > 0)
{
l.Notes += "\n********\nRockfish attachments\n";
foreach (JObject jAttachmentRecord in jAttachments["attach"])
{
l.Notes += $"File: \"{jAttachmentRecord["name"].Value<string>()}\", rfcaseblob table id: {jAttachmentRecord["id"].Value<long>()}\n";
}
l.Notes += "\n********\n";
}
GZCaseBiz biz = GZCaseBiz.GetBiz(ct);
await biz.CreateAsync(l); await biz.CreateAsync(l);
}// all licenses loop }// all licenses loop