Ejemplo n.º 1
0
        private void btnRdvConfirmer_Click(object sender, EventArgs e)
        {
            bool checkedradiobutton = false;

            foreach (Control c in pnlRendezVous.Controls)
            {
                if (c is GroupBox)
                {
                    GroupBox groupBox = c as GroupBox;
                    ttpARemplir.Hide(this);
                    groupBox.BackColor = DefaultBackColor;
                    foreach (RadioButton rdb in groupBox.Controls.OfType <RadioButton>())
                    {
                        if (rdb.Checked)
                        {
                            checkedradiobutton = true;
                            break;
                        }
                        else
                        {
                            checkedradiobutton = false;
                        }
                    }
                    if (checkedradiobutton == false)
                    {
                        ttpARemplir.Show("Veuillez choisir une option", groupBox);
                        groupBox.BackColor = Color.Red;
                        break;
                    }
                }
            }
            if (checkedradiobutton)
            {
                try
                {
                    Data_Handler.CreateRendezVousConsultation(CurrentPatient.Id, rdbRdvPremiereConsultOui.Checked, rdbRdvPremiereConsultOui.Checked, dtpRdvDate.Value, rtbRdvNotes.ToString(), false);
                    PanelManager("ListeRendezVous");
                }
                catch (Exception ex)
                {
                    Exception_Manager.NewException(ex, "Le rendez-vous n'a pas pu être créé", false);
                }
            }
        }
Ejemplo n.º 2
0
        private void btnVstConfirmer_Click(object sender, EventArgs e)
        {
            int[]    id          = new int[tlpVstServicesRendus.RowCount];
            string[] description = new string[tlpVstServicesRendus.RowCount];
            int[]    minutes     = new int[tlpVstServicesRendus.RowCount];
            int      i           = 0;
            bool     error       = false;
            int      idconsultation;

            foreach (ComboBox c in tlpVstServicesRendus.Controls.OfType <ComboBox>())
            {
                ComboBox cbx = c as ComboBox;
                switch (cbx.SelectedItem)
                {
                case "Entretien / Collecte d'infos":
                    id[i]         = 1;
                    cbx.BackColor = DefaultBackColor;
                    break;

                case "Examen Physique":
                    id[i]         = 2;
                    cbx.BackColor = DefaultBackColor;
                    break;

                case "Examen Complémentaire":
                    id[i]         = 3;
                    cbx.BackColor = DefaultBackColor;
                    break;

                case "Vaccination / Prise de sang":
                    id[i]         = 4;
                    cbx.BackColor = DefaultBackColor;
                    break;

                case "Chirurgie":
                    id[i]         = 5;
                    cbx.BackColor = DefaultBackColor;
                    break;

                default:
                    error = true;
                    cbx.Focus();
                    ttpARemplir.Show("Veuillez choisir un type", cbx);
                    cbx.BackColor = Color.Red;
                    break;
                }
                i++;
            }
            i = 0;

            foreach (TextBox c in tlpVstServicesRendus.Controls.OfType <TextBox>())
            {
                if (Regex.IsMatch(c.Name, "btnServiceDescription*"))
                {
                    description[i] = c.Text.Trim();
                }
                else
                {
                    try
                    {
                        minutes[i] = Convert.ToInt32(c.Text.Trim());
                        i++;
                    }
                    catch (Exception)
                    {
                        error = true;
                        c.Focus();
                        ttpARemplir.Show("Veuillez entrer un nombre en format numérique", c);
                    }
                }
            }
            if (!error)
            {
                if (rdbVstRdvNon.Checked)
                {
                    SQLiteDataReader reader = Data_Handler.CreateRendezVousConsultation(CurrentPatient.Id, false, false, DateTime.Now, rtbVstNotes.Text, true);
                    reader.Read();
                    idconsultation = Convert.ToInt32(reader.GetValue(0).ToString());
                    reader.Close();
                }
                else
                {
                    Data_Handler.UpdateRendezVousToConsultation(idconsultation = Convert.ToInt32(Regex.Match(cbxVstListeRdv.SelectedItem.ToString(), "(^|\\s)([0-9]+)($|\\s)").ToString()), lblVstNotes.Text.Trim());
                }
                i = 0;
                foreach (int row in id)
                {
                    if (description[i] != null && minutes[i] != 0)
                    {
                        Data_Handler.AddServiceToConsultation(row, description[i], minutes[i], idconsultation);
                    }
                    i++;
                }
                PanelManager("ValidationFacture");
                BuildServicesRendusTable(idconsultation);
                lblVFIDConsultation.Text = idconsultation.ToString();
                lblVstPatientActif.Text  = CurrentPatient.Prenom + CurrentPatient.Nom;
            }
        }
