private void btnMettreAJour_Click(object sender, EventArgs e) { try { if (SiFormulaireRempliCorrectement) { if (SiMDPConvient) { employeBLO.ModifierEmploye(this.employe, txbMDP.Text, RetourStatutEmploye(cmbRoleEmploye.Text), this.employeChef); new Uc_GererEmploye(this.employeChef).RefreshDataGrid(employeBLO.TousEmployes); fonction.AfficheMessageNotification(Color.FromArgb(33, 191, 116), "Modification", $"Employe modifie !"); } else { fonction.AfficheMessageNotification(Color.FromArgb(248, 43, 43), "Modification", "Les mots de passe non identiques !"); } } else { fonction.AfficheMessageNotification(Color.FromArgb(248, 43, 43), "Modification", "Veillez remplir tous les champs !"); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnAjouter_Click(object sender, EventArgs e) { try { if (SiFormulaireRempliCorrectement) { if (this.pays == null) { paysBLO.AjouterPays(txbNom.Text, txbCodeTelephone.Text, this.employe); fonction.AfficheMessageNotification(Color.FromArgb(33, 191, 116), "Ajout", $"Pays ajoute !"); } else { paysBLO.ModifierPays(this.pays, txbNom.Text, txbCodeTelephone.Text, this.employe); fonction.AfficheMessageNotification(Color.FromArgb(33, 191, 116), "Modification", $"Pays modifie !"); } InitForm(); } else { fonction.AfficheMessageNotification(Color.FromArgb(248, 43, 43), "Modification", "Veillez remplir tous les champs !"); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnConnexion_Click(object sender, EventArgs e) { try { if (txbNomUtilisateur.Text != string.Empty || txbPassword.Text != string.Empty) { Employe employe = employeBLO.SeConnecter(txbNomUtilisateur.Text, txbPassword.Text); if (employe != null) { fonction.AfficheMessageNotification(Color.FromArgb(33, 191, 116), "Authentification", $"Bienvenue {employe.StatutEmploye.ToString().Replace("_", " ")} {employe.NomComplet}"); Frm_Principal frm_Principal = new Frm_Principal(employe); frm_Principal.Show(); } else { fonction.AfficheMessageNotification(Color.FromArgb(248, 43, 43), "Authentification", "Compte errone"); } } else { MessageBox.Show("Veillez remplir tous les champs !", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnEnregistrer_Click_1(object sender, EventArgs e) { try { string fileName = fonction.PictureName(pbEmploye); if (SiFormulaireRempliCorrectement) { if (SiAgeConvient) { if (PersonneBLO.VerifierCNIExist(txbNumeroCNI.Text, new Client(), new Employe())) { if (SiMDPConvient) { employeBLO.AjouterEmploye(txbNomComplet.Text, dtDateNaissance.Value.Date, txbLieuNaissance.Text, RetourSexe(cmbSexe.Text), txbNumeroCNI.Text, $"{cmbCodeTelephone1.Text} {txbNumero1.Text} ", $"{cmbCodeTelephone2.Text} {txbNumero2.Text} ", paysBLO.RechercherUnPays(cmbPays.Text), villeBLO.RechercherUneVille(cmbVille.Text), txbAdresse.Text, fileName, txbMotDePasse.Text, RetourStatutEmploye(cmbRoleEmploye.Text), this.employe); new Uc_GererEmploye(this.employe).RefreshDataGrid(employeBLO.TousEmployes); fonction.AfficheMessageNotification(Color.FromArgb(33, 191, 116), "Enregistrement", $"Employe ajoute !"); InitForm(); } else { fonction.AfficheMessageNotification(Color.FromArgb(248, 43, 43), "Enregistrement", "Les mots de passe non identiques !"); } } else { fonction.AfficheMessageNotification(Color.FromArgb(248, 43, 43), "Enregistrement", "Ce numero de CNI est deja utilise !"); } } else { fonction.AfficheMessageNotification(Color.FromArgb(248, 43, 43), "Enregistrement", $"Votre age ne convient pas a l'age minimal " + $"({new ParametreGeneralBLO().TousParametreGenerals[0].AgeMinimalRequis}) !"); } } else { fonction.AfficheMessageNotification(Color.FromArgb(248, 43, 43), "Enregistrement", "Veillez remplir tous les champs !"); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error); } }