private void Button_Click(object sender, RoutedEventArgs e) { Insurance insurance = new Insurance(); insurance.Name = NameTb.Text; if (cbPrivate.IsChecked == true) { insurance.Is_Private = 1; } else { insurance.Is_Private = 0; } insurance.Country = tbCountry.Text; insurance.City = tbCity.Text; insurance.Street = tbStreet.Text; insurance.Streetnumber = tbStreetnumber.Text; insurance.Zipcode = tbZip.Text; Database.IInsuranceMapper mapper = PatientanlegerApp.Db.GetInsuranceMapper(); mapper.Insert(insurance); PatientanlegerApp.Mainwindow.contentFrame.Source = new Uri("Pages\\SearchInsurancePage.xaml", UriKind.Relative); }
private void searchBtn_Click(object sender, RoutedEventArgs e) { string name = searchTb.Text; List <Insurance> insurances = new List <Insurance>(); Database.IInsuranceMapper mapper = PatientanlegerApp.Db.GetInsuranceMapper(); mapper.SelectByName(name, ref insurances); InsuranceDg.Items.Clear(); foreach (var insurance in insurances) { InsuranceDg.Items.Add(insurance); } }
// for insurancecombobox private void UpdateInsuranceCombobox() { List <Insurance> insurances = new List <Insurance>(); Database.IInsuranceMapper mapper = PatientanlegerApp.Db.GetInsuranceMapper(); mapper.SelectAllNames(ref insurances); InsuranceCb.Items.Clear(); InsuranceCb.DisplayMemberPath = @"Name"; foreach (var insurance in insurances) { InsuranceCb.Items.Add(insurance); } }
private void SaveInsuranceBtn_Click(object sender, RoutedEventArgs e) { if (currentInsurance == null) { return; } if (!currentInsurance.Dirty) // nothing changed { return; } UpdateModel(); Database.IInsuranceMapper mapper = PatientanlegerApp.Db.GetInsuranceMapper(); if (!mapper.UpdateSingle(currentInsurance)) { MessageBox.Show("Es ist ein Fehler aufgetreten"); } currentInsurance.Dirty = false; }