This commit is contained in:
@@ -297,8 +297,6 @@ 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
|
||||||
@@ -329,8 +327,9 @@ namespace Sockeye.Biz
|
|||||||
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
|
||||||
@@ -400,6 +399,116 @@ namespace Sockeye.Biz
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion cases
|
#endregion cases
|
||||||
|
|
||||||
|
|
||||||
|
#region LICENSES
|
||||||
|
log.LogInformation("RFImport Licenses");
|
||||||
|
|
||||||
|
{
|
||||||
|
res = await client.GetAsync($"{URL_ROCKFISH}api/license/list");
|
||||||
|
responseText = await res.Content.ReadAsStringAsync();
|
||||||
|
var jaLicenseList = 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)
|
||||||
|
DateTime dtTempCreated = new DateTime(2000, 1, 1, 0, 0, 0, DateTimeKind.Utc);
|
||||||
|
foreach (JObject jLicenseListItem in jaLicenseList)
|
||||||
|
{
|
||||||
|
|
||||||
|
res = await client.GetAsync($"{URL_ROCKFISH}api/license/{jLicenseListItem["id"].Value<long>()}");
|
||||||
|
responseText = await res.Content.ReadAsStringAsync();
|
||||||
|
var jLicense = JObject.Parse(responseText);
|
||||||
|
|
||||||
|
/*
|
||||||
|
{"regTo":"PDI Technologies","customerName":"PDI Technologies","dtcreated":1672261044,"email":"jberkel@pdisoftware.com","code":"na","fetched":true,"dtfetched":1672262347,"fetchFrom":null,
|
||||||
|
"key":"[KEY\n{\n \"Key\": {\n \"LicenseFormat\": \"8\",\n \"Id\": \"1672261044\",\n \"RegisteredTo\": \"PDI Technologies\",\n \"DBID\": \"R6U37uNUN2hSQideG6Gg+MqoQY8vuUeyHFI6Kv7VDsE=\",\n \"Perpetual\": true,\n \"LicenseExpiration\": \"5555-01-01T00:00:00\",\n \"MaintenanceExpiration\": \"2023-12-28T00:00:00\",\n \"Features\": [\n {\n \"Name\": \"ActiveInternalUsers\",\n \"Count\": 5\n }\n ]\n }\n}\nKEY]\n[SIGNATURE\nkzVs8GH0MSIfsR7ZYQ5x+5wdVDJqpfOYvTfBCx32Vs+zqP7h89uUKI17jTx5rMvkOYX40GyJt0pTWOzltljzf+MaoTzoSvTsSPkWtdVWv8ZGOXUUdaZhzMoTJGxTg0JHka/8S5tLkTiuct3x+voiLAKXuFCp9TSZo4+UnejB6U2Bp6MfdZxLtKVZ/1RLu/h4SnP8ZbczuwbQReB1z4k4IRwjh5GHnUUm6YqZg/04m1X9FEeKQZQfGZk/qZ788jONbLQb4CLnq0/ZmIteeocDDBz59TYaC9BHwHp73y8jyPfEugVfyH2AE0J8ZILiFiozYQ7meP5X4ZOmd1nhTA8MkA==\nSIGNATURE]\n"
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
var l = new License();
|
||||||
|
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
|
||||||
|
Customer cust = null;
|
||||||
|
cust = await ct.Customer.AsNoTracking().FirstOrDefaultAsync(z => z.Name == jLicense["customerName"].Value<string>());
|
||||||
|
if (cust == null)//email?
|
||||||
|
cust = await ct.Customer.AsNoTracking().FirstOrDefaultAsync(z => z.EmailAddress.Contains(jLicense["email"].Value<string>()));
|
||||||
|
if (cust != null)
|
||||||
|
l.CustomerId = cust.Id;
|
||||||
|
l.DbId = jLicense["DBID"].Value<string>();
|
||||||
|
l.FetchCode = jLicense["DBID"].Value<string>();
|
||||||
|
if (l.FetchCode == "na") l.FetchCode = null;
|
||||||
|
l.FetchedOn = DateUtil.EpochToDateNullIsNull(jLicense["dtCreated"].Value<long?>());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//-------
|
||||||
|
|
||||||
|
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
|
||||||
|
l.Tags.Add($"{jLicenseListItem["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
|
||||||
|
//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);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}// all licenses loop
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
#endregion licenses
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ namespace Sockeye.Models
|
|||||||
public string Key { get; set; }
|
public string Key { get; set; }
|
||||||
public string FetchCode { get; set; }
|
public string FetchCode { get; set; }
|
||||||
public string FetchEmail { get; set; }
|
public string FetchEmail { get; set; }
|
||||||
public DateTime FetchedOn { get; set; }
|
public DateTime? FetchedOn { get; set; }
|
||||||
public string DbId { get; set; }
|
public string DbId { get; set; }
|
||||||
public DateTime LicenseExpire { get; set; }
|
public DateTime LicenseExpire { get; set; }
|
||||||
public DateTime MaintenanceExpire { get; set; }
|
public DateTime MaintenanceExpire { get; set; }
|
||||||
|
|||||||
Reference in New Issue
Block a user