// Permet de remplir les champs de formulaire
        private string setChamps(string matricule)
        {
            Curs cs = new Curs(chaineConnexion);

            // Récupération du collaborateur
            cs.ReqSelect("SELECT * FROM collaborateur WHERE COL_MATRICULE = '" + matricule + "';");
            string laboCode = "";

            while (!cs.Fin())
            {
                // Remplissage des champs
                txb_nom.Text     = cs.Champ("COL_NOM").ToString();
                txb_prenom.Text  = cs.Champ("COL_PRENOM").ToString();
                txb_adresse.Text = cs.Champ("COL_ADRESSE").ToString();
                txb_ville.Text   = cs.Champ("COL_VILLE").ToString();
                txb_cp.Text      = cs.Champ("COL_CP").ToString();

                laboCode = cs.Champ("LAB_CODE").ToString();

                // Si responsable, remplissage du secteur
                if (_role == "responsable")
                {
                    cbx_secteur.SelectedItem = secteur[cs.Champ("SEC_CODE").ToString()];
                }

                cs.Suivant();
            }

            cs.Fermer();
            return(laboCode);
        }
        // Constructeur, le rôle est important pour savoir si on donne l'autorisation de modifier le secteur
        public ModificationMyInformations(string matricule, string nom, string role)
        {
            InitializeComponent();
            _matricule = matricule;
            _nom       = nom;
            _role      = role;

            Curs cs = new Curs(chaineConnexion);

            if (_role == "visiteur")
            {
                // Si l'utilisateur est un visiteur, inutile d'afficher le secteur (responsable)
                lbl_secteur.Hide();
                cbx_secteur.Hide();
            }
            else
            {
                // Sinon récupération des secteurs
                cs.ReqSelect("SELECT SEC_CODE, SEC_LIBELLE FROM secteur");
                while (!cs.Fin())
                {
                    // Ajout au dictionnaire de secteurs
                    secteur.Add(cs.Champ("SEC_CODE").ToString(), cs.Champ("SEC_LIBELLE").ToString());
                    cbx_secteur.Items.Add(cs.Champ("SEC_LIBELLE").ToString());
                    cs.Suivant();
                }
                cs.Fermer();
            }

            string laboCode = setChamps(matricule);

            addItemsToLabo(laboCode);
        }
Пример #3
0
        /// <summary>
        /// Permet de récupérer tout les valeurs
        /// </summary>
        /// <returns>Une liste de toutes valeurs</returns>
        private List <string> Recup_All()
        {
            string        requete;
            string        rapNum   = "";
            int           nbRapNum = -1;
            List <string> Result   = new List <string>();

            foreach (KeyValuePair <string, int> item in echantillonsOffert)
            {
                if (echantillonsPresente.ContainsKey(item.Key))
                {
                    echantillonsPresente.Remove(item.Key);
                }
            }
            Curs cs2 = new Curs(connection);

            requete = "SELECT RAP_NUM" +
                      " FROM `rapport_visite`" +
                      " WHERE `rapport_visite`.`COL_MATRICULE` = '" + _colMatricule +
                      "' ORDER  BY RAP_NUM DESC LIMIT 1";
            cs2.ReqSelect(requete);
            while (!cs2.Fin())
            {
                nbRapNum = Convert.ToInt32(cs2.Champ("RAP_NUM").ToString());
                if (_previous != "Modif")
                {
                    nbRapNum++;
                }
                cs2.Suivant();
            }
            cs2.Fermer();
            if (nbRapNum == -1)
            {
                nbRapNum = 1;
            }
            rapNum = nbRapNum.ToString();

            Result.Add(Recup_textBox_BilanRap());
            Result.Add(Recup_comboBox_Motif());
            Result.Add(Recup_comboBox_connaissancePraticien());
            Result.Add(Recup_comboBox_confianceLabo());
            Result.Add(Recup_dateTimePicker_DateRap());
            Result.Add(Recup_dateTimePicker_DateProVisite());
            Result.Add(Recup_comboBox_presenceconcurrence());
            Result.Add(Recup_comboBox_Praticiens());
            Result.Add(rapNum);

            return(Result);
        }
        // Ajoute les laboratoire au comboBox labo
        private void addItemsToLabo(string laboCode)
        {
            Curs cs = new Curs(chaineConnexion);

            // Récupération des labos
            cs.ReqSelect("SELECT LAB_CODE, LAB_NOM FROM labo");

            while (!cs.Fin())
            {
                // Ajout au dictionnaire
                labo.Add(cs.Champ("LAB_CODE").ToString(), cs.Champ("LAB_NOM").ToString());

                cbx_labo.Items.Add(cs.Champ("LAB_NOM").ToString());

                // Si le labo récupérer est le même que celui de l'utilisateur, on le sélectionne
                if (laboCode == cs.Champ("LAB_CODE").ToString())
                {
                    cbx_labo.SelectedItem = cs.Champ("LAB_NOM").ToString();
                }

                cs.Suivant();
            }
            cs.Suivant();
        }
