This commit is contained in:
2021-08-19 17:04:21 +00:00
parent f0edd7030d
commit 250996a3f4
2 changed files with 46 additions and 24 deletions

View File

@@ -46,6 +46,11 @@ namespace AyaNova.PlugIn.V8
edCurrent.Text = txt; edCurrent.Text = txt;
} }
public string AllText
{
get { return edOut.Text; }
}
public string LastOp public string LastOp
{ {
get { return edCurrent.Text; } get { return edCurrent.Text; }

View File

@@ -35,7 +35,7 @@ namespace AyaNova.PlugIn.V8
public string PluginVersion public string PluginVersion
{ {
get { return "7.6.1-alpha.122.C"; } get { return "7.6.1-alpha.122.D"; }
} }
public string About public string About
@@ -403,9 +403,11 @@ namespace AyaNova.PlugIn.V8
progress.Append("\n************\nExport failed with error:\n"); progress.Append("\n************\nExport failed with error:\n");
progress.Append(ex.Message); progress.Append(ex.Message);
progress.Append("stack:\n" + ex.StackTrace); progress.Append("stack:\n" + ex.StackTrace);
} }
finally finally
{ {
PostExportLogToV8(progress).Wait();
progress.FinishedImport(); progress.FinishedImport();
} }
@@ -468,6 +470,18 @@ namespace AyaNova.PlugIn.V8
UsedUserNames.Clear(); UsedUserNames.Clear();
} }
private async System.Threading.Tasks.Task PostExportLogToV8(ProgressForm progress)
{
try
{
await util.PostAsync("memo",
}
catch(Exception ex)
{
progress.Append("Error attempting to post migrate log to v8 superuser memo:\n" + ex.Message);
}
}
#region Users #region Users
private async System.Threading.Tasks.Task ExportStaffUsers(ProgressForm progress) private async System.Threading.Tasks.Task ExportStaffUsers(ProgressForm progress)
@@ -2474,9 +2488,9 @@ namespace AyaNova.PlugIn.V8
//rates in v7 are combined travel and service and the ui allows to change them so some records may need //rates in v7 are combined travel and service and the ui allows to change them so some records may need
//a historical travel rate but it is now a service rate in v7 and was exported as such //a historical travel rate but it is now a service rate in v7 and was exported as such
//so this code either returns the rate if ok or cross exports the rate to the other type then returns that rate //so this code either returns the rate if ok or cross exports the rate to the other type then returns that rate
private async System.Threading.Tasks.Task<long?> GetRate(bool wantTravel, Guid rateId, bool mustExist=false) private async System.Threading.Tasks.Task<long?> GetRate(bool wantTravel, Guid rateId, bool mustExist = false)
{ {
if(!mustExist && rateId==Guid.Empty) return null; if (!mustExist && rateId == Guid.Empty) return null;
if (!wantTravel)//looking for a service rate if (!wantTravel)//looking for a service rate
{ {
@@ -2488,7 +2502,7 @@ namespace AyaNova.PlugIn.V8
//yup, it is now a travel rate but once was a service rate so dupe this travel to service, add to service mapt and return the id //yup, it is now a travel rate but once was a service rate so dupe this travel to service, add to service mapt and return the id
long sourceRavenRateId = TravelRateMap[rateId]; long sourceRavenRateId = TravelRateMap[rateId];
//get the source rate and save to the cross rate add to map and return //get the source rate and save to the cross rate add to map and return
util.ApiResponse a=await util.GetAsync("travel-rate/" + sourceRavenRateId); util.ApiResponse a = await util.GetAsync("travel-rate/" + sourceRavenRateId);
dynamic d = a.ObjectResponse["data"]; dynamic d = a.ObjectResponse["data"];
d.active = false;//assume it's no longer active d.active = false;//assume it's no longer active
@@ -3011,7 +3025,7 @@ namespace AyaNova.PlugIn.V8
dwisu.stopDate = util.DateToV8(wisu.StopDate); dwisu.stopDate = util.DateToV8(wisu.StopDate);
dwisu.estimatedQuantity = wisu.EstimatedQuantity; dwisu.estimatedQuantity = wisu.EstimatedQuantity;
//dwisu.serviceRateId = Getv7v8IdMapNullOk(wisu.ServiceRateID); //dwisu.serviceRateId = Getv7v8IdMapNullOk(wisu.ServiceRateID);
dwisu.serviceRateId = await GetRate(false,wisu.ServiceRateID); dwisu.serviceRateId = await GetRate(false, wisu.ServiceRateID);
await util.PostAsync("workorder/items/scheduled-users", dwisu.ToString()); await util.PostAsync("workorder/items/scheduled-users", dwisu.ToString());
} }
@@ -3773,8 +3787,10 @@ namespace AyaNova.PlugIn.V8
TagFromv7Guid(c.WorkorderCategoryID, tags); TagFromv7Guid(c.WorkorderCategoryID, tags);
SetTags(d, tags); SetTags(d, tags);
util.ApiResponse rMainObject = null;
rMainObject = await util.PostAsync("pm", d.ToString());
var rMainObject = await util.PostAsync("pm", d.ToString());
long RavenId = util.IdFromResponse(rMainObject); long RavenId = util.IdFromResponse(rMainObject);
Addv7v8IdMap(c.ID, RavenId); Addv7v8IdMap(c.ID, RavenId);
d = rMainObject.ObjectResponse["data"]; d = rMainObject.ObjectResponse["data"];
@@ -3796,6 +3812,7 @@ namespace AyaNova.PlugIn.V8
//put the header object //put the header object
await util.PutAsync("pm", d.ToString()); await util.PutAsync("pm", d.ToString());
//----- //-----
//Event log fixup //Event log fixup
@@ -3867,7 +3884,7 @@ namespace AyaNova.PlugIn.V8
dwisu.startDate = util.DateToV8(wisu.StartDate); dwisu.startDate = util.DateToV8(wisu.StartDate);
dwisu.stopDate = util.DateToV8(wisu.StopDate); dwisu.stopDate = util.DateToV8(wisu.StopDate);
dwisu.estimatedQuantity = wisu.EstimatedQuantity; dwisu.estimatedQuantity = wisu.EstimatedQuantity;
dwisu.serviceRateId = await GetRate(false,wisu.ServiceRateID);//Getv7v8IdMapNullOk(wisu.ServiceRateID); dwisu.serviceRateId = await GetRate(false, wisu.ServiceRateID);//Getv7v8IdMapNullOk(wisu.ServiceRateID);
await util.PostAsync("pm/items/scheduled-users", dwisu.ToString()); await util.PostAsync("pm/items/scheduled-users", dwisu.ToString());
} }