示例#1
0
        private void contextMenuStrip2_Opening(object sender, CancelEventArgs e)
        {
            var sqlObj = (SqlObject)DGVObject.CurrentRow.DataBoundItem;

            TsmiCompare.DropDownItems.Clear();
            TsmiSync.DropDownItems.Clear();
            foreach (var info in DBConnInfoList.Where(x => x != CurrDBConnInfo))
            {
                var miCompare = new ToolStripMenuItem(info.FullName);
                //比對
                miCompare.Click += (obj, args) =>
                {
                    var sourFile = SqlDefinition.ExportDefinitionToTempCompareFile(CurrDBConnInfo, sqlObj.Name);
                    var trgtFile = SqlDefinition.ExportDefinitionToTempCompareFile(info, sqlObj.Name);
                    var cmd      = $@"{System.IO.Directory.GetCurrentDirectory()}\Tools\WinMergeU.exe ""{sourFile}"" ""{trgtFile}""";
                    CommandUtils.ExecuteCommandSync(cmd);
                };
                TsmiCompare.DropDownItems.Add(miCompare);

                var miSync = new ToolStripMenuItem(info.FullName);
                miSync.Click += (obj, args) =>
                {
                    if (MessageBox.Show($"是否確定同步物件[{sqlObj.Name}]從{CurrDBConnInfo.FullName}-->{info.FullName}", "物件同步", MessageBoxButtons.YesNo) != DialogResult.Yes)
                    {
                        return;
                    }
                    var rslt = SqlDefinition.SyncObj(CurrDBConnInfo, info, sqlObj.Name);
                    MessageBox.Show(rslt != string.Empty ? rslt : "同步成功");
                };
                TsmiSync.DropDownItems.Add(miSync);
            }
        }
示例#2
0
 private void  步多處ToolStripMenuItem_Click(object sender, EventArgs e)
 {
     using (FmSyncMulti fm = new FmSyncMulti(CurrDBConnInfo, ((SqlObject)DGVObject.CurrentRow.DataBoundItem).Name, DBConnInfoList.Where(x => x != CurrDBConnInfo).ToList()))
     {
         fm.ShowDialog(this);
     }
 }