private void button1_Click(object sender, EventArgs e) { bynTree.node node = new bynTree.node(this.textBox2.Text, this.textBox1.Text, this.textBox3.Text); Tuple <node, int> findedNodeInfo = mainWindow.bynaryTreeSourceData.findNode(node); if (findedNodeInfo.Item2 == -1) { this.textBox1.Text = null; this.textBox2.Text = null; this.textBox3.Text = null; this.textBox4.Text = null; this.textBox5.Text = "Справочник не содержит записей"; } else if (findedNodeInfo.Item2 == -2) { this.textBox1.Text = null; this.textBox2.Text = null; this.textBox3.Text = null; this.textBox4.Text = null; this.textBox5.Text = "Запись не содержится в справочнике"; } else { this.textBox1.Text = findedNodeInfo.Item1.field2; this.textBox2.Text = findedNodeInfo.Item1.field1; this.textBox3.Text = findedNodeInfo.Item1.field3; this.textBox4.Text = findedNodeInfo.Item2.ToString(); this.textBox5.Text = "Запись найдена"; } }
private void button13_Click(object sender, EventArgs e) { if (listPayInfo.Rows.Count == 1) { return; } int indexRow = listPayInfo.SelectedCells[0].RowIndex; if (MessageBox.Show("Удаление может повлечь нарушение целостности информации\n" + "Продолжить удаление?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { DataGridViewRow selectedRow = listPayInfo.Rows[indexRow]; bynaryTreeSourceData.eraseFromArray(selectedRow.Cells[1].Value.ToString(), selectedRow.Cells[0].Value.ToString(), selectedRow.Cells[2].Value.ToString()); bynTree.node record = new bynTree.node(selectedRow.Cells[1].Value.ToString(), selectedRow.Cells[0].Value.ToString(), selectedRow.Cells[2].Value.ToString()); bynaryTreeSourceData.removeNode(bynaryTreeSourceData.findNode(record)); listPayInfo.Rows.RemoveAt(indexRow); } else { return; } }