113 lines
2.8 KiB
C#
113 lines
2.8 KiB
C#
|
|
using System;
|
|
using System.Configuration;
|
|
|
|
namespace DB_proxy
|
|
{
|
|
public class DataLayer
|
|
{
|
|
|
|
#region area gestione conf file
|
|
|
|
/// <summary>
|
|
/// legge conf in formato char
|
|
/// </summary>
|
|
/// <param name="key"></param>
|
|
/// <returns></returns>
|
|
public static char CRC(string key)
|
|
{
|
|
char answ = '-';
|
|
try
|
|
{
|
|
answ = ConfigurationManager.AppSettings[key].ToCharArray()[0];
|
|
}
|
|
catch
|
|
{ }
|
|
return answ;
|
|
}
|
|
/// <summary>
|
|
/// legge conf in formato stringa
|
|
/// </summary>
|
|
/// <param name="key"></param>
|
|
/// <returns></returns>
|
|
public static string CRS(string key)
|
|
{
|
|
string answ = "";
|
|
try
|
|
{
|
|
answ = ConfigurationManager.AppSettings[key].ToString();
|
|
}
|
|
catch
|
|
{ }
|
|
return answ;
|
|
}
|
|
/// <summary>
|
|
/// legge conf in formato INT
|
|
/// </summary>
|
|
/// <param name="key"></param>
|
|
/// <returns></returns>
|
|
public static Int32 CRI(string key)
|
|
{
|
|
int answ = 0;
|
|
try
|
|
{
|
|
answ = Convert.ToInt32(CRS(key));
|
|
}
|
|
catch
|
|
{ }
|
|
return answ;
|
|
}
|
|
/// <summary>
|
|
/// legge conf in formato BOOLean
|
|
/// </summary>
|
|
/// <param name="key"></param>
|
|
/// <returns></returns>
|
|
public static bool CRB(string key)
|
|
{
|
|
bool answ = false;
|
|
try
|
|
{
|
|
answ = Convert.ToBoolean(CRS(key));
|
|
}
|
|
catch
|
|
{ }
|
|
return answ;
|
|
}
|
|
#endregion
|
|
|
|
public DS_AppTableAdapters.AnagAllarmiTableAdapter taAnagAll;
|
|
public DS_AppTableAdapters.AnagArticoliTableAdapter taAnagArt;
|
|
public DS_AppTableAdapters.AnagOperatoriTableAdapter taAnagOpr;
|
|
public DS_AppTableAdapters.StoricoAllarmiExpTableAdapter taSAL;
|
|
public DS_AppTableAdapters.TabAttrezzatureTableAdapter taAttrezz;
|
|
public DS_AppTableAdapters.TabLogOperatoriTableAdapter taTLO;
|
|
public DS_AppTableAdapters.TabOperazioniTableAdapter taTO;
|
|
public DS_AppTableAdapters.TabPezziTableAdapter taPezzi;
|
|
|
|
|
|
/// <summary>
|
|
/// Init TAdapter
|
|
/// </summary>
|
|
protected void initTA()
|
|
{
|
|
taAnagAll = new DS_AppTableAdapters.AnagAllarmiTableAdapter();
|
|
taAnagArt = new DS_AppTableAdapters.AnagArticoliTableAdapter();
|
|
taAnagOpr = new DS_AppTableAdapters.AnagOperatoriTableAdapter();
|
|
taSAL = new DS_AppTableAdapters.StoricoAllarmiExpTableAdapter();
|
|
taAttrezz = new DS_AppTableAdapters.TabAttrezzatureTableAdapter();
|
|
taTO = new DS_AppTableAdapters.TabOperazioniTableAdapter();
|
|
taTLO = new DS_AppTableAdapters.TabLogOperatoriTableAdapter();
|
|
taPezzi = new DS_AppTableAdapters.TabPezziTableAdapter();
|
|
}
|
|
/// <summary>
|
|
/// Avvio DataLayer
|
|
/// </summary>
|
|
protected DataLayer()
|
|
{
|
|
initTA();
|
|
}
|
|
|
|
public static DataLayer man = new DataLayer();
|
|
}
|
|
}
|