Cleanup finale aree #if false

This commit is contained in:
Samuele Locatelli
2022-04-01 19:24:39 +02:00
parent e8870ca050
commit 04c8f8eba2
7 changed files with 4 additions and 270 deletions
@@ -1,29 +1,16 @@
using System;
using EgtBEAMWALL.DataLayer.DatabaseModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EgtBEAMWALL.DataLayer.DatabaseModels;
namespace EgtBEAMWALL.DataLayer.Controllers
{
public class BTLPartController : IDisposable
{
#region Private Fields
#if false
private DatabaseContext localDbCtx;
#endif
#endregion Private Fields
#region Public Constructors
public BTLPartController()
{
#if false
// Initialize database context
localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
#endif
}
#endregion Public Constructors
@@ -115,9 +102,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
localDbCtx.BTLPartList.AddRange(partData);
// Commit changes
localDbCtx.SaveChanges();
#if false
ResetController();
#endif
}
}
catch (Exception exc)
@@ -162,9 +146,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
localDbCtx.BTLPartList.AddRange(partData);
// Commit changes
localDbCtx.SaveChanges();
#if false
ResetController();
#endif
}
}
catch (Exception exc)
@@ -182,7 +163,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// <returns></returns>
public bool Delete(int PartDbId)
{
bool done = false;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
@@ -196,9 +176,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
localDbCtx.BTLPartList.Remove(item2del);
// Commit changes
localDbCtx.SaveChanges();
#if false
ResetController();
#endif
done = true;
}
catch (Exception exc)
@@ -228,9 +205,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
localDbCtx.BTLPartList.RemoveRange(items2del);
// Commit changes
localDbCtx.SaveChanges();
#if false
ResetController();
#endif
done = true;
}
catch (Exception exc)
@@ -243,10 +217,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public void Dispose()
{
#if false
// Clear database context
localDbCtx.Dispose();
#endif
}
/// <summary>
@@ -386,17 +356,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
return answ;
}
#if false
/// <summary>
/// Reinizializzaizone del controller
/// </summary>
public void ResetController()
{
// Re-Initialize database context
localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
}
#endif
/// <summary>
/// Update single BTLPart
/// </summary>
@@ -428,10 +387,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
{
Console.WriteLine($"EXCEPTION on Update: {exc}");
}
#if false
// reset...
ResetController();
#endif
}
return done;
}
@@ -7,18 +7,10 @@ namespace EgtBEAMWALL.DataLayer.Controllers
{
public class LogMachineController : IDisposable
{
#if false
private DatabaseContext localDbCtx;
#endif
#region Public Constructors
public LogMachineController()
{
#if false
// Initialize database context
localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
#endif
}
#endregion Public Constructors
@@ -84,9 +76,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
locallocalDbCtx.LogMachineList.Add(newLogMac);
// Commit changes
locallocalDbCtx.SaveChanges();
#if false
ResetController();
#endif
}
}
catch (Exception exc)
@@ -129,9 +118,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
localDbCtx.LogMachineList.RemoveRange(items2del);
// Commit changes
localDbCtx.SaveChanges();
#if false
ResetController();
#endif
done = true;
}
catch (Exception exc)
@@ -144,10 +130,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public void Dispose()
{
#if false
// Clear database context
localDbCtx.Dispose();
#endif
}
/// <summary>
@@ -204,17 +186,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
}
}
#if false
/// <summary>
/// Reinizializzaizone del controller
/// </summary>
public void ResetController()
{
// Re-Initialize database context
localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
}
#endif
/// <summary>
/// Update single LogMachineModel
/// </summary>
@@ -236,9 +207,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
// Commit changes
localDbCtx.SaveChanges();
#if false
ResetController();
#endif
done = true;
}
catch (Exception exc)
@@ -10,9 +10,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
{
#region Private Fields
#if false
private DatabaseContext localDbCtx;
#endif
#endregion Private Fields
@@ -20,10 +17,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public LogSupportController()
{
#if false
// Initialize database context
localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
#endif
}
#endregion Public Constructors
@@ -56,9 +49,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
localDbCtx.LogSupportList.Add(newItem);
// Commit changes
localDbCtx.SaveChanges();
#if false
ResetController();
#endif
}
catch (Exception exc)
{
@@ -90,9 +80,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
localDbCtx.LogSupportList.RemoveRange(items2del);
// Commit changes
localDbCtx.SaveChanges();
#if false
ResetController();
#endif
done = true;
}
catch (Exception exc)
@@ -105,10 +92,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public void Dispose()
{
#if false
// Clear database context
localDbCtx.Dispose();
#endif
}
/// <summary>
@@ -165,17 +148,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
}
}
#if false
/// <summary>
/// Reinizializzaizone del controller
/// </summary>
public void ResetController()
{
// Re-Initialize database context
localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
}
#endif
/// <summary>
/// Update single LogMachineModel
/// </summary>
@@ -197,9 +169,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
// Commit changes
localDbCtx.SaveChanges();
#if false
ResetController();
#endif
done = true;
}
catch (Exception exc)
@@ -207,10 +207,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public void Dispose()
{
#if false
// Clear database context
dbCtx.Dispose();
#endif
}
/// <summary>
@@ -1,21 +1,11 @@
using System;
using System.Collections.Generic;
using EgtBEAMWALL.DataLayer.DatabaseModels;
using System;
using System.Linq;
using System.Text;
using EgtBEAMWALL.DataLayer.DatabaseModels;
namespace EgtBEAMWALL.DataLayer.Controllers
{
public class PartController : IDisposable
{
#region Private Fields
#if false
private DatabaseContext localDbCtx;
#endif
#endregion Private Fields
#region Public Fields
public static PartController man = new PartController();
@@ -26,10 +16,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public PartController()
{
#if false
// Initialize database context
localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
#endif
}
#endregion Public Constructors
@@ -151,9 +137,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
localDbCtx.PartList.Remove(item2del);
// Commit changes
localDbCtx.SaveChanges();
#if false
ResetController();
#endif
done = true;
// aggiorno info sullo status
StatusMapController.man.UpdateAction("", ProdId, MachGroupId, Core.StatusMapItemType.MachGroup, Core.StatusMapOpType.MachGroupMod, "");
@@ -186,9 +169,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
localDbCtx.PartList.Remove(item2del);
// Commit changes
localDbCtx.SaveChanges();
#if false
ResetController();
#endif
done = true;
}
catch (Exception exc)
@@ -218,9 +198,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
localDbCtx.PartList.RemoveRange(items2del);
// Commit changes
localDbCtx.SaveChanges();
#if false
ResetController();
#endif
done = true;
}
catch (Exception exc)
@@ -233,10 +210,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public void Dispose()
{
#if false
// Clear database context
localDbCtx.Dispose();
#endif
}
/// <summary>
@@ -273,17 +246,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
return answ;
}
#if false
/// <summary>
/// Reinizializzaizone del controller
/// </summary>
public void ResetController()
{
// Re-Initialize database context
localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
}
#endif
/// <summary>
/// Update single Part
/// </summary>
@@ -11,9 +11,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
{
#region Private Fields
#if false
private DatabaseContext localDbCtx;
#endif
#endregion Private Fields
@@ -27,10 +24,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public ProdController()
{
#if false
// Initialize database context
localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
#endif
}
#endregion Public Constructors
@@ -110,9 +103,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
// salvo
localDbCtx.SaveChanges();
#if false
ResetController();
#endif
}
return done;
}
@@ -162,9 +152,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
localDbCtx.ProdList.Remove(currProd);
// salvo
localDbCtx.SaveChanges();
#if false
ResetController();
#endif
done = true;
}
catch (Exception exc)
@@ -177,10 +164,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public void Dispose()
{
#if false
// Clear database context
localDbCtx.Dispose();
#endif
}
/// <summary>
@@ -197,13 +180,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
.ProdList
.Where(x => x.ProdDbId == ProdDbId)
.SingleOrDefault();
#if false
// forzo rilettura
if (answ != null)
{
localDbCtx.Entry(answ).Reload();
}
#endif
}
return answ;
}
@@ -222,13 +198,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
.ProdList
.Where(x => x.ProdId == ProdId)
.SingleOrDefault();
#if false
// forzo rilettura
if (answ != null)
{
localDbCtx.Entry(answ).Reload();
}
#endif
}
return answ;
}
@@ -368,9 +337,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
}
localDbCtx.SaveChanges();
#if false
ResetController();
#endif
}
return currProd;
}
@@ -414,10 +380,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// </summary>
public void ResetController()
{
#if false
// Re-Initialize database context
localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
#endif
}
/// <summary>
@@ -445,9 +407,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
// Commit changes
localDbCtx.SaveChanges();
#if false
ResetController();
#endif
done = true;
}
catch
@@ -482,12 +441,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
// cerco le MG esistenti --> aggiorno
foreach (var item in MachGroupList)
{
#if false
var currMG = localDbCtx
.MachGroupList
.Where(x => x.Prod.ProdId == ProdId && x.MachGroupId == item.Id)
.SingleOrDefault();
#endif
var currMG = MachGroupController.man.FindByMachGroupId(ProdId, item.Id);
var convCurrMG = MachGroupController.ConvertFromCore(item, currData.ProdDbId);
if (currMG != null)
@@ -588,9 +541,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
// Commit changes
localDbCtx.SaveChanges();
#if false
ResetController();
#endif
}
catch (Exception exc)
{
@@ -620,9 +570,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
// Commit changes
localDbCtx.SaveChanges();
#if false
ResetController();
#endif
}
return coreConv(currData);
}
@@ -647,9 +594,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
// Commit changes
localDbCtx.SaveChanges();
#if false
ResetController();
#endif
}
return coreConv(currData);
}
@@ -9,12 +9,8 @@ namespace EgtBEAMWALL.DataLayer.Controllers
{
public class ProjController : IDisposable
{
private object dbCtx;
#region Private Fields
#if false
private DatabaseContext dbCtx;
#endif
#endregion Private Fields
@@ -22,10 +18,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public ProjController()
{
#if false
// Initialize database context
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
#endif
}
#endregion Public Constructors
@@ -147,9 +139,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
localDbCtx.ProjList.Remove(currProj);
// Commit changes
localDbCtx.SaveChanges();
#if false
ResetController();
#endif
done = true;
}
catch (Exception exc)
@@ -162,10 +151,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
public void Dispose()
{
#if false
// Clear database context
dbCtx.Dispose();
#endif
}
/// <summary>
@@ -227,13 +212,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
.ProjList
.Where(x => x.ProjDbId == ProjDbId)
.SingleOrDefault();
#if false
// forzo rilettura
if (answ != null)
{
localDbCtx.Entry(answ).Reload();
}
#endif
}
return answ;
}
@@ -252,13 +230,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
.ProjList
.Where(x => x.ProjId == ProjId)
.SingleOrDefault();
#if false
// forzo rilettura
if (answ != null)
{
dbCtx.Entry(answ).Reload();
}
#endif
}
return answ;
}
@@ -483,9 +454,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
}
// salvataggio
localDbCtx.SaveChanges();
#if false
ResetController();
#endif
}
return coreConv(currProj);
}
@@ -495,10 +463,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
/// </summary>
public void ResetController()
{
#if false
// Re-Initialize database context
dbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING);
#endif
}
/// <summary>
@@ -520,9 +484,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
// aggiorno stato
currProj.IsNew = false;
localDbCtx.SaveChanges();
#if false
ResetController();
#endif
}
return coreConv(currProj);
}
@@ -553,9 +514,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
// Commit changes
localDbCtx.SaveChanges();
#if false
ResetController();
#endif
done = true;
}
catch (Exception ex)
@@ -642,9 +600,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
// Commit changes
localDbCtx.SaveChanges();
#if false
ResetController();
#endif
}
return currData;
}
@@ -709,9 +664,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
// Commit changes
localDbCtx.SaveChanges();
#if false
ResetController();
#endif
}
return coreConv(currData);
@@ -728,9 +680,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
ProjModel currData;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
#if false
var currData = FindByProjId(ProjId);
#endif
currData = localDbCtx
.ProjList
.Where(x => x.ProjId == ProjId)
@@ -740,9 +689,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
// Commit changes
localDbCtx.SaveChanges();
#if false
ResetController();
#endif
}
return coreConv(currData);
}
@@ -758,9 +704,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
ProjModel currData;
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
{
#if false
var currData = FindByProjId(ProjId);
#endif
currData = localDbCtx
.ProjList
.Where(x => x.ProjId == ProjId)
@@ -770,9 +713,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
// Commit changes
localDbCtx.SaveChanges();
#if false
ResetController();
#endif
}
return coreConv(currData);
}