diff --git a/source/Plugins/AyaNova.Plugin.V8/V8.cs b/source/Plugins/AyaNova.Plugin.V8/V8.cs index cf962e9..87a70a8 100644 --- a/source/Plugins/AyaNova.Plugin.V8/V8.cs +++ b/source/Plugins/AyaNova.Plugin.V8/V8.cs @@ -182,7 +182,15 @@ namespace AyaNova.PlugIn.V8 return true; } 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"); //BIZ objects await ExportLocales(progress); - await ExportStaffUsers(progress); - await ExportClients(progress); - await ExportHeadOffices(progress); + await ExportStaffUsers(progress); await ExportContracts(progress); + await ExportHeadOffices(progress); + await ExportClients(progress); + + await ExportLoanItems(progress); await ExportParts(progress); await ExportProjects(progress); @@ -565,7 +575,7 @@ namespace AyaNova.PlugIn.V8 //{ // if (!progress.KeepGoing) return; // User c = User.GetItem(i.ID); - // var newId = Map[c.ID]; + // var newId = GetMapMap[c.ID]; // var creator = SafeGetUserMap(c.Creator); // var modifier = SafeGetUserMap(c.Modifier); @@ -649,17 +659,17 @@ namespace AyaNova.PlugIn.V8 if (c.VendorID != Guid.Empty) { 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) { - 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) { - 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; 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 modifier = SafeGetUserMap(c.Modifier); @@ -839,7 +849,11 @@ namespace AyaNova.PlugIn.V8 d.webAddress = c.WebAddress; d.popUpNotes = c.PopUpNotes; - //TODO: d.billHeadOffice = c.BillHeadOffice; + d.billHeadOffice = c.BillHeadOffice; + if (c.BillHeadOffice && c.HeadOfficeID!=Guid.Empty) + { + + } //todo: headOfficeId d.techNotes = c.TechNotes; d.accountNumber = c.AccountNumber; @@ -2730,7 +2744,9 @@ namespace AyaNova.PlugIn.V8 else RavenTypeAsString = ((int)util.RootObjectToAyaType(tid.RootObjectType)).ToString(); 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(dFileData.ToString()), name: "FileData"); @@ -2826,7 +2842,11 @@ namespace AyaNova.PlugIn.V8 else RavenTypeAsString = ((int)util.RootObjectToAyaType(tid.RootObjectType)).ToString(); 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(dFileData.ToString()), name: "FileData"); @@ -2869,7 +2889,7 @@ namespace AyaNova.PlugIn.V8 MatchCollection mc = AyaBizUtils.rxAyaImageTags.Matches(content); 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, ""); }