This commit is contained in:
@@ -149,7 +149,7 @@ namespace AyaNova.PlugIn.V8
|
||||
}
|
||||
|
||||
Opt dOpt = new Opt();
|
||||
var ro = dOpt.ShowDialog();
|
||||
var ro = dOpt.ShowDialog();
|
||||
if (ro == DialogResult.Cancel)
|
||||
{
|
||||
return;
|
||||
@@ -176,7 +176,7 @@ namespace AyaNova.PlugIn.V8
|
||||
/// </summary>
|
||||
private async void DoExport()
|
||||
{
|
||||
|
||||
|
||||
//Show progress form
|
||||
ProgressForm progress = new ProgressForm();
|
||||
progress.Show();
|
||||
@@ -187,7 +187,7 @@ namespace AyaNova.PlugIn.V8
|
||||
progress.Op("Preparing to export....");
|
||||
Map.Clear();
|
||||
TagMap.Clear();
|
||||
|
||||
|
||||
LocaleMap.Clear();
|
||||
|
||||
|
||||
@@ -249,15 +249,14 @@ namespace AyaNova.PlugIn.V8
|
||||
progress.Op("Exporting objects");
|
||||
//BIZ objects
|
||||
|
||||
if (progress.KeepGoing)
|
||||
await ExportLocales(progress);
|
||||
//if (progress.KeepGoing)
|
||||
// await ExportLocales(progress);
|
||||
|
||||
if (progress.KeepGoing)
|
||||
await ExportUsers(progress);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//dumpGlobalSettings(tempArchiveFolder, progress);
|
||||
@@ -294,7 +293,7 @@ namespace AyaNova.PlugIn.V8
|
||||
finally
|
||||
{
|
||||
progress.FinishedImport();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -325,7 +324,7 @@ namespace AyaNova.PlugIn.V8
|
||||
{
|
||||
User admin = User.GetItem(User.AdministratorID);
|
||||
progress.Op("Administrator account");
|
||||
var adminTid=new TypeAndID(RootObjectTypes.User, User.AdministratorID);
|
||||
var adminTid = new TypeAndID(RootObjectTypes.User, User.AdministratorID);
|
||||
//Attachments and wiki
|
||||
string AdminWikiContent = null;
|
||||
var hasWiki = WikiPage.HasWiki(User.AdministratorID);
|
||||
@@ -355,7 +354,7 @@ namespace AyaNova.PlugIn.V8
|
||||
await util.PutAsync("User/1", d.ToString());
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endregion admin export
|
||||
@@ -373,7 +372,7 @@ namespace AyaNova.PlugIn.V8
|
||||
|
||||
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();
|
||||
d.name = c.FirstName + " " + c.LastName;
|
||||
@@ -439,7 +438,10 @@ namespace AyaNova.PlugIn.V8
|
||||
d = rOptions.ObjectResponse["data"];
|
||||
d.uiColor = System.Drawing.ColorTranslator.ToHtml(System.Drawing.Color.FromArgb(c.ScheduleBackColor));
|
||||
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());
|
||||
}
|
||||
@@ -448,13 +450,16 @@ namespace AyaNova.PlugIn.V8
|
||||
await ExportAttachments(UserTID, progress);
|
||||
|
||||
//docs
|
||||
string NonFileUrls= await ExportDocs(UserTID, c.Docs, progress);
|
||||
if (!string.IsNullOrEmpty(NonFileUrls)) {
|
||||
//need to repost the user with the notes modified
|
||||
d = rMainObject.ObjectResponse["data"];
|
||||
d.notes = NonFileUrls + "\r\n-----------------\r\n" + d.notes;
|
||||
await util.PutAsync("User", d.ToString());
|
||||
}
|
||||
string NonFileUrls = await ExportDocs(UserTID, c.Docs, progress);
|
||||
if (!string.IsNullOrEmpty(NonFileUrls))
|
||||
{
|
||||
//need to repost the user with the notes modified
|
||||
d = rMainObject.ObjectResponse["data"];
|
||||
d.login = null;
|
||||
d.password = null;
|
||||
d.notes = NonFileUrls + "\n-----------------\n" + d.notes;
|
||||
await util.PutAsync("User/" + RavenId.ToString(), d.ToString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -471,7 +476,7 @@ namespace AyaNova.PlugIn.V8
|
||||
|
||||
await util.EventLog(3, newId, creator, modifier, c.Created, c.Modified);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
#endregion clients
|
||||
|
||||
@@ -549,7 +554,7 @@ namespace AyaNova.PlugIn.V8
|
||||
var exportName = i.Locale + " (" + RavenLocaleName + ")";
|
||||
progress.SubOp("");
|
||||
progress.Op("Exporting " + i.Locale + " to " + exportName);
|
||||
|
||||
|
||||
var t = new util.NameIdItem { Name = exportName, Id = x };
|
||||
a = await util.PostAsync("Translation/Duplicate", JObject.FromObject(t).ToString());
|
||||
var targetTranslationId = util.IdFromResponse(a);
|
||||
@@ -859,7 +864,7 @@ namespace AyaNova.PlugIn.V8
|
||||
|
||||
//--------------------------------------------
|
||||
#endregion object export
|
||||
|
||||
|
||||
#region Custom fields exporter
|
||||
|
||||
|
||||
@@ -1048,11 +1053,11 @@ namespace AyaNova.PlugIn.V8
|
||||
|
||||
}
|
||||
#endregion attachments
|
||||
|
||||
|
||||
#region Assigned docs exporter
|
||||
private async System.Threading.Tasks.Task<string> ExportDocs(TypeAndID tid, AssignedDocs docs, ProgressForm progress)
|
||||
{
|
||||
|
||||
|
||||
|
||||
if (!ExportAssignedDocs) return null;
|
||||
|
||||
@@ -1063,29 +1068,29 @@ namespace AyaNova.PlugIn.V8
|
||||
foreach (AssignedDoc doc in docs)
|
||||
{
|
||||
if (!progress.KeepGoing) return null;
|
||||
|
||||
|
||||
//is it a local file?
|
||||
if (!new Uri(doc.URL).IsFile)
|
||||
{
|
||||
NonFileUrls+=(doc.Description + "("+ImportTag+ ")\n" + doc.URL+"\n");
|
||||
NonFileUrls += (doc.Description + "(" + ImportTag + ")\n" + doc.URL + "\n");
|
||||
continue;
|
||||
}
|
||||
//can we see it?
|
||||
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;
|
||||
}
|
||||
|
||||
//get the file info
|
||||
FileInfo fi = new FileInfo(doc.URL);
|
||||
|
||||
|
||||
progress.SubOp("Assigned doc: \"" + doc.URL + "\" " + AyaBizUtils.FileSizeDisplay((decimal)fi.Length));
|
||||
|
||||
|
||||
//Compile the FileData property
|
||||
|
||||
|
||||
DateTimeOffset dtLastModified = fi.LastWriteTimeUtc;
|
||||
|
||||
|
||||
dynamic dFileData = new JArray();
|
||||
dynamic dFile = new JObject();
|
||||
dFile.name = fi.Name;
|
||||
@@ -1099,7 +1104,7 @@ namespace AyaNova.PlugIn.V8
|
||||
//Form data like the bizobject type and id
|
||||
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(doc.Description+" ("+ImportTag+")"), name: "Notes");
|
||||
formDataContent.Add(new StringContent(doc.Description + " (" + ImportTag + ")"), name: "Notes");
|
||||
formDataContent.Add(new StringContent(dFileData.ToString()), name: "FileData");
|
||||
|
||||
StreamContent AttachmentFile = new StreamContent(fi.OpenRead());
|
||||
|
||||
Reference in New Issue
Block a user