This commit is contained in:
@@ -156,58 +156,66 @@ namespace AyaNova.PlugIn.V8
|
|||||||
/// then zip it all up into a single archive file and then erase the temporary folder
|
/// then zip it all up into a single archive file and then erase the temporary folder
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private async void DoExport()
|
private async void DoExport()
|
||||||
{
|
{
|
||||||
Map.Clear();
|
|
||||||
|
|
||||||
/*
|
|
||||||
TODO:
|
|
||||||
* EMPTY DB ROUTE
|
|
||||||
* custom fields processor for: User, Client, Contract, HeadOffice, LoanItem, part, project, purchaseorder, unit, unitmodel, vendor, workorderitem
|
|
||||||
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
//Show progress form
|
//Show progress form
|
||||||
|
|
||||||
ProgressForm progress = new ProgressForm();
|
ProgressForm progress = new ProgressForm();
|
||||||
progress.Show();
|
progress.Show();
|
||||||
progress.StartedImport();
|
progress.StartedImport();
|
||||||
progress.Append("Exporting data to AyaNova server @ " + util.ApiBaseUrl);
|
progress.Append("Exporting data to AyaNova server @ " + util.ApiBaseUrl);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Map.Clear();
|
||||||
|
|
||||||
|
/*
|
||||||
|
TODO:
|
||||||
|
* EMPTY DB ROUTE
|
||||||
|
* custom fields processor for: User, Client, Contract, HeadOffice, LoanItem, part, project, purchaseorder, unit, unitmodel, vendor, workorderitem
|
||||||
|
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
//Export in correct order:
|
|
||||||
|
|
||||||
//ERASE DB
|
|
||||||
var a = await util.PostAsync("License/PermanentlyEraseAllData", "I understand");
|
|
||||||
if (!a.HttpResponse.IsSuccessStatusCode) { MessageBox.Show("Error erasing database: \n" + a.HttpResponse.ReasonPhrase); return;}
|
|
||||||
|
|
||||||
//TAGS
|
|
||||||
ExportUnitModelCategories(progress);
|
|
||||||
ExportUnitServiceTypes(progress);
|
|
||||||
ExportWorkorderItemTypes(progress);
|
|
||||||
ExportRegions(progress);
|
|
||||||
ExportClientGroups(progress);
|
|
||||||
ExportWorkorderCategories(progress);
|
|
||||||
ExportPartCategories(progress);
|
|
||||||
ExportScheduleableUserGroups(progress);
|
|
||||||
ExportDispatchZones(progress);
|
|
||||||
|
|
||||||
//BIZ objects
|
|
||||||
ExportUsers(progress);
|
|
||||||
|
|
||||||
//dumpGlobalSettings(tempArchiveFolder, progress);
|
|
||||||
//dumpLocales(tempArchiveFolder, progress);
|
|
||||||
|
|
||||||
//dumpSeedNumbers(tempArchiveFolder, progress);
|
|
||||||
//dumpClients(tempArchiveFolder, progress);
|
|
||||||
//dumpHeadOffices(tempArchiveFolder, progress);
|
|
||||||
//
|
|
||||||
|
|
||||||
|
|
||||||
//NOTE: when get to PRIORITY, or WORKORDER STATUS be sure to add color code as per already done in USER export
|
//Export in correct order:
|
||||||
|
|
||||||
|
//ERASE DB
|
||||||
|
var a = await util.PostAsync("License/PermanentlyEraseAllData", "\"I understand\"");
|
||||||
|
if (!a.HttpResponse.IsSuccessStatusCode) { MessageBox.Show("Error erasing database: \n" + a.HttpResponse.ReasonPhrase); return; }
|
||||||
|
|
||||||
|
//TAGS
|
||||||
|
ExportUnitModelCategories(progress);
|
||||||
|
ExportUnitServiceTypes(progress);
|
||||||
|
ExportWorkorderItemTypes(progress);
|
||||||
|
ExportRegions(progress);
|
||||||
|
ExportClientGroups(progress);
|
||||||
|
ExportWorkorderCategories(progress);
|
||||||
|
ExportPartCategories(progress);
|
||||||
|
ExportScheduleableUserGroups(progress);
|
||||||
|
ExportDispatchZones(progress);
|
||||||
|
|
||||||
|
//BIZ objects
|
||||||
|
ExportUsers(progress);
|
||||||
|
|
||||||
|
//dumpGlobalSettings(tempArchiveFolder, progress);
|
||||||
|
//dumpLocales(tempArchiveFolder, progress);
|
||||||
|
|
||||||
|
//dumpSeedNumbers(tempArchiveFolder, progress);
|
||||||
|
//dumpClients(tempArchiveFolder, progress);
|
||||||
|
//dumpHeadOffices(tempArchiveFolder, progress);
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
progress.Append("Export completed");
|
//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");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
progress.Append("Export failed with error:");
|
||||||
|
progress.Append(ex.Message);
|
||||||
|
}
|
||||||
progress.FinishedImport();
|
progress.FinishedImport();
|
||||||
|
|
||||||
//-----------------------------------
|
//-----------------------------------
|
||||||
@@ -222,7 +230,7 @@ namespace AyaNova.PlugIn.V8
|
|||||||
#region Global settings
|
#region Global settings
|
||||||
private void ExportGlobalSettings(ProgressForm progress)
|
private void ExportGlobalSettings(ProgressForm progress)
|
||||||
{
|
{
|
||||||
|
|
||||||
progress.Append("STUB: Dumping Global Settings");
|
progress.Append("STUB: Dumping Global Settings");
|
||||||
////DumpObjectToFolder(tempArchiveFolder, AyaBizUtils.GlobalSettings, "globalsettings", objectExcludeProperties, new TypeAndID(RootObjectTypes.Global, Address.GlobalAddressID));
|
////DumpObjectToFolder(tempArchiveFolder, AyaBizUtils.GlobalSettings, "globalsettings", objectExcludeProperties, new TypeAndID(RootObjectTypes.Global, Address.GlobalAddressID));
|
||||||
}
|
}
|
||||||
@@ -231,7 +239,7 @@ namespace AyaNova.PlugIn.V8
|
|||||||
#region locales
|
#region locales
|
||||||
private void ExportLocales(ProgressForm progress)
|
private void ExportLocales(ProgressForm progress)
|
||||||
{
|
{
|
||||||
// List<string> objectExcludeProperties = new List<string>(standardExcludePropertiesList);
|
// List<string> objectExcludeProperties = new List<string>(standardExcludePropertiesList);
|
||||||
|
|
||||||
//Skip stock locales already handled in Raven
|
//Skip stock locales already handled in Raven
|
||||||
List<string> SkipLocales = new List<string>();
|
List<string> SkipLocales = new List<string>();
|
||||||
@@ -256,8 +264,8 @@ namespace AyaNova.PlugIn.V8
|
|||||||
#region REGIONS
|
#region REGIONS
|
||||||
private void ExportRegions(ProgressForm progress)
|
private void ExportRegions(ProgressForm progress)
|
||||||
{
|
{
|
||||||
// List<string> objectExcludeProperties = new List<string>(standardExcludePropertiesList);
|
// List<string> objectExcludeProperties = new List<string>(standardExcludePropertiesList);
|
||||||
|
|
||||||
RegionList l = RegionList.GetList(string.Empty);
|
RegionList l = RegionList.GetList(string.Empty);
|
||||||
progress.Append("Dumping " + l.Count.ToString() + " Regions");
|
progress.Append("Dumping " + l.Count.ToString() + " Regions");
|
||||||
foreach (RegionList.RegionListInfo i in l)
|
foreach (RegionList.RegionListInfo i in l)
|
||||||
@@ -281,7 +289,7 @@ namespace AyaNova.PlugIn.V8
|
|||||||
}
|
}
|
||||||
private void ExportSeedNumbers(ProgressForm progress)
|
private void ExportSeedNumbers(ProgressForm progress)
|
||||||
{
|
{
|
||||||
// List<string> objectExcludeProperties = new List<string>(standardExcludePropertiesList);
|
// List<string> objectExcludeProperties = new List<string>(standardExcludePropertiesList);
|
||||||
progress.Append("Dumping seeds");
|
progress.Append("Dumping seeds");
|
||||||
//create a new object with the id numbers in it and then dump it
|
//create a new object with the id numbers in it and then dump it
|
||||||
WorkorderPMList pml = WorkorderPMList.GetList("<?xml version=\"1.0\" encoding=\"utf-16\" standalone=\"yes\"?> \r\n" +
|
WorkorderPMList pml = WorkorderPMList.GetList("<?xml version=\"1.0\" encoding=\"utf-16\" standalone=\"yes\"?> \r\n" +
|
||||||
@@ -323,7 +331,7 @@ namespace AyaNova.PlugIn.V8
|
|||||||
#region headoffices
|
#region headoffices
|
||||||
private void ExportHeadOffices(ProgressForm progress)
|
private void ExportHeadOffices(ProgressForm progress)
|
||||||
{
|
{
|
||||||
|
|
||||||
PickListAutoComplete pl = PickListAutoComplete.GetList("**", "headoffice");
|
PickListAutoComplete pl = PickListAutoComplete.GetList("**", "headoffice");
|
||||||
|
|
||||||
progress.Append("Dumping " + pl.Count.ToString() + " Head offices");
|
progress.Append("Dumping " + pl.Count.ToString() + " Head offices");
|
||||||
@@ -369,21 +377,21 @@ namespace AyaNova.PlugIn.V8
|
|||||||
User c = User.GetItem(i.ID);
|
User c = User.GetItem(i.ID);
|
||||||
dynamic d = new JObject();
|
dynamic d = new JObject();
|
||||||
d.name = c.FirstName + " " + c.LastName;
|
d.name = c.FirstName + " " + c.LastName;
|
||||||
|
|
||||||
d.userType = (int)c.UserType;
|
d.userType = (int)c.UserType;
|
||||||
if (c.VendorID != Guid.Empty)
|
if (c.VendorID != Guid.Empty)
|
||||||
d.userType = 7;//7 is the RAVEN user type for subcontractor
|
d.userType = 7;//7 is the RAVEN user type for subcontractor
|
||||||
|
|
||||||
d.active = false;//all imported users are inactive to start
|
d.active = false;//all imported users are inactive to start
|
||||||
d.roles=0;//todo: try to determine role from v7 member of group? or is that even possible?
|
d.roles = 0;//todo: try to determine role from v7 member of group? or is that even possible?
|
||||||
|
|
||||||
d.employeeNumber = c.EmployeeNumber;
|
d.employeeNumber = c.EmployeeNumber;
|
||||||
d.notes = c.Notes;
|
d.notes = c.Notes;
|
||||||
Tagit(c.RegionID,tags);
|
Tagit(c.RegionID, tags);
|
||||||
Tagit(c.DispatchZoneID, tags);
|
Tagit(c.DispatchZoneID, tags);
|
||||||
SetTags(d, tags);
|
SetTags(d, tags);
|
||||||
|
|
||||||
var a=await util.PostAsync("User", d.ToString());
|
var a = await util.PostAsync("User", d.ToString());
|
||||||
|
|
||||||
|
|
||||||
//JObject xtra = new JObject();
|
//JObject xtra = new JObject();
|
||||||
@@ -652,13 +660,13 @@ namespace AyaNova.PlugIn.V8
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void SetTags(dynamic d, List<string> tags)
|
private void SetTags(dynamic d, List<string> tags)
|
||||||
{
|
{
|
||||||
dynamic dtags= new JArray();
|
dynamic dtags = new JArray();
|
||||||
foreach(string s in tags)
|
foreach (string s in tags)
|
||||||
dtags.Add(s);
|
dtags.Add(s);
|
||||||
d.tags=dtags;
|
d.tags = dtags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -150,6 +150,10 @@ namespace AyaNova.PlugIn.V8
|
|||||||
|
|
||||||
HttpResponseMessage response = await client.SendAsync(requestMessage);
|
HttpResponseMessage response = await client.SendAsync(requestMessage);
|
||||||
var responseAsString = await response.Content.ReadAsStringAsync();
|
var responseAsString = await response.Content.ReadAsStringAsync();
|
||||||
|
if (!response.IsSuccessStatusCode)
|
||||||
|
{
|
||||||
|
throw new Exception(responseAsString + "\n" + response.ReasonPhrase);
|
||||||
|
}
|
||||||
|
|
||||||
return new ApiResponse() { HttpResponse = response, ObjectResponse = Parse(responseAsString) };
|
return new ApiResponse() { HttpResponse = response, ObjectResponse = Parse(responseAsString) };
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user