This commit is contained in:
2021-08-20 22:38:06 +00:00
parent 69f8d7aaa5
commit 117e52808f
2 changed files with 60 additions and 10 deletions

View File

@@ -35,7 +35,7 @@ namespace AyaNova.PlugIn.V8
public string PluginVersion
{
get { return "7.6.1-alpha.124"; }
get { return "7.6.1-alpha.123A"; }
}
public string About
@@ -4445,7 +4445,7 @@ namespace AyaNova.PlugIn.V8
else
{
//log it as unfixable but still migrated
progress.Append("CSR '" + c.Title + "' is linked to a missing work order item record. This cannot be fixed automatically; this CSR will still be migrated but without the link to the missing work order item record");
progress.Append("CSR '" + c.Title + "' is linked to a missing workorderitem; this CSR will be migrated but without the link to the workorder");
}
}

View File

@@ -123,10 +123,22 @@ namespace AyaNova.PlugIn.V8
requestMessage.Headers.Add("X-AY-Import-Mode", "1");
if (!string.IsNullOrWhiteSpace(JWT))
requestMessage.Headers.Authorization = new AuthenticationHeaderValue("Bearer", JWT);
// requestMessage.RequestUri = new Uri(ApiBaseUrl);
HttpResponseMessage response = null;
try
{
response = await client.SendAsync(requestMessage);
}
catch (HttpRequestException ex)
{
var Err = ex.Message;
var InnerErr = "";
if (ex.InnerException != null)
InnerErr = ex.InnerException.Message;
throw new Exception("GET error, route: " + route + "\nError:" + Err + "\nInner error:" + InnerErr + "\nStack:" + ex.StackTrace );
}
HttpResponseMessage response = await client.SendAsync(requestMessage);
var responseAsString = await response.Content.ReadAsStringAsync();
if (!response.IsSuccessStatusCode)
{
@@ -144,6 +156,7 @@ namespace AyaNova.PlugIn.V8
public async static Task<ApiResponse> PostAsync(string route, string postJson = null)
{
var requestMessage = new HttpRequestMessage(HttpMethod.Post, ApiBaseUrl + route);
requestMessage.Headers.Add("X-AY-Import-Mode", "1");
if (!string.IsNullOrWhiteSpace(JWT))
@@ -151,8 +164,19 @@ namespace AyaNova.PlugIn.V8
if (!string.IsNullOrWhiteSpace(postJson))
requestMessage.Content = new StringContent(postJson, System.Text.Encoding.UTF8, "application/json");
HttpResponseMessage response = await client.SendAsync(requestMessage);
HttpResponseMessage response = null;
try
{
response = await client.SendAsync(requestMessage);
}
catch (HttpRequestException ex)
{
var Err = ex.Message;
var InnerErr = "";
if (ex.InnerException != null)
InnerErr = ex.InnerException.Message;
throw new Exception("POST error, route: " + route + "\nError:" + Err + "\nInner error:" + InnerErr + "\nStack:" + ex.StackTrace + "\nPOSTED OBJECT:\n" + postJson);
}
var responseAsString = await response.Content.ReadAsStringAsync();
if (!response.IsSuccessStatusCode)
{
@@ -179,8 +203,19 @@ namespace AyaNova.PlugIn.V8
if (!string.IsNullOrWhiteSpace(putJson))
requestMessage.Content = new StringContent(putJson, System.Text.Encoding.UTF8, "application/json");
HttpResponseMessage response = await client.SendAsync(requestMessage);
HttpResponseMessage response = null;
try
{
response = await client.SendAsync(requestMessage);
}
catch (HttpRequestException ex)
{
var Err = ex.Message;
var InnerErr = "";
if (ex.InnerException != null)
InnerErr = ex.InnerException.Message;
throw new Exception("PUT error, route: " + route + "\nError:" + Err + "\nInner error:" + InnerErr + "\nStack:" + ex.StackTrace + "\nPOSTED OBJECT:\n" + putJson);
}
var responseAsString = await response.Content.ReadAsStringAsync();
if (!response.IsSuccessStatusCode)
{
@@ -202,7 +237,22 @@ namespace AyaNova.PlugIn.V8
requestMessage.Content = formContent;
HttpResponseMessage response = await client.SendAsync(requestMessage);
HttpResponseMessage response = null;
try
{
response = await client.SendAsync(requestMessage);
}
catch (HttpRequestException ex)
{
var Err = ex.Message;
var InnerErr = "";
if (ex.InnerException != null)
InnerErr = ex.InnerException.Message;
throw new Exception("POST FORMDATA error, route: " + route + "\nError:" + Err + "\nInner error:" + InnerErr + "\nStack:" + ex.StackTrace );
}
var responseAsString = await response.Content.ReadAsStringAsync();
if (!response.IsSuccessStatusCode)
{
@@ -856,7 +906,7 @@ Locale Français is customized [signature: 804154061] exporting
}
}
public static DateTime GetDateFromSpanAndUnit(DateTime StartDate, GZTW.AyaNova.BLL.AyaUnitsOfTime unit, int multiple)
{
switch (unit)