internal ConnectionViewModel Query(string key) { if (connections[key] != null) { return(connections[key]); } else { GlobalExceptionHelper.Display(null, "连接不存在"); return(null); } }
public bool Save(ConnectionViewModel connection) { if (!connections.ContainsKey(connection.ConnectionName)) { connections.Add(connection.ConnectionName, connection); return(true); } else { GlobalExceptionHelper.Display(null, "已存在相同的连接名称"); return(false); } }
private void btnConfirm_Click(object sender, RoutedEventArgs e) { if (string.IsNullOrEmpty(txtDatabaseName.Text.Trim())) { MessageBox.Show("请填写数据库名称"); return; } try { CreateDatabaseAction(txtDatabaseName.Text.Trim()); MessageBox.Show("创建成功"); this.Close(); } catch (Exception ex) { GlobalExceptionHelper.Display(ex, "创建失败", true); } }
private void btnConfirm_Click(object sender, RoutedEventArgs e) { if (!string.IsNullOrEmpty(viewModel.DatabaseName) && !string.IsNullOrEmpty(viewModel.CollectionName)) { try { CreateCollectionAction(viewModel.DatabaseName, viewModel.CollectionName); MessageBox.Show("创建成功"); this.Close(); } catch (Exception ex) { GlobalExceptionHelper.Display(ex, "创建Collection失败"); } } else { MessageBox.Show("请完整填写数据库名称和Collection名称"); } }