diff --git a/Step.Config/Config/serverConfig.xml b/Step.Config/Config/serverConfig.xml index 18a16bce..0e09cdd0 100644 --- a/Step.Config/Config/serverConfig.xml +++ b/Step.Config/Config/serverConfig.xml @@ -11,5 +11,6 @@ 9000 en true + localhost \ No newline at end of file diff --git a/Step.Config/Config/serverConfigValidator.xsd b/Step.Config/Config/serverConfigValidator.xsd index adecf615..0ec2589d 100644 --- a/Step.Config/Config/serverConfigValidator.xsd +++ b/Step.Config/Config/serverConfigValidator.xsd @@ -21,6 +21,7 @@ + diff --git a/Step.Config/ServerConfigController.cs b/Step.Config/ServerConfigController.cs index 2e907db3..1010f3fe 100644 --- a/Step.Config/ServerConfigController.cs +++ b/Step.Config/ServerConfigController.cs @@ -38,7 +38,8 @@ namespace Step.Config { // Set server config model data Language = CultureInfo.CreateSpecificCulture(x.Element("language").Value), ServerPort = Convert.ToInt32(x.Element("serverPort").Value), - EnableDirectoryBrowsing = Convert.ToBoolean(x.Element("enableDirectoryBrowsing").Value) + EnableDirectoryBrowsing = Convert.ToBoolean(x.Element("enableDirectoryBrowsing").Value), + DatabaseAddress = x.Element("databaseAddress").Value }).FirstOrDefault(); // Get Areas file handler diff --git a/Step.Database/DatabaseContext.cs b/Step.Database/DatabaseContext.cs index 4f286f0b..6282dbc6 100644 --- a/Step.Database/DatabaseContext.cs +++ b/Step.Database/DatabaseContext.cs @@ -26,8 +26,11 @@ namespace Step.Database public DbSet Maintenances { get; set; } public DbSet PerformedMaintenances { get; set; } + + public static string CONNECTION_STRING = "Server = " + ServerStartupConfig.DatabaseAddress + "; Database=" + DATABASE_NAME +";Uid="+ DATABASE_USER +";Pwd="+ DATABASE_PWD +";"; + public DatabaseContext() - : base("mySQLDatabaseConnection") + : base(CONNECTION_STRING) { } diff --git a/Step.Model/ConfigModels/ServerConfigModel.cs b/Step.Model/ConfigModels/ServerConfigModel.cs index 74e362cc..92611e5e 100644 --- a/Step.Model/ConfigModels/ServerConfigModel.cs +++ b/Step.Model/ConfigModels/ServerConfigModel.cs @@ -12,5 +12,6 @@ namespace Step.Model.ConfigModels public CultureInfo Language { get; set; } public int ServerPort { get; set; } public bool EnableDirectoryBrowsing { get; set; } + public string DatabaseAddress { get; set; } } } \ No newline at end of file diff --git a/Step.Utils/Constants.cs b/Step.Utils/Constants.cs index 70aa03c3..4d5aaf20 100644 --- a/Step.Utils/Constants.cs +++ b/Step.Utils/Constants.cs @@ -27,6 +27,11 @@ namespace Step.Utils public const string SIEMENS = "SIEMENS"; public const string OSAI = "OSAI"; } + // Database config + public const string DATABASE_USER = "root"; + public const string DATABASE_PWD = "root"; + public const string DATABASE_NAME = "step"; + // Registry key public const string REGISTER_MACHINE_ID_KEY_NAME = "MachineUniqueId"; diff --git a/Step/Controllers/SignalR/NcHub.cs b/Step/Controllers/SignalR/NcHub.cs index 18459960..a8e027ff 100644 --- a/Step/Controllers/SignalR/NcHub.cs +++ b/Step/Controllers/SignalR/NcHub.cs @@ -34,8 +34,6 @@ namespace Step.Controllers.SignalR Groups.Add(Context.ConnectionId, "ncData"); NewConnectedClients = true; ConnectedClients.Add(Context.ConnectionId); - // Resends data to all the clients - MessageServices.Current.Publish(BROADCAST_DATA); var result = base.OnReconnected();