コード例 #1
0
ファイル: DbToScript.cs プロジェクト: zhangxsheng/Codematic
        public DbToScript(string longservername, string dbname)
        {
            InitializeComponent();
            DbName = dbname;
            dsb    = ObjHelper.CreatDsb(longservername);
            dbobj  = ObjHelper.CreatDbObj(longservername);
            this.lblServer.Text = longservername;

            List <string> dblist = dbobj.GetDBList();

            if (dblist != null)
            {
                if (dblist.Count > 0)
                {
                    foreach (string name in dblist)
                    {
                        this.cmbDB.Items.Add(name);
                    }
                }
            }
            //DataTable dt = dbobj.GetDBList();
            //if (dt != null)
            //{
            //    foreach (DataRow row in dt.Rows)
            //    {
            //        this.cmbDB.Items.Add(row["name"].ToString());
            //    }
            //}
            this.btn_Creat.Enabled = false;
            this.cmbDB.Text        = DbName;
        }
コード例 #2
0
ファイル: CodeMaker.cs プロジェクト: zhangxsheng/Codematic
        public void SetListView(DbView dbviewfrm)
        {
            #region 得到类型对象

            TreeNode selectedNode = dbviewfrm.treeView1.SelectedNode;
            if (selectedNode == null)
            {
                return;
            }
            string key;
            switch (key = selectedNode.Tag.ToString())
            {
            case "serverlist":
            case "server":
                this.servername = selectedNode.Text;
                break;

            case "db":
                this.servername = selectedNode.Parent.Text;
                this.dbname     = selectedNode.Text;
                break;

            case "table":
                this.servername = selectedNode.Parent.Parent.Parent.Text;
                this.dbname     = selectedNode.Parent.Parent.Text;
                this.tablename  = selectedNode.Text;
                this.dbobj      = ObjHelper.CreatDbObj(this.servername);
                this.SetListViewMenu("column");
                this.BindlistViewCol(this.dbname, this.tablename);
                break;

            case "view":
                this.servername = selectedNode.Parent.Parent.Parent.Text;
                this.dbname     = selectedNode.Parent.Parent.Text;
                this.tablename  = selectedNode.Text;
                this.dbobj      = ObjHelper.CreatDbObj(this.servername);
                this.SetListViewMenu("column");
                this.BindlistViewCol(this.dbname, this.tablename);
                break;

            case "column":
                this.servername = selectedNode.Parent.Parent.Parent.Parent.Text;
                this.dbname     = selectedNode.Parent.Parent.Parent.Text;
                this.tablename  = selectedNode.Parent.Text;
                this.dbobj      = ObjHelper.CreatDbObj(this.servername);
                this.SetListViewMenu("column");
                this.BindlistViewCol(this.dbname, this.tablename);
                break;

            default: this.listView1.Items.Clear(); break;
            }

IL_256:
            this.SetCodeBuilders();
            this.SetFormConfig(this.servername);
            #endregion
        }
コード例 #3
0
        public DataExport(string longservername, string dbname)
        {
            InitializeComponent();
            DbName             = dbname;
            dbset              = Maticsoft.CmConfig.DbConfig.GetSetting(longservername);
            dbobj              = Maticsoft.DBFactory.DBOMaker.CreateDbObj(dbset.DbType);
            dbobj.DbConnectStr = dbset.ConnectStr;
            cb  = new Maticsoft.CodeBuild.CodeBuilders(dbobj);
            dsb = Maticsoft.DBFactory.DBOMaker.CreateScript(dbset.DbType);// ObjHelper.CreatDsb(longservername);

            this.lblServer.Text = dbset.Server;
        }
