103 lines
3.5 KiB
C#
103 lines
3.5 KiB
C#
namespace SteamWare
|
|
{
|
|
/// <summary>
|
|
/// Summary description for selettori
|
|
/// </summary>
|
|
public class selettori
|
|
{
|
|
#region avvio
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public selettori()
|
|
{
|
|
}
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
protected DataLayer_AnagGen.CDCDataTable _tblCdC;
|
|
/// <summary>
|
|
/// carica i dati CdC se in cache o da TableAdapter
|
|
/// </summary>
|
|
protected virtual void caricaCdC()
|
|
{
|
|
DataLayer_AnagGenTableAdapters.CDCTableAdapter taCdC = new DataLayer_AnagGenTableAdapters.CDCTableAdapter();
|
|
taCdC.Connection.ConnectionString = memLayer.ML.CRS("UtenteCdcConnectionString");
|
|
if (memLayer.ML.isInCacheObject("_tblCdC"))
|
|
{
|
|
if (memLayer.ML.serializeSession)
|
|
{
|
|
_tblCdC = DataSetAdapter<DataLayer_AnagGen.CDCDataTable>.convert(memLayer.ML.dsSessionObj("_tblCdC"));
|
|
}
|
|
else
|
|
{
|
|
_tblCdC = (DataLayer_AnagGen.CDCDataTable)memLayer.ML.objCacheObj("_tblCdC");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
_tblCdC = taCdC.GetData();
|
|
if (memLayer.ML.serializeSession)
|
|
{
|
|
memLayer.ML.setSessionDataTable("_tblCdC", _tblCdC);
|
|
}
|
|
else
|
|
{
|
|
memLayer.ML.setCacheVal("_tblCdC", _tblCdC);
|
|
}
|
|
memLayer.ML.addTabInCache("_tblCdC");
|
|
}
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
/// <summary>
|
|
/// restituisce l'elenco di tutti i cdc
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public virtual DataLayer_generic.selettoreDataTable getSelAllCdC()
|
|
{
|
|
caricaCdC();
|
|
// costruisco il dataset, lo popolo e lo restituisco...
|
|
DataLayer_generic.selettoreDataTable dtSelCdC = new DataLayer_generic.selettoreDataTable();
|
|
string _label;
|
|
foreach (DataLayer_AnagGen.CDCRow riga in _tblCdC)
|
|
{
|
|
try
|
|
{
|
|
_label = string.Format("{0} ({1})", riga.DESCRIZIONE, riga.COD_CDC);
|
|
dtSelCdC.AddselettoreRow(_label, riga.COD_CDC);
|
|
}
|
|
catch
|
|
{ }
|
|
}
|
|
return dtSelCdC;
|
|
}
|
|
/// <summary>
|
|
/// restituisce l'elenco di tutti i cdc della gerarchia dell'utente
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public virtual DataLayer_generic.selettoreDataTable getSelCdCGer()
|
|
{
|
|
caricaCdC();
|
|
// la var di sessione _AuthCdC contiene COD_CDC IN ('...', )
|
|
DataLayer_AnagGen.CDCRow[] _tblCdcGer = (DataLayer_AnagGen.CDCRow[])_tblCdC.Select(memLayer.ML.StringSessionObj("_AuthCdC"));
|
|
// costruisco il dataset, lo popolo e lo restituisco...
|
|
DataLayer_generic.selettoreDataTable dtSelCdC = new DataLayer_generic.selettoreDataTable();
|
|
string _label;
|
|
foreach (DataLayer_AnagGen.CDCRow riga in _tblCdcGer)
|
|
{
|
|
try
|
|
{
|
|
_label = string.Format("{0} ({1})", riga.DESCRIZIONE, riga.COD_CDC);
|
|
dtSelCdC.AddselettoreRow(_label, riga.COD_CDC);
|
|
}
|
|
catch
|
|
{ }
|
|
}
|
|
return dtSelCdC;
|
|
}
|
|
}
|
|
} |