예제 #1
0
        public static void AddPrescription(Hospitalisation hospit, Prescription prescript, int numEmp)
        {
            prescript.DateEvenement   = DateTime.Now;
            prescript.EmployeImplique = DataModelEmploye.GetEmploye(numEmp);

            if (ConnexionBD.Instance().EstConnecte())
            {
                string requete = string.Format("INSERT INTO evenements " +
                                               "(idHospitalisation, idEmploye, dateHeure, estNotifier) " +
                                               "VALUES (" +
                                               "(SELECT idHospitalisation FROM hospitalisations WHERE dateDebut = '{0}')," +
                                               "{1}," +
                                               "'{2}'," +
                                               "{3})", hospit.DateDebut.ToString(), numEmp, prescript.DateEvenement.ToString(), prescript.EstNotifier);


                ConnexionBD.Instance().ExecuterRequete(requete);

                requete = string.Format("INSERT INTO Prescriptions " +
                                        "(idEvenement, produit, posologie, dateDebut, nbJour) " +
                                        "VALUES (" +
                                        "(SELECT idEvenement FROM evenements WHERE dateHeure = '{0}')," +
                                        "'{1}'," +
                                        "'{2}'," +
                                        "'{3}'," +
                                        "{4})"
                                        , prescript.DateEvenement.ToString(), prescript.Produit, prescript.Posologie, prescript.DateDebut.ToString(), prescript.NbJour);

                ConnexionBD.Instance().ExecuterRequete(requete);
                ControlModel.ControlModelDossierPatientPrescriptions.LstPrescriptions.Add(prescript);
            }
        }
        public static void AddResultatLabo(Hospitalisation hospit, ResultatLabo resultLabo, int numEmp)
        {
            resultLabo.DateEvenement   = DateTime.Now;
            resultLabo.EmployeImplique = DataModelEmploye.GetEmploye(numEmp);

            if (ConnexionBD.Instance().EstConnecte())
            {
                string requete = string.Format("INSERT INTO evenements " +
                                               "(idHospitalisation, idEmploye, dateHeure, estNotifier) " +
                                               "VALUES (" +
                                               "(SELECT idHospitalisation FROM hospitalisations WHERE dateDebut = '{0}')," +
                                               "{1}," +
                                               "'{2}'," +
                                               "{3})", hospit.DateDebut.ToString(), numEmp, resultLabo.DateEvenement.ToString(), resultLabo.EstNotifier);


                ConnexionBD.Instance().ExecuterRequete(requete);

                requete = string.Format("INSERT INTO resultatsLabo " +
                                        "(idEvenement, lienImage, nomAnalyse) " +
                                        "VALUES (" +
                                        "(SELECT idEvenement FROM evenements WHERE dateHeure = '{0}')," +
                                        "'{1}'," +
                                        "'{2}')"
                                        , resultLabo.DateEvenement.ToString(), resultLabo.LienImage, resultLabo.NomAnalyse);

                ConnexionBD.Instance().ExecuterRequete(requete);
                ControlModel.ControlModelDossierPatientResultatsLabo.LstResultsLabo.Add(resultLabo);
            }
        }
