private bool BuildServicesRendusTable(int idconsultation)
        {
            tlpValidationFacture.Controls.Clear();
            tlpValidationFacture.RowCount = 1;
            tlpValidationFacture.Controls.Add(new Label()
            {
                Text = "Type MedEasy"
            }, 0, 0);
            tlpValidationFacture.Controls.Add(new Label()
            {
                Text = "Description"
            }, 1, 0);
            tlpValidationFacture.Controls.Add(new Label()
            {
                Text = "Durée (minutes)"
            }, 2, 0);
            tlpValidationFacture.Controls.Add(new Label()
            {
                Text = "Prix à facturer"
            }, 3, 0);

            try
            {
                Database_Manager db     = new Database_Manager();
                SQLiteDataReader reader = db.SqlRequest("SELECT SR.*, ST.SET_Chf_Minute, ST.SET_Nom FROM Service_Rendu SR INNER JOIN Service_Type ST ON SR.SER_SET_ID = ST.SET_ID WHERE SR.SER_CON_FID IS " + idconsultation);

                while (reader.Read())
                {
                    tlpValidationFacture.RowCount = tlpValidationFacture.RowCount + 1;
                    tlpValidationFacture.Controls.Add(new Label()
                    {
                        Text = reader.GetValue(6).ToString()
                    }, 0, tlpValidationFacture.RowCount - 1);
                    tlpValidationFacture.Controls.Add(new Label()
                    {
                        Text = reader.GetValue(2).ToString()
                    }, 1, tlpValidationFacture.RowCount - 1);
                    tlpValidationFacture.Controls.Add(new Label()
                    {
                        Text = reader.GetValue(1).ToString()
                    }, 2, tlpValidationFacture.RowCount - 1);
                    float duree  = Convert.ToSingle(reader.GetValue(1).ToString());
                    float prixpm = Convert.ToSingle(reader.GetValue(5).ToString());
                    float res    = duree * prixpm;
                    tlpValidationFacture.Controls.Add(new Label()
                    {
                        Text = Convert.ToString(res)
                    }, 3, tlpValidationFacture.RowCount - 1);
                }
                reader.Close();

                return(true);
            }
            catch (Exception e)
            {
                Exception_Manager.NewException(e, "Erreur lors du calcul de la facture", false);
                //PanelManager("ListeRendezVous");
                return(false);
            }
        }
Example #2
0
        //Vérifie si l'utilisateur peut être identifié
        internal bool LoginIsCorrect()
        {
            //Vérifie si le nom d'utilisateur est vide
            if (string.IsNullOrEmpty(Username))
            {
                //Affiche un message d'erreur
                MessageBox.Show("Veuillez entrer votre nom d'utilisateur"); //Affiche un message d'erreur si le nom d'utiisateur est vide
                return false;

            }
            //Vérifie si le mot de passe est vide
            else if (string.IsNullOrEmpty(Password))
            {
                MessageBox.Show("Veuillez entrer votre mot de passe"); //Affiche un message d'erreur si le mot de passe est vide
                return false;
            }
            //Dans ce "else" on vérifie que le nom d'utilisateur soit correct
            else
            {
                //Crée une nouvelle instance de la classe Database_Manager pour executer la requête
                Database_Manager db = new Database_Manager();
                SQLiteDataReader results = db.SqlRequest("SELECT * FROM Utilisateurs WHERE USR_ID ='" + Username + "' AND " + "USR_Password ='******';");
                try
                {
                    // Lis la prochaine ligne des résultats de la requête tant que la ligne existe
                    while (results.Read())
                    {
                        // Sécurité supplémentaire, vérifie si le nom d'utilisateur et mot de passe sont corrects
                        if (results.GetValue(0).Equals(Username) || results.GetValue(1).Equals(Password))
                        {
                            isadmin = (bool)results.GetValue(4);
                            CurrentUser.IsAdmin = isadmin;
                            CurrentUser.UserID = results.GetValue(0).ToString();
                            return true;
                        }
                        else
                        {
                            return false;
                        }
                    }
<<<<<<< HEAD
                    return false;
        private void BuildVisiteForm(bool modifier)
        {
            if (modifier)
            {
            }
            else
            {
                rdbVstRdvNon.Checked    = true;
                lblVstPatientActif.Text = CurrentPatient.Prenom + CurrentPatient.Nom;
                try
                {
                    Database_Manager db      = new Database_Manager();
                    SQLiteDataReader results = db.SqlRequest("SELECT CON_ID, CON_Date_Heure FROM Consultation WHERE CON_PAT_FID IS '" + CurrentPatient.Id + "';");

                    while (results.Read())
                    {
                        cbxVstListeRdv.Items.Add("Rendez-vous " + results.GetValue(0) + " pour le " + results.GetValue(1).ToString());
                    }
                    results.Close();

                    tlpVstServicesRendus.RowCount = 1;
                    tlpVstServicesRendus.Controls.Add(new Label {
                        Text = "Type MedEasy"
                    }, 0, 1);
                    tlpVstServicesRendus.Controls.Add(new Label {
                        Text = "Description"
                    }, 1, 1);
                    tlpVstServicesRendus.Controls.Add(new Label {
                        Text = "Durée (min)"
                    }, 2, 1);
                }
                catch (Exception e)
                {
                    Exception_Manager.NewException(e, "", false);
                }
                cbxVstListeRdv.Enabled = false;
            }
        }
        private void btnActions_Click(object sender, EventArgs e)
        {
            Button btn = (Button)sender;

            if (Regex.IsMatch(btn.Name, "btnSelectionnerPatient*"))
            {
                try
                {
                    Database_Manager db      = new Database_Manager();
                    SQLiteDataReader results = db.SqlRequest("SELECT PAT_Nom, PAT_Prenom, PAT_Date_Naissance FROM Patient WHERE PAT_ID IS " + Regex.Match(btn.Name, @"\d+$").Value);
                    if (results.Read())
                    {
                        int age = 0;
                        age = DateTime.Now.Year - Convert.ToDateTime(results.GetValue(2)).Year;
                        if (DateTime.Now.DayOfYear < Convert.ToDateTime(results.GetValue(2)).DayOfYear)
                        {
                            age--;
                        }
                        CurrentPatient.Id       = Convert.ToInt32(Regex.Match(btn.Name, @"\d+$").Value);
                        lblPatientactif.Text    = (CurrentPatient.Prenom = results.GetValue(1).ToString()) + " " + (CurrentPatient.Nom = results.GetValue(0).ToString());
                        lblPatientactifage.Text = Convert.ToString(CurrentPatient.Age = age);
                    }
                    results.Close();
                }
                catch (Exception ex)
                {
                    Exception_Manager.NewException(ex, "Le patient sélectionné n'a pas pu être trouvé", false);
                }
            }
            else if (Regex.IsMatch(btn.Name, "btnModifierPatient*"))
            {
                MessageBox.Show("Fonctionalitlé en cours de création");
            }
            else if (Regex.IsMatch(btn.Name, "btnSupprimmerPatient*"))
            {
                try
                {
                    Data_Handler.DeletePatient(Convert.ToInt16(Regex.Match(btn.Name, @"\d+$").Value));
                    PanelManager("ListePatients");
                }
                catch (Exception ex)
                {
                    Exception_Manager.NewException(ex, "Le patient sélectionné n'a pas pu être supprimmé", false);
                }
            }
            else if (Regex.IsMatch(btn.Name, "btnModifierRendezVous*"))
            {
                MessageBox.Show("Fonctionalitlé en cours de création");
            }
            else if (Regex.IsMatch(btn.Name, "btnSupprimmerRendezVous*"))
            {
                try
                {
                    Data_Handler.DeleteConsultationRendezVous(Convert.ToInt16(Regex.Match(btn.Name, @"\d+$").Value));
                    PanelManager("RendezVous");
                }
                catch (Exception ex)
                {
                    Exception_Manager.NewException(ex, "Le Rendez-Vous sélectionné n'a pas pu être supprimmé", false);
                }
            }
            else
            {
                Exception_Manager.NewException(new Exception("NoMatchBtnName:" + btn.Name), "L'élément sélectionné n'a pas pu être trouvé", false);
            }
        }
        private bool BuildPatientsTable()
        {
            tblPatients.Controls.Clear();
            tblPatients.RowCount = 1;
            tblPatients.Controls.Add(new Label()
            {
                Text = "ID Patient"
            }, 0, 0);
            tblPatients.Controls.Add(new Label()
            {
                Text = "Nom"
            }, 1, 0);
            tblPatients.Controls.Add(new Label()
            {
                Text = "Prénom"
            }, 2, 0);
            tblPatients.Controls.Add(new Label()
            {
                Text = "Date de Naissance"
            }, 3, 0);
            tblPatients.Controls.Add(new Label()
            {
                Text = "Numéro AVS"
            }, 4, 0);
            tblPatients.Controls.Add(new Label()
            {
                Text = "Actions"
            }, 5, 0);

            try
            {
                Database_Manager db = new Database_Manager();

                SQLiteDataReader results = db.SqlRequest("SELECT PAT_ID, PAT_NOM, PAT_PRENOM, PAT_Date_Naissance, PAT_Ass_Numero_Avs FROM Patient");
                while (results.Read())
                {
                    tblPatients.RowCount = tblPatients.RowCount + 1;
                    tblPatients.Controls.Add(new Label()
                    {
                        Text = results.GetValue(0).ToString()
                    }, 0, tblPatients.RowCount - 1);
                    tblPatients.Controls.Add(new Label()
                    {
                        Text = results.GetValue(1).ToString()
                    }, 1, tblPatients.RowCount - 1);
                    tblPatients.Controls.Add(new Label()
                    {
                        Text = results.GetValue(2).ToString()
                    }, 2, tblPatients.RowCount - 1);
                    tblPatients.Controls.Add(new Label()
                    {
                        Text = results.GetDateTime(3).ToString()
                    }, 3, tblPatients.RowCount - 1);
                    tblPatients.Controls.Add(new Label()
                    {
                        Text = results.GetValue(4).ToString()
                    }, 4, tblPatients.RowCount - 1);
                    tblPatients.Controls.Add(BuildActionsPanel("Patient", Convert.ToInt32(results.GetValue(0))), 5, tblPatients.RowCount - 1);
                }
                results.Close();
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
                return(false);
            }
            return(true);
        }
        private bool BuildRendezvousTable()
        {
            tblListeRendezvous.Controls.Clear();
            tblListeRendezvous.RowCount = 1;
            tblListeRendezvous.Controls.Add(new Label()
            {
                Text = "ID Patient"
            }, 0, 0);
            tblListeRendezvous.Controls.Add(new Label()
            {
                Text = "Nom"
            }, 1, 0);
            tblListeRendezvous.Controls.Add(new Label()
            {
                Text = "Prénom"
            }, 2, 0);
            tblListeRendezvous.Controls.Add(new Label()
            {
                Text = "Date"
            }, 3, 0);
            tblListeRendezvous.Controls.Add(new Label()
            {
                Text = "Heure d'arrivée"
            }, 4, 0);
            tblListeRendezvous.Controls.Add(new Label()
            {
                Text = "Première consultation"
            }, 5, 0);
            tblListeRendezvous.Controls.Add(new Label()
            {
                Text = "Actions"
            }, 6, 0);

            try
            {
                Database_Manager db = new Database_Manager();

                SQLiteDataReader results = db.SqlRequest("SELECT C.CON_Premiere_Consultation, C.CON_Date_Heure, C.CON_PAT_FID, P.PAT_Prenom, P.PAT_Nom, C.CON_ID  FROM Consultation C LEFT JOIN Patient P ON C.CON_PAT_FID = P.PAT_ID WHERE C.CON_Visite_Effectuee = 'False' ORDER BY 'C.CON_DATE_HEURE';");
                while (results.Read())
                {
                    DateTime rdvdateheure = (DateTime)results.GetValue(1);

                    Panel pnlActions = BuildActionsPanel("RendezVous", Convert.ToInt32(results.GetValue(5)));

                    tblListeRendezvous.RowCount = tblListeRendezvous.RowCount + 1;
                    tblListeRendezvous.Controls.Add(new Label()
                    {
                        Text = results.GetValue(2).ToString()
                    }, 0, tblListeRendezvous.RowCount - 1);
                    tblListeRendezvous.Controls.Add(new Label()
                    {
                        Text = results.GetValue(4).ToString()
                    }, 1, tblListeRendezvous.RowCount - 1);
                    tblListeRendezvous.Controls.Add(new Label()
                    {
                        Text = results.GetValue(3).ToString()
                    }, 2, tblListeRendezvous.RowCount - 1);
                    tblListeRendezvous.Controls.Add(new Label()
                    {
                        Text = rdvdateheure.ToString("yyyy-MM-dd")
                    }, 3, tblListeRendezvous.RowCount - 1);
                    tblListeRendezvous.Controls.Add(new Label()
                    {
                        Text = rdvdateheure.ToString("HH:mm:ss")
                    }, 4, tblListeRendezvous.RowCount - 1);
                    if ((bool)results.GetValue(0) == true)
                    {
                        tblListeRendezvous.Controls.Add(new Label()
                        {
                            Text = "Oui"
                        }, 5, tblListeRendezvous.RowCount - 1);
                    }
                    else
                    {
                        tblListeRendezvous.Controls.Add(new Label()
                        {
                            Text = "Non"
                        }, 5, tblListeRendezvous.RowCount - 1);
                    }
                    tblListeRendezvous.Controls.Add(pnlActions, 6, tblListeRendezvous.RowCount - 1);
                }
                results.Close();
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
                return(false);
            }
            return(true);
        }