Пример #1
0
        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
        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 void SetListView(DbView dbviewfrm)
        {
            #region 得到类型对象

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

            case "view":
            {
                servername = SelNode.Parent.Parent.Parent.Text;
                dbname     = SelNode.Parent.Parent.Text;
                tablename  = SelNode.Text;
                dbobj      = ObjHelper.CreatDbObj(servername);
                SetListViewMenu("column");
                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);
                SetListViewMenu("column");
                BindlistViewCol(dbname, tablename);
            }
            break;

            default:
            {
                this.listView1.Items.Clear();
            }
            break;
            }
            if (dbobj != null)
            {
                cb = new CodeBuilders(dbobj);
            }
            #endregion
        }
Пример #4
0
 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 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;
            }
        }
Пример #7
0
 public static CodeBuilders CreatCB(string longservername)
 {
     return(new CodeBuilders(ObjHelper.CreatDbObj(longservername)));
 }
Пример #8
0
        public void SetListView(DbView dbviewfrm)
        {
            TreeNode selectedNode = dbviewfrm.treeView1.SelectedNode;

            if (selectedNode == null)
            {
                return;
            }
            string a;

            if ((a = selectedNode.Tag.ToString()) != null)
            {
                if (a == "server")
                {
                    this.servername = selectedNode.Text;
                    goto IL_1E6;
                }
                if (a == "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.BindTablist(this.dbname);
                    goto IL_1E6;
                }
                if (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.BindTablist(this.dbname);
                    goto IL_1E6;
                }
                if (a == "column")
                {
                    this.servername = selectedNode.Parent.Parent.Parent.Parent.Text;
                    this.dbname     = selectedNode.Parent.Parent.Parent.Text;
                    this.dbobj      = ObjHelper.CreatDbObj(this.servername);
                    this.BindTablist(this.dbname);
                    goto IL_1E6;
                }
                if (a == "db")
                {
                    this.servername = selectedNode.Parent.Text;
                    this.dbname     = selectedNode.Text;
                    this.dbobj      = ObjHelper.CreatDbObj(this.servername);
                    this.BindTablist(this.dbname);
                    goto IL_1E6;
                }
            }
            this.listView1.Items.Clear();
IL_1E6:
            if (this.dbobj != null)
            {
                this.cb = new CodeBuilders(this.dbobj);
                DataTable tablesExProperty = this.dbobj.GetTablesExProperty(this.dbname);
                if (tablesExProperty != null)
                {
                    try
                    {
                        DataRow[] array = tablesExProperty.Select("objname='" + this.tablename + "'");
                        if (array.Length > 0 && array[0]["value"] != null)
                        {
                            this.cb.TableDescription = array[0]["value"].ToString();
                        }
                    }
                    catch
                    {
                    }
                }
            }
            this.SetFormConfig(this.servername);
        }