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
|
||||
- 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
|
||||
- Overall list menu toolbar at top with following icons:
|
||||
@@ -73,18 +79,12 @@ TODO CLIENT 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
|
||||
- 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
|
||||
- so user can type first fiew characters adn select
|
||||
- So consistency is maintained and not sloppy multiple spellings
|
||||
|
||||
@@ -56,10 +56,8 @@ namespace AyaNova.Api.Controllers
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Upload AyaNova 7 import file
|
||||
///
|
||||
/// Upload AyaNova 7 import file
|
||||
/// Required roles: OpsAdminFull
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns>NameValue list of filenames and id's</returns>
|
||||
[HttpPost]
|
||||
@@ -182,10 +180,7 @@ namespace AyaNova.Api.Controllers
|
||||
/// <summary>
|
||||
/// Get AyaNova 7 data dump uploaded files list
|
||||
///
|
||||
/// Required roles: OpsAdminFull
|
||||
///
|
||||
/// This list cannot be filtered or queried
|
||||
///
|
||||
/// Required roles: OpsAdminFull
|
||||
/// </summary>
|
||||
/// <returns>List of uploaded data dump files</returns>
|
||||
[HttpGet]
|
||||
@@ -214,7 +209,8 @@ namespace AyaNova.Api.Controllers
|
||||
|
||||
|
||||
/// <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
|
||||
///
|
||||
|
||||
@@ -78,6 +78,13 @@ namespace AyaNova.Biz
|
||||
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
|
||||
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
|
||||
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
|
||||
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);
|
||||
|
||||
//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);
|
||||
|
||||
//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);
|
||||
|
||||
//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);
|
||||
|
||||
//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);
|
||||
|
||||
//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);
|
||||
|
||||
//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);
|
||||
|
||||
//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);
|
||||
|
||||
//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);
|
||||
|
||||
//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);
|
||||
|
||||
|
||||
@@ -187,7 +194,7 @@ namespace AyaNova.Biz
|
||||
/// <param name="zipEntries"></param>
|
||||
/// <param name="tagLists"></param>
|
||||
/// <returns></returns>
|
||||
private async Task DoImport(string entryStartsWith, string importTask, AyaType importerType, Guid jobId,
|
||||
private async Task DoImport(string entryStartsWith, string importTask, AyaType importerType, Guid jobId,
|
||||
List<ImportAyaNova7MapItem> importMap, string importFileName, List<string> zipEntries, Dictionary<string, Dictionary<Guid, string>> tagLists)
|
||||
{
|
||||
var zipObjectList = zipEntries.Where(m => m.StartsWith(entryStartsWith)).ToList();
|
||||
|
||||
@@ -307,6 +307,8 @@ namespace AyaNova.Util
|
||||
}
|
||||
|
||||
|
||||
//#########################################
|
||||
//!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImporting WHEN NEW TABLES ADDED!!!!
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
// 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
|
||||
// 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);
|
||||
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();
|
||||
|
||||
//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())
|
||||
{
|
||||
cmd.Connection = conn;
|
||||
@@ -272,14 +283,14 @@ namespace AyaNova.Util
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
|
||||
//THIS METHOD IS ONLY CALLED BY SEEDER
|
||||
//SO ONLY REMOVE DATA THAT IS SEEDED
|
||||
//I.E. Normal user business data, not infrastructure data like license or localized text etc
|
||||
|
||||
//REMOVE ALL DATA with few exceptions of manager user, license, schema tables
|
||||
//and job logs because this is called by job code
|
||||
EraseTable("afileattachment", conn);
|
||||
EraseTable("awidget", conn);
|
||||
EraseTable("aevent", conn);
|
||||
EraseTable("adatafilter", conn);
|
||||
EraseTable("asearchkey", conn);
|
||||
EraseTable("asearchdictionary", conn);
|
||||
|
||||
conn.Close();
|
||||
}
|
||||
@@ -309,7 +320,7 @@ namespace AyaNova.Util
|
||||
///////////////////////////////////////////
|
||||
// Check if DB is empty
|
||||
// CALLED BY LICENSE CONTROLLER AND LICENSE.CS FOR TRIAL Request check
|
||||
//
|
||||
// Also called by Import
|
||||
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
|
||||
|
||||
@@ -66,7 +66,7 @@ namespace AyaNova.Util
|
||||
apiServerState.SetOpsOnly("Seeding database");
|
||||
|
||||
//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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user