This commit is contained in:
@@ -13,6 +13,12 @@ TODO CLIENT STUFF
|
|||||||
- Validate time zone offset is accurate: it should validate the time zone offset when the client software starts and if it's found to be off what was set offer to change it automatically
|
- Validate time zone offset is accurate: it should validate the time zone offset when the client software starts and if it's found to be off what was set offer to change it automatically
|
||||||
- This way it works client to client and will handle DST changes almost automatically
|
- This way it works client to client and will handle DST changes almost automatically
|
||||||
|
|
||||||
|
- TODO: Will need currency symbol, date format, numeric format from user settings at server
|
||||||
|
- rather than try to use local browser settings which is fraught with peril will need to be specified at server itself
|
||||||
|
- Wherever I am currently storing time zone that's where these other settings need to be
|
||||||
|
- Need to find out in client world what format should be stored and how to document it
|
||||||
|
|
||||||
|
- Error messages: ensure error messages that come back from API that start with LT: will be localized correctly before display / logging (may need string interpolation too for some in future, consider that)
|
||||||
|
|
||||||
- LIST
|
- LIST
|
||||||
- Overall list menu toolbar at top with following icons:
|
- Overall list menu toolbar at top with following icons:
|
||||||
@@ -75,16 +81,10 @@ TODO CLIENT STUFF
|
|||||||
TODO SERVER STUFF
|
TODO SERVER STUFF
|
||||||
|
|
||||||
|
|
||||||
- Trial license ROCKFISH up it to 1000 techs to cover huge seeding.
|
|
||||||
|
|
||||||
- AyaNova 7 import is NOT erasing the db before it does the import but it should be so what's up with that??
|
|
||||||
- Also isn't it supposed to respect if there is existing data and force user to erase db first??
|
|
||||||
|
|
||||||
- TODO: Will need currency symbol, date format, numeric format from user settings at server
|
|
||||||
- rather than try to use local browser settings which is fraught with peril will need to be specified at server itself
|
|
||||||
- Wherever I am currently storing time zone that's where these other settings need to be
|
|
||||||
|
|
||||||
- TODO: Make sure private data filters get deleted with users who created them
|
- TODO: Make sure private data filters get deleted with users who created them
|
||||||
|
- non issue due to delete not allowed for any user after any data created under it so
|
||||||
- TAGS: REally need to have a think about how tags are used in the UI, probably need a autofill route that has a source of used or common tags to drive it
|
- TAGS: REally need to have a think about how tags are used in the UI, probably need a autofill route that has a source of used or common tags to drive it
|
||||||
- so user can type first fiew characters adn select
|
- so user can type first fiew characters adn select
|
||||||
- So consistency is maintained and not sloppy multiple spellings
|
- So consistency is maintained and not sloppy multiple spellings
|
||||||
|
|||||||
@@ -57,9 +57,7 @@ namespace AyaNova.Api.Controllers
|
|||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Upload AyaNova 7 import file
|
/// Upload AyaNova 7 import file
|
||||||
///
|
|
||||||
/// Required roles: OpsAdminFull
|
/// Required roles: OpsAdminFull
|
||||||
///
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>NameValue list of filenames and id's</returns>
|
/// <returns>NameValue list of filenames and id's</returns>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
@@ -183,9 +181,6 @@ namespace AyaNova.Api.Controllers
|
|||||||
/// Get AyaNova 7 data dump uploaded files list
|
/// Get AyaNova 7 data dump uploaded files list
|
||||||
///
|
///
|
||||||
/// Required roles: OpsAdminFull
|
/// Required roles: OpsAdminFull
|
||||||
///
|
|
||||||
/// This list cannot be filtered or queried
|
|
||||||
///
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>List of uploaded data dump files</returns>
|
/// <returns>List of uploaded data dump files</returns>
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
@@ -214,7 +209,8 @@ namespace AyaNova.Api.Controllers
|
|||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Start import of previously uploaded import file
|
/// *ERASE DATABASE and start import of previously uploaded import file
|
||||||
|
/// **This will permanently erase all current data in database without further warning as the first step in the import process**
|
||||||
///
|
///
|
||||||
/// Required roles: OpsAdminFull
|
/// Required roles: OpsAdminFull
|
||||||
///
|
///
|
||||||
|
|||||||
@@ -78,6 +78,13 @@ namespace AyaNova.Biz
|
|||||||
throw new System.ArgumentNullException("ImportAyaNova7 job failed due to import file specified not existing");
|
throw new System.ArgumentNullException("ImportAyaNova7 job failed due to import file specified not existing");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//Erase all the data except for the license, schema and the manager user
|
||||||
|
Microsoft.Extensions.Logging.ILogger log = AyaNova.Util.ApplicationLogging.CreateLogger("ImportAyaNova7");
|
||||||
|
JobsBiz.LogJob(job.GId, "ImportAyaNova7 - Erasing data from database", ct);
|
||||||
|
DbUtil.EmptyBizDataFromDatabaseForSeedingOrImporting(log);
|
||||||
|
|
||||||
|
|
||||||
//get the contents of the archive
|
//get the contents of the archive
|
||||||
List<string> zipEntries = FileUtil.ZipGetUtilityFileEntries(importFileName);
|
List<string> zipEntries = FileUtil.ZipGetUtilityFileEntries(importFileName);
|
||||||
|
|
||||||
@@ -94,45 +101,45 @@ namespace AyaNova.Biz
|
|||||||
//
|
//
|
||||||
|
|
||||||
//FIRST: import items that will become tags first into temporary cache lists
|
//FIRST: import items that will become tags first into temporary cache lists
|
||||||
Dictionary<string,Dictionary<Guid,string>> TagLists=new Dictionary<string, Dictionary<Guid, string>>();
|
Dictionary<string, Dictionary<Guid, string>> TagLists = new Dictionary<string, Dictionary<Guid, string>>();
|
||||||
|
|
||||||
//IMPORT UNIT MODEL CATEGORIES AS TAGS
|
//IMPORT UNIT MODEL CATEGORIES AS TAGS
|
||||||
TagLists.Add("UnitModelCategory",new Dictionary<Guid, string>());
|
TagLists.Add("UnitModelCategory", new Dictionary<Guid, string>());
|
||||||
ImportTagList("GZTW.AyaNova.BLL.UnitModelCategory", job.GId, TagLists["UnitModelCategory"], importFileName, zipEntries);
|
ImportTagList("GZTW.AyaNova.BLL.UnitModelCategory", job.GId, TagLists["UnitModelCategory"], importFileName, zipEntries);
|
||||||
|
|
||||||
//IMPORT Unit service type AS TAGS
|
//IMPORT Unit service type AS TAGS
|
||||||
TagLists.Add("UnitServiceType",new Dictionary<Guid, string>());
|
TagLists.Add("UnitServiceType", new Dictionary<Guid, string>());
|
||||||
ImportTagList("GZTW.AyaNova.BLL.UnitServiceType", job.GId, TagLists["UnitServiceType"], importFileName, zipEntries);
|
ImportTagList("GZTW.AyaNova.BLL.UnitServiceType", job.GId, TagLists["UnitServiceType"], importFileName, zipEntries);
|
||||||
|
|
||||||
//IMPORT Workorder Item Type AS TAGS
|
//IMPORT Workorder Item Type AS TAGS
|
||||||
TagLists.Add("WorkorderItemType",new Dictionary<Guid, string>());
|
TagLists.Add("WorkorderItemType", new Dictionary<Guid, string>());
|
||||||
ImportTagList("GZTW.AyaNova.BLL.WorkorderItemType", job.GId, TagLists["WorkorderItemType"], importFileName, zipEntries);
|
ImportTagList("GZTW.AyaNova.BLL.WorkorderItemType", job.GId, TagLists["WorkorderItemType"], importFileName, zipEntries);
|
||||||
|
|
||||||
//IMPORT Client group AS TAGS
|
//IMPORT Client group AS TAGS
|
||||||
TagLists.Add("ClientGroup",new Dictionary<Guid, string>());
|
TagLists.Add("ClientGroup", new Dictionary<Guid, string>());
|
||||||
ImportTagList("GZTW.AyaNova.BLL.ClientGroup", job.GId, TagLists["ClientGroup"], importFileName, zipEntries);
|
ImportTagList("GZTW.AyaNova.BLL.ClientGroup", job.GId, TagLists["ClientGroup"], importFileName, zipEntries);
|
||||||
|
|
||||||
//IMPORT Workorder category AS TAGS
|
//IMPORT Workorder category AS TAGS
|
||||||
TagLists.Add("WorkorderCategory",new Dictionary<Guid, string>());
|
TagLists.Add("WorkorderCategory", new Dictionary<Guid, string>());
|
||||||
ImportTagList("GZTW.AyaNova.BLL.WorkorderCategory", job.GId, TagLists["WorkorderCategory"], importFileName, zipEntries);
|
ImportTagList("GZTW.AyaNova.BLL.WorkorderCategory", job.GId, TagLists["WorkorderCategory"], importFileName, zipEntries);
|
||||||
|
|
||||||
//IMPORT Part Category AS TAGS
|
//IMPORT Part Category AS TAGS
|
||||||
TagLists.Add("PartCategory",new Dictionary<Guid, string>());
|
TagLists.Add("PartCategory", new Dictionary<Guid, string>());
|
||||||
ImportTagList("GZTW.AyaNova.BLL.PartCategory", job.GId, TagLists["PartCategory"], importFileName, zipEntries);
|
ImportTagList("GZTW.AyaNova.BLL.PartCategory", job.GId, TagLists["PartCategory"], importFileName, zipEntries);
|
||||||
|
|
||||||
//IMPORT Dispatch zones AS TAGS
|
//IMPORT Dispatch zones AS TAGS
|
||||||
TagLists.Add("DispatchZone",new Dictionary<Guid, string>());
|
TagLists.Add("DispatchZone", new Dictionary<Guid, string>());
|
||||||
ImportTagList("GZTW.AyaNova.BLL.DispatchZone", job.GId, TagLists["DispatchZone"], importFileName, zipEntries);
|
ImportTagList("GZTW.AyaNova.BLL.DispatchZone", job.GId, TagLists["DispatchZone"], importFileName, zipEntries);
|
||||||
|
|
||||||
//IMPORT Scheduleable User Groups AS TAGS
|
//IMPORT Scheduleable User Groups AS TAGS
|
||||||
TagLists.Add("ScheduleableUserGroup",new Dictionary<Guid, string>());
|
TagLists.Add("ScheduleableUserGroup", new Dictionary<Guid, string>());
|
||||||
ImportTagList("GZTW.AyaNova.BLL.ScheduleableUserGroup", job.GId, TagLists["ScheduleableUserGroup"], importFileName, zipEntries);
|
ImportTagList("GZTW.AyaNova.BLL.ScheduleableUserGroup", job.GId, TagLists["ScheduleableUserGroup"], importFileName, zipEntries);
|
||||||
|
|
||||||
//Now can set users to correct tag for scheduleable user group
|
//Now can set users to correct tag for scheduleable user group
|
||||||
// await ImportTagList("GZTW.AyaNova.BLL.ScheduleableUserGroup", "scheduleableusergrouptags", AyaType.Tag, job.GId, importMap, importFileName, zipEntries);
|
// await ImportTagList("GZTW.AyaNova.BLL.ScheduleableUserGroup", "scheduleableusergrouptags", AyaType.Tag, job.GId, importMap, importFileName, zipEntries);
|
||||||
|
|
||||||
//IMPORT REGIONS AS TAGS
|
//IMPORT REGIONS AS TAGS
|
||||||
TagLists.Add("Region",new Dictionary<Guid, string>());
|
TagLists.Add("Region", new Dictionary<Guid, string>());
|
||||||
ImportTagList("GZTW.AyaNova.BLL.Region", job.GId, TagLists["Region"], importFileName, zipEntries);
|
ImportTagList("GZTW.AyaNova.BLL.Region", job.GId, TagLists["Region"], importFileName, zipEntries);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -307,6 +307,8 @@ namespace AyaNova.Util
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//#########################################
|
||||||
|
//!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImporting WHEN NEW TABLES ADDED!!!!
|
||||||
|
|
||||||
//////////////////////////////////////////////////
|
//////////////////////////////////////////////////
|
||||||
// FUTURE
|
// FUTURE
|
||||||
@@ -318,7 +320,7 @@ namespace AyaNova.Util
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
//!!!!WARNING: BE SURE TO UPDATE THE DbUtil::PrepareDatabaseForSeeding WHEN NEW TABLES ADDED!!!!
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -251,8 +251,10 @@ namespace AyaNova.Util
|
|||||||
// Erase all user entered data from the db
|
// Erase all user entered data from the db
|
||||||
// This is called by seeder for trial seeding purposes
|
// This is called by seeder for trial seeding purposes
|
||||||
//
|
//
|
||||||
internal static void PrepareDatabaseForSeeding(ILogger _log)
|
internal static void EmptyBizDataFromDatabaseForSeedingOrImporting(ILogger _log)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
_log.LogInformation("Erasing Database \"{0}\"", _dbName);
|
_log.LogInformation("Erasing Database \"{0}\"", _dbName);
|
||||||
AyaNova.Api.ControllerHelpers.ApiServerState apiServerState = (AyaNova.Api.ControllerHelpers.ApiServerState)ServiceProviderProvider.Provider.GetService(typeof(AyaNova.Api.ControllerHelpers.ApiServerState));
|
AyaNova.Api.ControllerHelpers.ApiServerState apiServerState = (AyaNova.Api.ControllerHelpers.ApiServerState)ServiceProviderProvider.Provider.GetService(typeof(AyaNova.Api.ControllerHelpers.ApiServerState));
|
||||||
|
|
||||||
@@ -265,6 +267,15 @@ namespace AyaNova.Util
|
|||||||
{
|
{
|
||||||
conn.Open();
|
conn.Open();
|
||||||
|
|
||||||
|
//Delete from user options table first
|
||||||
|
using (var cmd = new Npgsql.NpgsqlCommand())
|
||||||
|
{
|
||||||
|
cmd.Connection = conn;
|
||||||
|
cmd.CommandText = "delete from \"auseroptions\" where UserId <> 1;";
|
||||||
|
cmd.ExecuteNonQuery();
|
||||||
|
}
|
||||||
|
|
||||||
|
//Delete from users table
|
||||||
using (var cmd = new Npgsql.NpgsqlCommand())
|
using (var cmd = new Npgsql.NpgsqlCommand())
|
||||||
{
|
{
|
||||||
cmd.Connection = conn;
|
cmd.Connection = conn;
|
||||||
@@ -272,14 +283,14 @@ namespace AyaNova.Util
|
|||||||
cmd.ExecuteNonQuery();
|
cmd.ExecuteNonQuery();
|
||||||
}
|
}
|
||||||
|
|
||||||
//THIS METHOD IS ONLY CALLED BY SEEDER
|
//REMOVE ALL DATA with few exceptions of manager user, license, schema tables
|
||||||
//SO ONLY REMOVE DATA THAT IS SEEDED
|
//and job logs because this is called by job code
|
||||||
//I.E. Normal user business data, not infrastructure data like license or localized text etc
|
|
||||||
|
|
||||||
EraseTable("afileattachment", conn);
|
EraseTable("afileattachment", conn);
|
||||||
EraseTable("awidget", conn);
|
EraseTable("awidget", conn);
|
||||||
EraseTable("aevent", conn);
|
EraseTable("aevent", conn);
|
||||||
EraseTable("adatafilter", conn);
|
EraseTable("adatafilter", conn);
|
||||||
|
EraseTable("asearchkey", conn);
|
||||||
|
EraseTable("asearchdictionary", conn);
|
||||||
|
|
||||||
conn.Close();
|
conn.Close();
|
||||||
}
|
}
|
||||||
@@ -309,7 +320,7 @@ namespace AyaNova.Util
|
|||||||
///////////////////////////////////////////
|
///////////////////////////////////////////
|
||||||
// Check if DB is empty
|
// Check if DB is empty
|
||||||
// CALLED BY LICENSE CONTROLLER AND LICENSE.CS FOR TRIAL Request check
|
// CALLED BY LICENSE CONTROLLER AND LICENSE.CS FOR TRIAL Request check
|
||||||
//
|
// Also called by Import
|
||||||
internal static bool DBIsEmpty(AyContext ctx, ILogger _log)
|
internal static bool DBIsEmpty(AyContext ctx, ILogger _log)
|
||||||
{
|
{
|
||||||
//TODO: This needs to be way more thorough, only the main tables though, no need to get crazy with it
|
//TODO: This needs to be way more thorough, only the main tables though, no need to get crazy with it
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ namespace AyaNova.Util
|
|||||||
apiServerState.SetOpsOnly("Seeding database");
|
apiServerState.SetOpsOnly("Seeding database");
|
||||||
|
|
||||||
//Erase all the data except for the license, schema and the manager user
|
//Erase all the data except for the license, schema and the manager user
|
||||||
DbUtil.PrepareDatabaseForSeeding(log);
|
DbUtil.EmptyBizDataFromDatabaseForSeedingOrImporting(log);
|
||||||
|
|
||||||
//Set the time zone of the manager account
|
//Set the time zone of the manager account
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user