Пример #1
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);
            }
        }
Пример #2
0
        private void comb2_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            Lit1 x   = comb2.SelectedItem as Lit1;
            int  nr  = Convert.ToInt32(x.NumeroLit);
            var  rez = MainWindow.db.Lit1.Where(w => w.NumeroLit == nr).FirstOrDefault();

            txtOccup.Text = rez.Occupe;
            x.Occupe      = txtOccup.Text;
            MainWindow.db.SaveChanges();
            // Lit1 x = comb2.SelectedItem as Lit1;
            //  txtDes.Text = MainWindow.db.TypeLits.des
            //  int nr = Convert.ToInt32(comb2.SelectedItem);
            //  var rez = MainWindow.db.Lit1.Where(w => w.NumeroLit == nr).FirstOrDefault();
        }
Пример #3
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);
            }
        }
Пример #4
0
        private void button3_Click(object sender, RoutedEventArgs e)
        {
            Lit1 lit2 = new Lit1();

            // lit1.numeroLit = Convert.ToInt32(txtNumLit.Text);
            lit2.Occupe        = "non";//txtOccupe.Text;
            lit2.NumeroType    = Convert.ToInt32(cbNumType.Text);
            lit2.IdDepartament = Convert.ToInt32(cbDept.Text);

            MainWindow.db.Lit1.Add(lit2);
            try
            {
                MainWindow.db.SaveChanges();
                MessageBox.Show("Lit ajouté avec Succés", "Message", MessageBoxButton.OK, MessageBoxImage.Warning);
            }

            catch (DbEntityValidationException ex)
            {
                Console.WriteLine(ex.ToString());
            }
            //txtOccupe.Text = "";
        }
        private void button3_Click(object sender, RoutedEventArgs e)
        {
            Lit1 lit2 = new Lit1();

            // lit1.numeroLit = Convert.ToInt32(txtNumLit.Text);
            lit2.Occupe        = txtOccupe.Text;
            lit2.NumeroType    = Convert.ToInt32(cbNumType.Text);
            lit2.IdDepartament = Convert.ToInt32(cbDept.Text);

            MainWindow.db.Lit1.Add(lit2);
            try
            {
                MainWindow.db.SaveChanges();
            }

            catch (DbEntityValidationException ex)
            {
                Console.WriteLine(ex.ToString());
            }



            txtOccupe.Text = "";
        }