This commit is contained in:
2023-02-15 19:14:51 +00:00
parent 8c2ed59e91
commit 82cacacfde
5 changed files with 121 additions and 18 deletions

View File

@@ -253,7 +253,7 @@ namespace Sockeye.Biz
//create product if not exist then import
//Get product id if exists
var ProductName = jPurchase["name"].Value<string>();
bool maybeRenewal=ProductName.ToLowerInvariant().Contains("renew");
bool maybeRenewal = ProductName.ToLowerInvariant().Contains("renew");
ProductName = ProductName.Replace("- Renewal", "").Replace(" Renewal", "").Replace(" RENEWAL", "").Replace("CANCELLED ", "").Replace("CANCELED ", "");
var p = await ct.Product.AsNoTracking().FirstOrDefaultAsync(z => z.VendorCode == jPurchase["productCode"].Value<string>());
@@ -294,7 +294,7 @@ namespace Sockeye.Biz
s.ProductId = p.Id;
s.PGroup = p.PGroup;
s.CustomerId = CurrentCustomerId;
s.RegTo=CustomerName;
s.RegTo = CustomerName;
s.CancelDate = DateUtil.EpochToDateNullIsNull(jPurchase["cancelDate"].Value<long?>());
s.CouponCode = jPurchase["couponCode"].Value<string>();
s.ExpireDate = DateUtil.EpochToDateNullIsNull(jPurchase["expireDate"].Value<long?>());
@@ -305,7 +305,7 @@ namespace Sockeye.Biz
s.RenewNoticeSent = jPurchase["renewNoticeSent"].Value<bool>();
s.SalesOrderNumber = jPurchase["salesOrderNumber"].Value<string>();
s.Notes = jPurchase["notes"].Value<string>();
s.IsRenewal=maybeRenewal;
s.IsRenewal = maybeRenewal;
PurchaseBiz biz = PurchaseBiz.GetBiz(ct);
await biz.CreateAsync(s);
}
@@ -361,12 +361,12 @@ namespace Sockeye.Biz
await ct.SaveChangesAsync();
// #if (DEBUG)
// //Test dev stuff
// #warning DEV TEST ORDER PROCESSING REMOVE THIS WHEN DONE
// if (!string.IsNullOrWhiteSpace(vn.VendorData))
// await SockBotProcessVendorNotifications.ParseVendorNotificationData(vn, ct, log);
// #endif
// #if (DEBUG)
// //Test dev stuff
// #warning DEV TEST ORDER PROCESSING REMOVE THIS WHEN DONE
// if (!string.IsNullOrWhiteSpace(vn.VendorData))
// await SockBotProcessVendorNotifications.ParseVendorNotificationData(vn, ct, log);
// #endif
}
}// all vendor notifications loop
@@ -440,20 +440,29 @@ namespace Sockeye.Biz
//priority to tags
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
//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");
responseText = await res.Content.ReadAsStringAsync();
var jAttachments = JObject.Parse(responseText);
if (jAttachments["attach"].Count() > 0)
try
{
g.Notes += "\n********\nRockfish attachments\n";
foreach (JObject jAttachmentRecord in jAttachments["attach"])
var jAttachments = JObject.Parse(responseText);
if (jAttachments["attach"].Count() > 0)
{
g.Notes += $"File: \"{jAttachmentRecord["name"].Value<string>()}\", rfcaseblob table id: {jAttachmentRecord["id"].Value<long>()}\n";
g.Notes += "\n********\nRockfish attachments\n";
foreach (JObject jAttachmentRecord in jAttachments["attach"])
{
g.Notes += $"File: \"{jAttachmentRecord["name"].Value<string>()}\", rfcaseblob table id: {jAttachmentRecord["id"].Value<long>()}\n";
}
g.Notes += "\n********\n";
}
g.Notes += "\n********\n";
}
catch (Newtonsoft.Json.JsonReaderException jre)
{
log.LogError(jre, $"Error parsing attachment check for case {g.CaseId}, response text was {responseText}");
}
GZCaseBiz biz = GZCaseBiz.GetBiz(ct);