Exemplo n.º 1
0
        private void AddNewPatienPatientButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (AppLogic.CreatePatient(CurrentPatient))
                {
                    MessageBoxes.ShowSuccess();
                    AppointmentsGrid.Visibility      = Visibility.Visible;
                    PatientDataStackPanel.Visibility = Visibility.Visible;
                    NewPatientStackPanel.Visibility  = Visibility.Hidden;
                    i.Visibility = Visibility.Hidden;
                    EnableTextBoxes(false);
                    PeselTextBox.IsEnabled = false;
                }

                else
                {
                    MessageBoxes.ShowFail();
                }
            }
            catch (NotImplementedException)
            {
                MessageBoxes.ShowNotImplemented();
            }
            catch (Exception ex)
            {
                MessageBoxes.ShowUnknownError(ex);
            }
        }
Exemplo n.º 2
0
        private void Search(int page)
        {
            int count = 10;
            IEnumerable <Patient> list = null;

            try
            {
                count = int.Parse((PatientsNumberCombo.SelectedItem as ComboBoxItem).Content.ToString());
                list  = AppLogic.SearchPatient(PeselTextBox_Search.Text, SurnameTextBox_Search.Text, NameTextBox_Search.Text, CityTextBox_Search.Text, page - 1, int.Parse((PatientsNumberCombo.SelectedItem as ComboBoxItem).Content.ToString()));
            }
            catch (NotImplementedException)
            {
                MessageBoxes.ShowNotImplemented();
                DisableNext();
                return;
            }
            catch (Exception ex)
            {
                MessageBoxes.ShowUnknownError(ex);
                DisableNext();
                return;
            }
            if (list == null)
            {
                MessageBoxes.ShowWrongData();
                DisableNext();
                return;
            }
            FoundPatientsListView.ItemsSource = list;
            if (FoundPatientsListView.Items.Count == 0)
            {
                MessageBoxes.ShowNoSuchPatients();
            }
            if (FoundPatientsListView.Items.Count < count)
            {
                DisableNext();
            }
            else
            {
                EnableNext();
            }
            if (FoundPatientsListView.Items.Count == 0)
            {
                MessageBoxes.ShowNoSuchPatients();
            }
        }
        private void SearchButton_Click(object sender, RoutedEventArgs e)
        {
            IEnumerable <Visit> list = null;

            try
            {
                DateTime       dt           = VisitDatePicker.SelectedDate != null ? VisitDatePicker.SelectedDate.Value : DateTime.Today;
                string         startingHour = (HoursFromCombo.SelectedItem as ComboBoxItem).Content.ToString();
                string         endingHour   = (HoursToCombo.SelectedItem as ComboBoxItem).Content.ToString();
                string         surname      = SurnameTextBox_Search.Text;
                string         city         = CityTextBox_Search.Text;
                Specialization spec         = (Specialization)SpecializationCombo.SelectedItem;
                bool           freeOnly     = FreeOnlyCheckbox.IsChecked.Value;
                int            itemsPerPage = int.Parse((VisitsNumberCombo.SelectedItem as ComboBoxItem).Content.ToString());
                list = AppLogic.ShowVisits(dt, startingHour, endingHour, surname, city, spec, freeOnly, Page, itemsPerPage);
            }
            catch (NotImplementedException)
            {
                MessageBoxes.ShowNotImplemented();
            }
            catch (Exception ex)
            {
                MessageBoxes.ShowUnknownError(ex);
            }
            if (list == null)
            {
                MessageBoxes.ShowWrongData();
            }
            else
            {
                VisitsListView.Items.Clear();
                foreach (var x in list)
                {
                    VisitsListView.Items.Add(x);
                }
            }
            if (VisitsListView.Items.Count == 0)
            {
                MessageBoxes.ShowNoSuchPatients();
            }
        }
Exemplo n.º 4
0
 private void UpdatePatienPatientButton_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (AppLogic.UpdatePatient(CurrentPatient))
         {
             MessageBoxes.ShowSuccess();
             EnableTextBoxes(false);
             CurrentPatient.NotifyFullName();
         }
         else
         {
             MessageBoxes.ShowFail();
         }
     }
     catch (NotImplementedException)
     {
         MessageBoxes.ShowNotImplemented();
     }
     catch (Exception ex)
     {
         MessageBoxes.ShowUnknownError(ex);
     }
 }