private void btnConfirmerModifPat_Click(object sender, EventArgs e)
        {
            if (tbModifPatNom.Text == "" || tbModifPatPrenom.Text == "" || tbModifPatAdresse.Text == "" || tbModifPatGSM.Text == "")
            {
                MessageBox.Show("Veuillez remplir chaque champs de données.", "Attention", MessageBoxButtons.OK,
                                MessageBoxIcon.Warning);
            }
            else
            {
                bool modif_pat = false;

                tbModifPatNom.Text    = tbModifPatNom.Text[0].ToString().ToUpper() + tbModifPatNom.Text.Substring(1);
                tbModifPatPrenom.Text = tbModifPatPrenom.Text[0].ToString().ToUpper() + tbModifPatPrenom.Text.Substring(1);

                // On crée la liste des patients de la base de données afin de vérifier si le patient à ajouter existe déjà ou pas \\
                List <C_t_patients> lTmp_Pat = new G_t_patients(sConnexion).Lire("NomPat");
                foreach (C_t_patients p in lTmp_Pat)
                {
                    if (p.IDPat != int.Parse(tbModifPatID.Text))
                    {
                        if (tbModifPatNom.Text == p.NomPat)
                        {
                            if (tbModifPatPrenom.Text == p.PrenomPat)
                            {
                                modif_pat = false;
                            }
                            else
                            {
                                modif_pat = true;
                            }
                        }
                        else
                        {
                            modif_pat = true;
                        }
                    }
                    else
                    {
                        continue;
                    }
                }
                // Si modif_pat est vrai alors on modifie le patient sinon on affiche un message d'erreur \\
                if (modif_pat)
                {
                    new G_t_patients(sConnexion).Modifier(int.Parse(tbModifPatID.Text), tbModifPatNom.Text, tbModifPatPrenom.Text, tbModifPatAdresse.Text,
                                                          int.Parse(tbModifPatGSM.Text));
                    MessageBox.Show("Le patient a été modifié.", "Info:", MessageBoxButtons.OK,
                                    MessageBoxIcon.Information);
                    ViderTB();
                }
                else
                {
                    MessageBox.Show(
                        "Le patient n'a pas été modifié!\nIl existe déjà dans la base de données.",
                        "Attention", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    ViderTB();
                }
            }
            AfficherPatients();
        }
Ejemplo n.º 2
0
        private void btnConfirmerAjPat_Click(object sender, EventArgs e)
        {
            if (tbNomPat.Text == "" || tbPrePat.Text == "" || tbAdrPat.Text == "" || tbGSMPat.Text == "")
            {
                MessageBox.Show("Veuillez remplir chaque champs de données.", "Attention", MessageBoxButtons.OK,
                                MessageBoxIcon.Warning);
            }
            else
            {
                bool ajout_pat = false;
                // Majuscule pour les noms et prénoms
                tbNomPat.Text = tbNomPat.Text[0].ToString().ToUpper() + tbNomPat.Text.Substring(1);
                tbPrePat.Text = tbPrePat.Text[0].ToString().ToUpper() + tbPrePat.Text.Substring(1);

                // On crée la liste des patients de la base de données afin de vérifier si le patient à ajouter existe déjà ou pas \\
                List <C_t_patients> lTmp_Pat = new G_t_patients(sConnexion).Lire("Nom");
                foreach (C_t_patients p in lTmp_Pat)
                {
                    if (tbNomPat.Text == p.NomPat)
                    {
                        if (tbPrePat.Text == p.PrenomPat)
                        {
                            ajout_pat = false;
                        }
                        else
                        {
                            ajout_pat = true;
                        }
                    }
                    else
                    {
                        ajout_pat = true;
                    }
                }
                // Si la liste est vide on ajoute le patient \\
                if (lTmp_Pat.Count == 0)
                {
                    ajout_pat = true;
                }
                // Si ajout_pat est vrai alors on ajoute le patient sinon on affiche un message d'erreur \\
                if (ajout_pat)
                {
                    new G_t_patients(sConnexion).Ajouter(tbNomPat.Text, tbPrePat.Text, tbAdrPat.Text,
                                                         int.Parse(tbGSMPat.Text));
                    MessageBox.Show("Le patient a été ajouté.", "Info:", MessageBoxButtons.OK,
                                    MessageBoxIcon.Information);
                    tbNomPat.Text = tbPrePat.Text = tbAdrPat.Text = tbGSMPat.Text = "";
                }
                else
                {
                    MessageBox.Show(
                        "Le patient n'a pas été ajoutée!\nIl existe déjà dans la base de données.",
                        "Attention", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    tbNomPat.Text = tbPrePat.Text = tbAdrPat.Text = tbGSMPat.Text = "";
                }
            }
        }
Ejemplo n.º 3
0
        public static BindingSource ReafficherPatients()
        {
            t_patients = TablesDeDonnees.t_patients;
            List <C_t_patients> lTmp_Pat = new G_t_patients(TablesDeDonnees.SConnexion).Lire("ID");

            foreach (C_t_patients pat in lTmp_Pat)
            {
                t_patients.Rows.Add(pat.NomPat, pat.PrenomPat, pat.AdressePat, pat.GSMPat.ToString());
            }
            BindingSource bs_patients = TablesDeDonnees.bs_patients;

            bs_patients.DataSource = t_patients;
            return(bs_patients);
        }
        private void AfficherPatients()
        {
            t_patients = new DataTable();
            t_patients.Columns.Add(new DataColumn("ID", System.Type.GetType("System.Int32")));
            t_patients.Columns.Add(new DataColumn("Nom"));
            t_patients.Columns.Add(new DataColumn("Prénom"));
            List <C_t_patients> lTmp_Pat = new G_t_patients(sConnexion).Lire("NomPat");

            foreach (C_t_patients p in lTmp_Pat)
            {
                t_patients.Rows.Add(p.IDPat, p.NomPat, p.PrenomPat);
            }
            bs_patients               = new BindingSource();
            bs_patients.DataSource    = t_patients;
            dgvPatientsSoi.DataSource = bs_patients;
        }
Ejemplo n.º 5
0
        public static int IDPat(string nom, string prenom)
        {
            int id = 0;
            List <C_t_patients> lTmp_Pat = new G_t_patients(TablesDeDonnees.SConnexion).Lire("ID");

            foreach (C_t_patients p in lTmp_Pat)
            {
                if (nom == p.NomPat && prenom == p.PrenomPat)
                {
                    id = p.IDPat;
                    break;
                }
            }

            return(id);
        }
Ejemplo n.º 6
0
        private void AfficherSoins()
        {
            t_soigner = new DataTable();
            t_soigner.Columns.Add(new DataColumn("ID", System.Type.GetType("System.Int32")));
            t_soigner.Columns.Add(new DataColumn("Médecin"));
            t_soigner.Columns.Add(new DataColumn("Patient"));
            t_soigner.Columns.Add(new DataColumn("Opération prévue le"));
            t_soigner.Columns.Add(new DataColumn("Sortie prévue le"));
            t_soigner.Columns.Add(new DataColumn("Coût de l'opération"));
            List <C_t_medecins> lTmp_Med  = new G_t_medecins(sConnexion).Lire("NomMed");
            List <C_t_patients> lTmp_Pat  = new G_t_patients(sConnexion).Lire("NomPat");
            List <C_t_soigner>  lTmp_Soin = new G_t_soigner(sConnexion).Lire("IDSoi");

            foreach (C_t_soigner s in lTmp_Soin)
            {
                string Medecin = "", Patient = "";
                // Recherche du nom et prénom du médecin
                foreach (C_t_medecins m in lTmp_Med)
                {
                    if (s.IDMed == m.IDMed)
                    {
                        Medecin = m.NomMed + " " + m.PrenomMed;
                        break;
                    }
                }

                // Recherche du nom et prénom du patient
                foreach (C_t_patients p in lTmp_Pat)
                {
                    if (s.IDPat == p.IDPat)
                    {
                        Patient = p.NomPat + " " + p.PrenomPat;
                        break;
                    }
                }

                t_soigner.Rows.Add(s.IDSoi, Medecin, Patient, s.DateOperation.ToShortDateString(),
                                   s.DateAuthorisationSortie.ToString(), s.PrixOperation.ToString());
            }
            bs_soigner            = new BindingSource();
            bs_soigner.DataSource = t_soigner;
            dgvSoins.DataSource   = bs_soigner;
        }
Ejemplo n.º 7
0
        public static BindingSource AfficherPatients()
        {
            t_patients = new DataTable();
            //t_patients.Columns.Add(new DataColumn("ID", System.Type.GetType("System.Int32")));
            t_patients.Columns.Add(new DataColumn("Nom"));
            t_patients.Columns.Add(new DataColumn("Prénom"));
            t_patients.Columns.Add(new DataColumn("Adresse"));
            t_patients.Columns.Add(new DataColumn("GSM"));
            List <C_t_patients> lTmp_Pat = new G_t_patients(TablesDeDonnees.SConnexion).Lire("ID");

            foreach (C_t_patients pat in lTmp_Pat)
            {
                t_patients.Rows.Add(pat.NomPat, pat.PrenomPat, pat.AdressePat, pat.GSMPat.ToString());
            }
            BindingSource bs_patients = TablesDeDonnees.bs_patients;

            bs_patients.DataSource = t_patients;
            return(bs_patients);
        }
Ejemplo n.º 8
0
        private void AfficherOccupation()
        {
            t_occuper = new DataTable();
            t_occuper.Columns.Add(new DataColumn("ID", System.Type.GetType("System.Int32")));
            t_occuper.Columns.Add(new DataColumn("Patient"));
            t_occuper.Columns.Add(new DataColumn("Chambre"));
            t_occuper.Columns.Add(new DataColumn("Entrée le"));
            t_occuper.Columns.Add(new DataColumn("Sortie le"));
            t_occuper.Columns.Add(new DataColumn("Coût journalier"));
            List <C_t_chambres> lTmp_Cha = new G_t_chambres(sConnexion).Lire("NomCha");
            List <C_t_patients> lTmp_Pat = new G_t_patients(sConnexion).Lire("NomPat");
            List <C_t_occuper>  lTmp_Occ = new G_t_occuper(sConnexion).Lire("IDOcc");

            foreach (C_t_occuper o in lTmp_Occ)
            {
                string Chambre = "", Patient = "";

                foreach (C_t_chambres c in lTmp_Cha)
                {
                    if (o.IDCha == c.IDCha)
                    {
                        Chambre = c.NomCha.ToString();
                        break;
                    }
                }
                foreach (C_t_patients p in lTmp_Pat)
                {
                    if (o.IDPat == p.IDPat)
                    {
                        Patient = p.NomPat + " " + p.PrenomPat;
                        break;
                    }
                }

                t_occuper.Rows.Add(o.IDOcc, Patient, Chambre, o.DateEntree.ToShortDateString(),
                                   o.DateSortie.ToString(), o.PrixJournalier.ToString());
            }
            bs_occuper               = new BindingSource();
            bs_occuper.DataSource    = t_occuper;
            dgvOccupation.DataSource = bs_occuper;
        }