sistemato loggin + fix funzione reload su modifica
This commit is contained in:
@@ -34,7 +34,7 @@ namespace SHERPA.BBM.UI.Data
|
||||
_logger = logger;
|
||||
_configuration = configuration;
|
||||
connString = _configuration["SherpaBBM"];
|
||||
_logger.LogInformation($"ConnString: {connString}");
|
||||
//_logger.LogInformation($"ConnString: {connString}");
|
||||
if (string.IsNullOrEmpty(connString))
|
||||
{
|
||||
_logger.LogError("ConnString empty!");
|
||||
@@ -43,7 +43,7 @@ namespace SHERPA.BBM.UI.Data
|
||||
{
|
||||
dbController = new Controllers.BBMController(connString);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.AppendLine($"DbController OK: {dbController.currConnString}");
|
||||
sb.AppendLine($"DbController OK");
|
||||
sb.AppendLine($"CST: {dbController.CustomersCount()} | CNT: {dbController.CountersCount()} | BSK: {dbController.BasketsCount()} | NGT: {dbController.NegotiationsCount()} | DOC: {dbController.DocsCount()} | ITM: {dbController.ItemsCount()} | RES: {dbController.ResourcesCount()}");
|
||||
_logger.LogInformation(sb.ToString());
|
||||
}
|
||||
@@ -366,7 +366,7 @@ namespace SHERPA.BBM.UI.Data
|
||||
|
||||
public void rollBackEdit(object item)
|
||||
{
|
||||
dbController.roolBackEntity(item);
|
||||
dbController.rollBackEntity(item);
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
@@ -21,8 +21,6 @@ namespace SHERPA.BBM.Controllers
|
||||
|
||||
public BBMController(string connString)
|
||||
{
|
||||
Log.Info($"Richiesta avvio classe BBMController, connString: {connString}");
|
||||
//dbCtx = new MainDbContext();
|
||||
dbCtx = new MainDbContext(connString);
|
||||
Log.Info("Avviata classe BBMController");
|
||||
}
|
||||
@@ -996,10 +994,20 @@ namespace SHERPA.BBM.Controllers
|
||||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
/// <returns></returns>
|
||||
public bool roolBackEntity(object item)
|
||||
public bool rollBackEntity(object item)
|
||||
{
|
||||
bool answ = false;
|
||||
dbCtx.Entry(item).Reload();
|
||||
try
|
||||
{
|
||||
if (dbCtx.Entry(item).State == System.Data.Entity.EntityState.Deleted || dbCtx.Entry(item).State == System.Data.Entity.EntityState.Modified)
|
||||
{
|
||||
dbCtx.Entry(item).Reload();
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Eccezione in rollBackEntity{Environment.NewLine}{exc}");
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace SHERPA.BBM
|
||||
|
||||
public MainDbContext(string connectionString) : base(connectionString)
|
||||
{
|
||||
Log.Info($"init MainDbContext {connectionString}");
|
||||
Log.Info($"init MainDbContext - start");
|
||||
|
||||
try
|
||||
{
|
||||
@@ -44,7 +44,7 @@ namespace SHERPA.BBM
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Eccezione in fase init MainDbContext{Environment.NewLine}{exc}");
|
||||
Log.Error($"Eccezione in fase init MainDbContext, connectionString: {connectionString}{Environment.NewLine}{exc}");
|
||||
}
|
||||
Log.Error("init MainDbContext - DONE");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user