private void btnTestSave_Click(object sender, EventArgs e) { if (!btnTestNew.Enabled && !txtTestNQueryId.ReadOnly) { //create if (string.IsNullOrEmpty(txtTestNQueryId.Text) || string.IsNullOrEmpty(txtTestNVersion.Text)) { ShowBoxWarmOK("Query Id& Version不能为空!", this.Text); return; } DialogResult dis = ShowBoxQuesYesNo("要保存Test,Insert内容吗?", this.Text); if (!dis.Equals(DialogResult.Yes)) { return; } //insert into CT_CUSTOMQUERY Dictionary <string, object> setMap = new Dictionary <string, object>(); setMap.Add("QUERYID", txtTestNQueryId.Text.Trim()); setMap.Add("VERSION", txtTestNVersion.Text.Trim()); setMap.Add("QUERYSTRING", txtTestCurrentQuery.Text); setMap.Add("DESCRIPTION", txtTestComment.Text); setMap.Add("LASTEVENTUSER", Machine.GetMachineIP()); setMap.Add("LASTEVENTDATE", DateTime.Now); setMap.Add("TAG", "1");//? if (oraTestEnv.InsertTable("CT_CUSTOMQUERY", setMap) > 0) { ShowBoxInfoOK("保存OK", this.Text); } else { ShowBoxInfoOK("保存失败", this.Text); } //insert into CT_CUSTOMQUERY_HISTORY } else if (btnTestNew.Enabled && txtTestNQueryId.ReadOnly) { DialogResult dis = ShowBoxQuesYesNo("要保存Test,Update内容吗?", this.Text); if (!dis.Equals(DialogResult.Yes)) { return; } //update CT_CUSTOMQUERY Dictionary <string, object> setMap = new Dictionary <string, object>(); setMap.Add("QUERYSTRING", txtTestCurrentQuery.Text); setMap.Add("OLDQUERYSTRING", dgvTestQuery.CurrentRow.Cells["QUERYSTRING"].Value.ToString()); setMap.Add("DESCRIPTION", txtTestComment.Text); setMap.Add("LASTEVENTUSER", Machine.GetMachineIP()); setMap.Add("LASTEVENTDATE", DateTime.Now); Dictionary <string, object> whereMap = new Dictionary <string, object>(); whereMap.Add("QUERYID", txtTestNQueryId.Text.Trim()); whereMap.Add("VERSION", txtTestNVersion.Text.Trim()); if (oraTestEnv.UpdateTable("CT_CUSTOMQUERY", setMap, whereMap) > 0) { ShowBoxInfoOK("保存OK", this.Text); } else { ShowBoxInfoOK("保存失败", this.Text); } //insert into CT_CUSTOMQUERY_HISTORY } this.btnTeseQuery_Click(sender, null); }