private void addUserBtn_Click(object sender, RoutedEventArgs e) { try { Metody metody = new Metody(); BazaDAO baza = new BazaDAO(); if (stanowiskoCB.Text == "Administrator") { Administrator administrator = new Administrator(); administrator.Imie = imieTB.Text; administrator.Nazwisko = nazwiskoTB.Text; administrator.Login = loginTB.Text; administrator.Haslo = hasloTB.Text; metody.Dodaj_Administratora(administrator); MessageBox.Show("Dodano użytkownika"); } else if (stanowiskoCB.Text == "Trener") { Trener trener = new Trener(); trener.Imie = imieTB.Text; trener.Nazwisko = nazwiskoTB.Text; trener.Login = loginTB.Text; trener.Haslo = hasloTB.Text; metody.Dodaj_Trener(trener); MessageBox.Show("Dodano użytkownika"); } else if (stanowiskoCB.Text == "Recepcja") { Recepcja recepcja = new Recepcja(); recepcja.Imie = imieTB.Text; recepcja.Nazwisko = nazwiskoTB.Text; recepcja.Login = loginTB.Text; recepcja.Haslo = hasloTB.Text; metody.Dodaj_Recepcja(recepcja); MessageBox.Show("Dodano użytkownika"); } } catch (Exception) { } }
private void szukajBTN_Click(object sender, RoutedEventArgs e) { Metody metody = new Metody(); try { BazaDAO baza = new BazaDAO(); if (dniaCHB.IsChecked == true) { metody.Pobierz_Trening_Dnia(dataTreningDP.Text, trenerTreningSzukajCB.Text); } else { metody.Pobierz_Trening_Trener(trenerTreningSzukajCB.Text); } } catch (Exception) { throw; } }
static void Main(string[] args) { Console.WriteLine(Metody.CzyPalindrom("Kobyła ma mały bok.")); }
private void Button_Click(object sender, RoutedEventArgs e) { Metody metody = new Metody(); string idKlient = ""; var connectionString = @"Data Source=RAFAL-PC;initial catalog=FITNES;integrated security=True"; using (var con = new SqlConnection(connectionString)) { con.Open(); string query = "Select IdKlient from Klient where Pesel = @pesel"; SqlCommand cmd = new SqlCommand(query, con); cmd.Parameters.Add(new SqlParameter("@pesel", peselWywiadTB.Text)); SqlDataReader dataReader = cmd.ExecuteReader(); while (dataReader.Read()) { idKlient = dataReader["idKlient"].ToString(); } con.Close(); } try { BazaDAO baza = new BazaDAO(); Wywiad wywiad = new Wywiad(); wywiad.IdKlient = idKlient; if (wadaSercaRB.IsChecked == true) { wywiad.WadaSerca = true; } if (nadcisnienieRB.IsChecked == true) { wywiad.Nadcisnienie = true; } if (zaburzeniaRytmuRB.IsChecked == true) { wywiad.ZabRytmSerca = true; } if (epilepsjaRB.IsChecked == true) { wywiad.Epilepsja = true; } if (alergiaRB.IsChecked == true) { wywiad.Alergia = true; } if (astmaRB.IsChecked == true) { wywiad.Astma = true; } if (cukrzycaRB.IsChecked == true) { wywiad.Cukrzyca = true; } wywiad.InneChoroby = inneChorobyTB.Text; metody.Zapisz_Wywiad(wywiad); } catch (Exception b) { MessageBox.Show(b.ToString()); } }