예제 #1
0
        private void btnDonnerConge_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                DossierAdmission DA = ((DossierAdmission)cbIDDossier.SelectedItem);
                if (DA.DateAdmission > dkDateConge.SelectedDate)
                {
                    throw new Exception("La date de conge ne peut pas etre inferior de la date d'admission.");
                }
                DA.DateConge     = dkDateConge.SelectedDate;
                DA.ChirurgieProg = true;

                Lit LI = MainWindow.bdHospital.Lits.Where(l => l.NumeroLit == DA.NumeroLit).FirstOrDefault();
                LI.Occupe = false;

                MainWindow.bdHospital.SaveChanges();
                MessageBox.Show("Modification Fait! La date de congé a été fixé", "La date de congé avec Succes", MessageBoxButton.OK, MessageBoxImage.Information);

                refresh();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Erreur Asignation date conge", MessageBoxButton.OK, MessageBoxImage.Information);
            }
        }
예제 #2
0
        private void cbIDDossier_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            DossierAdmission DA = ((DossierAdmission)cbIDDossier.SelectedItem);

            labDateAdminission.Content = DA.DateAdmission.Value.ToString("yyyy-MM-dd");
            labDateChirurgie.Content   = string.IsNullOrEmpty(DA.DateChirurgie.ToString()) ? "Pas Date" : DA.DateChirurgie.Value.ToString("yyyy-MM-dd");
            labNSS.Content             = DA.NSS;
            labLit.Content             = DA.NumeroLit;
            DateTime dConge = string.IsNullOrEmpty(DA.DateConge.ToString()) ? DateTime.Today : DateTime.Parse(DA.DateConge.ToString());

            dkDateConge.SelectedDate = dConge;
        }
예제 #3
0
        private void btnOpenDossier_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (validaDossier())
                {
                    DossierAdmission dossier = new DossierAdmission();


                    dossier.ChirurgieProg = dateChirurgienDossier.SelectedDate == null? false : true;
                    dossier.DateAdmission = dateAdmissionDossier.SelectedDate;
                    dossier.DateChirurgie = dateChirurgienDossier.SelectedDate;
                    dossier.NSS           = int.Parse(cbNSSPatient.Text);
                    dossier.NumeroLit     = cbNumeroLit.Text;
                    dossier.IdMedecin     = (cbIdMedecin.SelectedItem as Medecin).IdMedecin;
                    dossier.IdLocation    = (cbLocation.SelectedItem != null) ? (cbLocation.SelectedItem as Location).IdLocation : 1;


                    // methode pour savoir la valeur a payer du lit.

                    Lit litPat         = cbNumeroLit.SelectedItem as Lit;
                    int TypeLitFacture = typeLitFact(litPat.NumeroType);

                    decimal cout = (decimal)(MainWindow.bdHospital.TypeLits.Where(tl => tl.NumeroType == TypeLitFacture).FirstOrDefault()).Prix;

                    CompagnieAssurance cass = cbAssurancePatient.SelectedItem as CompagnieAssurance;
                    if (cass.IdCompagnie != 1)
                    {
                        cout -= (decimal)(MainWindow.bdHospital.TypeLits.Where(tl => tl.NumeroType == 1).FirstOrDefault()).Prix;
                    }

                    Location loca = cbLocation.SelectedItem as Location;
                    if (loca.IdLocation != 1)
                    {
                        cout += (decimal)loca.Prix;
                    }


                    MessageBoxResult res = MessageBox.Show(string.Format("Il y a un frais a payer de $ {0}. Voulez vous continuer et payer?", cout.ToString("F")), "Attention", MessageBoxButton.YesNo, MessageBoxImage.Question);

                    if (res == MessageBoxResult.Yes)
                    {
                        MainWindow.bdHospital.DossierAdmissions.Add(dossier);

                        Lit lit = cbNumeroLit.SelectedItem as Lit;
                        lit.Occupe = true;

                        MainWindow.bdHospital.SaveChanges();
                        MessageBox.Show("OK le patient est admis", "Succes", MessageBoxButton.OK, MessageBoxImage.Information);

                        labNSS.Content            = cbNSSPatient.Text;
                        prenomPatientShow.Content = txtPrenomPatient.Text;
                        prenomParentShow.Content  = txtPrenomParent.Text;
                        NomParentShow.Content     = txtNomParent.Text;
                        assuranceShow.Content     = cbAssurancePatient.Text;
                        idCossierShow.Content     = dossier.IdAdmission;
                        telPatientShow.Content    = txtTelePatient.Text;
                        coutShow.Content          = "$ " + cout.ToString("F");
                    }
                }
                else
                {
                    throw new Exception("SECTION PATIENT: Les champs Nom, Prenom, Telephone, Date naissance et Assurance sont requis");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString(), "Erreur", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }