private void btnAdd_Click(object sender, EventArgs e) { if (txtName.Text != "") { if (editScreen) { editScope.setName(txtName.Text); editScope.setDescription(txtDescription.Text); } else { btnDelete.Visible = false; Scope scope = new Scope(); scope.setName(txtName.Text); scope.setDescription(txtDescription.Text); scope.setId(Program.database.getId()); KeyValue parentItem = (KeyValue)cbbParrent.SelectedItem; Scope parent = Program.database.getScopeById(Convert.ToInt32(parentItem.key)); scope.setParentId(parent.getId()); parent.AddSubComponent(scope); } this.receiver.Updater(); exitform = true; this.Close(); } else { string message = "Het naamveld mag niet leeg zijn!"; MessageBox.Show(message, "Foutmelding", MessageBoxButtons.OK); } }
private void btnNewDatabase_Click(object sender, EventArgs e) { Program.database = new Database(); Program.database.id = 0; Scope scope = new Scope(); scope.setName("Scope"); scope.setId(Program.database.getId()); scope.setDescription("Head of hierachy"); Purpose purpose = new Purpose(); purpose.setName("Purpose"); purpose.setId(Program.database.getId()); purpose.setDescription("Head of hierachy"); Program.database.setHeadScope(scope); Program.database.setHeadPurpose(purpose); Program.frmEditor.Show(); Program.frmStart.Hide(); }