using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Configuration;
using System.Linq;
using System.Text;

namespace SmartZip.Logic
{
    public class ZipConfiguration
    {
        public string maxActiveThreads = "1";
        public string recordsPerThread = "1";
        public string FTPServer = "ftp://134.44.28.220:21/";
        public string FTPUser = "C6Stampe";
        public string FTPPassword = "C6Stampe";
        public string FTPServerHost = "ftp://134.44.28.220:22/passaggi/Contratto_SEI/";
        public string FTPUserHost = "C6Stampe";
        public string FTPPasswordHost = "C6Stampe";
        public string PrefissoFile = "SEI";
        public string EstensioneFile = "IDX";
        public string EstensioneFileHost = "TXT";
        public string TIPO_INVIO = "T";
        public string NomeFileHostSettimanale = "SEI_INVIOSETTIMANALE";
        public string PathFileHostSettimanaleBackup = @"C:\Progetti\FLUSSI_SETTIMANALI_AD_HOSTS";
        public string NomeFileHostGiornaliero = "SEI_INVIOGIORNALIERO";
        public string PathFileHostGiornalieroBackup = @"C:\Progetti\FLUSSI_GIORNALIERI_AD_HOSTS";
        public string NomeFileHostTrimestrale = "SEI_INVIOTRIMESTRALE";
        public string PathFileHostTrimestraleBackup = @"C:\Progetti\FLUSSI_TRIMESTRALI_AD_HOSTS";
        public string DataLotto = "20160208";
        public string numeroCfPerZip = "3";
        public string SP_GESTIONE_SELECT_FTP_DA_INVIARE = "[C6MartPeriodico].[GESTIONE_SELECT_FTP_DA_INVIARE]";
        public string SP_GESTIONE_UPDATE_FTP = "[C6MartPeriodico].[GESTIONE_UPDATE_FTP]";
        public string SP_GESTIONE_UPDATE_EMAIL_HOST = "[C6MartPeriodico].[GESTIONE_UPDATE_EMAIL_HOST]";
        public string SP_GESTIONE_UPDATE_ZIP = "[C6MartPeriodico].[GESTIONE_UPDATE_ZIP]";
        public string SP_GESTIONE_INSERT_ELABORAZIONE_ZIP = "[C6MartPeriodico].[GESTIONE_INSERT_ELABORAZIONE_ZIP]";
        public string SP_GESTIONE_UPDATE_ELABORAZIONE_ZIP = "[C6MartPeriodico].[GESTIONE_UPDATE_ELABORAZIONE_ZIP]";
        public string SP_GESTIONE_INSERT_ZIP = "[C6MartPeriodico].[GESTIONE_INSERT_ZIP]";
        public string SP_GESTIONE_INSERT_ZIP_IDX_NOINSERT = "[C6MartPeriodico].[GESTIONE_INSERT_ZIP_IDX_NOINSERT]";
        public string SP_GESTIONE_SELECT_FTP_INVIATI = "[C6MartPeriodico].[GESTIONE_SELECT_FTP_INVIATI]";
        public string SP_GESTIONE_SELECT_FTP_INVIATI_INCLUDINGFILENAME = "[C6MartPeriodico].[GESTIONE_SELECT_FTP_INVIATI_INCLUDINGFILENAME]";
        public string SP_GESTIONE_SELECT_LAST_ZIP = "[C6MartPeriodico].[GESTIONE_SELECT_LAST_ZIP]";
        public string GESTIONE_SELECT_SPECIFIC_ZIP = "[C6MartPeriodico].[GESTIONE_SELECT_SPECIFIC_ZIP]";
        public string SP_GESTIONE_SELECT_HOST = "[C6MartPeriodico].[GESTIONE_SELECT_HOST]";
        public string ambiente = "SVILUPPO";
        public string cawTo_Bin = "CAWTO";
        public string fac_I_100 = "FAC_I_100";
        public string fac_T_100 = "FAC_T_100";
        public string fac_E_100 = "FAC_E_101";
        public string scriviErroreNelDB = "1";
        public string prefissoZIP = "SEI";
        public string suffissoZIP_T1 = "01_A";
        public string suffissoZIP_T2 = "01_B";
        public string suffissoZIP_R1 = "03_A";
        public string suffissoZIP_R2 = "03_B";
        public string pathZIP = @"C:\Progetti\ZIP_SELECTA\";
        public string pathZIP_PERIODICO = @"C:\ReportisticaTrimestrale\Pdf\";
        public string pathPDFToDB_PERIODICO = @"C:\ReportisticaTrimestrale\PdfToDb\";
        public string path_OUTPUT_ZIP = @"C:\Progetti\ZIP_SELECTA_TO_SEND\";
        public string path_OUTPUT_ZIP_PERIODICO = @"C:\ReportisticaTrimestrale\SELECTA\";
        public string FTP = "0";
        public string TotaliReportGenerazioneZip = "[C6MartPeriodico].[sp_TotaliReportGenerazioneZip]";
        public string IDXRowMaxLen1 = "385";
        public string IDXRowMaxLen2 = "768";

        public static ZipConfiguration ReadFromConfiguration(NameValueCollection myConfig)
        {
            ZipConfiguration c = new ZipConfiguration();
            c.maxActiveThreads = myConfig["maxActiveThreads"];
            c.recordsPerThread = myConfig["recordsPerThread"];
            c.FTPServer = myConfig["FTPServer"];
            c.FTPUser = myConfig["FTPUser"];
            c.FTPPassword = myConfig["FTPPassword"];
            c.FTPServerHost = myConfig["FTPServerHost"];
            c.FTPUserHost = myConfig["FTPUserHost"];
            c.FTPPasswordHost = myConfig["FTPPasswordHost"];
            c.PrefissoFile = myConfig["PrefissoFile"];
            c.EstensioneFile = myConfig["EstensioneFile"];
            c.EstensioneFileHost = myConfig["EstensioneFileHost"];
            c.TIPO_INVIO = myConfig["TIPO_INVIO"];
            c.NomeFileHostSettimanale = myConfig["NomeFileHostSettimanale"];
            c.PathFileHostSettimanaleBackup = myConfig["PathFileHostSettimanaleBackup"];
            c.NomeFileHostGiornaliero = myConfig["NomeFileHostGiornaliero"];
            c.PathFileHostGiornalieroBackup = myConfig["PathFileHostGiornalieroBackup"];
            c.NomeFileHostTrimestrale = myConfig["NomeFileHostTrimestrale"];
            c.PathFileHostTrimestraleBackup = myConfig["PathFileHostTrimestraleBackup"];
            c.DataLotto = myConfig["DataLotto"];
            c.numeroCfPerZip = myConfig["numeroCfPerZip"];
            c.SP_GESTIONE_SELECT_FTP_DA_INVIARE = myConfig["SP_GESTIONE_SELECT_FTP_DA_INVIARE"];
            c.SP_GESTIONE_UPDATE_FTP = myConfig["SP_GESTIONE_UPDATE_FTP"];
            c.SP_GESTIONE_UPDATE_EMAIL_HOST = myConfig["SP_GESTIONE_UPDATE_EMAIL_HOST"];
            c.SP_GESTIONE_UPDATE_ZIP = myConfig["SP_GESTIONE_UPDATE_ZIP"];
            c.SP_GESTIONE_INSERT_ELABORAZIONE_ZIP = myConfig["SP_GESTIONE_INSERT_ELABORAZIONE_ZIP"];
            c.SP_GESTIONE_UPDATE_ELABORAZIONE_ZIP = myConfig["SP_GESTIONE_UPDATE_ELABORAZIONE_ZIP"];
            c.SP_GESTIONE_INSERT_ZIP = myConfig["SP_GESTIONE_INSERT_ZIP"];
            c.SP_GESTIONE_SELECT_FTP_INVIATI = myConfig["SP_GESTIONE_SELECT_FTP_INVIATI"];
            c.SP_GESTIONE_SELECT_LAST_ZIP = myConfig["SP_GESTIONE_SELECT_LAST_ZIP"];
            c.SP_GESTIONE_SELECT_HOST = myConfig["SP_GESTIONE_SELECT_HOST"];
            c.ambiente = myConfig["ambiente"];
            c.cawTo_Bin = myConfig["cawTo_Bin"];
            c.fac_I_100 = myConfig["fac_I_100"];
            c.fac_T_100 = myConfig["fac_T_100"];
            c.fac_E_100 = myConfig["fac_E_100"];
            c.scriviErroreNelDB = myConfig["scriviErroreNelDB"];
            c.prefissoZIP = myConfig["prefissoZIP"];
            c.suffissoZIP_T1 = myConfig["suffissoZIP_T1"];
            c.suffissoZIP_T2 = myConfig["suffissoZIP_T2"];
            c.suffissoZIP_R1 = myConfig["suffissoZIP_R1"];
            c.suffissoZIP_R2 = myConfig["suffissoZIP_R2"];
            c.pathZIP = myConfig["pathZIP"];
            c.pathZIP_PERIODICO = myConfig["pathZIP_PERIODICO"];
            c.pathPDFToDB_PERIODICO = myConfig["pathPDFToDB_PERIODICO"];
            c.path_OUTPUT_ZIP = myConfig["path_OUTPUT_ZIP"];
            c.path_OUTPUT_ZIP_PERIODICO = myConfig["path_OUTPUT_ZIP_PERIODICO"];
            c.FTP = myConfig["FTP"];
            c.TotaliReportGenerazioneZip = myConfig["TotaliReportGenerazioneZip"];
            c.IDXRowMaxLen1 = myConfig["IDXRowMaxLen1"];
            c.IDXRowMaxLen2 = myConfig["IDXRowMaxLen2"];
            return c;
        }
    }
}