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

@@ -25,7 +25,7 @@ namespace AyaNova.PlugIn.V8
btnClose.Enabled = false; btnClose.Enabled = false;
btnCancel.Enabled = true; btnCancel.Enabled = true;
btnCancel.Visible = true; btnCancel.Visible = true;
} }
public void FinishedImport() public void FinishedImport()
@@ -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
@@ -168,7 +168,7 @@ namespace AyaNova.PlugIn.V8
#endregion #endregion
private Dictionary<Guid, long> V7ToV8IdMap = new Dictionary<Guid, long>(); private Dictionary<Guid, long> V7ToV8IdMap = new Dictionary<Guid, long>();
private void Addv7v8IdMap(Guid v7id, long v8id) private void Addv7v8IdMap(Guid v7id, long v8id)
{ {
@@ -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)
@@ -632,7 +646,7 @@ namespace AyaNova.PlugIn.V8
d = rMainObject.ObjectResponse["data"]; d = rMainObject.ObjectResponse["data"];
// wiki // wiki
if (WikiPage.HasWiki(c.ID)) if (WikiPage.HasWiki(c.ID))
{ {
d.wiki = GetWikiContent(ObjectTID); d.wiki = GetWikiContent(ObjectTID);
repost = true; repost = true;
} }
@@ -1203,7 +1217,7 @@ namespace AyaNova.PlugIn.V8
// wiki // wiki
if (WikiPage.HasWiki(c.ID)) if (WikiPage.HasWiki(c.ID))
{ {
d.wiki = GetWikiContent(ObjectTID); d.wiki = GetWikiContent(ObjectTID);
repost = true; repost = true;
} }
@@ -1362,7 +1376,7 @@ namespace AyaNova.PlugIn.V8
// wiki // wiki
if (WikiPage.HasWiki(c.ID)) if (WikiPage.HasWiki(c.ID))
{ {
d.wiki = GetWikiContent(ObjectTID); d.wiki = GetWikiContent(ObjectTID);
repost = true; repost = true;
} }
@@ -1451,7 +1465,7 @@ namespace AyaNova.PlugIn.V8
// wiki // wiki
if (WikiPage.HasWiki(c.ID)) if (WikiPage.HasWiki(c.ID))
{ {
d.wiki = GetWikiContent(ObjectTID); d.wiki = GetWikiContent(ObjectTID);
repost = true; repost = true;
} }
@@ -1472,7 +1486,7 @@ namespace AyaNova.PlugIn.V8
} }
} }
#endregion LoanItems #endregion LoanItems
@@ -1569,7 +1583,7 @@ namespace AyaNova.PlugIn.V8
// wiki // wiki
if (WikiPage.HasWiki(c.ID)) if (WikiPage.HasWiki(c.ID))
{ {
d.wiki = GetWikiContent(ObjectTID); d.wiki = GetWikiContent(ObjectTID);
repost = true; repost = true;
} }
@@ -1780,7 +1794,7 @@ namespace AyaNova.PlugIn.V8
// wiki // wiki
if (WikiPage.HasWiki(c.ID)) if (WikiPage.HasWiki(c.ID))
{ {
d.wiki = GetWikiContent(ObjectTID); d.wiki = GetWikiContent(ObjectTID);
repost = true; repost = true;
} }
@@ -1955,7 +1969,7 @@ namespace AyaNova.PlugIn.V8
// wiki // wiki
if (WikiPage.HasWiki(c.ID)) if (WikiPage.HasWiki(c.ID))
{ {
d.wiki = GetWikiContent(ObjectTID); d.wiki = GetWikiContent(ObjectTID);
repost = true; repost = true;
} }
@@ -2125,7 +2139,7 @@ namespace AyaNova.PlugIn.V8
// wiki // wiki
if (WikiPage.HasWiki(c.ID)) if (WikiPage.HasWiki(c.ID))
{ {
d.wiki = GetWikiContent(ObjectTID); d.wiki = GetWikiContent(ObjectTID);
repost = true; repost = true;
} }
@@ -2251,7 +2265,7 @@ namespace AyaNova.PlugIn.V8
// wiki // wiki
if (WikiPage.HasWiki(c.ID)) if (WikiPage.HasWiki(c.ID))
{ {
d.wiki = GetWikiContent(ObjectTID); d.wiki = GetWikiContent(ObjectTID);
repost = true; repost = true;
} }
@@ -2367,7 +2381,7 @@ namespace AyaNova.PlugIn.V8
// wiki // wiki
if (WikiPage.HasWiki(c.ID)) if (WikiPage.HasWiki(c.ID))
{ {
d.wiki = GetWikiContent(ObjectTID); d.wiki = GetWikiContent(ObjectTID);
repost = true; repost = true;
} }
@@ -2427,7 +2441,7 @@ namespace AyaNova.PlugIn.V8
} }
else else
if (TravelRateMap.ContainsKey(i.ID)) continue; if (TravelRateMap.ContainsKey(i.ID)) continue;
if (IsDuplicatev7v8IdMapItem(i.ID, i.Name, progress)) continue; if (IsDuplicatev7v8IdMapItem(i.ID, i.Name, progress)) continue;
progress.Op(ObjectTypeName + " " + d.name); progress.Op(ObjectTypeName + " " + d.name);
d.active = i.Active; d.active = i.Active;
@@ -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,10 +2502,10 @@ 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
d.notes = d.notes + "\n### V8 Migrate note: This record created automatically by v8 migrate because a migrated record is using this as a Service rate but it's currently a Travel rate in v7"; d.notes = d.notes + "\n### V8 Migrate note: This record created automatically by v8 migrate because a migrated record is using this as a Service rate but it's currently a Travel rate in v7";
d.Remove("id"); d.Remove("id");
d.Remove("concurrency"); d.Remove("concurrency");
@@ -2531,7 +2545,7 @@ namespace AyaNova.PlugIn.V8
else else
return null; return null;
} }
} }
#endregion Rates #endregion Rates
@@ -2887,7 +2901,7 @@ namespace AyaNova.PlugIn.V8
// wiki // wiki
if (WikiPage.HasWiki(c.ID)) if (WikiPage.HasWiki(c.ID))
{ {
d.wiki = GetWikiContent(ObjectTID); d.wiki = GetWikiContent(ObjectTID);
} }
@@ -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());
} }