Пример #5
0
        /// <summary>
        /// Rempli le dataGridViewComboBox pour médicaments présentés et offerts
        /// </summary>
        private void Add_comboBox_Medicament()
        {
            Curs   cs2     = new Curs(connection);
            string requete = "SELECT `medicament`.`MED_NOMCOMMERCIAL` " +
                             "FROM `medicament` " +
                             "ORDER BY `medicament`.`MED_NOMCOMMERCIAL` ASC";

            cs2.ReqSelect(requete);
            while (!cs2.Fin())
            {
                Medicaments.Items.Add(cs2.Champ("MED_NOMCOMMERCIAL").ToString());
                dataGridViewComboBoxColumn1.Items.Add(cs2.Champ("MED_NOMCOMMERCIAL").ToString());
                cs2.Suivant();
            }
            cs2.Fermer();
        }
Пример #6
0
        /// <summary>
        /// Affichage d'un praticien, modification d'un praticien
        /// </summary>
        /// <param name="NumPraticiens">numéro du praticien </param>
        /// <param name="previous">valeur de la page précédente</param>
        public DetailsPraticien(int NumPraticiens, string previous = "AllPraticiens")
        {
            InitializeComponent();
            //On remplit les variables
            _previous      = previous;
            _NumPraticiens = NumPraticiens;

            // Récuperation des données du praticien
            Curs   cs2     = new Curs(connection);
            string requete = "SELECT praticien.`PRA_NUM`,`praticien`.`PRA_NOM`,`praticien`.`PRA_PRENOM`,`praticien`.`PRA_ADRESSE`,`praticien`.`PRA_CP`" +
                             ",`praticien`.`PRA_VILLE`,`praticien`.`PRA_COEFNOTORIETE`,`type_praticien`.`TYP_LIBELLE` FROM praticien,`type_praticien`" +
                             " WHERE type_praticien.`TYP_CODE` = praticien.`TYP_CODE` AND praticien.`PRA_NUM` = " + NumPraticiens.ToString();
            Curs   cs3 = new Curs(connection);
            string req = "SELECT TYP_CODE, TYP_LIBELLE FROM type_praticien;";

            cs2.ReqSelect(requete);
            cs3.ReqSelect(req);

            //Remplissage des champs
            while (!cs2.Fin())
            {
                textBox_num.Text     = cs2.Champ("PRA_NUM").ToString();
                textBox_nom.Text     = cs2.Champ("PRA_NOM").ToString();
                textBox_prenom.Text  = cs2.Champ("PRA_PRENOM").ToString();
                textBox_adresse.Text = cs2.Champ("PRA_ADRESSE").ToString();
                textBox_CP.Text      = cs2.Champ("PRA_CP").ToString();
                textBox_ville.Text   = cs2.Champ("PRA_VILLE").ToString();
                textBox_coef.Text    = cs2.Champ("PRA_COEFNOTORIETE").ToString();
                textBox_lieu.Text    = cs2.Champ("TYP_LIBELLE").ToString();
                cbx_tp.SelectedItem  = cs2.Champ("TYP_LIBELLE").ToString();
                cs2.Suivant();
            }
            cs2.Fermer();

            //Remplissage du comboBox
            while (!cs3.Fin())
            {
                typePraticiens.Add(cs3.Champ("TYP_CODE").ToString(), cs3.Champ("TYP_LIBELLE").ToString());
                cs3.Suivant();
            }
            cs3.Fermer();

            if (_previous == "RapportVisite")
            {
                btn_modif.Visible = false;
            }
        }
