public void afficherPatient(HopitalEntities bdd, Patient pat)
        {
            // On retrouve le patient dans la BDD et affiches ses attributs
            Patient sPatient = bdd.Patients.SingleOrDefault(x => x.NumAssuranceMaladie.Trim() == pat.NumAssuranceMaladie.Trim());

            if (sPatient != null)
            {
                cboNAM.SelectedItem          = sPatient;
                cboNom.SelectedItem          = sPatient;
                txtPrenom.Text               = sPatient.Prenom;
                dpDateNaissance.SelectedDate = sPatient.DateNaissance;
                if (sPatient.CompagnieAssurance == null)
                {
                    txtAssurancePrivee.Text = "Aucune";
                }
                else
                {
                    txtAssurancePrivee.Text = sPatient.CompagnieAssurance.NomCompagnie;
                }

                // On verifie l'age du patient et change la valeur de cboDepartement a "Pediatrie" is necessaire
                int age = calculerAge(sPatient);
                txtAge.Text = age.ToString();

                if (age <= 16)
                {
                    cboDepartement.SelectedIndex = 1; // Index 1 de combobox - Pédiatrie
                }
                else
                {
                    cboDepartement.SelectedIndex = 4; // Index 4 - dpt Général (choix par défault)
                }
            }
        } // afficherPatient
        public int calculerLitsTotalDispHopital(HopitalEntities hopital)
        {
            int nbreLits = (from lit in hopital.Lits
                            where lit.Occupe == false
                            select lit).Count();

            return(nbreLits);
        }
        } // cboDepartement_SelectionChanged

        public int calculerLitsDispDeptParCat(HopitalEntities hopital, int idDept, int cat)
        {
            int nbreLits = (from lit in hopital.Lits
                            where lit.IdDepartement == idDept &&
                            lit.IdTypeLit == cat &&
                            lit.Occupe == false
                            select lit).Count();

            return(nbreLits);
        }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            myBdd = new HopitalEntities();
            // Binding de comboboxes
            provinces = Province.RecupererProvinces();
            cboProvince.ItemsSource = (from province in provinces
                                       orderby province.abbreviation
                                       select province).ToList();

            cboParentProvince.ItemsSource = (from province in provinces
                                             orderby province.abbreviation
                                             select province).ToList();

            cboAssurancePrivee.DataContext = myBdd.CompagnieAssurances.ToList();
        }
        } // bthEnregistrerAdmission_Click

        public Lit trouverLit(HopitalEntities hopital, int categorieDesiree, int idDept)
        {
            int cat = categorieDesiree;
            Lit sLit;

            do
            {
                sLit = hopital.Lits.Where(lit => lit.IdTypeLit == cat &&
                                          lit.IdDepartement == idDept &&
                                          lit.Occupe == false).FirstOrDefault();
                if (sLit == null)
                {
                    cat++;
                }
            } while (sLit == null && cat <= 3);

            return(sLit);
        }
        public void afficherPatient(HopitalEntities bdd, Patient pat)
        {
            // Nettoyage des champs non-obligatoires avant d'affichage d'un autre patient
            txtTelephone.Text       = string.Empty;
            txtAdresse.Text         = string.Empty;
            txtAssurancePrivee.Text = string.Empty;
            txtParentNom.Text       = string.Empty;
            txtParentTelephone.Text = string.Empty;

            // On retrouve le patient dans la BDD et affiches ses attributs
            Patient sPatient = bdd.Patients.SingleOrDefault(x => x.NumAssuranceMaladie.Trim() == pat.NumAssuranceMaladie.Trim());

            if (sPatient != null)
            {
                cboNAM.SelectedItem          = sPatient;
                cboNom.SelectedItem          = sPatient;
                txtPrenom.Text               = sPatient.Prenom;
                txtTelephone.Text            = sPatient.Telephone;
                txtAdresse.Text              = sPatient.Adresse.Trim() + " " + sPatient.Ville.Trim() + " " + sPatient.Province + " " + sPatient.CodePostal;
                dpDateNaissance.SelectedDate = sPatient.DateNaissance;

                if (sPatient.CompagnieAssurance == null)
                {
                    txtAssurancePrivee.Text = "Aucune";
                }
                else
                {
                    txtAssurancePrivee.Text = sPatient.CompagnieAssurance.NomCompagnie;
                }

                if (sPatient.IdParent != null)
                {
                    txtParentNom.Text       = sPatient.Parent.Nom.Trim() + ", " + sPatient.Parent.Prenom.Trim();
                    txtParentTelephone.Text = sPatient.Parent.Telephone;
                }
            }
        }
 public MedecinAccueil()
 {
     InitializeComponent();
     myBdd = new HopitalEntities();
 }
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     myBdd = new HopitalEntities();
     afficherMedecins();
 }
 public AjouterAdmission(Patient patient)
 {
     InitializeComponent();
     myBdd = new HopitalEntities();
     afficherPatient(myBdd, patient);
 }
 public AjouterAdmission()
 {
     InitializeComponent();
     myBdd = new HopitalEntities();
 }
 public AfficherPatient(Patient pat)
 {
     InitializeComponent();
     myBdd = new HopitalEntities();
     afficherPatient(myBdd, pat);
 }
 public AfficherPatient()
 {
     InitializeComponent();
     myBdd = new HopitalEntities();
 }