Пример #1
0
        private void CheckNCreateMetadataCategoryTable(bool forOnlineDB, DITables tablesName)
        {
            string DataPrefix   = string.Empty;
            string LanguageCode = string.Empty;
            MetadataCategoryBuilder MetadataCategoryBuilderObj = null;
            DIQueries TempQueries;

            try
            {
                // check table already exists or not
                TempQueries = new DIQueries(tablesName.CurrentDataPrefix, tablesName.CurrentLanguageCode);
                MetadataCategoryBuilderObj = new MetadataCategoryBuilder(this._DBConnection, TempQueries);

                if (MetadataCategoryBuilderObj.IsMetadataCategoryTableExists() == false)
                {
                    this.AddMissingMetadataCategoryTables(tablesName.MetadataCategory);

                    this._DBConnection.ExecuteNonQuery(DevInfo.Lib.DI_LibDAL.Queries.MetadataCategory.Insert.CreateTable(tablesName.MetadataCategory, forOnlineDB, this._DBConnection.ConnectionStringParameters.ServerType));
                }
            }
            catch (Exception ex)
            {
                throw new ApplicationException(ex.ToString());
            }
        }
Пример #2
0
        private void CreateMetadatCategoryTable(bool forOnlineDB)
        {
            string   DataPrefix   = string.Empty;
            string   LanguageCode = string.Empty;
            DITables TableNames;
            MetadataCategoryBuilder MetadataCategoryBuilderObj = null;
            DIQueries TempQueries;

            try
            {
                // step1: 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);
                        MetadataCategoryBuilderObj = new MetadataCategoryBuilder(this._DBConnection, TempQueries);

                        if (MetadataCategoryBuilderObj.IsMetadataCategoryTableExists() == false)
                        {
                            TableNames = new DITables(DataPrefix, LanguageCode);

                            this._DBConnection.ExecuteNonQuery(DevInfo.Lib.DI_LibDAL.Queries.MetadataCategory.Insert.CreateTable(TableNames.MetadataCategory,
                                                                                                                                 forOnlineDB, this._DBConnection.ConnectionStringParameters.ServerType));
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw new ApplicationException(ex.ToString());
            }
        }