示例#1
0
 private void selectdConnection()
 {
     if (this.cbtemplate.SelectedIndex > -1)
     {
         _currentEntity     = ConfigureModel.Find(cbtemplate.SelectedValue.ToString());
         tbConnectInfo.Text = _currentEntity.ConnectionString;
     }
 }
示例#2
0
文件: editor.cs 项目: sf71316/SQLTool
        private void toolbtnupdate_Click(object sender, EventArgs e)
        {
            var table = Project.Tables
                        .FirstOrDefault(p => p.Table_Name == lbTableList.SelectedValue.ToString());
            var _config   = ConfigureModel.Find(Project.ConnectionName);
            var updatefrm = new Updateschema(table, _config);

            updatefrm.Notify += Updatefrm_Notify;
            updatefrm.ShowDialog();
            if (tableschemaContext != null)
            {
                int currentindex = this.lbTableList.SelectedIndex;
                tableschemaContext.ResetBindings(false);
                LoadTableList(tbKeyword.Text);
                this.lbTableList.SelectedIndex = currentindex;
            }
        }
示例#3
0
        private async void btnupdate_Click(object sender, EventArgs e)
        {
            ProjectModel model = new ProjectModel();

            if (!cbIsoriginal.Checked)
            {
                _config = ConfigureModel.Find(cbtemplate.SelectedValue.ToString());
            }
            model.Notify += Model_Notify;
            await Task.Run(() =>
            {
                this.Invoke(new Action(() => {
                    btnupdate.Enabled = false;
                }));
                model.UpdateSchema(_table, rbselect2.Checked, cbIsoriginal.Checked, _config, this.Invoke);
            });

            btnupdate.Enabled = true;
        }
示例#4
0
文件: main.cs 项目: sf71316/SQLTool
        private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var editor = (this.ActiveMdiChild as editor);

            if (editor != null)
            {
                var entity = ConfigureModel.Find(editor.Project.ConnectionName);
                using (DbContext context = new DbContext(entity))
                {
                    ProjectModel model    = new ProjectModel();
                    var          _columns = context.GetColumns(editor.Project.Tables.Select(p => p.Table_Name).ToArray());
                    foreach (var item in editor.Project.Tables)
                    {
                        var columns = _columns.Where(p => p.Table == item.Table_Name);
                        item.Object_id = columns.First().Object_id;
                        foreach (var column in item.Columns)
                        {
                            var co = _columns.FirstOrDefault(p => p.Column == column.Column);
                            column.Column_id = co.Column_id;
                        }
                    }
                }
            }
        }