This commit is contained in:
2020-12-03 16:01:06 +00:00
parent 4813ed5725
commit 8dae1a192c

View File

@@ -182,7 +182,15 @@ namespace AyaNova.PlugIn.V8
return true; return true;
} }
return false; return false;
}
private long GetMap(Guid id, string details)
{
if (!Map.ContainsKey(id))
{
throw new Exception("Error: GetMap (source id: "+ id.ToString() +") [" + details + "] - v7 Id not previously exported, missing or corrupted source data, export can not complete until fixed");
}
return Map[id];
} }
@@ -295,10 +303,12 @@ namespace AyaNova.PlugIn.V8
progress.Op("Exporting Business objects"); progress.Op("Exporting Business objects");
//BIZ objects //BIZ objects
await ExportLocales(progress); await ExportLocales(progress);
await ExportStaffUsers(progress); await ExportStaffUsers(progress);
await ExportClients(progress);
await ExportHeadOffices(progress);
await ExportContracts(progress); await ExportContracts(progress);
await ExportHeadOffices(progress);
await ExportClients(progress);
await ExportLoanItems(progress); await ExportLoanItems(progress);
await ExportParts(progress); await ExportParts(progress);
await ExportProjects(progress); await ExportProjects(progress);
@@ -565,7 +575,7 @@ namespace AyaNova.PlugIn.V8
//{ //{
// if (!progress.KeepGoing) return; // if (!progress.KeepGoing) return;
// User c = User.GetItem(i.ID); // User c = User.GetItem(i.ID);
// var newId = Map[c.ID]; // var newId = GetMapMap[c.ID];
// var creator = SafeGetUserMap(c.Creator); // var creator = SafeGetUserMap(c.Creator);
// var modifier = SafeGetUserMap(c.Modifier); // var modifier = SafeGetUserMap(c.Modifier);
@@ -649,17 +659,17 @@ namespace AyaNova.PlugIn.V8
if (c.VendorID != Guid.Empty) if (c.VendorID != Guid.Empty)
{ {
d.userType = RavenUserType.ServiceContractor; d.userType = RavenUserType.ServiceContractor;
d.vendorId = Map[c.VendorID]; d.vendorId = GetMap(c.VendorID, "Vendor for subcontractor User " + d.name);
} }
if (c.ClientID != Guid.Empty) if (c.ClientID != Guid.Empty)
{ {
d.customerId = Map[c.ClientID]; d.customerId = GetMap(c.ClientID, "Client for Client type User " + d.name); //Map[c.ClientID];
} }
if (c.HeadOfficeID != Guid.Empty) if (c.HeadOfficeID != Guid.Empty)
{ {
d.headOfficeId = Map[c.HeadOfficeID]; d.headOfficeId = GetMap(c.HeadOfficeID, "Headoffice for HeadOffice type User " + d.name); //Map[c.HeadOfficeID];
} }
@@ -743,7 +753,7 @@ namespace AyaNova.PlugIn.V8
{ {
if (!progress.KeepGoing) return; if (!progress.KeepGoing) return;
User c = User.GetItem(i.ID); User c = User.GetItem(i.ID);
var newId = Map[c.ID]; var newId = GetMap(c.ID, "User for event log synchro. " + c.FirstName + " " + c.LastName); //Map[c.ID];
var creator = SafeGetUserMap(c.Creator); var creator = SafeGetUserMap(c.Creator);
var modifier = SafeGetUserMap(c.Modifier); var modifier = SafeGetUserMap(c.Modifier);
@@ -839,7 +849,11 @@ namespace AyaNova.PlugIn.V8
d.webAddress = c.WebAddress; d.webAddress = c.WebAddress;
d.popUpNotes = c.PopUpNotes; d.popUpNotes = c.PopUpNotes;
//TODO: d.billHeadOffice = c.BillHeadOffice; d.billHeadOffice = c.BillHeadOffice;
if (c.BillHeadOffice && c.HeadOfficeID!=Guid.Empty)
{
}
//todo: headOfficeId //todo: headOfficeId
d.techNotes = c.TechNotes; d.techNotes = c.TechNotes;
d.accountNumber = c.AccountNumber; d.accountNumber = c.AccountNumber;
@@ -2730,7 +2744,9 @@ namespace AyaNova.PlugIn.V8
else else
RavenTypeAsString = ((int)util.RootObjectToAyaType(tid.RootObjectType)).ToString(); RavenTypeAsString = ((int)util.RootObjectToAyaType(tid.RootObjectType)).ToString();
formDataContent.Add(new StringContent(RavenTypeAsString), name: "AttachToObjectType"); formDataContent.Add(new StringContent(RavenTypeAsString), name: "AttachToObjectType");
formDataContent.Add(new StringContent(Map[tid.ID].ToString()), name: "AttachToObjectId");
//formDataContent.Add(new StringContent(Map[tid.ID].ToString()), name: "AttachToObjectId");
formDataContent.Add(new StringContent(GetMap(tid.ID, "Object ID for attachment export (tid:"+tid.ToString()+") ").ToString()), name: "AttachToObjectId");
formDataContent.Add(new StringContent(ImportTag), name: "Notes"); formDataContent.Add(new StringContent(ImportTag), name: "Notes");
formDataContent.Add(new StringContent(dFileData.ToString()), name: "FileData"); formDataContent.Add(new StringContent(dFileData.ToString()), name: "FileData");
@@ -2826,7 +2842,11 @@ namespace AyaNova.PlugIn.V8
else else
RavenTypeAsString = ((int)util.RootObjectToAyaType(tid.RootObjectType)).ToString(); RavenTypeAsString = ((int)util.RootObjectToAyaType(tid.RootObjectType)).ToString();
formDataContent.Add(new StringContent(RavenTypeAsString), name: "AttachToObjectType"); formDataContent.Add(new StringContent(RavenTypeAsString), name: "AttachToObjectType");
formDataContent.Add(new StringContent(Map[tid.ID].ToString()), name: "AttachToObjectId"); // formDataContent.Add(new StringContent(Map[tid.ID].ToString()), name: "AttachToObjectId");
formDataContent.Add(new StringContent(GetMap(tid.ID, "Object ID for attached docs export (tid:" + tid.ToString() + ") ").ToString()), name: "AttachToObjectId");
formDataContent.Add(new StringContent(doc.Description + " (" + ImportTag + ")"), name: "Notes"); formDataContent.Add(new StringContent(doc.Description + " (" + ImportTag + ")"), name: "Notes");
formDataContent.Add(new StringContent(dFileData.ToString()), name: "FileData"); formDataContent.Add(new StringContent(dFileData.ToString()), name: "FileData");
@@ -2869,7 +2889,7 @@ namespace AyaNova.PlugIn.V8
MatchCollection mc = AyaBizUtils.rxAyaImageTags.Matches(content); MatchCollection mc = AyaBizUtils.rxAyaImageTags.Matches(content);
foreach (Match m in mc) foreach (Match m in mc)
{ {
var RavenId = Map[new Guid(m.Groups["guid"].Value)]; var RavenId = GetMap(new Guid(m.Groups["guid"].Value), "Object id for Wiki export (tid:" + tid.ToString()+")"); //Map[new Guid(m.Groups["guid"].Value)];
content = content.Replace(m.Value, "<img src=\"" + "[ATTACH:" + RavenId.ToString() + "]" + "\">"); content = content.Replace(m.Value, "<img src=\"" + "[ATTACH:" + RavenId.ToString() + "]" + "\">");
} }