Ejemplo n.º 3
0
        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);
            }
        }
Ejemplo n.º 4
0
        private void btnConfirmerNvPat_Click(object sender, EventArgs e)
        {
            int emptyfieldcount = 0;

            foreach (Control c in pnlNouveauPatient.Controls)
            {
                if (c is TextBox)
                {
                    TextBox textBox = c as TextBox;
                    if (textBox.Text == string.Empty && (textBox.Name == txtNom.Name || textBox.Name == txtPrenom.Name || textBox.Name == txtAdresse.Name || textBox.Name == txtCP.Name || textBox.Name == txtOrigine.Name))
                    {
                        emptyfieldcount++;
                        textBox.Focus();
                        textBox.BackColor = Color.Red;
                        if (emptyfieldcount <= 1)
                        {
                            ttpARemplir.Show("Veuillez remplir ce champ", textBox);
                        }
                    }
                    else
                    {
                        textBox.BackColor = DefaultBackColor;
                    }
                }
                if (c is ComboBox)
                {
                    ComboBox comboBox = c as ComboBox;
                    if (comboBox.SelectedItem == null && comboBox.Name != cbxEmpCanton.Name)
                    {
                        emptyfieldcount++;
                        comboBox.Focus();
                        comboBox.BackColor = Color.Red;
                        if (emptyfieldcount <= 1)
                        {
                            ttpARemplir.Show("Veuillez remplir ce champ", comboBox);
                        }
                    }
                    else
                    {
                        comboBox.BackColor = DefaultBackColor;
                    }
                }
            }
            if (emptyfieldcount > 1)
            {
                MessageBox.Show("Veuillez remplir tous les champs en rouge");
            }
            else if (emptyfieldcount == 0)
            {
                if (txtTelDomicile.Text != string.Empty && !UInt64.TryParse(txtTelDomicile.Text.Trim(), out UInt64 trash))
                {
                    ttpARemplir.Show("Veuillez rentrer un numéro valide", txtTelDomicile);
                    txtTelDomicile.BackColor = Color.Red;
                    return;
                }
                else
                {
                    txtTelDomicile.BackColor = TextBox.DefaultBackColor;
                }

                if (txtTelMobile.Text != string.Empty && !UInt64.TryParse(txtTelMobile.Text.Trim(), out trash))
                {
                    ttpARemplir.Show("Veuillez rentrer un numéro valide", txtTelMobile);
                    txtTelMobile.BackColor = Color.Red;
                    return;
                }
                else
                {
                    txtTelMobile.BackColor = TextBox.DefaultBackColor;
                }

                if (txtTelPro.Text != string.Empty && !UInt64.TryParse(txtTelPro.Text.Trim(), out trash))
                {
                    ttpARemplir.Show("Veuillez rentrer un numéro valide", txtTelPro);
                    txtTelPro.BackColor = Color.Red;
                    return;
                }
                else
                {
                    txtTelPro.BackColor = TextBox.DefaultBackColor;
                }

                if (txtTelUrgence.Text != string.Empty && !UInt64.TryParse(txtTelUrgence.Text.Trim(), out trash))
                {
                    ttpARemplir.Show("Veuillez rentrer un numéro valide", txtTelUrgence);
                    txtTelUrgence.BackColor = Color.Red;
                    return;
                }
                else
                {
                    txtTelUrgence.BackColor = TextBox.DefaultBackColor;
                }

                if (txtCP.Text != string.Empty)
                {
                    if (!Regex.IsMatch(txtCP.Text, "[0-9][0-9][0-9][0-9]$"))
                    {
                        ttpARemplir.Show("Veuillez entrer un Code Postal valide", txtCP);
                        txtCP.BackColor = Color.Red;
                        return;
                    }
                }
                else
                {
                    txtCP.BackColor = TextBox.DefaultBackColor;
                }

                if (txtEmpCP.Text != string.Empty)
                {
                    if (!Regex.IsMatch(txtEmpCP.Text, "[0-9][0-9][0-9][0-9]$"))
                    {
                        ttpARemplir.Show("Veuillez entrer un Code Postal valide", txtEmpCP);
                        txtEmpCP.BackColor = Color.Red;
                        return;
                    }
                }
                else
                {
                    txtEmpCP.BackColor = TextBox.DefaultBackColor;
                }

                if (txtEmail.Text != string.Empty)
                {
                    try { new System.Net.Mail.MailAddress(txtEmail.Text); }
                    catch
                    {
                        ttpARemplir.Show("Veuillez rentrer une adresse email valide", txtTelPro);
                        txtEmail.BackColor = Color.Red;
                        return;
                    }
                }
                else
                {
                    txtEmail.BackColor = TextBox.DefaultBackColor;
                }

                string canton;
                string titre;
                string etatCivil;
                string cantonEmployeur;

                try { canton = cbxCanton.SelectedItem.ToString(); }
                catch { canton = string.Empty; }

                try { titre = cbxTitre.SelectedItem.ToString(); }
                catch { titre = string.Empty; }

                try { etatCivil = cbxEtatCivil.SelectedItem.ToString(); }
                catch { etatCivil = string.Empty; }

                try { cantonEmployeur = cbxEmpCanton.SelectedItem.ToString(); }
                catch { cantonEmployeur = string.Empty; }

                try
                {
                    Data_Handler.CreatePatient(txtNom.Text.Trim(), txtPrenom.Text.Trim() + "" + txtPrenom2.Text.Trim(), dtpNaissance.Value.Date, titre, etatCivil, txtOrigine.Text.Trim(), txtAdresse.Text.Trim(), txtVille.Text.Trim(), txtCP.Text.Trim(), canton, txtTelMobile.Text.Trim(), txtTelPro.Text.Trim(), txtTelUrgence.Text.Trim(), txtEmail.Text.Trim(), txtEmpNom.Text.Trim(), txtEmpAdresse.Text.Trim(), cantonEmployeur, txtEmpVille.Text.Trim(), txtEmpCP.Text.Trim(), txtEmpPays.Text.Trim(), txtNumAvs.Text.Trim(), txtNumCarte.Text.Trim(), txtNumOFSP.Text.Trim(), txtInstitution.Text.Trim(), txtNumPolice.Text.Trim());
                }
                catch (Exception e2)
                {
                    Exception_Manager.NewException(e2, "Une erreur est survenue durant la création du patient", false);
                }
                finally
                {
                    PanelManager("ListePatients");
                }
            }
        }