コード例 #4
0
ファイル: CodeMaker.cs プロジェクト: zhangxsheng/Codematic
 public CodeMaker(string longServername, string DBName, string tableName)
 {
     this.InitializeComponent();
     this.InitializeForm();
     this.servername = longServername;
     this.dbname     = DBName;
     this.tablename  = tableName;
     this.dbobj      = ObjHelper.CreatDbObj(longServername);
     this.SetListViewMenu("column");
     this.BindlistViewCol(this.dbname, this.tablename);
     this.SetCodeBuilders();
     this.SetFormConfig(this.servername);
 }
コード例 #5
0
        public void SetListView(DbView dbviewfrm)
        {
            #region 得到类型对象
            TreeNode selectedNode = dbviewfrm.treeView1.SelectedNode;
            if (selectedNode == null)
            {
                return;
            }
            this.objtype = selectedNode.Tag.ToString();
            string a;
            if ((a = selectedNode.Tag.ToString()) != null)
            {
                if (a == "table" || a == "view")
                {
                    this.servername = selectedNode.Parent.Parent.Parent.Text;
                    this.dbname     = selectedNode.Parent.Parent.Text;
                    this.tablename  = selectedNode.Text;
                    this.dbobj      = ObjHelper.CreatDbObj(this.servername);
                    this.BindlistViewCol(this.dbname, this.tablename);
                    goto IL_1B7;
                }
                if (a == "column")
                {
                    this.servername = selectedNode.Parent.Parent.Parent.Parent.Text;
                    this.dbname     = selectedNode.Parent.Parent.Parent.Text;
                    this.tablename  = selectedNode.Parent.Text;
                    this.dbobj      = ObjHelper.CreatDbObj(this.servername);
                    this.BindlistViewCol(this.dbname, this.tablename);
                    goto IL_1B7;
                }
                if (a == "proc")
                {
                    this.servername = selectedNode.Parent.Parent.Parent.Text;
                    this.dbname     = selectedNode.Parent.Parent.Text;
                    this.tablename  = selectedNode.Text;
                    this.dbobj      = ObjHelper.CreatDbObj(this.servername);
                    this.BindlistProcCol(this.dbname, this.tablename);
                    goto IL_1B7;
                }
            }
            this.listView1.Items.Clear();
IL_1B7:
            this.GetTableDesc();
            if (this.servername != null && this.servername.Length > 1)
            {
                this.dbset = DbConfig.GetSetting(this.servername);
            }
            #endregion
        }
コード例 #6
0
        public DataList(Maticsoft.IDBO.IDbObject idbobj, string dbName, string tabName)
        {
            InitializeComponent();
            try
            {
                dbobj   = idbobj;
                dbname  = dbName;
                tabname = tabName;
                StatusLabel_dbname.Text = "库:" + dbname + ",表:" + tabname + "  ";

                mythread = new Thread(new ThreadStart(ThreadWork));
                mythread.Start();

                //ThreadWork();
            }
            catch (System.Exception er)
            {
                //MessageBox.Show(er.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Stop);
            }
        }
コード例 #7
0
ファイル: CodeTemp.cs プロジェクト: zhangxsheng/Codematic
        public void SetListView(DbView dbviewfrm)
        {
            #region 得到类型对象

            TreeNode SelNode = dbviewfrm.treeView1.SelectedNode;
            if (SelNode == null)
            {
                return;
            }
            switch (SelNode.Tag.ToString())
            {
            case "table":
            case "view":
            {
                servername = SelNode.Parent.Parent.Parent.Text;
                dbname     = SelNode.Parent.Parent.Text;
                tablename  = SelNode.Text;
                dbobj      = ObjHelper.CreatDbObj(servername);
                BindlistViewCol(dbname, tablename);
            }
            break;

            case "column":
            {
                servername = SelNode.Parent.Parent.Parent.Parent.Text;
                dbname     = SelNode.Parent.Parent.Parent.Text;
                tablename  = SelNode.Parent.Text;
                dbobj      = ObjHelper.CreatDbObj(servername);
                BindlistViewCol(dbname, tablename);
            }
            break;

            default:
            {
                this.listView1.Items.Clear();
            }
            break;
            }

            #endregion
        }
