Exemplo n.º 1
0
        /// <summary>
        /// Returns true/false. True if Database is in valid format otherwise false.
        /// </summary>
        /// <param name="forOnlineDB"></param>
        /// <returns></returns>
        public override bool IsValidDB(bool forOnlineDB)
        {
            bool RetVal = false;

            DBMetadataTableBuilder DBMetadataBuilder = new DBMetadataTableBuilder(this._DBConnection, this._DBQueries);

            RetVal = DBMetadataBuilder.IsDBMetadataTableExists();

            return(RetVal);
        }
Exemplo n.º 2
0
        private void CreateDBMetaTable(bool forOnlineDB)
        {
            string   DataPrefix   = string.Empty;
            string   LanguageCode = string.Empty;
            DITables TableNames;
            DBMetadataTableBuilder DBMetadataTblBuilder;
            DIQueries TempQueries;

            try
            {
                // create table for all dataset
                foreach (DataRow DataPrefixRow in this._DBConnection.DIDataSets().Rows)
                {
                    DataPrefix = DataPrefixRow[DBAvailableDatabases.AvlDBPrefix].ToString() + "_";

                    // create table for all available langauges
                    foreach (DataRow LanguageRow in this._DBConnection.DILanguages(DataPrefix).Rows)
                    {
                        LanguageCode = "_" + LanguageRow[Language.LanguageCode].ToString();

                        // check table already exists or not
                        TempQueries          = new DIQueries(DataPrefix, LanguageCode);
                        DBMetadataTblBuilder = new DBMetadataTableBuilder(this._DBConnection, TempQueries);
                        if (DBMetadataTblBuilder.IsDBMetadataTableExists() == false)
                        {
                            TableNames = new DITables(DataPrefix, LanguageCode);
                            this._DBConnection.ExecuteNonQuery(DevInfo.Lib.DI_LibDAL.Queries.DBMetadata.Insert.CreateTable(TableNames.DBMetadata,
                                                                                                                           forOnlineDB, this._DBConnection.ConnectionStringParameters.ServerType));
                        }
                    }

                    // insert blank records with counts
                    // reset DBMetadata builder with main DIQuerie's object
                    DBMetadataTblBuilder = new DBMetadataTableBuilder(this._DBConnection, this._DBQueries);
                    DBMetadataTblBuilder.InsertRecord(string.Empty, string.Empty, string.Empty, string.Empty,
                                                      string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty);
                    DBMetadataTblBuilder.GetNUpdateCounts();
                }
            }
            catch (Exception ex)
            {
                throw new ApplicationException(ex.ToString());
            }
        }