This commit is contained in:
@@ -150,6 +150,7 @@ namespace AyaNova.PlugIn.V8
|
||||
|
||||
private Dictionary<Guid, long> Map = new Dictionary<Guid, long>();
|
||||
private Dictionary<Guid, string> TagMap = new Dictionary<Guid, string>();
|
||||
private string ImportTag = "v7-import";
|
||||
/// <summary>
|
||||
/// Dump the objects into a temporary directory as a series of JSON files
|
||||
/// then zip it all up into a single archive file and then erase the temporary folder
|
||||
@@ -158,6 +159,11 @@ namespace AyaNova.PlugIn.V8
|
||||
{
|
||||
Map.Clear();
|
||||
|
||||
/*
|
||||
TODO:
|
||||
|
||||
|
||||
*/
|
||||
|
||||
//Show progress form
|
||||
|
||||
@@ -180,8 +186,9 @@ namespace AyaNova.PlugIn.V8
|
||||
ExportScheduleableUserGroups(progress);
|
||||
ExportDispatchZones(progress);
|
||||
|
||||
//BIZ objects
|
||||
ExportUsers(progress);
|
||||
|
||||
//dumpUsers(tempArchiveFolder, progress);
|
||||
//dumpGlobalSettings(tempArchiveFolder, progress);
|
||||
//dumpLocales(tempArchiveFolder, progress);
|
||||
|
||||
@@ -190,10 +197,10 @@ namespace AyaNova.PlugIn.V8
|
||||
//dumpHeadOffices(tempArchiveFolder, progress);
|
||||
//
|
||||
|
||||
|
||||
|
||||
//NOTE: when get to PRIORITY, or WORKORDER STATUS be sure to add color code as per already done in USER export
|
||||
|
||||
|
||||
|
||||
progress.Append("Export completed");
|
||||
progress.FinishedImport();
|
||||
|
||||
@@ -332,30 +339,40 @@ namespace AyaNova.PlugIn.V8
|
||||
private void ExportUsers(ProgressForm progress)
|
||||
{
|
||||
|
||||
List<string> objectExcludeProperties = new List<string>(standardExcludePropertiesList);
|
||||
objectExcludeProperties.Add("LastView");
|
||||
objectExcludeProperties.Add("LastSchedGroupID");
|
||||
objectExcludeProperties.Add("LastSchedStartDate");
|
||||
objectExcludeProperties.Add("LastSchedStopDate");
|
||||
objectExcludeProperties.Add("LastSchedView");
|
||||
objectExcludeProperties.Add("ScheduleLastGraphicalPrintSettings");
|
||||
objectExcludeProperties.Add("MainGridLastRowCount");
|
||||
objectExcludeProperties.Add("ScheduleLastViewOpenOnly");
|
||||
objectExcludeProperties.Add("IsAdministrator");
|
||||
objectExcludeProperties.Add("IsGenerator");
|
||||
objectExcludeProperties.Add("IsScheduleable");
|
||||
objectExcludeProperties.Add("IsClientOrHeadOfficeAccount");
|
||||
objectExcludeProperties.Add("IsClientAccount");
|
||||
objectExcludeProperties.Add("IsHeadOfficeAccount");
|
||||
objectExcludeProperties.Add("OrganizationTypeAndID");
|
||||
//List<string> objectExcludeProperties = new List<string>(standardExcludePropertiesList);
|
||||
//objectExcludeProperties.Add("LastView");
|
||||
//objectExcludeProperties.Add("LastSchedGroupID");
|
||||
//objectExcludeProperties.Add("LastSchedStartDate");
|
||||
//objectExcludeProperties.Add("LastSchedStopDate");
|
||||
//objectExcludeProperties.Add("LastSchedView");
|
||||
//objectExcludeProperties.Add("ScheduleLastGraphicalPrintSettings");
|
||||
//objectExcludeProperties.Add("MainGridLastRowCount");
|
||||
//objectExcludeProperties.Add("ScheduleLastViewOpenOnly");
|
||||
//objectExcludeProperties.Add("IsAdministrator");
|
||||
//objectExcludeProperties.Add("IsGenerator");
|
||||
//objectExcludeProperties.Add("IsScheduleable");
|
||||
//objectExcludeProperties.Add("IsClientOrHeadOfficeAccount");
|
||||
//objectExcludeProperties.Add("IsClientAccount");
|
||||
//objectExcludeProperties.Add("IsHeadOfficeAccount");
|
||||
//objectExcludeProperties.Add("OrganizationTypeAndID");
|
||||
|
||||
UserPickList pl = UserPickList.GetList(false);
|
||||
progress.Append("Dumping " + pl.Count.ToString() + " Users");
|
||||
foreach (UserPickList.UserPickListInfo i in pl)
|
||||
{
|
||||
//skip administrator
|
||||
if (i.ID == User.AdministratorID) continue;
|
||||
|
||||
User c = User.GetItem(i.ID);
|
||||
JObject xtra = new JObject();
|
||||
xtra.Add("hexaScheduleBackColor", System.Drawing.ColorTranslator.ToHtml(System.Drawing.Color.FromArgb(c.ScheduleBackColor)));
|
||||
dynamic d = new JObject();
|
||||
d.name = c.FirstName + " " + c.LastName;
|
||||
d.userType = (int)c.UserType;
|
||||
if (c.VendorID != Guid.Empty)
|
||||
d.userType = 7;//7 is the RAVEN user type for subcontractor
|
||||
|
||||
|
||||
//JObject xtra = new JObject();
|
||||
//xtra.Add("hexaScheduleBackColor", System.Drawing.ColorTranslator.ToHtml(System.Drawing.Color.FromArgb(c.ScheduleBackColor)));
|
||||
|
||||
//DumpObjectToFolder(tempArchiveFolder, c, "user." + c.ID.ToString(), objectExcludeProperties, new TypeAndID(RootObjectTypes.User, c.ID), null, xtra);
|
||||
|
||||
@@ -449,59 +466,59 @@ namespace AyaNova.PlugIn.V8
|
||||
|
||||
#region Dump
|
||||
|
||||
// /// <summary>
|
||||
// /// Write out the object properties as JSON
|
||||
// /// </summary>
|
||||
// /// <param name="tempArchiveFolder"></param>
|
||||
// /// <param name="o"></param>
|
||||
// private void ExportObjectToFolder(object o, string objectFileName, List<string> excludeProperties,
|
||||
// TypeAndID tid, string forceTypeString = "", JObject jExtra = null)
|
||||
// {
|
||||
// /// <summary>
|
||||
// /// Write out the object properties as JSON
|
||||
// /// </summary>
|
||||
// /// <param name="tempArchiveFolder"></param>
|
||||
// /// <param name="o"></param>
|
||||
// private void ExportObjectToFolder(object o, string objectFileName, List<string> excludeProperties,
|
||||
// TypeAndID tid, string forceTypeString = "", JObject jExtra = null)
|
||||
// {
|
||||
|
||||
// var typestring = o.GetType().ToString();
|
||||
// if (!string.IsNullOrWhiteSpace(forceTypeString))
|
||||
// {
|
||||
// typestring = forceTypeString;
|
||||
// }
|
||||
// var typestring = o.GetType().ToString();
|
||||
// if (!string.IsNullOrWhiteSpace(forceTypeString))
|
||||
// {
|
||||
// typestring = forceTypeString;
|
||||
// }
|
||||
|
||||
// var dumpFolder = tempArchiveFolder + Path.DirectorySeparatorChar + typestring;
|
||||
// makeFolderIfNotExist(dumpFolder);
|
||||
// var dumpFolder = tempArchiveFolder + Path.DirectorySeparatorChar + typestring;
|
||||
// makeFolderIfNotExist(dumpFolder);
|
||||
|
||||
// var outputFileName = dumpFolder + Path.DirectorySeparatorChar + objectFileName + ".json";
|
||||
// var wikiOutputPath = dumpFolder + Path.DirectorySeparatorChar + objectFileName + Path.DirectorySeparatorChar + "files";
|
||||
// var outputFileName = dumpFolder + Path.DirectorySeparatorChar + objectFileName + ".json";
|
||||
// var wikiOutputPath = dumpFolder + Path.DirectorySeparatorChar + objectFileName + Path.DirectorySeparatorChar + "files";
|
||||
|
||||
// JsonSerializer serializer = new JsonSerializer();
|
||||
// serializer.NullValueHandling = NullValueHandling.Include;
|
||||
// serializer.ContractResolver = new ExcludeNamedPropertiesContractResolver(excludeProperties);
|
||||
// serializer.ReferenceLoopHandling = ReferenceLoopHandling.Serialize;
|
||||
// JsonSerializer serializer = new JsonSerializer();
|
||||
// serializer.NullValueHandling = NullValueHandling.Include;
|
||||
// serializer.ContractResolver = new ExcludeNamedPropertiesContractResolver(excludeProperties);
|
||||
// serializer.ReferenceLoopHandling = ReferenceLoopHandling.Serialize;
|
||||
|
||||
|
||||
//#if(DEBUG)
|
||||
// serializer.Formatting = Formatting.Indented;
|
||||
//#endif
|
||||
// // serializer.Converters.Add(new JavaScriptDateTimeConverter());
|
||||
// // serializer.NullValueHandling = NullValueHandling.Ignore;
|
||||
//#if(DEBUG)
|
||||
// serializer.Formatting = Formatting.Indented;
|
||||
//#endif
|
||||
// // serializer.Converters.Add(new JavaScriptDateTimeConverter());
|
||||
// // serializer.NullValueHandling = NullValueHandling.Ignore;
|
||||
|
||||
// //generate file name, should be ID of object plus .json
|
||||
// //generate file name, should be ID of object plus .json
|
||||
|
||||
// JObject jo = JObject.FromObject(o, serializer);
|
||||
// if (jExtra != null)
|
||||
// {
|
||||
// jo.Add("jextra", jExtra);
|
||||
// }
|
||||
// JObject jo = JObject.FromObject(o, serializer);
|
||||
// if (jExtra != null)
|
||||
// {
|
||||
// jo.Add("jextra", jExtra);
|
||||
// }
|
||||
|
||||
|
||||
// using (StreamWriter sw = new StreamWriter(outputFileName))
|
||||
// using (JsonWriter writer = new JsonTextWriter(sw))
|
||||
// {
|
||||
// using (StreamWriter sw = new StreamWriter(outputFileName))
|
||||
// using (JsonWriter writer = new JsonTextWriter(sw))
|
||||
// {
|
||||
|
||||
// // serializer.Serialize(writer, o);
|
||||
// serializer.Serialize(writer, jo);
|
||||
// }
|
||||
// // serializer.Serialize(writer, o);
|
||||
// serializer.Serialize(writer, jo);
|
||||
// }
|
||||
|
||||
// //WIKI / ATTACHMENTS
|
||||
// DumpWikiPageAndAttachments(tid, wikiOutputPath);
|
||||
// }
|
||||
// //WIKI / ATTACHMENTS
|
||||
// DumpWikiPageAndAttachments(tid, wikiOutputPath);
|
||||
// }
|
||||
|
||||
|
||||
//WIKI
|
||||
@@ -533,76 +550,76 @@ namespace AyaNova.PlugIn.V8
|
||||
private void ExportWikiPageAndAttachments(TypeAndID tid, string wikiOutputPath)
|
||||
{
|
||||
|
||||
// //may not exist
|
||||
// if (!WikiPage.HasWiki(tid.ID)) return;
|
||||
// //may not exist
|
||||
// if (!WikiPage.HasWiki(tid.ID)) return;
|
||||
|
||||
// WikiPage w = WikiPage.GetItem(tid);
|
||||
// var content = w.GetContentAsString;
|
||||
// AyaFileList fl = AyaFileList.GetList(w.ID);
|
||||
// WikiPage w = WikiPage.GetItem(tid);
|
||||
// var content = w.GetContentAsString;
|
||||
// AyaFileList fl = AyaFileList.GetList(w.ID);
|
||||
|
||||
// if (string.IsNullOrWhiteSpace(content) && fl.Count < 1) return;
|
||||
// if (string.IsNullOrWhiteSpace(content) && fl.Count < 1) return;
|
||||
|
||||
// makeFolderIfNotExist(wikiOutputPath);
|
||||
// makeFolderIfNotExist(wikiOutputPath);
|
||||
|
||||
// if (!string.IsNullOrWhiteSpace(content))
|
||||
// {
|
||||
// //write out the html wiki page
|
||||
// File.WriteAllText(wikiOutputPath + Path.DirectorySeparatorChar + "w.html", content);
|
||||
// }
|
||||
// if (!string.IsNullOrWhiteSpace(content))
|
||||
// {
|
||||
// //write out the html wiki page
|
||||
// File.WriteAllText(wikiOutputPath + Path.DirectorySeparatorChar + "w.html", content);
|
||||
// }
|
||||
|
||||
// //files
|
||||
// foreach (AyaFileList.AyaFileListInfo i in fl)
|
||||
// {
|
||||
// //WikiFileInfo fi = new WikiFileInfo();
|
||||
// // fi.Id = i.LT_O_AyaFile.Value.ToString();
|
||||
// // fi.Name = i.LT_O_AyaFile.Display;
|
||||
// // fi.Size = i.LT_AyaFile_Label_FileSize;
|
||||
// // fi.Creator = i.LT_Common_Label_Creator.Display;
|
||||
// // fi.Created = i.LT_Common_Label_Created.ToString();
|
||||
// // ret.Add(fi);
|
||||
// //files
|
||||
// foreach (AyaFileList.AyaFileListInfo i in fl)
|
||||
// {
|
||||
// //WikiFileInfo fi = new WikiFileInfo();
|
||||
// // fi.Id = i.LT_O_AyaFile.Value.ToString();
|
||||
// // fi.Name = i.LT_O_AyaFile.Display;
|
||||
// // fi.Size = i.LT_AyaFile_Label_FileSize;
|
||||
// // fi.Creator = i.LT_Common_Label_Creator.Display;
|
||||
// // fi.Created = i.LT_Common_Label_Created.ToString();
|
||||
// // ret.Add(fi);
|
||||
|
||||
|
||||
|
||||
// //save each file plus file info into their own folder by ayafile id this is because ayafiles can be dupe names and we need the wiki info to fixup the last created date etc
|
||||
// var filePath = wikiOutputPath + Path.DirectorySeparatorChar + i.LT_O_AyaFile.Value.ToString();
|
||||
// makeFolderIfNotExist(filePath);//output/objectype/client.f861ec01-8bde-46e1-9849-fcee9b42f05e/files/d5461ec01-8bde-46e1-9849-fcee9b42f0ff34/
|
||||
// //save each file plus file info into their own folder by ayafile id this is because ayafiles can be dupe names and we need the wiki info to fixup the last created date etc
|
||||
// var filePath = wikiOutputPath + Path.DirectorySeparatorChar + i.LT_O_AyaFile.Value.ToString();
|
||||
// makeFolderIfNotExist(filePath);//output/objectype/client.f861ec01-8bde-46e1-9849-fcee9b42f05e/files/d5461ec01-8bde-46e1-9849-fcee9b42f0ff34/
|
||||
|
||||
// var af = AyaFile.GetItem(i.LT_O_AyaFile.Value);
|
||||
// if (af == null) continue;
|
||||
// af.WriteToDisk(filePath, af.Name);
|
||||
// var af = AyaFile.GetItem(i.LT_O_AyaFile.Value);
|
||||
// if (af == null) continue;
|
||||
// af.WriteToDisk(filePath, af.Name);
|
||||
|
||||
// var fileInfo = new
|
||||
// {
|
||||
// name = i.LT_O_AyaFile.Display,
|
||||
// created = i.LT_Common_Label_Created,
|
||||
// creator = i.LT_Common_Label_Creator.Value,
|
||||
// mimetype = af.mimeType,
|
||||
// id = af.ID,
|
||||
// size = af.FileSize,
|
||||
// ayafiletype = af.FileType,
|
||||
// rootobjectid = af.RootObjectID,
|
||||
// rootobjecttype = af.RootObjectType
|
||||
// };
|
||||
// var fileInfo = new
|
||||
// {
|
||||
// name = i.LT_O_AyaFile.Display,
|
||||
// created = i.LT_Common_Label_Created,
|
||||
// creator = i.LT_Common_Label_Creator.Value,
|
||||
// mimetype = af.mimeType,
|
||||
// id = af.ID,
|
||||
// size = af.FileSize,
|
||||
// ayafiletype = af.FileType,
|
||||
// rootobjectid = af.RootObjectID,
|
||||
// rootobjecttype = af.RootObjectType
|
||||
// };
|
||||
|
||||
// JsonSerializer serializer = new JsonSerializer();
|
||||
// serializer.NullValueHandling = NullValueHandling.Include;
|
||||
// JsonSerializer serializer = new JsonSerializer();
|
||||
// serializer.NullValueHandling = NullValueHandling.Include;
|
||||
|
||||
//#if(DEBUG)
|
||||
// serializer.Formatting = Formatting.Indented;
|
||||
//#endif
|
||||
// JObject jo = JObject.FromObject(fileInfo, serializer);
|
||||
//#if(DEBUG)
|
||||
// serializer.Formatting = Formatting.Indented;
|
||||
//#endif
|
||||
// JObject jo = JObject.FromObject(fileInfo, serializer);
|
||||
|
||||
|
||||
|
||||
// using (StreamWriter sw = new StreamWriter(filePath + Path.DirectorySeparatorChar + "meta.json"))
|
||||
// using (JsonWriter writer = new JsonTextWriter(sw))
|
||||
// {
|
||||
// using (StreamWriter sw = new StreamWriter(filePath + Path.DirectorySeparatorChar + "meta.json"))
|
||||
// using (JsonWriter writer = new JsonTextWriter(sw))
|
||||
// {
|
||||
|
||||
// // serializer.Serialize(writer, o);
|
||||
// serializer.Serialize(writer, jo);
|
||||
// }
|
||||
// // serializer.Serialize(writer, o);
|
||||
// serializer.Serialize(writer, jo);
|
||||
// }
|
||||
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
#endregion dump
|
||||
|
||||
Reference in New Issue
Block a user