private void DataGridView1_SelectionChanged(object sender, EventArgs e) { Data.Catalogus.resetBoekenSelectie(); foreach (DataGridViewRow row in dataGridView1.SelectedRows) { Data.Boek boekSelected = (Data.Boek)row.DataBoundItem; Data.Catalogus.addBoekenSelectie(boekSelected); } }
private void button1_Click(object sender, EventArgs e) { int tempDeel; Dictionary <string, string> errorMessages = new Dictionary <string, string>(); Data.Boek boek; if (int.TryParse(txtDeel.Text, out tempDeel)) { boek = new Data.Boek(Data.Catalogus.getBoeken().Count + 1, txtTitel.Text, txtSubtitel.Text, txtAuteur.Text, tempDeel); } else { boek = new Data.Boek(Data.Catalogus.getBoeken().Count + 1, txtTitel.Text, txtSubtitel.Text, txtAuteur.Text, 1); } errorMessages = boek.validate(); Label[] textCheckers = new Label[] { lblTitelException, lblSubtitelException, lblAuteurException, lblDeelException }; foreach (Label label in textCheckers) { label.ResetText(); } if (errorMessages.Count == 0) { List <Data.Boek> duplicates = Data.Catalogus.getDuplicates(boek); if (!showDuplicateDialog(duplicates)) { Data.Catalogus.addBoek(boek); Data.Catalogus.setBufferOnopgeslagen(true); } } else { showErrors(errorMessages); } }
public Wijzig_Boek(Data.Boek boek) { InitializeComponent(); this.boek = boek; }