Пример #7
0
        /// <summary>
        /// Rempli le dictionnaire de données des praticiens et rempli le comboBox_Praticiens
        /// </summary>
        private void Add_comboBox_Praticiens()
        {
            string Name    = "";
            Curs   cs      = new Curs(connection);
            string requete = "SELECT `praticien`.`PRA_NUM`, `praticien`.`PRA_NOM`, `praticien`.`PRA_PRENOM`" +
                             " FROM `praticien`" +
                             " ORDER BY `praticien`.`PRA_NOM`";

            cs.ReqSelect(requete);
            while (!cs.Fin())
            {
                Name = cs.Champ("PRA_NOM").ToString() + " " + cs.Champ("PRA_PRENOM").ToString();
                praticiens.Add(Convert.ToInt16(cs.Champ("PRA_NUM").ToString()), Name);
                comboBox_Praticiens.Items.Add(Name);
                cs.Suivant();
            }
            cs.Fermer();
        }
Пример #8
0
        /// <summary>
        /// Requetes nécessaire pour remplir les dataGridViews selon un numéro de rapport
        /// </summary>
        private void Prefill_Medicament()
        {
            string requete = "SELECT `medicament`.`MED_NOMCOMMERCIAL`,`distribuer`.`QUANTITE`,`distribuer`.`OFFERT`" +
                             " FROM `distribuer`,`echantillon`,`medicament`" +
                             " WHERE `distribuer`.`RAP_NUM` = " + _numRap +
                             " AND `echantillon`.`ECH_ID` = `distribuer`.`ECH_ID`" +
                             " AND `medicament`.`MED_DEPOTLEGAL` = `echantillon`.`MED_ID`" +
                             " AND `distribuer`.`COL_MATRICULE` = '";

            string Medicament = "";
            int    NbMedicament = 0, indexOffert = 0, IndexPresente = 0;

            if (_role == "responsable")
            {
                requete += _colMatClic + "'";
            }
            else
            {
                requete += _colMatricule + "'";
            }

            Curs cs3 = new Curs(connection);

            cs3.ReqSelect(requete);
            while (!cs3.Fin())
            {
                Medicament   = cs3.Champ("MED_NOMCOMMERCIAL").ToString();
                NbMedicament = Convert.ToInt16(cs3.Champ("QUANTITE"));
                if (cs3.Champ("OFFERT").ToString() == "True")
                {
                    Fill_Combobox_Medicament(dataGridView_echantillonOffert, Medicament, NbMedicament, indexOffert);
                    indexOffert++;
                }
                else
                {
                    Fill_Combobox_Medicament(dataGridView_echantillonPresente, Medicament, NbMedicament, IndexPresente);
                    IndexPresente++;
                }
                cs3.Suivant();
            }
            cs3.Fermer();
        }
        // Constructeur
        public Consulter_Medicament(string idMedicament = "a")
        {
            InitializeComponent();

            Curs cs = new Curs(chaineconnexion);
            // Sélection des médicaments
            string requete = "SELECT `medicament`.`MED_NOMCOMMERCIAL` FROM `medicament` ORDER BY `medicament`.`MED_NOMCOMMERCIAL`";

            cs.ReqSelect(requete);
            string nom = "";

            while (!cs.Fin())
            {
                nom = cs.Champ("MED_NOMCOMMERCIAL").ToString();
                // Ajout des items
                Consulter_medicament_combobox.Items.Add(nom);
                cs.Suivant();
            }

            cs.Fermer();
            // Si un id est définit
            if (idMedicament != "a")
            {
                cs = new Curs(chaineconnexion);

                cs.ReqSelect("SELECT MED_NOMCOMMERCIAL FROM medicament WHERE MED_DEPOTLEGAL = '" + idMedicament + "';");

                string medicamentParameter;
                while (!cs.Fin())
                {
                    medicamentParameter = cs.Champ("MED_NOMCOMMERCIAL").ToString();
                    Consulter_medicament_combobox.SelectedItem = medicamentParameter;

                    cs.Suivant();
                }
                cs.Fermer();
            }
        }
