private void btnSave_Click(object sender, EventArgs e) { bool status = true; string message = ""; if (isChanged) { foreach (var dbConfigInfo in dbConfigInfos) { status = IniConfigHelper.WriteDBInfo(dbConfigInfo, ref message); if (!status) { break; } } if (status) { if (DBConfigInfoChanged != null) { DBConfigInfoChanged(); } } } if (status) { Close(); } else { MessageBox.Show(this, "保存失败[" + message + "]", @"提示"); } }
public void Save() { bool status = false; string msg = ""; CsharpCodeGenConfig tem = getConfigObject(); IniConfigHelper.writeDefaultDBInfo(tem); if (CsharpCodeGenConfig.Count > 0) { if (CsharpCodeGenConfig.ContainsKey(cbObject.Text)) { string id = CsharpCodeGenConfig[cbObject.Text].Id; bool isDelete = CsharpCodeGenConfig[cbObject.Text].IsDelete; CsharpCodeGenConfig[cbObject.Text] = null; CsharpCodeGenConfig[cbObject.Text] = tem; CsharpCodeGenConfig[cbObject.Text].Id = id; CsharpCodeGenConfig[cbObject.Text].IsDelete = isDelete; } else if (!string.IsNullOrEmpty(cbObject.Text)) { CsharpCodeGenConfig.Add(cbObject.Text, tem); addItem(cbObject.Text); } foreach (string key in CsharpCodeGenConfig.Keys) { status = IniConfigHelper.WriteDBInfo(CsharpCodeGenConfig[key], ref msg); if (!status) { throw new Exception(msg); } else { status = false; msg = ""; } } } else { if (!string.IsNullOrEmpty(tem.DisplayName)) { status = IniConfigHelper.WriteDBInfo(tem, ref msg); if (!status) { throw new Exception(msg); } else { CsharpCodeGenConfig.Add(tem.DisplayName, tem); addItem(tem.DisplayName); } } } }
public void Save() { bool status = false; string msg = ""; JavaCodeGenConfig temp = getConfigObject(); status = IniConfigHelper.writeDefaultDBInfo(temp); if (!status) { throw new Exception(msg); } else { status = false; msg = ""; } if (javaCodeGenConfigs.Count > 0) { if (javaCodeGenConfigs.ContainsKey(cbObject.Text)) { string id = javaCodeGenConfigs[cbObject.Text].Id; bool isDelete = javaCodeGenConfigs[cbObject.Text].IsDelete; javaCodeGenConfigs[cbObject.Text] = null; temp.Id = id; temp.IsDelete = isDelete; javaCodeGenConfigs[cbObject.Text] = temp; } else if (!string.IsNullOrEmpty(cbObject.Text)) { javaCodeGenConfigs.Add(cbObject.Text, temp); addItem(cbObject.Text); } foreach (string key in javaCodeGenConfigs.Keys) { status = IniConfigHelper.WriteDBInfo(javaCodeGenConfigs[key], ref msg); if (!status) { throw new Exception(msg); } else { status = false; msg = ""; } } } else { if (!string.IsNullOrEmpty(temp.DisplayName)) { status = IniConfigHelper.WriteDBInfo(temp, ref msg); if (!status) { throw new Exception(msg); } else { javaCodeGenConfigs.Add(temp.DisplayName, temp); addItem(temp.DisplayName); } } } }