Exemplo n.º 1
0
        /// <summary>
        /// Updates database schema into latest format
        /// </summary>
        /// <returns></returns>
        public static bool UpdateDBSchemaToLatestDI6(string fileNameWPath)
        {
            bool RetVal = false;
            DBConverterDecorator DBConverter = null;

            try
            {
                DBConverter = new DBConverterDecorator(fileNameWPath);
                RetVal = DBConverter.DoConversion(false);

            }
            catch (Exception ex)
            {
                RetVal = false;
                throw new ApplicationException(ex.ToString());
            }
            finally
            {
                if (DBConverter != null)
                {
                    DBConverter.Dispose();
                }
            }

            return RetVal;
        }
Exemplo n.º 2
0
        /// <summary>
        /// To open or create DevInfo database
        /// </summary>
        /// <param name="fileNameWPath"></param>
        /// <param name="datasetPrefix"></param>        
        /// <param name="langaugeCode"></param>
        public void OpenDatabase(string fileNameWPath, string datasetPrefix, string langaugeCode)
        {
            DBConverterDecorator DBConverter;

            //check file exists or not. If not exists then create it.
            if (!File.Exists(fileNameWPath))
            {
                DIDatabase.CreateDevInfoDBFile(fileNameWPath);

                // update the db schema
                DBConverter = new DBConverterDecorator(fileNameWPath);
                DBConverter.DoConversion(false);
                DBConverter.Dispose();
            }

            this.SetDatabaseObjects(fileNameWPath, datasetPrefix, langaugeCode);

            this.DIArea = new AreaBuilder(this.DBConnection, this.DBQueries);
            this.DIIUS = new IUSBuilder(this.DBConnection, this.DBQueries);
            this.DITimeperiod = new TimeperiodBuilder(this.DBConnection, this.DBQueries);
            this.DISource = new SourceBuilder(this.DBConnection, this.DBQueries);
            this.DIFootnote = new FootnoteBuilder(this.DBConnection, this.DBQueries);
        }