using SteamWare;

namespace GMW_data
{
  /// <summary>
  /// fa da proxy singleton x gli oggetti applicativi
  /// </summary>
  public class DataProxy
  {
    #region area table adapters

    public DS_ApplicazioneTableAdapters.AnagBilanceTableAdapter taAnagBil;
    public DS_ApplicazioneTableAdapters.AnagClientiTableAdapter taAnagClienti;
    public DS_ApplicazioneTableAdapters.AnagCompanySitoTableAdapter taAnagCS;
    public DS_ApplicazioneTableAdapters.AnagImballiTableAdapter taAnagImballi;
    public DS_ApplicazioneTableAdapters.AnagImpiantiTableAdapter taAnagImp;
    public DS_ApplicazioneTableAdapters.AnagFamiglieTableAdapter taAnagFamiglie;
    public DS_ApplicazioneTableAdapters.AnagOperatoriTableAdapter taAnagOperatore;
    public DS_ApplicazioneTableAdapters.AnagParticolariTableAdapter taAnagParticolari;
    public DS_ApplicazioneTableAdapters.AnagParticolariImballiTableAdapter taAnagPartImb;
    public DS_ApplicazioneTableAdapters.v_ArtInProdTableAdapter taArtInProd;
    public DS_ApplicazioneTableAdapters.ElencoCartelliniTableAdapter taCartellini;
    public DS_ApplicazioneTableAdapters.ElencoPostazioniTableAdapter taElPost;
    public DS_ApplicazioneTableAdapters.ElencoNCTableAdapter taENC;
    public DS_ApplicazioneTableAdapters.RelazUDCTableAdapter taRelazUDC;
    public DS_ApplicazioneTableAdapters.v_RapQualNoteTableAdapter taRQN;
    public DS_ApplicazioneTableAdapters.Soggetti2UtenteTableAdapter taSogg2Oper;
    public DS_ApplicazioneTableAdapters.v_specParticolariTableAdapter taSpecPart;
    public DS_ApplicazioneTableAdapters.AnagStatiProdottoTableAdapter taStatiProd;
    public DS_ApplicazioneTableAdapters.AnagTipoDichiarazTableAdapter taTipoDich;
    public DS_ApplicazioneTableAdapters.TrascCodSoggTableAdapter taTrascSogg;
    public DS_ApplicazioneTableAdapters.UDC_NCTableAdapter taUDC2NC;
    public DS_ApplicazioneTableAdapters.UNC_treeTableAdapter taUNCTree;

    public DS_cartelliniTableAdapters.stp_prtCartByUDCTableAdapter taPrtCart;
    public DS_cartelliniTableAdapters.stp_prtCartALTableAdapter taPrtCartAL;
    public DS_cartelliniTableAdapters.stp_prtCartAnimeByUDCTableAdapter taPrtCartAnime;
    public DS_cartelliniTableAdapters.stp_prtCartAnimeByALTableAdapter taPrtCartKitAnime;
    public DS_cartelliniTableAdapters.stp_prtCartFinitiByUDCTableAdapter taPrtCartFiniti;
    public DS_cartelliniTableAdapters.stp_prtCartFinitiByUDC_SPTableAdapter taPrtCartFinitiSP;
    public DS_cartelliniTableAdapters.stp_prtCartFinitiRxByUDC_SPTableAdapter taPrtCartFinitiRxSP;
    public DS_cartelliniTableAdapters.stp_prtCartFusiByUDCTableAdapter taPrtCartFusi;
    public DS_cartelliniTableAdapters.stp_prtCartLiquidi_F10ByUDCTableAdapter taPrtCartLiqF10;
    public DS_cartelliniTableAdapters.stp_prtCartLiquidi_F18ByUDCTableAdapter taPrtCartLiqF18;
    public DS_cartelliniTableAdapters.stp_prtCartMatPrimaByUDCTableAdapter taPrtCartMP;
    public DS_cartelliniTableAdapters.stp_prtCartSterratiByUDCTableAdapter taPrtCartSterrati;
    public DS_cartelliniTableAdapters.stp_prtCartTrattatiByUDCTableAdapter taPrtCartTratt;
    public DS_cartelliniTableAdapters.PrintJobQueueTableAdapter taPJQ;

