This commit is contained in:
@@ -170,35 +170,7 @@ namespace Sockeye.Biz
|
||||
client.DefaultRequestHeaders.Accept.Add(contentType);
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", authToken);
|
||||
|
||||
// var keyText = responseJson["data"]["key"].Value<string>();
|
||||
|
||||
// {{
|
||||
// "ok": 1,
|
||||
// "issued": 1672162767,
|
||||
// "expires": 1674754767,
|
||||
// "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOiIxNjcyMTYyNzY3IiwiZXhwIjoiMTY3NDc1NDc2NyIsImlzcyI6InJvY2tmaXNoQ29yZSIsImlkIjoiMiJ9.59Boie4EYtuRkccpf9QG8oszitx8UkGwAozgU1Effjk",
|
||||
// "dlkey": "Cz48oUgPfEitcJ3/Dxw",
|
||||
// "name": "John Cardinal",
|
||||
// "id": 2
|
||||
// }}
|
||||
|
||||
|
||||
//CUSTOMERS
|
||||
/*
|
||||
[
|
||||
{
|
||||
"active": false,
|
||||
"lapsed": true,
|
||||
"id": 1,
|
||||
"name": "4PRINT"
|
||||
},
|
||||
{
|
||||
"active": true,
|
||||
"lapsed": false,
|
||||
"id": 118,
|
||||
"name": "AAA TEST DEVELOPMENT"
|
||||
},etc
|
||||
*/
|
||||
res = await client.GetAsync($"{URL_ROCKFISH}api/customer/list");
|
||||
responseText = await res.Content.ReadAsStringAsync();
|
||||
var jaCustomerList = JArray.Parse(responseText);
|
||||
@@ -273,10 +245,23 @@ namespace Sockeye.Biz
|
||||
//Create it here
|
||||
p = new Product();
|
||||
p.Name = ProductName;
|
||||
p.Active = true;//not entirely true but we can always deactivate there aren't many products
|
||||
p.VendorId = 1;
|
||||
p.OurCode = p.VendorCode = jPurchase["productCode"].Value<string>();
|
||||
|
||||
//log.LogInformation($"Importing new product name:{p.Name} - code:{p.VendorCode}");
|
||||
if (p.VendorCode == "301028468")//subscription yearly
|
||||
{
|
||||
p.LicenseInterval = new TimeSpan(365, 0, 0, 0); //actual length, in license is where I pad to cover them
|
||||
}
|
||||
|
||||
if (p.VendorCode == "301028467")//subscription monthly
|
||||
{
|
||||
p.LicenseInterval = new TimeSpan(31, 0, 0, 0);//there is no concept beyond days for timespan so a month is 31 days max
|
||||
p.MaintInterval = new TimeSpan(31, 0, 0, 0);//the only product less than one year of maintenance save the ones with no maintenance which can be edited manually later as there are so few of them
|
||||
}
|
||||
else
|
||||
p.MaintInterval = new TimeSpan(365, 0, 0, 0);
|
||||
|
||||
ProductBiz biz = ProductBiz.GetBiz(ct);
|
||||
p = await biz.CreateAsync(p);
|
||||
}
|
||||
@@ -287,6 +272,7 @@ namespace Sockeye.Biz
|
||||
var s = new Purchase();
|
||||
s.VendorId = 1;
|
||||
s.ProductId = p.Id;
|
||||
|
||||
s.CustomerId = CurrentCustomerId;
|
||||
s.CancelDate = DateUtil.EpochToDateNullIsNull(jPurchase["cancelDate"].Value<long?>());
|
||||
s.CouponCode = jPurchase["couponCode"].Value<string>();
|
||||
@@ -307,15 +293,35 @@ namespace Sockeye.Biz
|
||||
|
||||
}//site loop
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}//end of all customers iteration
|
||||
|
||||
|
||||
|
||||
#region CASES
|
||||
//case projects to be tags
|
||||
List<NameIdItem> CaseProjectList = new List<NameIdItem>();
|
||||
{
|
||||
res = await client.GetAsync($"{URL_ROCKFISH}api/rfcaseproject");
|
||||
responseText = await res.Content.ReadAsStringAsync();
|
||||
|
||||
var jaRFCaseProjectList = JArray.Parse(responseText);
|
||||
foreach (JObject jRFCaseProject in jaRFCaseProjectList)
|
||||
{
|
||||
CaseProjectList.Add(new NameIdItem() { Name = jRFCaseProject["name"].Value<string>(), Id = jRFCaseProject["id"].Value<long>() });
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
{
|
||||
res = await client.GetAsync($"{URL_ROCKFISH}api/rfcase/list");
|
||||
responseText = await res.Content.ReadAsStringAsync();
|
||||
var jaRFCaseList = JArray.Parse(responseText);
|
||||
foreach (JObject jRFCase in jaRFCaseList)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
#endregion cases
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user