Beispiel #1
0
        protected void btnRefresh_Click(object sender, EventArgs e)
        {
            DefaultSettings defaultSettings = new DefaultSettings();

            this.myMeta.Connect(defaultSettings.DbDriver, defaultSettings.ConnectionString);

            GetSetting();

            this.propertyGridSetting.SelectedObject = config;

            CodeGenerateUIHelper.BindDataBaseToComboBox(this.myMeta, this.cmbSelectDataBase);
        }
        public static DataSet GetDataSetBySql(string sql)
        {
            DefaultSettings settings = new DefaultSettings();

            using (OleDbConnection cnn = new OleDbConnection(settings.ConnectionString))
            {
                DataSet ds = new DataSet();
                cnn.Open();
                OleDbCommand cmd = cnn.CreateCommand();
                cmd.CommandType = CommandType.Text;
                cmd.CommandText = sql;
                OleDbDataAdapter dpt = new OleDbDataAdapter();
                dpt.SelectCommand = cmd;
                dpt.Fill(ds);
                cnn.Close();
                return(ds);
            }
        }
        public void PopulateZeusContext(IZeusContext context)
        {
            DefaultSettings settings = new DefaultSettings();
            IZeusInput      input    = context.Input;

            if (!input.Contains("__version"))
            {
                Assembly ver = System.Reflection.Assembly.GetEntryAssembly();
                input["__version"] = ver.GetName().Version.ToString();
            }

            //-- BEGIN LEGACY VARIABLE SUPPORT -----
            if (!input.Contains("defaultTemplatePath"))
            {
                input["defaultTemplatePath"] = settings.DefaultTemplateDirectory;
            }
            if (!input.Contains("defaultOutputPath"))
            {
                input["defaultOutputPath"] = settings.DefaultOutputDirectory;
            }
            //-- END LEGACY VARIABLE SUPPORT -------

            if (!input.Contains("__defaultTemplatePath"))
            {
                input["__defaultTemplatePath"] = settings.DefaultTemplateDirectory;
            }

            if (!input.Contains("__defaultOutputPath"))
            {
                input["__defaultOutputPath"] = settings.DefaultOutputDirectory;
            }

            if (settings.DbDriver != string.Empty)
            {
                //-- BEGIN LEGACY VARIABLE SUPPORT -----
                if (!input.Contains("dbDriver"))
                {
                    input["dbDriver"] = settings.DbDriver;
                }
                if (!input.Contains("dbConnectionString"))
                {
                    input["dbConnectionString"] = settings.DomainOverride;
                }
                //-- END LEGACY VARIABLE SUPPORT -------

                if (!input.Contains("__dbDriver"))
                {
                    input["__dbDriver"] = settings.DbDriver;
                }

                if (!input.Contains("__dbConnectionString"))
                {
                    input["__dbConnectionString"] = settings.ConnectionString;
                }

                if (!input.Contains("__domainOverride"))
                {
                    input["__domainOverride"] = settings.DomainOverride;
                }

                if ((settings.DbTarget != string.Empty) && (!input.Contains("__dbTarget")))
                {
                    input["__dbTarget"] = settings.DbTarget;
                }

                if ((settings.DbTargetMappingFile != string.Empty) && (!input.Contains("__dbTargetMappingFileName")))
                {
                    input["__dbTargetMappingFileName"] = settings.DbTargetMappingFile;
                }

                if ((settings.LanguageMappingFile != string.Empty) && (!input.Contains("__dbLanguageMappingFileName")))
                {
                    input["__dbLanguageMappingFileName"] = settings.LanguageMappingFile;
                }

                if ((settings.Language != string.Empty) && (!input.Contains("__language")))
                {
                    input["__language"] = settings.Language;
                }

                if ((settings.UserMetaDataFileName != string.Empty) && (!input.Contains("__userMetaDataFileName")))
                {
                    input["__userMetaDataFileName"] = settings.UserMetaDataFileName;
                }
            }
        }