예제 #3
0
        public static void AddNoteInf(Hospitalisation hospit, NoteInfirmiere noteInf, int numEmp)
        {
            noteInf.DateEvenement   = DateTime.Now;
            noteInf.EmployeImplique = DataModelEmploye.GetEmploye(numEmp);

            if (ConnexionBD.Instance().EstConnecte())
            {
                string requete = string.Format("INSERT INTO evenements " +
                                               "(idHospitalisation, idEmploye, dateHeure, estNotifier) " +
                                               "VALUES (" +
                                               "(SELECT idHospitalisation FROM hospitalisations WHERE dateDebut = '{0}')," +
                                               "{1}," +
                                               "'{2}'," +
                                               "{3})", hospit.DateDebut.ToString(), numEmp, noteInf.DateEvenement.ToString(), noteInf.EstNotifier);


                ConnexionBD.Instance().ExecuterRequete(requete);

                requete = string.Format("INSERT INTO NotesInfirmiere " +
                                        "(idEvenement, note) " +
                                        "VALUES (" +
                                        "(SELECT idEvenement FROM evenements WHERE dateHeure = '{0}')," +
                                        "'{1}')"
                                        , noteInf.DateEvenement.ToString(), noteInf.NotesInf);

                ConnexionBD.Instance().ExecuterRequete(requete);
                ControlModel.ControlModelDossierPatientNotesInf.LstNotesInf.Add(noteInf);
            }
        }
        public static Departement GetDepartement(string abreviation, string expand = "")
        {
            Departement departement = null;

            if (ConnexionBD.Instance().EstConnecte())
            {
                int idEmployeChef = -1;
                ConnexionBD.Instance().ExecuterRequete(
                    string.Format(
                        "SELECT idDepartement _id, nom, abreviation, idEmploye " +
                        "FROM Departements " +
                        "WHERE abreviation = '{0}'",
                        abreviation
                        ), lecteur =>
                {
                    departement = new Departement
                    {
                        _identifiant = int.Parse(lecteur.GetString("_id")),
                        Nom          = lecteur.GetString("nom"),
                        Abreviation  = lecteur.GetString("abreviation")
                    };
                    if (!lecteur.IsDBNull(lecteur.GetOrdinal("idEmploye")))
                    {
                        idEmployeChef = int.Parse(lecteur.GetString("idEmploye"));
                    }
                }
                    );

                if (departement != null)
                {
                    departement.PersonnelMedicalEnChef = (idEmployeChef >= 0 ? null : DataModelEmploye.GetEmploye(idEmployeChef));
                    if (expand.Contains("chambres"))
                    {
                        StringBuilder expandPropagation = new StringBuilder();
                        if (expand.Contains("lits"))
                        {
                            expandPropagation.Append("lits ");
                        }
                        if (expand.Contains("equipements"))
                        {
                            expandPropagation.Append("equipements ");
                        }
                        departement.Chambres = new ObservableCollection <Chambre>(
                            DataModelChambre.GetChambres(
                                departement._identifiant.ToString(),
                                expandPropagation.ToString()
                                )
                            );
                    }
                }
            }
            return(departement);
        }
        public static List <Departement> GetDepartements()
        {
            List <Departement> lstDepartement = new List <Departement>();

            // On vérifie si la BD est connecté
            if (ConnexionBD.Instance().EstConnecte())
            {
                List <int> idEmployesChefs = new List <int>();

                // Si oui, on execute la requête que l'on veut effectuer
                // SqlDR (MySqlDataReader) emmagasine une liste des citoyens de la BD
                ConnexionBD.Instance().ExecuterRequete(
                    "SELECT * " +
                    "FROM departements"
                    , SqlDR => {
                    lstDepartement.Add(new Departement
                    {
                        _identifiant = int.Parse(SqlDR.GetString("idDepartement")),
                        Nom          = SqlDR.GetString("nom"),
                        Abreviation  = SqlDR.GetString("abreviation")
                    });
                    idEmployesChefs.Add(SqlDR.IsDBNull(SqlDR.GetOrdinal("idEmploye")) ? -1 : int.Parse(SqlDR.GetString("idEmploye")));
                }
                    );

                for (int i = 0; i < lstDepartement.Count; i++)
                {
                    lstDepartement[i].PersonnelMedicalEnChef = (idEmployesChefs[i] == -1 ? null : DataModelEmploye.GetEmploye(idEmployesChefs[i]));
                }

                for (int i = 0; i < lstDepartement.Count; i++)
                {
                    lstDepartement[i].Chambres = new ObservableCollection <Chambre>(DataModelChambre.GetChambres(lstDepartement[i]._identifiant.ToString(), "lits, equipements"));
                }
            }

            return(lstDepartement);
        }