コード例 #1
0
ファイル: NurseForm.xaml.cs プロジェクト: suchyba/przychodnia
        private void searchBtn_Click(object sender, RoutedEventArgs e)
        {
            ErrorLabel.Visibility = Visibility.Collapsed;
            PeselTextBox.ClearValue(TextBox.BorderBrushProperty);
            long PESELPacjeta;

            using DataBaseContext dataBaseContext = new DataBaseContext();
            IQueryable <Pacjent> Wynik = null;

            if (!String.IsNullOrEmpty(PeselTextBox.Text) && long.TryParse(PeselTextBox.Text, out PESELPacjeta))
            {
                Wynik = dataBaseContext.Pacjeci.Include("adres").Where(p => p.PESEL == PESELPacjeta).OrderBy(p => p.PESEL);
            }
            else
            {
                PeselTextBox.BorderBrush = Brushes.Red;
            }
            pacjent = Wynik?.FirstOrDefault();
            if (pacjent != null)
            {
                ImieTextBox.Text                = pacjent.Imie;
                NazwiskoTextBox.Text            = pacjent.Nazwisko;
                MiastoTextBox.Text              = pacjent.adres.Miasto;
                SearchPacjentGroupBox.IsEnabled = true;
            }
            else
            {
                ImieTextBox.Text                = "";
                NazwiskoTextBox.Text            = "";
                MiastoTextBox.Text              = "";
                SearchPacjentGroupBox.IsEnabled = false;
                ErrorLabel.Content              = "Nie ma takiego pacjenta!";
                ErrorLabel.Visibility           = Visibility.Visible;
            }
        }
コード例 #2
0
 public void ClearLoginForm()
 {
     //Clear login form
     FirstNameTextBox.ClearTextBox();
     LastNameTextBox.ClearTextBox();
     PeselTextBox.ClearTextBox();
 }