コード例 #8
0
ファイル: DbToScript.cs プロジェクト: zhangxsheng/Codematic
        public DbToScript(string longservername)
        {
            InitializeComponent();
            dsb   = ObjHelper.CreatDsb(longservername);
            dbobj = ObjHelper.CreatDbObj(longservername);

            int    s      = longservername.IndexOf("(");
            string server = longservername.Substring(0, s);

            this.lblServer.Text = server;

            List <string> dblist = dbobj.GetDBList();

            if (dblist != null)
            {
                if (dblist.Count > 0)
                {
                    foreach (string dbname in dblist)
                    {
                        this.cmbDB.Items.Add(dbname);
                    }
                }
            }

            //DataTable dt = dbobj.GetDBList();
            //if (dt != null)
            //{
            //    foreach (DataRow row in dt.Rows)
            //    {
            //        string dbname = row["name"].ToString();
            //        this.cmbDB.Items.Add(dbname);
            //    }
            //}
            this.btn_Creat.Enabled = false;
            if (cmbDB.Items.Count > 0)
            {
                this.cmbDB.SelectedIndex = 0;
            }
        }
コード例 #9
0
 private void btn_ConTest_Click(object sender, EventArgs e)
 {
     try
     {
         string server = this.comboBoxServer.Text.Trim();
         string user   = this.txtUser.Text.Trim();
         string pass   = this.txtPass.Text.Trim();
         string port   = this.textBox1.Text.Trim();
         if ((user == "") || (server == ""))
         {
             MessageBox.Show(this, "服务器或用户名不能为空!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
         }
         else
         {
             constr = String.Format("server={0};uid={1}; Port={2};pwd={3}; pooling=false", server, user, port, pass);
             try
             {
                 this.Text = "正在连接服务器,请稍候...";
                 Maticsoft.IDBO.IDbObject dbobj = Maticsoft.DBFactory.DBOMaker.CreateDbObj("MySQL");
                 dbobj.DbConnectStr = constr;
                 List <string> dblist = dbobj.GetDBList();
                 this.cmbDBlist.Enabled = true;
                 this.cmbDBlist.Items.Clear();
                 this.cmbDBlist.Items.Add("全部库");//5_1_a_s_p_x
                 if (dblist != null && dblist.Count > 0)
                 {
                     foreach (string dbname in dblist)
                     {
                         this.cmbDBlist.Items.Add(dbname);
                     }
                 }
                 this.cmbDBlist.SelectedIndex = 0;
                 this.Text = "连接服务器成功!";
             }
             catch (System.Exception ex)
             {
                 LogInfo.WriteLog(ex);
                 this.Text = "连接服务器或获取数据信息失败!";
                 DialogResult drs = MessageBox.Show(this, "连接服务器或获取数据信息失败!\r\n请检查服务器地址或用户名密码是否正确!查看帮助文件以帮助您解决问题?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Hand);
                 //if (drs == DialogResult.OK)
                 //{
                 //    try
                 //    {
                 //        //Process proc = new Process();
                 //        //Process.Start("IExplore.exe", "http://help.maticsoft.com");
                 //    }
                 //    catch
                 //    {
                 //        MessageBox.Show("请访问:http://www.maticsoft.com", "完成", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                 //    }
                 //}
                 //return;
             }
         }
     }
     catch (Exception ex2)
     {
         LogInfo.WriteLog(ex2);
         MessageBox.Show(this, ex2.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
 }
コード例 #10
0
ファイル: DbBrowser.cs プロジェクト: zhangxsheng/Codematic
 private void CreatDbObj(string servername)
 {
     Maticsoft.CmConfig.DbSettings dbset = Maticsoft.CmConfig.DbConfig.GetSetting(servername);
     dbobj = Maticsoft.DBFactory.DBOMaker.CreateDbObj(dbset.DbType);
     dbobj.DbConnectStr = dbset.ConnectStr;
 }