Ejemplo n.º 1
0
        private void btnAdmission_Click(object sender, RoutedEventArgs e)
        {
            if (dgPatientTrouver.SelectedItem != null)
            {
                int nbLitsDispo;
                using (NorthenLightsHopitalEntities db = new NorthenLightsHopitalEntities())
                {
                    nbLitsDispo = db.lits
                                  .Where(lit => lit.occupe == false)
                                  .Count();
                }

                if (nbLitsDispo > 0)
                {
                    nouvelleAdmission nouvelleAdmission = new nouvelleAdmission(dgPatientTrouver.SelectedItem as patient, cetEmploye);
                    nouvelleAdmission.ShowDialog();
                }
                else
                {
                    MessageBox.Show("Aucun lit n'est disponible en ce moment.", "Attention"
                                    , MessageBoxButton.OK, MessageBoxImage.Exclamation);
                }
            }
            else
            {
                MessageBox.Show("Veuillez selectionner un patient tout d'abord", "Attention"
                                , MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Ejemplo n.º 2
0
 private void btnAjouter_Click(object sender, RoutedEventArgs e)
 {
     using (NorthenLightsHopitalEntities db = new NorthenLightsHopitalEntities())
     {
         try
         {
             commentaire_patient nouveauCommentaire = new commentaire_patient
             {
                 id_client   = cePatient.id,
                 id_medecin  = cetEmploye.id,
                 commentaire = txtCommentaire.Text,
                 date        = DateTime.Now
             };
             db.commentaire_patient.Add(nouveauCommentaire);
             db.SaveChanges();
             this.Close();
         }catch (Exception ex)
         {
             MessageBox.Show("Une erreur s'est produite : \n" +
                             ex.Message.ToString(), "Attention"
                             , MessageBoxButton.OK, MessageBoxImage.Error);
             this.Close();
         }
     }
 }
Ejemplo n.º 3
0
        private void comboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            patientInfo.Clear();
            patientHistorique.Clear();
            int idClient = Convert.ToInt16(cboPatient.SelectedValue);

            using (db = new NorthenLightsHopitalEntities())
            {
                View_dossier_nom_prenom toAdd =
                    db.View_dossier_nom_prenom
                    .Where(pat => pat.id_client == idClient)
                    .ToList()
                    .Where(pat => pat.date_conge == null)
                    .FirstOrDefault();
                if (toAdd != null)
                {
                    patientInfo.Add(toAdd);
                }
                IEnumerable <View_nom_medecin> afficherHistorique =
                    db.View_nom_medecin
                    .Where(pat => pat.id_client == idClient)
                    .ToList()
                    .Where(pat => pat.date_conge != null)
                    .ToList();
                foreach (var ligne in afficherHistorique)
                {
                    patientHistorique.Add(ligne);
                }
            }
        }
Ejemplo n.º 4
0
 private void dgPatientTrouver_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (e.OriginalSource != null)
     {
         Type type = e.OriginalSource.GetType();
         if (type == typeof(DataGrid) && dgPatientTrouver.SelectedItem != null)
         {
             patient cePatient = dgPatientTrouver.SelectedItem as patient;
             using (NorthenLightsHopitalEntities db = new NorthenLightsHopitalEntities())
             {
                 if ((db.dossier_admission
                      .Where(dos => dos.id_client == cePatient.id)
                      .ToList()
                      .Where(dos => dos.date_conge == null)
                      .ToList()
                      .Count()) < 1)
                 {
                     btnAdmission.IsEnabled = true;
                 }
                 else
                 {
                     btnAdmission.IsEnabled = false;
                 }
             }
             btnMiseAJour.IsEnabled = true;
         }
         else if (dgPatientTrouver.CurrentItem == null)
         {
             btnAdmission.IsEnabled = false;
             btnMiseAJour.IsEnabled = false;
         }
     }
 }
Ejemplo n.º 5
0
        private void txtRecherche_KeyUp(object sender, KeyEventArgs e)
        {
            if (patientTrouver.Count() > 0)
            {
                patientTrouver.Clear();
                dgPatientTrouver.Items.Refresh();
            }

            if (txtRecherche.Text.Length > 1)
            {
                string[] aChercher = txtRecherche.Text.Split(' ', ',');
                foreach (string mot in aChercher)
                {
                    using (db = new NorthenLightsHopitalEntities())
                    {
                        var trouver = db.patients
                                      .Where(pat => pat.nom.ToLower().Contains(mot.ToLower()) ||
                                             pat.prenom.ToLower().Contains(mot.ToLower()))
                                      .ToList();
                        if (trouver != null)
                        {
                            foreach (var patient in trouver)
                            {
                                patient.nom.Trim();
                                patient.prenom.Trim();
                                patientTrouver.Add(patient);
                                dgPatientTrouver.Items.Refresh();
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 6
0
 public bool verifierAssurance()
 {
     using (NorthenLightsHopitalEntities db = new NorthenLightsHopitalEntities())
     {
         return((db.assurances
                 .Where(ass => ass.id_client == dossier.id_client)
                 .Count()) > 0);
     }
 }
Ejemplo n.º 7
0
 public assurance verifierAssurance(patient patient)
 {
     using (NorthenLightsHopitalEntities db = new NorthenLightsHopitalEntities())
     {
         return(db.assurances
                .Where(pat => pat.id_client == patient.id)
                .FirstOrDefault());
     }
 }
 public void affichertout()
 {
     using (NorthenLightsHopitalEntities db = new NorthenLightsHopitalEntities())
     {
         var tousPatients = db.patients.ToList();
         foreach (var ligne in tousPatients)
         {
             patientTrouver.Add(ligne);
         }
     }
 }
        public void populateListBox(string type)
        {
            listeLitsUp.Clear();
            using (NorthenLightsHopitalEntities db = new NorthenLightsHopitalEntities())
            {
                switch (type)
                {
                case "standard":
                    listeLits = db.View_lits_informations
                                .Where(acc => acc.id_accomodation == 1 &&
                                       acc.occupe == false)
                                .ToList();
                    if (dgLits.Items == null)
                    {
                        freeUpgrade           = true;
                        rbSemiPrive.IsChecked = true;
                    }
                    foreach (var lit in listeLits)
                    {
                        listeLitsUp.Add(lit);
                    }
                    litPreselectionner(listeLitsUp);
                    break;

                case "semi-prive":
                    listeLits = db.View_lits_informations
                                .Where(acc => acc.id_accomodation == 2 &&
                                       acc.occupe == false)
                                .ToList();
                    if (dgLits.Items.Count < 1 && freeUpgrade == true)
                    {
                        rbPrive.IsChecked = true;
                    }
                    foreach (var lit in listeLits)
                    {
                        listeLitsUp.Add(lit);
                    }
                    litPreselectionner(listeLitsUp);
                    break;

                case "prive":
                    listeLits = db.View_lits_informations
                                .Where(acc => acc.id_accomodation == 3 &&
                                       acc.occupe == false)
                                .ToList();
                    foreach (var lit in listeLits)
                    {
                        listeLitsUp.Add(lit);
                    }
                    litPreselectionner(listeLitsUp);
                    break;
                }
            }
        }
Ejemplo n.º 10
0
 public AccueilAdmin(employe emp)
 {
     InitializeComponent();
     cetEmploye    = emp;
     listeEmployes = new ObservableCollection <employe>();
     using (NorthenLightsHopitalEntities db = new NorthenLightsHopitalEntities())
     {
         cbxRole.DataContext = db.roles.ToList();
     }
     dgEmployes.DataContext = listeEmployes;
 }
Ejemplo n.º 11
0
 public void populateCombobox()
 {
     using (NorthenLightsHopitalEntities db = new NorthenLightsHopitalEntities())
     {
         cbxRaisonAdmission.DataContext = db.raison_admission.ToList();
         cbxDepartement.DataContext     = db.departements.ToList();
         cbxMedecin.DataContext         = db.employes
                                          .Where(emp => emp.id_role == 2)
                                          .ToList();
     }
 }
Ejemplo n.º 12
0
 public DonnerConge(int id)
 {
     InitializeComponent();
     using (NorthenLightsHopitalEntities db = new NorthenLightsHopitalEntities())
     {
         dossier = db.dossier_admission
                   .Where(dos => dos.id == id)
                   .FirstOrDefault();
     }
     id_admission = id;
     estAssurer   = verifierAssurance();
 }
Ejemplo n.º 13
0
        private void btnConge_Click(object sender, RoutedEventArgs e)
        {
            int patient = 0;

            patient = (int)cboPatient.SelectedValue;
            using (NorthenLightsHopitalEntities db = new NorthenLightsHopitalEntities())
            {
                var dossier = db.dossier_admission
                              .Where(dos => dos.id_client == (int)cboPatient.SelectedValue &&
                                     dos.date_conge == null)
                              .FirstOrDefault();
                if (dossier != null)
                {
                    DonnerConge choixDate = new DonnerConge(dossier.id);
                    choixDate.Show();
                }
            }
        }
Ejemplo n.º 14
0
        public AccueilMedecin(employe emp)
        {
            InitializeComponent();
            employe                  = emp;
            patientInfo              = new ObservableCollection <View_dossier_nom_prenom>();
            patientHistorique        = new ObservableCollection <View_nom_medecin>();
            dgHistorique.DataContext = patientHistorique;
            dgPatients.DataContext   = patientInfo;
            lblGreeting.Content      = "Bonjour, " + emp.prenom.TrimEnd() + " " + emp.nom.Trim();


            using (db = new NorthenLightsHopitalEntities())
            {
                cboPatient.DataContext = db.View_dossier_nom_prenom
                                         .Where(pat => pat.id_medecin == employe.id)
                                         .GroupBy(pat => pat.id_client)
                                         .Select(pati => pati.FirstOrDefault())
                                         .ToList();
            }
        }
Ejemplo n.º 15
0
 private void cbxRole_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (listeEmployes.Count > 0)
     {
         listeEmployes.Clear();
         dgEmployes.Items.Refresh();
     }
     if (cbxRole.SelectedIndex != -1)
     {
         using (NorthenLightsHopitalEntities db = new NorthenLightsHopitalEntities())
         {
             IEnumerable <employe> liste = db.employes
                                           .Where(emp => emp.id_role == (int)cbxRole.SelectedValue)
                                           .ToList();
             foreach (employe ligne in liste)
             {
                 listeEmployes.Add(ligne);
             }
         }
     }
 }
Ejemplo n.º 16
0
        private void btnAppliquer_Click(object sender, RoutedEventArgs e)
        {
            DateTime choix = (DateTime)conge.SelectedDate;

            if (choix != null)
            {
                using (NorthenLightsHopitalEntities db = new NorthenLightsHopitalEntities())
                {
                    db.dossier_admission
                    .Where(dos => dos.id == id_admission)
                    .ToList()
                    .FirstOrDefault().date_conge = choix;
                    db.SaveChanges();
                    db.lits
                    .Where(li => li.id == dossier.id_lit)
                    .ToList()
                    .ForEach(li => li.occupe = false);
                    db.accomodation_sejour
                    .Where(acc => acc.id_dossier_admission == id_admission)
                    .ToList()
                    .ForEach(acc => acc.date_fin = choix);
                    db.SaveChanges();

                    IEnumerable <View_accomodation_information> aFacturer = db.View_accomodation_information
                                                                            .Where(acc => acc.id_dossier_admission == id_admission)
                                                                            .ToList();
                    messageSucces();
                    nouvelleFacture(aFacturer);
                }
            }
            else
            {
                MessageBox.Show("Vous devez sélectionner une date.", "Attention"
                                , MessageBoxButton.OK, MessageBoxImage.Warning);
            }
        }
Ejemplo n.º 17
0
 private void btnSupprimer_Click(object sender, RoutedEventArgs e)
 {
     if (dgEmployes.SelectedItem != null)
     {
         employe employeSel = dgEmployes.SelectedItem as employe;
         var     result     = MessageBox.Show("Voulez-vous vraiment supprimer cet usager ?", "Attention"
                                              , MessageBoxButton.YesNo, MessageBoxImage.Exclamation);
         if (result == MessageBoxResult.Yes)
         {
             using (NorthenLightsHopitalEntities db = new NorthenLightsHopitalEntities())
             {
                 var empASup = db.employes
                               .Where(emp => emp.id == employeSel.id)
                               .FirstOrDefault();
                 if (empASup != null)
                 {
                     db.employes.Remove(empASup);
                     db.SaveChanges();
                 }
             }
         }
         actualiser();
     }
 }
Ejemplo n.º 18
0
 public Accueil()
 {
     InitializeComponent();
     db = new NorthenLightsHopitalEntities();
 }
        private void btnValider_Click(object sender, RoutedEventArgs e)
        {
            using (NorthenLightsHopitalEntities db = new NorthenLightsHopitalEntities())
            {
                if (dgLits.SelectedItem != null)
                {
                    accomodation_sejour nouvelAccTelevision = null;
                    accomodation_sejour nouvelAccTelephone  = null;
                    try
                    {
                        dossier_admission nouvelAdmission = new dossier_admission
                        {
                            id_client        = int.Parse(admissionData["id_client"]),
                            id_medecin       = int.Parse(admissionData["id_medecin"]),
                            date_admission   = Convert.ToDateTime(admissionData["date_admission"]),
                            raison_admission = admissionData["raison_admission"],
                            id_lit           = litChoisi.id
                        };
                        db.dossier_admission.Add(nouvelAdmission);
                        db.SaveChanges();
                        int idDossier = nouvelAdmission.id;

                        if (ckbxTelephone.IsChecked == true)
                        {
                            nouvelAccTelephone = new accomodation_sejour
                            {
                                id_dossier_admission = idDossier,
                                id_accomodation      = 5,
                                date_debut           = nouvelAdmission.date_admission,
                                upgrade_sans_frais   = false
                            };
                        }
                        if (ckbxTelevision.IsChecked == true)
                        {
                            nouvelAccTelevision = new accomodation_sejour
                            {
                                id_dossier_admission = idDossier,
                                id_accomodation      = 4,
                                date_debut           = nouvelAdmission.date_admission,
                                upgrade_sans_frais   = false
                            };
                        }
                        accomodation_sejour nouvelAccChambre = new accomodation_sejour
                        {
                            id_dossier_admission = idDossier,
                            id_accomodation      = litChoisi.id_accomodation,
                            date_debut           = nouvelAdmission.date_admission,
                            upgrade_sans_frais   = freeUpgrade
                        };
                        if (ckbxTelevision.IsChecked == true)
                        {
                            db.accomodation_sejour.Add(nouvelAccTelephone);
                        }


                        if (ckbxTelephone.IsChecked == true)
                        {
                            db.accomodation_sejour.Add(nouvelAccTelevision);
                        }
                        db.accomodation_sejour.Add(nouvelAccChambre);
                        db.lits
                        .Where(li => li.id == litChoisi.id)
                        .ToList()
                        .FirstOrDefault().occupe = true;
                        db.SaveChanges();
                        MessageBox.Show("Le patient a ete admis avec succes", "Succes"
                                        , MessageBoxButton.OK, MessageBoxImage.Exclamation);
                        this.Close();
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("Une erreur s'est produite : \n" +
                                        ex.Message.ToString(), "Attention"
                                        , MessageBoxButton.OK, MessageBoxImage.Error);
                        this.Close();
                    }
                }
            }
        }
Ejemplo n.º 20
0
 private void btnValider_Click(object sender, RoutedEventArgs e)
 {
     if (champsRempli())
     {
         try
         {
             using (NorthenLightsHopitalEntities db = new NorthenLightsHopitalEntities())
             {
                 if (cePatient == null)
                 {
                     patient nouveauPatient = new patient
                     {
                         nom            = txtNom.Text,
                         prenom         = txtPrenom.Text,
                         date_naissance = (DateTime)dateNais.SelectedDate,
                         proche_parent  = txtParent.Text
                     };
                     db.patients.Add(nouveauPatient);
                     db.SaveChanges();
                     int idPatient = nouveauPatient.id;
                     if (ckbxAss.IsChecked == true)
                     {
                         assurance nouvellePolice = new assurance
                         {
                             no_police             = int.Parse(txtAssNoPol.Text),
                             nom_societe_assurance = txtAssNom.Text,
                             id_client             = idPatient
                         };
                         db.assurances.Add(nouvellePolice);
                         db.SaveChanges();
                     }
                 }
                 else
                 {
                     patient aModif = cePatient;
                     aModif.date_naissance = (DateTime)dateNais.SelectedDate;
                     aModif.nom            = txtNom.Text;
                     aModif.prenom         = txtPrenom.Text;
                     aModif.proche_parent  = txtParent.Text;
                     if (ckbxAss.IsChecked == true)
                     {
                         assurance nouvellePolice = new assurance
                         {
                             no_police             = int.Parse(txtAssNoPol.Text),
                             nom_societe_assurance = txtAssNom.Text,
                             id_client             = aModif.id
                         };
                         db.assurances.Add(nouvellePolice);
                     }
                     db.Entry(aModif).State = System.Data.Entity.EntityState.Modified;
                     db.SaveChanges();
                 }
             }
             succes();
         }
         catch (Exception ex)
         {
             MessageBox.Show("Une erreur s'est produite : \n" +
                             ex.Message.ToString(), "Attention"
                             , MessageBoxButton.OK, MessageBoxImage.Error);
             this.Close();
         }
     }
     else
     {
         MessageBox.Show("Veuillez remplir tous les champs.", "ATTENTION"
                         , MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }