public override void Connect_To_Database(StorageConfig config)
 {
     foreach (var s in storages)
     {
         s.Connect_To_Database(storrageConfigs[s]);
     }                    
 }
        public override void Connect_To_Database(StorageConfig config)
        {
            myConfig = config as SQLiteConfig;
            if (myConfig == null)
                throw new Exception("Database Config is NULL");

            if (!FileNameLockObjects.ContainsKey(myConfig.DatabaseFile))
                FileNameLockObjects.Add(myConfig.DatabaseFile,new object());

            try
            {
                myDBConn = new SQLiteConnection(ConnectionString);
                myDBConn.Open();
                if (myDBConn.State != System.Data.ConnectionState.Open)
                    throw new Exception("Unable to Open Database. Storage:" + config.Name);
            }
            catch (SQLiteException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public override void Connect_To_Database(StorageConfig config)
        {
            myConfig = config as PLCConfig;

            _plcConnection = new PLCConnection(myConfig.Configuration);
            _plcConnection.AutoConnect = true;
            _plcConnection.Connect();
        }
        public override void Connect_To_Database(StorageConfig config)
        {
            myConfig = config as PLCConfig;

            _plcConnection = new PLCConnection(myConfig.Configuration);
            _plcConnection.AutoConnect = true;
            _plcConnection.Connect();
            Logging.LogTextToLog4Net("Connect_To_Database() => \"" + _plcConnection.Name + "\" => Connect...");
        }
 public override void Connect_To_Database(StorageConfig config)
 {
     myConfig = config as MySQLConfig;
     if (myConfig == null)
         throw new Exception("Database Config is NULL");
     try
     {
         myDBConn = new MySqlConnection(ConnectionString);
         myDBConn.Open();
         if (myDBConn.State != System.Data.ConnectionState.Open)
             throw new Exception("Unable to Open Database. Storage:" + config.Name);               
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        public MultiStorage(ProtokollerConfiguration protokollerConfiguration, StorageConfig config, Action<string> NewDataCallback)
        {
            this._protokollerConfiguration = protokollerConfiguration;
            this._newDataCallback = NewDataCallback;

            storages = new List<DBBaseClass>();
            this.myConfig = config as MultiStorageConfig;

            foreach (string s in myConfig.StorageList)
            {
                var storCfg = _protokollerConfiguration.Storages.First(x => x.Name == s);
                var stor = (DBBaseClass)StorageHelper.GetStorage(null, storCfg, RemotingServer.ClientComms.CallNotifyEvent);
                storages.Add(stor);

                storrageConfigs.Add(stor, storCfg);

            }   
        }
        public override void Connect_To_Database(StorageConfig config)
        {
            myConfig = config as CSVConfig;
            if (myConfig == null)
                throw new Exception("Database Config is NULL");

            if (!string.IsNullOrEmpty(myConfig.NetworkUserName))
            {
                try
                {
                    networkShare = new NetworkShare(Path.GetDirectoryName(myConfig.Textfile), myConfig.NetworkUserName, myConfig.NetworkPassword);
                }
                catch(Exception ex)
                {
                    if (!RaiseThreadExceptionOccured(this, ex))
                        Logging.LogText("Exception: ", ex, Logging.LogLevel.Error);
                }
            }
        }
 public static IDBInterface GetStorage(ProtokollerConfiguration config, StorageConfig cfg, Action<string> NewDataCallback)
 {
     if (cfg is SQLiteConfig)
         return new SQLLiteStorage(NewDataCallback);
     else if (cfg is CSVConfig)
         return new CSVStorage(NewDataCallback);
     else if (cfg is ExcelConfig)
         return new ExcelStorage(NewDataCallback);
     else if (cfg is PostgreSQLConfig)
         return new PostgreSQLStorage(NewDataCallback);
     else if (cfg is MySQLConfig)
         return new MySQLStorage(NewDataCallback);
     else if (cfg is Excel2007Config)
         return new Excel2007Storage(NewDataCallback);
     else if (cfg is MsSQLConfig)
         return new MsSQLStorage(NewDataCallback);
     else if (cfg is PLCConfig)
         return new PLCStorage(NewDataCallback);
     else if (cfg is MultiStorageConfig)
         return new MultiStorage.MultiStorage(config, cfg, NewDataCallback);
     return null;
 }        
 public override void Connect_To_Database(StorageConfig config)
 {
     myConfig = config as SQLiteConfig;
     if (myConfig == null)
         throw new Exception("Database Config is NULL");
     try
     {
         string connString = string.Format("Data Source={0};Pooling=true;FailIfMissing=false", myConfig.DatabaseFile);
         myDBConn = new FbConnection(connString);
         myDBConn.Open();
         if (myDBConn.State != System.Data.ConnectionState.Open)
             throw new Exception();
     }
     catch (FbException ex)
     {
         throw ex;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 public override void Connect_To_Database(StorageConfig config)
 {
     myConfig = config as Excel2007Config;
     if (myConfig == null)
         throw new Exception("Database Config is NULL");
 }
 public virtual void Initiate(DatasetConfig dsConfig)
 {
     datasetConfig = dsConfig;
     storCfg = datasetConfig.Storage;
     Initiate();
 }
 public abstract void Connect_To_Database(StorageConfig config);