private void btnValider_Click(object sender, EventArgs e) { if (verifier()) { try { if (txt_Telephone.Text != leVisiteur.tel || txt_Email.Text != leVisiteur.mail || txt_Adresse.Text != leVisiteur.VIS_ADRESSE || txt_CodePostal.Text != leVisiteur.VIS_CP || txt_Ville.Text != leVisiteur.VIS_VILLE) { VisiteurManager.updateVisiteur(leVisiteur.VIS_MATRICULE, txt_Adresse.Text, txt_CodePostal.Text, txt_Ville.Text, txt_Telephone.Text, txt_Email.Text); } if (txt_RegionCode.Text != laAffectation.REG_CODE || txt_Role.Text != laAffectation.TRA_ROLE) { ResponsableManager.MettreAjourAffectationVisiteur(leVisiteur.VIS_MATRICULE, txt_RegionCode.Text, dtp_DateAffectation.Value, txt_Role.Text); } MessageBox.Show("Visiteur mis à jour avec succès", "Mise à jour terminé", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { MessageBox.Show(ex.Message, "Echec de la mise à jour", MessageBoxButtons.OK, MessageBoxIcon.Error); } formParent.AfficherAffectationsVisiteurs(); this.Close(); } else { MessageBox.Show("Veuillez renseignez tous les champs obligatoire au bon format", "Erreur de saisie", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
/// <summary> /// Affiche les affectations des visiteurs dans la datagridview /// </summary> public void AfficherAffectationsVisiteurs() { List <VAFFECTATION> affectationsVisiteurs = null; if (laAffectationUtilisateur.TRA_ROLE == "Délégué") { affectationsVisiteurs = DelegueManager.ChargerAffectationsVisiteursByRegion(laAffectationUtilisateur.REG_CODE, laAffectationUtilisateur.TRA_ROLE); } else if (laAffectationUtilisateur.TRA_ROLE == "Responsable") { affectationsVisiteurs = ResponsableManager.ChargerAffectationsVisiteursBySecteur(laAffectationUtilisateur.SEC_CODE, laAffectationUtilisateur.TRA_ROLE); } bsVisiteurs.DataSource = affectationsVisiteurs; }
private void ActiverModification() { this.modification = true; this.btnAnnuler.Visible = true; this.btnAnnuler.Enabled = true; this.btnValider.Visible = true; this.btnValider.Enabled = true; this.btnModifier.Visible = false; if (this.txt_RegionLibelle != null) { this.txt_RegionLibelle.Dispose(); } this.cbx_Region = new System.Windows.Forms.ComboBox(); this.cbx_Region.BackColor = System.Drawing.Color.White; this.cbx_Region.Location = new System.Drawing.Point(76, 2); this.cbx_Region.Name = "txt_RegionLibelle"; this.cbx_Region.Size = new System.Drawing.Size(154, 20); this.cbx_Region.TabIndex = 13; this.pnl_Region.Controls.Add(this.cbx_Region); this.cbx_Region.SelectedIndexChanged += new System.EventHandler(this.cbx_Region_SelectedIndexChanged); this.cbx_Region.ValueMember = "REG_CODE"; this.cbx_Region.DisplayMember = "REG_NOM"; this.bsRegions.DataSource = ResponsableManager.ChargerRegionsSecteur(leUtilisateur.SEC_CODE); this.cbx_Region.DataSource = bsRegions; this.cbx_Region.SelectedValue = this.laAffectation.REG_CODE; this.txt_Email.ReadOnly = false; this.txt_Telephone.ReadOnly = false; this.txt_Adresse.ReadOnly = false; this.txt_CodePostal.ReadOnly = false; this.txt_Ville.ReadOnly = false; if (laAffectation.TRA_ROLE == "Visiteur") { btn_Promouvoir.Visible = true; btn_Promouvoir.Enabled = true; } else { btn_Promouvoir.Visible = false; btn_Promouvoir.Enabled = false; } }