This commit is contained in:
2020-05-02 20:48:51 +00:00
parent 050f9fafef
commit 2a4ca525df

View File

@@ -249,8 +249,8 @@ namespace AyaNova.PlugIn.V8
progress.Op("Exporting objects"); progress.Op("Exporting objects");
//BIZ objects //BIZ objects
if (progress.KeepGoing) //if (progress.KeepGoing)
await ExportLocales(progress); // await ExportLocales(progress);
if (progress.KeepGoing) if (progress.KeepGoing)
await ExportUsers(progress); await ExportUsers(progress);
@@ -259,7 +259,6 @@ namespace AyaNova.PlugIn.V8
//dumpGlobalSettings(tempArchiveFolder, progress); //dumpGlobalSettings(tempArchiveFolder, progress);
//dumpSeedNumbers(tempArchiveFolder, progress); //dumpSeedNumbers(tempArchiveFolder, progress);
@@ -325,7 +324,7 @@ namespace AyaNova.PlugIn.V8
{ {
User admin = User.GetItem(User.AdministratorID); User admin = User.GetItem(User.AdministratorID);
progress.Op("Administrator account"); progress.Op("Administrator account");
var adminTid=new TypeAndID(RootObjectTypes.User, User.AdministratorID); var adminTid = new TypeAndID(RootObjectTypes.User, User.AdministratorID);
//Attachments and wiki //Attachments and wiki
string AdminWikiContent = null; string AdminWikiContent = null;
var hasWiki = WikiPage.HasWiki(User.AdministratorID); var hasWiki = WikiPage.HasWiki(User.AdministratorID);
@@ -373,7 +372,7 @@ namespace AyaNova.PlugIn.V8
User c = User.GetItem(i.ID); User c = User.GetItem(i.ID);
var UserTID=new TypeAndID(RootObjectTypes.User, c.ID); var UserTID = new TypeAndID(RootObjectTypes.User, c.ID);
dynamic d = new JObject(); dynamic d = new JObject();
d.name = c.FirstName + " " + c.LastName; d.name = c.FirstName + " " + c.LastName;
@@ -439,7 +438,10 @@ namespace AyaNova.PlugIn.V8
d = rOptions.ObjectResponse["data"]; d = rOptions.ObjectResponse["data"];
d.uiColor = System.Drawing.ColorTranslator.ToHtml(System.Drawing.Color.FromArgb(c.ScheduleBackColor)); d.uiColor = System.Drawing.ColorTranslator.ToHtml(System.Drawing.Color.FromArgb(c.ScheduleBackColor));
d.emailAddress = string.IsNullOrWhiteSpace(c.EmailAddress) ? null : c.EmailAddress; d.emailAddress = string.IsNullOrWhiteSpace(c.EmailAddress) ? null : c.EmailAddress;
d.translationId = LocaleMap[c.DefaultLanguage]; if (LocaleMap.ContainsKey(c.DefaultLanguage))
d.translationId = LocaleMap[c.DefaultLanguage];
else
d.translationId = 1;
await util.PutAsync("UserOptions/" + RavenId.ToString(), d.ToString()); await util.PutAsync("UserOptions/" + RavenId.ToString(), d.ToString());
} }
@@ -448,13 +450,16 @@ namespace AyaNova.PlugIn.V8
await ExportAttachments(UserTID, progress); await ExportAttachments(UserTID, progress);
//docs //docs
string NonFileUrls= await ExportDocs(UserTID, c.Docs, progress); string NonFileUrls = await ExportDocs(UserTID, c.Docs, progress);
if (!string.IsNullOrEmpty(NonFileUrls)) { if (!string.IsNullOrEmpty(NonFileUrls))
//need to repost the user with the notes modified {
d = rMainObject.ObjectResponse["data"]; //need to repost the user with the notes modified
d.notes = NonFileUrls + "\r\n-----------------\r\n" + d.notes; d = rMainObject.ObjectResponse["data"];
await util.PutAsync("User", d.ToString()); d.login = null;
} d.password = null;
d.notes = NonFileUrls + "\n-----------------\n" + d.notes;
await util.PutAsync("User/" + RavenId.ToString(), d.ToString());
}
} }
@@ -1067,13 +1072,13 @@ namespace AyaNova.PlugIn.V8
//is it a local file? //is it a local file?
if (!new Uri(doc.URL).IsFile) if (!new Uri(doc.URL).IsFile)
{ {
NonFileUrls+=(doc.Description + "("+ImportTag+ ")\n" + doc.URL+"\n"); NonFileUrls += (doc.Description + "(" + ImportTag + ")\n" + doc.URL + "\n");
continue; continue;
} }
//can we see it? //can we see it?
if (!File.Exists(doc.URL)) if (!File.Exists(doc.URL))
{ {
NonFileUrls+=(ImportTag + " - Assigned doc. file not found:\n" + doc.Description + "\n" + doc.URL + "\n"); NonFileUrls += (ImportTag + " - Assigned doc. file not found:\n" + doc.Description + "\n" + doc.URL + "\n");
continue; continue;
} }
@@ -1099,7 +1104,7 @@ namespace AyaNova.PlugIn.V8
//Form data like the bizobject type and id //Form data like the bizobject type and id
formDataContent.Add(new StringContent(util.RootObjectToAyaType(tid.RootObjectType).ToString()), name: "AttachToObjectType"); formDataContent.Add(new StringContent(util.RootObjectToAyaType(tid.RootObjectType).ToString()), 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(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");
StreamContent AttachmentFile = new StreamContent(fi.OpenRead()); StreamContent AttachmentFile = new StreamContent(fi.OpenRead());