Example #1
0
        public void refresh()
        {
            List <Patient> pa    = new List <Patient>();
            var            query = from l in myBDD2.DemandeAdmissions
                                   join p in myBDD2.Patients on l.idPatient equals p.id
                                   select new { l.idMedecin, l.idPrepose, l.idPatient, l.idLit, p.nomAssurance, l.idCommo, l.dateAdmiss, l.dateConge, l.prix };

            dtAdmission.ItemsSource = query.ToList();//affichage des admissions courantes

            /*var query1 = from l in myBDD2.Patients
             *          where l.pris==false
             *          select new { l.id, l.nom, l.age, l.nomAssurance, l.parent, l.TypeIntervention, l.pris};*/

            foreach (Patient a in myBDD2.Patients) //pour afficher juste patient qui ne sont pas dans des admissions(pour etre dans une autre admissions il faut
            {
                //avoir congé dans la precedente

                if (a.pris == false)
                {
                    pa.Add(a);
                }
            }
            dtPatient.ItemsSource = myBDD2.Patients.ToList();

            CommoditeSup com = new CommoditeSup();

            // refresh de l,affichage des contenus de tous les combobox :Patients, Preposes,Medecins,Chgambres, Departements,Lits ...etc
            cbCommod.ItemsSource      = myBDD2.CommoditeSups.ToList();
            cbMedecin.ItemsSource     = myBDD2.Medecins.ToList();
            cbPrepose.ItemsSource     = myBDD2.Preposes.ToList();
            cbPatient.ItemsSource     = pa.ToList();
            cbDepartement.ItemsSource = myBDD2.Departement1.ToList();
        }
Example #2
0
        public void refresh()
        {
            var query = from l in myBDD2.DemandeAdmissions
                        //join p in myBDD2.Patients on l.idPatient equals p.id
                        select new { l.idMedecin, l.idPrepose, l.idPatient, l.idLit, l.idCommo, l.dateAdmiss, l.dateConge, l.nomAssurance };

            dtAdmission1.ItemsSource = query.ToList();

            /*var query1 = from l in myBDD2.Patients
             *          select new { l.id, l.nom, l.age, l.nomAssurance,l.parent };
             * dtPatient.ItemsSource = myBDD2.Patients.ToList();// query1.ToList();*/

            CommoditeSup com = new CommoditeSup();
            //lit.Add(new Lit());
            // cbCommod.a

            /* cbCommod.ItemsSource = myBDD2.CommoditeSups.ToList();
             * // cbLit.ItemsSource = myBDD2.Lits.ToList();
             * cbMedecin.ItemsSource = myBDD2.Medecins.ToList();
             * cbPrepose.ItemsSource = myBDD2.Preposes.ToList();
             * cbPatient.ItemsSource = myBDD2.Patients.ToList();
             * cbDepartement.ItemsSource = myBDD2.Departement1.ToList();
             * cbDepart.ItemsSource = myBDD2.Departement1.ToList();*/
            /*var query1 = from l in myBDD1.Medecins
             *           select new { l.idMedecin, l.nom };
             * dtMedecin.ItemsSource = query1.ToList();*/
        }
Example #3
0
        private void btnAjouter_Click(object sender, RoutedEventArgs e)
        {
            bool valider = verif();

            if (valider)
            {
                DemandeAdmission dem1 = new DemandeAdmission();
                Patient          pat  = cbPatient.SelectedItem as Patient;
                CommoditeSup     com  = cbCommod.SelectedItem as CommoditeSup;
                Medecin          m    = cbMedecin.SelectedItem as Medecin;
                Prepose          k    = cbPrepose.SelectedItem as Prepose;
                Lit lit = cbLit.SelectedItem as Lit;
                if (prixChambre != 0) //appliquer les prix selon le type de la chambre(ici le patient accepte les frais )
                {
                    if ((rdPrive.IsChecked == true) || (rdSemi.IsChecked == true))
                    {
                        foreach (TypeChambre type1 in myBDD2.TypeChambres)
                        {
                            if ((type1.idType == 1) || (type1.idType == 2))
                            {
                                prixChambre = Convert.ToDecimal(type1.prix);
                                break;
                            }
                        }
                    }
                }
                pat.pris       = true;
                prixChambre   += Convert.ToDecimal(com.prix);
                dem1.idMedecin = m.idMedecin;
                dem1.idPatient = pat.id;
                dem1.idPrepose = k.idPrepose;
                lit.dispo      = false;

                dem1.idLit        = lit.idLit;
                dem1.idCommo      = com.idCommo;
                dem1.dateAdmiss   = dateAdmission.SelectedDate;
                dem1.nomAssurance = pat.nomAssurance;
                dem1.prix         = prixChambre;
                myBDD2.DemandeAdmissions.Add(dem1); //ajout de l,admission
                myBDD2.SaveChanges();
                MessageBox.Show("Insertion réussie", "Bravo", MessageBoxButton.OK, MessageBoxImage.Information);
                refresh();
            }
            else
            {
                MessageBox.Show("Verifiez les champs sélectionnés, ils ne correspondent pas au reglement, type de chambre et assurance privée ...etc", "Attention", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            prixChambre = 0;
        }