Ejemplo n.º 5
0
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (e.ColumnIndex == 1 && e.RowIndex >= 0)
                {
                    this.dataGridView1.CommitEdit(DataGridViewDataErrorContexts.Commit);
                }
                string signalname = this.dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString();
                //Check the value of cell
                if ((bool)this.dataGridView1.CurrentCell.Value == true)
                {
                    Dictionary <DateTime, double[]> result     = new Dictionary <DateTime, double[]>();
                    Dictionary <DateTime, double[]> ref_result = new Dictionary <DateTime, double[]>();

                    List <KeyValuePair <DateTime, double> > original_values      = new List <KeyValuePair <DateTime, double> >();
                    List <KeyValuePair <DateTime, double> > estimated_values     = new List <KeyValuePair <DateTime, double> >();
                    List <KeyValuePair <DateTime, double> > ref_original_values  = new List <KeyValuePair <DateTime, double> >();
                    List <KeyValuePair <DateTime, double> > ref_estimated_values = new List <KeyValuePair <DateTime, double> >();
                    Data_Handler.GetSignalResult(signalname, result);
                    foreach (var frame in result)
                    {
                        original_values.Add(new KeyValuePair <DateTime, double>(frame.Key, frame.Value[0]));
                        if (frame.Value.Count() == 2)
                        {
                            estimated_values.Add(new KeyValuePair <DateTime, double>(frame.Key, frame.Value[1]));
                        }
                    }
                    if (_refAngle != "" && _refAngle != null)
                    {
                        Data_Handler.GetSignalResult(_refAngle, ref_result);
                        foreach (var frame in ref_result)
                        {
                            ref_original_values.Add(new KeyValuePair <DateTime, double>(frame.Key, frame.Value[0]));
                            ref_estimated_values.Add(new KeyValuePair <DateTime, double>(frame.Key, frame.Value[1]));
                        }
                        AddLinesWithRef(signalname, original_values, ref_original_values);
                        if (estimated_values.Count > 0 || ref_estimated_values.Count > 0)
                        {
                            AddLinesWithRef("Estimated_" + signalname, estimated_values, ref_estimated_values);
                        }
                    }
                    else
                    {
                        AddLines(signalname, original_values);
                        if (estimated_values.Count > 0)
                        {
                            AddLines("Estimated_" + signalname, estimated_values);
                        }
                    }
                }
                else
                {
                    DeselectLines(signalname);
                    DeselectLines("Estimated_" + signalname);
                }
            }
            catch (Exception ex)
            {
                Log4NetHelper.Instance.LogEntries(new LogEntry(DateTime.Now, "Error", ex.Message));
            }
        }