private void btnDon_Click(object sender, RoutedEventArgs e)//le medecin donne conge au patient
        {
            // id admission se trouvent dans comb1
            DossierAdmission d1 = (DossierAdmission)comb1.SelectedItem;

            //date du congé est insérée a la table dossier admission a partir de datecong.selectedDate
            d1.DateConge = dateCong.SelectedDate;

            //on affiche dans le datagrid
            dateAd1.ItemsSource = MainWindow.db.DossierAdmissions.ToList();

            //on accede au lit du patient a partir de son dossier et  on met a non le champs occupé
            var rez = MainWindow.db.Lit1.Where(w => w.NumeroLit == d1.NumeroLit).FirstOrDefault();

            //on met le champs occupé a non recuperer a partir du text box, on peut affecter tout simplement non sans passer par le text box
            rez.Occupe = "non";

            MainWindow.db.SaveChanges();
            if (d1.DateConge == null)
            {
                MessageBox.Show("Veuillez introduire la date du congé", "Message", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
            else

            {
                txtOcupp.Text = rez.Occupe;
                MessageBox.Show("Congé ajouté avec Success, et le lit est libéré", "Message", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
        }
Пример #2
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Lit1             l  = new Lit1();
                DossierAdmission p1 = new DossierAdmission();

                p1.ChirurgieProgramme = txtChirurgie.Text;
                p1.DateAdmission      = dateAd.SelectedDate;
                p1.DateChirurgie      = dateChirurgie.SelectedDate;


                p1.IdPatient = Convert.ToInt32(comb1.Text);
                p1.NumeroLit = Convert.ToInt32(comb2.Text);

                l.Occupe = txtOccup.Text;


                MainWindow.db.DossierAdmissions.Add(p1);
                MainWindow.db.SaveChanges();
                dateAd1.ItemsSource = MainWindow.db.DossierAdmissions.ToList();
                txtChirurgie.Text   = "";
            }
            catch (Exception)
            {
                MessageBox.Show("Ajout de dossier impossible!", "Message", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
        }
Пример #3
0
        private void btnDon_Click(object sender, RoutedEventArgs e)
        {
            DossierAdmission d1 = (DossierAdmission)comb1.SelectedItem;

            d1.DateConge = dateCong.SelectedDate;

            MainWindow.db.SaveChanges();
            dateAd1.ItemsSource = MainWindow.db.DossierAdmissions.ToList();
        }
        private void comb1_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            DossierAdmission d1 = comb1.SelectedItem as DossierAdmission;

            textDateAd.Text = d1.DateAdmission.ToString();

            dateCong.SelectedDate = d1.DateConge;
            txtNumLit.Text        = d1.NumeroLit.ToString();
            int nr  = Convert.ToInt32(txtNumLit.Text);
            var rez = MainWindow.db.Lit1.Where(w => w.NumeroLit == nr).FirstOrDefault();

            txtOcupp.Text = rez.Occupe;
        }
Пример #5
0
        private void Button_Click(object sender, RoutedEventArgs e) // ajoutter une admission
        {
            try
            {
                DossierAdmission p1 = new DossierAdmission();

                p1.ChirurgieProgramme = txtChirurgie.Text;
                p1.DateAdmission      = dateAd.SelectedDate;
                p1.DateChirurgie      = dateChirurgie.SelectedDate;


                p1.IdPatient = Convert.ToInt32(comb1.Text);
                p1.NumeroLit = Convert.ToInt32(comb2.Text);

                Lit1 x   = comb2.SelectedItem as Lit1;
                int  nr  = Convert.ToInt32(comb2.Text);
                var  rez = MainWindow.db.Lit1.Where(w => w.NumeroLit == nr).FirstOrDefault();
                rez.Occupe = "Oui";
                if (checkCommodite.IsChecked == true)
                {
                    p1.Commodite = "oui";
                }
                else
                {
                    p1.Commodite = "non";
                }
                MainWindow.db.DossierAdmissions.Add(p1);
                MainWindow.db.SaveChanges();
                dateAd1.ItemsSource = MainWindow.db.DossierAdmissions.ToList();
                txtOccup.Text       = rez.Occupe;

                txtChirurgie.Text = "";
                MessageBox.Show("Dossier Admission ajouté avec Success", "Message", MessageBoxButton.OK, MessageBoxImage.Warning);
            }

            catch (DbEntityValidationException ex)
            {
                Console.WriteLine(ex.ToString());
                // MessageBox.Show("Ajout de dossier impossible!", "Message", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
        }
Пример #6
0
        private void btnOk_Click(object sender, RoutedEventArgs e)
        {
            string nss   = GetNumero(comboNSS.Text);
            string idMed = GetNumero(comboMedecin.Text);

            using (NLHContext context = new NLHContext())
            {
                DossierAdmission dossier = new DossierAdmission()
                {
                    Chirurgie     = (bool)checkChirurgie.IsChecked,
                    NSS           = Convert.ToInt32(nss),
                    DateAdmission = DateTime.Now,
                    NumLit        = Convert.ToInt32(comboLit.Text),
                    IdMedecin     = Convert.ToInt32(idMed)
                };

                context.DossierAdmissions.Add(dossier);

                context.SaveChanges();

                MessageBox.Show("Ajouter!", "Info", MessageBoxButton.OK, MessageBoxImage.Information);
            }
        }