a2171e643d
- FTP - Gomba - Icoel - MultiCcn - OSAI - SqlDB
72 lines
2.4 KiB
C#
72 lines
2.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace EgwProxy.Icoel.DataLayer
|
|
{
|
|
public static class DbConfig
|
|
{
|
|
#region Public Fields
|
|
|
|
public static string DATABASE_NAME = "EgtBwDb";
|
|
|
|
public static int DATABASE_PROCESS_TIMEOUT = 5;
|
|
public static string DATABASE_PWD = "viacremasca";
|
|
|
|
// Database config
|
|
public static string DATABASE_SERV = "127.0.0.1";
|
|
|
|
public static string DATABASE_USER = "EgtUser";
|
|
|
|
#endregion Public Fields
|
|
|
|
#region Public Properties
|
|
|
|
/// <summary>
|
|
/// DB Connection string per azioni amministrative
|
|
/// </summary>
|
|
public static string ADMIN_CONNECTION_STRING { get; set; } = "";
|
|
|
|
/// <summary>
|
|
/// DB Connection string
|
|
/// </summary>
|
|
public static string CONNECTION_STRING { get; set; } = "";
|
|
|
|
#endregion Public Properties
|
|
|
|
#region Public Methods
|
|
|
|
/// <summary>
|
|
/// Metodo di init standard per DB in rete con Master_Key
|
|
/// </summary>
|
|
/// <param name="server">Indirizzo del server (tipicamente indirizzo di rete)</param>
|
|
/// <param name="nKey">Numero chiave</param>
|
|
/// <param name="sKey">Codice/pwd associato a chaive</param>
|
|
/// <param name="masterKey">Numero di chiave master con cui è creato il DB</param>
|
|
public static void InitDb(string server, string nKey, string sKey, string masterKey = "")
|
|
{
|
|
// se nulla metto amster come nKey...
|
|
masterKey = string.IsNullOrEmpty(masterKey) ? nKey : masterKey;
|
|
DATABASE_SERV = server;
|
|
DATABASE_NAME = $"EgtBwDb_{masterKey}";
|
|
DATABASE_USER = $"user_{nKey}";
|
|
DATABASE_PWD = $"pwd_{sKey}";
|
|
CONNECTION_STRING = $"server={DATABASE_SERV};port=3306;database={DATABASE_NAME};uid={DATABASE_USER};pwd={DATABASE_PWD};sslmode=None";
|
|
// stringa admin con utente root egalware...
|
|
ADMIN_CONNECTION_STRING = $"server={DATABASE_SERV};port=3306;database=mysql;uid=root;pwd=Egalware_24068!;sslmode=None;CHARSET=utf8";
|
|
}
|
|
|
|
#if false
|
|
public static bool CheckUser(string nKey, string sKey, bool isNetwork)
|
|
{
|
|
// esecuzione script di install locale
|
|
return Controllers.DbController.man.checkCreateUser(DATABASE_USER, DATABASE_PWD, isNetwork);
|
|
}
|
|
#endif
|
|
|
|
#endregion Public Methods
|
|
}
|
|
}
|