public ObservableCollection <DataGridTreatmentsViewModel> FillGrid()
        {
            ObservableCollection <DataGridTreatmentsViewModel> dataSource = new ObservableCollection <DataGridTreatmentsViewModel>();
            ObservableCollection <Treatment> treatments = new ObservableCollection <Treatment>();
            DataGridTreatmentsViewModel      data       = new DataGridTreatmentsViewModel();
            CustomPrincipal customPrincipal             = Thread.CurrentPrincipal as CustomPrincipal;
            string          currentEmail = customPrincipal.Identity.Email;
            var             context      = new MedicalDBEntities();
            var             query        = context.Users
                                           .Where(s => s.email == currentEmail)
                                           .FirstOrDefault <User>();
            User user       = query;
            var  queryTreat = from st in context.Treatments
                              where st.idUser == user.idUser
                              select st;

            if (queryTreat != null)
            {
                foreach (Treatment t in queryTreat)
                {
                    treatments.Add(t);
                }


                dataSource = data.FillTreatmentsGrid(treatments);
                return(dataSource);
            }
            else
            {
                MessageBox.Show("Nu aveti introduse tratamente medicale momentan");
                return(null);
            }
        }
        private void SearchUser(object obj)
        {
            if (Cnp != null)
            {
                ObservableCollection <DataGridTreatmentsViewModel> dataSource = new ObservableCollection <DataGridTreatmentsViewModel>();
                ObservableCollection <Treatment> treatments = new ObservableCollection <Treatment>();
                DataGridTreatmentsViewModel      data       = new DataGridTreatmentsViewModel();
                CustomPrincipal customPrincipal             = Thread.CurrentPrincipal as CustomPrincipal;
                string          currentEmail = customPrincipal.Identity.Email;
                var             context      = new MedicalDBEntities();
                var             query        = context.Users
                                               .Where(s => s.email == currentEmail)
                                               .FirstOrDefault <User>();
                User user     = query;
                var  queryDoc = context.Doctors
                                .Where(s => s.idUser == user.idUser)
                                .FirstOrDefault <Doctor>();
                Doctor doc     = queryDoc;
                var    patient = context.Users
                                 .Where(s => s.CNP == Cnp)
                                 .FirstOrDefault <User>();
                if (patient != null)
                {
                    var queryTreat = from st in context.Treatments
                                     where st.idUser == patient.idUser
                                     select st;

                    if (queryTreat.FirstOrDefault <Treatment>() != null)
                    {
                        foreach (Treatment t in queryTreat)
                        {
                            treatments.Add(t);
                        }
                        dataSource  = data.FillTreatmentsGrid(treatments);
                        _dataSource = dataSource;
                        NotifyPropertyChanged("DataSource");
                    }
                    else
                    {
                        MessageBox.Show("Acest pacient nu are tratament momentan");
                    }
                }
                else
                {
                    MessageBox.Show("Nu s-a gasit pacient cu acest CNP");
                }
            }
            else
            {
                MessageBox.Show("Introduceti mai intai CNP-ul!");
            }
        }