Exemple #1
0
 private void btn_valider_Click(object sender, EventArgs e)
 {
     if (txt_nom.Text == "" || txt_pays.Text == "" || txt_adresse1.Text == "" || txt_CP.Text == "" || cbx_communes.Text == "")
     {
         MessageBox.Show("Merci de remplir tous les champs obligatoires");
     }
     else
     {
         bool retourConfirmation = RequetesSql.Ajout_Ext(cbx_civilite.Text, sexe, txt_nom.Text, txt_prenom.Text, txt_nommarital.Text, cbx_cplt_titre.Text, cbx_spe.Text, txt_rpps.Text, txt_apicrypt.Text, txt_pays.Text, txt_adresse1.Text, txt_adresse2.Text, txt_adresse3.Text, txt_adresse4.Text, txt_adresseloc.Text, txt_CP.Text, cbx_communes.Text, txt_tel1.Text, txt_tel2.Text);
         if (retourConfirmation != false)
         {
             MessageBox.Show("Enregistrement effectué");
         }
         else
         {
             MessageBox.Show("Erreur");
         }
     }
 }
        public void Rechercher(string prenom, string nom, string nomMarital, string cpltTitre, string specialite, string commune, string cp, string apicrypt, string rpps, string datecrea)
        {
            int nb_ext = 0;

            try
            {
                dtgv_search.DataSource = null;
                dtgv_search.Refresh();
                /*requete recuperation resultats*/
                resultatControle = RequetesSql.Recherche_EXT(prenom, nom, nomMarital, cpltTitre, specialite, commune, cp, apicrypt, rpps, datecrea);
                if (resultatControle.Rows.Count != 0)
                {
                    Recherche         = true;
                    pict_Ext.Image    = Properties.Resources.tab_white;
                    lbl_Ext.ForeColor = Color.Black;
                    lbl_Ext.BackColor = Color.White;
                    lbl_Ext.Font      = new System.Drawing.Font("Avenir LT Std 55 Roman", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));

                    dtgv_search.DataSource = resultatControle;
                    nb_ext = dtgv_search.RowCount;
                    dtgv_search.Columns[0].Width  = 100;
                    dtgv_search.Columns[1].Width  = 100;
                    dtgv_search.Columns[2].Width  = 100;
                    dtgv_search.Columns[3].Width  = 130;
                    dtgv_search.Columns[4].Width  = 160;
                    dtgv_search.Columns[5].Width  = 150;
                    dtgv_search.Columns[6].Width  = 70;
                    dtgv_search.Columns[7].Width  = 170;
                    dtgv_search.Columns[8].Width  = 140;
                    dtgv_search.Columns[9].Width  = 110;
                    dtgv_search.Columns[10].Width = 90;

                    dtgv_search.Columns[0].HeaderText  = "Nom";
                    dtgv_search.Columns[1].HeaderText  = "Prénom";
                    dtgv_search.Columns[2].HeaderText  = "Nom Ep";
                    dtgv_search.Columns[3].HeaderText  = "C. Titre";
                    dtgv_search.Columns[4].HeaderText  = "Spécialité";
                    dtgv_search.Columns[5].HeaderText  = "Commune";
                    dtgv_search.Columns[6].HeaderText  = "CP";
                    dtgv_search.Columns[7].HeaderText  = "Adresse";
                    dtgv_search.Columns[8].HeaderText  = "Pays";
                    dtgv_search.Columns[9].HeaderText  = "RPPS";
                    dtgv_search.Columns[10].HeaderText = "Titre";

                    if (nb_ext > 1)
                    {
                        lbl_Ext.Text = "Externes " + nb_ext + "";
                    }
                    else if (nb_ext < 1)
                    {
                        lbl_Ext.Text = "Externe " + nb_ext + "";
                    }
                }
                else
                {
                    //Popup(getResourcesString("ErreurADM"), "Erreur", "OK", "WARN");
                    MessageBox.Show("Aucun correspondant(s) trouvé(s)");
                }
            }
            catch (System.Exception exception)
            {
                //  Popup(exception.Message.ToString(), "Erreur", "OK", "WARN");
                MessageBox.Show(exception.Message.ToString());
            }
            finally
            {
            }
        }