private void ProfileForm_Load(object sender, EventArgs e)
        {
            sourceDBMS.Items.AddRange(DBMSFactory.GetDBMSReaderNames());
            destDBMS.Items.AddRange(DBMSFactory.GetDBMSWriterNames());
            runner.Items.AddRange(RunnerFactory.GetRunnerAssistantNames());

            string[] charsets = new string[] { "gbk", "utf8" };

            sourceCharSet.Items.AddRange(charsets);
            destCharSet.Items.AddRange(charsets);
        }
        private void DBMS_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (sender == sourceDBMS)
            {
                IDBMSAssistant source = DBMSFactory.GetDBMSAssistantByName(sourceDBMS.Text);

                if (source != null)
                {
                    DBMSParams param = source.GetParams();

                    sourceServer.Enabled   = param.Server;
                    sourcePort.Enabled     = param.Port;
                    sourceDB.Enabled       = param.DB;
                    sourceUser.Enabled     = param.User;
                    sourceSchema.Enabled   = param.Schema;
                    sourcePwd.Enabled      = param.Pwd;
                    sourceCharSet.Enabled  = param.CharSet;
                    sourceTimeout.Enabled  = param.Timeout;
                    sourceEncrypt.Enabled  = param.Encrypt;
                    sourceCompress.Enabled = param.Compress;

                    sourcePort.Text    = param.DefaultPort;
                    sourceSchema.Text  = param.DefaultSchema;
                    sourceCharSet.Text = param.DefaultCharSet;
                    sourceTimeout.Text = param.DefaultTimeout;
                }
            }
            else if (sender == destDBMS)
            {
                IDBMSAssistant dest = DBMSFactory.GetDBMSAssistantByName(destDBMS.Text);

                if (dest != null)
                {
                    DBMSParams param = dest.GetParams();

                    destServer.Enabled   = param.Server;
                    destPort.Enabled     = param.Port;
                    destDB.Enabled       = param.DB;
                    destUser.Enabled     = param.User;
                    destSchema.Enabled   = param.Schema;
                    destPwd.Enabled      = param.Pwd;
                    destCharSet.Enabled  = param.CharSet;
                    destTimeout.Enabled  = param.Timeout;
                    destEncrypt.Enabled  = param.Encrypt;
                    destCompress.Enabled = param.Compress;

                    destPort.Text    = param.DefaultPort;
                    destSchema.Text  = param.DefaultSchema;
                    destCharSet.Text = param.DefaultCharSet;
                    destTimeout.Text = param.DefaultTimeout;
                }
            }
        }
Пример #3
0
        private void LoadSvrLists()
        {
            _contexts          = new Dictionary <DBMSPlatformEnum, DBMSContext>();
            _svrConnectionList = new Dictionary <DBMSPlatformEnum, Dictionary <string, string> >();

            Dictionary <string, string> servers = null;

            foreach (DBMSPlatformEnum dbEnum in Enum.GetValues(typeof(DBMSPlatformEnum)))
            {
                if (_configMgr.LoadSysConfig(ToSvrConnectionListFile(dbEnum), out servers))
                {
                    _svrConnectionList.Add(dbEnum, servers);
                }

                DBMSContext ctxt = DBMSFactory.CreateDBMSContext(dbEnum);
                if (ctxt != null)
                {
                    _contexts.Add(dbEnum, ctxt);
                }
            }
        }
        private bool InitDataSource(ref IDBMSAssistant source, ref IDBMSAssistant dest)
        {
            source = DBMSFactory.GetDBMSAssistantByName(sourceDBMS.Text);
            dest   = DBMSFactory.GetDBMSAssistantByName(destDBMS.Text);
            if (source != null && dest != null)
            {
                Database srcDB = new Database()
                {
                    DBMS     = sourceDBMS.Text,
                    Server   = sourceServer.Text,
                    Port     = uint.Parse(sourcePort.Text),
                    DB       = sourceDB.Text,
                    User     = sourceUser.Text,
                    Schema   = sourceSchema.Text,
                    Pwd      = sourcePwd.Text,
                    CharSet  = sourceCharSet.Text,
                    Compress = sourceCompress.Checked,
                    Encrypt  = sourceEncrypt.Checked,
                    Timeout  = uint.Parse(sourceTimeout.Text)
                };
                Database dstDB = new Database()
                {
                    DBMS     = destDBMS.Text,
                    Server   = destServer.Text,
                    Port     = uint.Parse(destPort.Text),
                    DB       = destDB.Text,
                    User     = destUser.Text,
                    Schema   = destSchema.Text,
                    Pwd      = destPwd.Text,
                    CharSet  = destCharSet.Text,
                    Compress = destCompress.Checked,
                    Encrypt  = destEncrypt.Checked,
                    Timeout  = uint.Parse(destTimeout.Text)
                };

                return(source.Connect(srcDB) && dest.Connect(dstDB));
            }

            return(false);
        }