private void treeViewClients_AfterExpand(object sender, TreeViewEventArgs e) { e.Node.Nodes.Clear(); var childClients = _clientService.GetChildren(e.Node.Text); MainFormUtils.SetNode(e.Node, childClients); }
private void buttonAdd_Click(object sender, EventArgs e) { var addClientForm = new AddClientForm(); addClientForm.ShowDialog(); MainFormUtils.SetRoot(treeViewClients, _clientService.GetRootClients()); }
private void buttonEdit_Click(object sender, EventArgs e) { var client = _clientService.GetByName(treeViewClients.SelectedNode.Text); var editClientForm = new EditClientForm(client); editClientForm.ShowDialog(); MainFormUtils.SetRoot(treeViewClients, _clientService.GetRootClients()); }
private void buttonDelete_Click(object sender, EventArgs e) { var acceptForm = new AcceptForm("Удалить клиента?"); acceptForm.ShowDialog(); if (acceptForm.Accepted) { var parentNode = treeViewClients.SelectedNode.Parent; _clientService.Delete(_clientService.GetByName(treeViewClients.SelectedNode.Text)); if (parentNode != null) { MainFormUtils.Reload(parentNode); } else { MainFormUtils.SetRoot(treeViewClients, _clientService.GetRootClients()); } } }
private void MainForm_Load(object sender, EventArgs e) { MainFormUtils.SetRoot(treeViewClients, _clientService.GetRootClients()); }