/// <summary>
        /// Filters doctors by name and number and sets the datagrdview source
        /// </summary>
        /// <param name="name"></param>
        /// <param name="number"></param>
        public void LoadDoctorsByCriterias(string name)
        {
            try
            {
                IQueryable <Doctor> doctorsQuery;
                doctorsQuery = DoctorDataAccess.GetDoctors();
                if (!string.IsNullOrEmpty(name))
                {
                    doctorsQuery = doctorsQuery.Where(d => d.Name.Contains(name));
                }


                this.Doctors = doctorsQuery.ToList();
            }
            catch (Exception e)
            {
                this.Message = "Ошибка при запросе базы данных! Вызовите администратора!\n" + e.Message;
            }
        }
Beispiel #2
0
 private void buttonSearch_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (Category.SelectedItem != null && Category.SelectedItem.ToString() != "")
         {
             dataGridViewResult.ItemsSource = DoctorDataAccess.GetDoctorsByCat(Category.SelectedItem.ToString());
             return;
         }
         if (!String.IsNullOrEmpty(Spec.Text))
         {
             dataGridViewResult.ItemsSource = DoctorDataAccess.GetDoctorsBySpec(Spec.Text);
             return;
         }
         if (Category.SelectedItem.ToString() == "" && String.IsNullOrEmpty(Spec.Text))
         {
             dataGridViewResult.ItemsSource = DoctorDataAccess.GetDoctors();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Beispiel #3
0
 private void SelectAllDoctors()
 {
     dataGridViewResult.ItemsSource = DoctorDataAccess.GetDoctors();
     //throw new NotImplementedException();
 }