private void btnBevestig_Click(object sender, EventArgs e) { List<BibliotheekServiceReference.Uitleningen> uitleningen = new List<BibliotheekServiceReference.Uitleningen>(); BibliotheekServiceReference.Klanten klant = new BibliotheekServiceReference.Klanten(); klant.Klant_Id = Convert.ToInt32(cmbKlant.SelectedValue); for (int i = 0; i <= trbAantal.Value; i++) { BibliotheekServiceReference.Boeken boek = new BibliotheekServiceReference.Boeken(); boek.Boek_Id = Convert.ToInt32(lstBoeken[i].SelectedValue); boek.Boek_Aantal = ((BibliotheekServiceReference.Boeken)lstBoeken[i].SelectedItem).Boek_Aantal; boek.Boek_Titel = ((BibliotheekServiceReference.Boeken)lstBoeken[i].SelectedItem).Boek_Titel; BibliotheekServiceReference.Uitleningen uitlening = new BibliotheekServiceReference.Uitleningen(); uitlening.boek = boek; uitlening.klant = klant; uitlening.Uitlening_Datum = DateTime.Now; uitlening.Inleveringsdatum = DateTime.Now.AddDays(14); uitleningen.Add(uitlening); } if (myClient.AddUitlening(uitleningen)) { MessageBox.Show("Uitlening Toegevoegd"); } else { MessageBox.Show("Er is een fout opgetreden"); } }
private void btnToevoegen_Click(object sender, EventArgs e) { myClient = new BibliotheekServiceReference.BibliotheekServiceClient(); BibliotheekServiceReference.Boeken boek = new BibliotheekServiceReference.Boeken(); boek.Boek_Titel = txtTitel.Text; boek.BoekAuteur_Id = Convert.ToInt32(cmbAuteur.SelectedValue.ToString()); boek.Boek_GenreId = Convert.ToInt32(cmbGenre.SelectedValue.ToString()); boek.Boek_EersteUitgave = Convert.ToInt32(txtEersteUitgave.Text); boek.Boek_Aantal = Convert.ToInt32(txtAantal.Text); if (myClient.setNieuwBoek(boek)) { MessageBox.Show("Nieuw boek toegevoegd"); txtTitel.Clear(); txtAantal.Clear(); txtEersteUitgave.Clear(); } }