    /// <summary>
    /// init dei table adapters
    /// </summary>
    protected void initTA()
    {
      taAnagBil = new GMW_data.DS_ApplicazioneTableAdapters.AnagBilanceTableAdapter();
      taAnagClienti = new GMW_data.DS_ApplicazioneTableAdapters.AnagClientiTableAdapter();
      taAnagCS = new GMW_data.DS_ApplicazioneTableAdapters.AnagCompanySitoTableAdapter();
      taAnagImballi = new GMW_data.DS_ApplicazioneTableAdapters.AnagImballiTableAdapter();
      taAnagImp = new GMW_data.DS_ApplicazioneTableAdapters.AnagImpiantiTableAdapter();
      taAnagFamiglie = new GMW_data.DS_ApplicazioneTableAdapters.AnagFamiglieTableAdapter();
      taAnagOperatore = new GMW_data.DS_ApplicazioneTableAdapters.AnagOperatoriTableAdapter();
      taAnagParticolari = new GMW_data.DS_ApplicazioneTableAdapters.AnagParticolariTableAdapter();
      taAnagPartImb = new GMW_data.DS_ApplicazioneTableAdapters.AnagParticolariImballiTableAdapter();
      taArtInProd = new GMW_data.DS_ApplicazioneTableAdapters.v_ArtInProdTableAdapter();
      taCartellini = new GMW_data.DS_ApplicazioneTableAdapters.ElencoCartelliniTableAdapter();
      taElPost = new GMW_data.DS_ApplicazioneTableAdapters.ElencoPostazioniTableAdapter();
      taENC = new GMW_data.DS_ApplicazioneTableAdapters.ElencoNCTableAdapter();
      taRelazUDC = new GMW_data.DS_ApplicazioneTableAdapters.RelazUDCTableAdapter();
      taRQN = new GMW_data.DS_ApplicazioneTableAdapters.v_RapQualNoteTableAdapter();
      taSogg2Oper = new GMW_data.DS_ApplicazioneTableAdapters.Soggetti2UtenteTableAdapter();
      taSpecPart = new GMW_data.DS_ApplicazioneTableAdapters.v_specParticolariTableAdapter();
      taStatiProd = new GMW_data.DS_ApplicazioneTableAdapters.AnagStatiProdottoTableAdapter();
      taTipoDich = new GMW_data.DS_ApplicazioneTableAdapters.AnagTipoDichiarazTableAdapter();
      taTrascSogg = new GMW_data.DS_ApplicazioneTableAdapters.TrascCodSoggTableAdapter();
      taUDC2NC = new GMW_data.DS_ApplicazioneTableAdapters.UDC_NCTableAdapter();
      taUNCTree = new GMW_data.DS_ApplicazioneTableAdapters.UNC_treeTableAdapter();

      taPrtCart = new GMW_data.DS_cartelliniTableAdapters.stp_prtCartByUDCTableAdapter();
      taPrtCartAL = new DS_cartelliniTableAdapters.stp_prtCartALTableAdapter();
      taPrtCartAnime = new GMW_data.DS_cartelliniTableAdapters.stp_prtCartAnimeByUDCTableAdapter();
      taPrtCartKitAnime = new GMW_data.DS_cartelliniTableAdapters.stp_prtCartAnimeByALTableAdapter();
      taPrtCartFiniti = new DS_cartelliniTableAdapters.stp_prtCartFinitiByUDCTableAdapter();
      taPrtCartFinitiRxSP = new DS_cartelliniTableAdapters.stp_prtCartFinitiRxByUDC_SPTableAdapter();
      taPrtCartFinitiSP = new DS_cartelliniTableAdapters.stp_prtCartFinitiByUDC_SPTableAdapter();
      taPrtCartFusi = new DS_cartelliniTableAdapters.stp_prtCartFusiByUDCTableAdapter();
      taPrtCartLiqF10 = new GMW_data.DS_cartelliniTableAdapters.stp_prtCartLiquidi_F10ByUDCTableAdapter();
      taPrtCartLiqF18 = new GMW_data.DS_cartelliniTableAdapters.stp_prtCartLiquidi_F18ByUDCTableAdapter();
      taPrtCartMP = new GMW_data.DS_cartelliniTableAdapters.stp_prtCartMatPrimaByUDCTableAdapter();
      taPrtCartSterrati = new DS_cartelliniTableAdapters.stp_prtCartSterratiByUDCTableAdapter();
      taPrtCartTratt = new DS_cartelliniTableAdapters.stp_prtCartTrattatiByUDCTableAdapter();
      taPJQ = new DS_cartelliniTableAdapters.PrintJobQueueTableAdapter();
    }
    /// <summary>
    /// effettua setup dei connection strings da web.config delal singola applicazione
    /// </summary>
    protected virtual void setupConnectionStringBase()
    {
      string connString = memLayer.ML.confReadString("GMWConnectionString");
      // connections strings del db
      taAnagBil.Connection.ConnectionString = connString;
      taAnagClienti.Connection.ConnectionString = connString;
      taAnagCS.Connection.ConnectionString = connString;
      taAnagFamiglie.Connection.ConnectionString = connString;
      taAnagImballi.Connection.ConnectionString = connString;
      taAnagImp.Connection.ConnectionString = connString;
      taAnagOperatore.Connection.ConnectionString = connString;
      taAnagParticolari.Connection.ConnectionString = connString;
      taAnagPartImb.Connection.ConnectionString = connString;
      taArtInProd.Connection.ConnectionString = connString;
      taCartellini.Connection.ConnectionString = connString;
      taElPost.Connection.ConnectionString = connString;
      taENC.Connection.ConnectionString = connString;
      taRelazUDC.Connection.ConnectionString = connString;
      taRQN.Connection.ConnectionString = connString;
      taSogg2Oper.Connection.ConnectionString = connString;
      taSpecPart.Connection.ConnectionString = connString;
      taStatiProd.Connection.ConnectionString = connString;
      taTipoDich.Connection.ConnectionString = connString;
      taTrascSogg.Connection.ConnectionString = connString;
      taUDC2NC.Connection.ConnectionString = connString;
      taUNCTree.Connection.ConnectionString = connString;

      taPrtCart.Connection.ConnectionString = connString;
      taPrtCartAL.Connection.ConnectionString = connString;
      taPrtCartAnime.Connection.ConnectionString = connString;
      taPrtCartKitAnime.Connection.ConnectionString = connString;
      taPrtCartFiniti.Connection.ConnectionString = connString;
      taPrtCartFinitiRxSP.Connection.ConnectionString = connString;
      taPrtCartFinitiSP.Connection.ConnectionString = connString;
      taPrtCartFusi.Connection.ConnectionString = connString;
      taPrtCartLiqF10.Connection.ConnectionString = connString;
      taPrtCartLiqF18.Connection.ConnectionString = connString;
      taPrtCartMP.Connection.ConnectionString = connString;
      taPrtCartSterrati.Connection.ConnectionString = connString;
      taPrtCartTratt.Connection.ConnectionString = connString;
      taPJQ.Connection.ConnectionString = connString;
    }

    #endregion

    public DataProxy()
    {
      initTA();
      setupConnectionStringBase();
    }


    public static DataProxy obj = new DataProxy();
  }
}
