private void KlantenOpvragen_Load(object sender, EventArgs e) { BibliotheekServiceReference.BibliotheekServiceClient myClient = new BibliotheekServiceReference.BibliotheekServiceClient(); klanten = myClient.GetAllKlanten(); dgvKlanten.DataSource = klanten; }
private void btnLogin_Click(object sender, EventArgs e) { BibliotheekServiceReference.BibliotheekServiceClient myClient = new BibliotheekServiceReference.BibliotheekServiceClient(); lblFout.Visible = false; if (myClient.Validate(txtUser.Text, txtPass.Text)) { if (myClient.IsUserInRole(txtUser.Text, "User")) { HoofdMenu hm = new HoofdMenu(); hm.Tag = this; hm.Show(); this.Hide(); } else { AdminLevel.AdminPanel ap = new AdminLevel.AdminPanel(); ElementHost.EnableModelessKeyboardInterop(ap); ap.Show(); ap.Tag = this; this.Hide(); } } else { lblFout.Visible = true; } }
private void UitleningenToevoegen_Load(object sender, EventArgs e) { lstBoeken = new List<ComboBox>(); lstBoeken.Add(cmbBoek1); lstBoeken.Add(cmbBoek2); lstBoeken.Add(cmbBoek3); lstBoeken.Add(cmbBoek4); lstBoeken.Add(cmbBoek5); myClient = new BibliotheekServiceReference.BibliotheekServiceClient(); boeken = myClient.GetBoekenInVoorraad(); klanten = myClient.GetAllKlanten(); cmbKlant.DataSource = klanten; cmbKlant.DisplayMember = "Klant_VolNaam"; cmbKlant.ValueMember = "Klant_Id"; for (int i = 0; i < lstBoeken.Count; i++) { BindingSource bs = new BindingSource(); bs.DataSource = boeken; lstBoeken[i].DataSource = bs; lstBoeken[i].DisplayMember = "Boek_Titel"; lstBoeken[i].ValueMember = "Boek_Id"; } laatsteWaarde = trbAantal.Value; DateTime terugbreng = DateTime.Now; terugbreng = terugbreng.AddDays(14); lblDatumTerug.Text = terugbreng.ToShortDateString(); }
public ViewModel():base() { myClient = new BibliotheekServiceReference.BibliotheekServiceClient(); ObservableCollection<BibliotheekServiceReference.Boeken> boeken = myClient.GetAllBoeken(); boekenlijst = boeken; }
private void Boekenlijst_Load(object sender, EventArgs e) { /// StreamWriter aanmaken //StreamWriter log; /// als er nog geen logfile.txt bestand is, logfile aanmaken //if (!File.Exists(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "logs/logfile.txt"))) if (!File.Exists(@"C:\Users\Public\Logs\logfile.txt")) { // eerst moet je een folder 'logs' aanmaken in je AppData/Roaming folder if(!Directory.Exists("C:\\Users\\Public\\Logs")) Directory.CreateDirectory("C:\\Users\\Public\\Logs"); new StreamWriter(@"C:\Users\Public\Logs\logfile.txt"); } /// anders tekst toevoegen aan logfile.txt //else //{ //} try { BibliotheekServiceReference.BibliotheekServiceClient myClient = new BibliotheekServiceReference.BibliotheekServiceClient(); // var abonList = myClient.GetAllAbonnementen(); List<Auteurs> auteursList = myClient.GetAllAuteurs(); foreach (var item in auteursList) { lsbAuteurs.Items.Add(item.Auteur_Naam); } } catch (Exception ex) { MessageBox.Show(ex.Message); /// error wegschrijven naar log using (StreamWriter log = new StreamWriter(@"C:\Users\Public\Logs\logfile.txt")) { log.WriteLine(DateTime.Now); log.WriteLine(ex.Message); log.WriteLine(); } } //finally //{ // /// log afsluiten // log.Close(); //} }
private void btnToevoegen_Click(object sender, EventArgs e) { BibliotheekServiceReference.BibliotheekServiceClient myClient = new BibliotheekServiceReference.BibliotheekServiceClient(); BibliotheekServiceReference.Auteurs auteur = new BibliotheekServiceReference.Auteurs(); auteur.Auteur_Naam = txtNaam.Text; auteur.Auteur_Voornaam = txtVoornaam.Text; auteur.Auteur_GeboorteDatum = dtpGeboortedatum.Value; if (myClient.setNieuweAuteur(auteur)) { MessageBox.Show("nieuwe auteur toegevoegd"); txtNaam.Clear(); txtVoornaam.Clear(); dtpGeboortedatum.ResetText(); } }
private void BoekenToevoegen_Load(object sender, EventArgs e) { myClient = new BibliotheekServiceReference.BibliotheekServiceClient(); List<BibliotheekServiceReference.Auteurs> auteurs; List<BibliotheekServiceReference.Genres> genres; auteurs = myClient.GetAllAuteurs(); cmbAuteur.DataSource = auteurs; cmbAuteur.DisplayMember = "Auteur_Naam"; cmbAuteur.ValueMember = "Auteur_Id"; genres = myClient.getAllGenres(); cmbGenre.DataSource = genres; cmbGenre.DisplayMember = "Genre_Naam"; cmbGenre.ValueMember = "Genre_Id"; }
private void UitleningenVerlengen_Load(object sender, EventArgs e) { Dictionary<String, int> weken = new Dictionary<string, int>(); weken.Add("1 week", 7); weken.Add("2 weken", 14); weken.Add("3 weken", 21); weken.Add("4 weken", 28); cmbAantalWeken.DataSource = new BindingSource(weken, null); cmbAantalWeken.ValueMember = "Value"; cmbAantalWeken.DisplayMember = "Key"; myClient = new BibliotheekServiceReference.BibliotheekServiceClient(); klanten = myClient.GetKlantenMetUitlening(); cmbKlant.DataSource = klanten; cmbKlant.DisplayMember = "Klant_VolNaam"; cmbKlant.ValueMember = "Klant_Id"; }
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(); } }
private void TeLaat_Load(object sender, EventArgs e) { BibliotheekServiceReference.BibliotheekServiceClient myClient = new BibliotheekServiceReference.BibliotheekServiceClient(); List<BibliotheekServiceReference.Uitleningen> uitleningen = myClient.getUitleningenTeLaat(); DataGridViewRow nieuweRij = null; nieuweRij = (DataGridViewRow)tblTeLaat.Rows[0].Clone(); tblTeLaat.Rows.Clear(); foreach (BibliotheekServiceReference.Uitleningen uitlening in uitleningen) { nieuweRij.Cells[0].Value = uitlening.Uitlening_Id; nieuweRij.Cells[1].Value = uitlening.klant.Klant_Voornaam + " " + uitlening.klant.Klant_Naam; nieuweRij.Cells[2].Value = uitlening.boek.Boek_Titel; nieuweRij.Cells[3].Value = uitlening.Uitlening_Datum.ToShortDateString(); nieuweRij.Cells[4].Value = uitlening.Ingeleverd; tblTeLaat.Rows.Add(nieuweRij); nieuweRij = (DataGridViewRow)tblTeLaat.Rows[0].Clone(); } tblTeLaat.AllowUserToAddRows = false; }