Ejemplo n.º 1
0
        /// <summary>
        /// Updates database if the original source file still exists and has
        /// been modified.
        /// </summary>
        protected override void UpdateCore(DateTime t1, DateTime t2, bool minimal)
        {
            Logger.WriteLine("Checking Excel series " + Name + " (" + ID + ") for updates");
            string dir = Path.GetDirectoryName(m_db.DataSource);

            if (TextSeries.CanUpdateFromFile(ConnectionString, dir))
            {
                Logger.WriteLine("Update: File has changed");
                SpreadsheetGearSeries g = SpreadsheetGearSeries.CreateFromConnectionString(ConnectionString, dir);
                g.Read();
                //m_db.Truncate(ID);
                ConnectionString = g.ConnectionString;
                ConnectionString = ConnectionStringUtility.MakeFileNameRelative(ConnectionString, m_db.DataSource);
                m_db.SaveProperties(this);// LastWriteTime proabably changed
                m_db.SaveTimeSeriesTable(ID, g, DatabaseSaveOptions.DeleteAllExisting);
            }
        }