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;
            }
        }