Пример #10
0
        /// <summary>
        /// Rempli tout les champs sauf les dataGridViews
        /// </summary>
        private void Add_allChamp()
        {
            string requete = "SELECT `RAP_DATE`, `RAP_BILAN`, `RAP_MOTIF`, `RAP_CONNAISSANCE_PRACTICIEN`, `RAP_CONFIANCE_LABO`, `RAP_DATE_VISITE`, `RAP_DATE_PROCHAINE_VISITE`, `RAP_PRESENCE_CONCURENCE`,`PRA_NUM`" +
                             " FROM `rapport_visite`" +
                             " WHERE `rapport_visite`.`RAP_NUM` = " + _numRap +
                             " AND `rapport_visite`.`COL_MATRICULE` = '";

            if (_role == "responsable")
            {
                requete += _colMatClic + "'";
            }
            else
            {
                requete += _colMatricule + "'";
            }

            Curs cs2 = new Curs(connection);

            cs2.ReqSelect(requete);
            while (!cs2.Fin())
            {
                //comboBox
                comboBox_connaissancePraticien.SelectedItem = cs2.Champ("RAP_CONNAISSANCE_PRACTICIEN").ToString() == "" ? "Je ne sais pas" : cs2.Champ("RAP_CONNAISSANCE_PRACTICIEN").ToString();
                comboBox_confianceLabo.SelectedItem         = cs2.Champ("RAP_CONFIANCE_LABO").ToString() == "" ? "Je ne sais pas" : cs2.Champ("RAP_CONFIANCE_LABO").ToString();
                comboBox_Praticiens.SelectedItem            = praticiens[Convert.ToInt16(cs2.Champ("PRA_NUM").ToString())];
                comboBox_Motif.SelectedItem = cs2.Champ("RAP_MOTIF").ToString();
                //Textbox
                textBox_BilanRap.Text = cs2.Champ("RAP_BILAN").ToString();
                //dateTime

                try
                {
                    dateTimePicker_DateRap.Value = DateTime.Parse(cs2.Champ("RAP_DATE_VISITE").ToString());
                }
                catch (Exception)
                {
                    DateTime.TryParse(cs2.Champ("RAP_DATE_VISITE").ToString(), out test);
                    dateTimePicker_DateRap.Value = test.AddYears(1980);
                }



                bool verifDate = cs2.Champ("RAP_DATE_PROCHAINE_VISITE").ToString() == "" ? false : true;
                if (!verifDate)
                {
                    comboBox_NewRDV.SelectedItem = "Non";
                }
                else
                {
                    comboBox_NewRDV.SelectedItem         = "Oui";
                    DateProVisite.Visible                = true;
                    dateTimePicker_DateProVisite.Visible = true;
                    dateTimePicker_DateProVisite.Value   = DateTime.Parse(cs2.Champ("RAP_DATE_PROCHAINE_VISITE").ToString());
                }

                if (comboBox_Motif.Text.Trim() == "")
                {
                    comboBox_Motif.SelectedItem = "Autre";
                    textBox_AutreMotif.Visible  = true;
                    textBox_AutreMotif.Text     = cs2.Champ("RAP_MOTIF").ToString();
                }
                switch (cs2.Champ("RAP_PRESENCE_CONCURENCE").ToString())
                {
                case "":
                    comboBox_presenceconcurrence.SelectedItem = "Je ne sais pas";
                    break;

                case "True":
                    comboBox_presenceconcurrence.SelectedItem = "Oui";
                    break;

                case "False":
                    comboBox_presenceconcurrence.SelectedItem = "Non";
                    break;
                }
                cs2.Suivant();
            }
            cs2.Fermer();
        }