Esempio n. 1
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 DeletePatientButton_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (AppLogic.DeletePatient(CurrentPatient))
         {
             MessageBoxes.ShowSuccess();
             ReturnButton_Click(null, null);
         }
         else
         {
             MessageBoxes.ShowFail();
         }
     }
     catch (Exception ex)
     {
         MessageBoxes.ShowUnknownError(ex);
     }
 }
        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();
            }
        }
 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);
     }
 }
        private void AppliementListView_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            Visit v = VisitsListView.SelectedItem as Visit;

            if (v.Patient == null)
            {
                try
                {
                    if (AppLogic.AddVisit(v.DT, patient, v.Doctor))
                    {
                        MessageBoxes.ShowSuccess();
                        v.Patient = patient;
                    }
                    else
                    {
                        MessageBoxes.ShowFail();
                    }
                }
                catch (Exception ex)
                {
                    MessageBoxes.ShowUnknownError(ex);
                }
            }
        }