Skip to content
Snippets Groups Projects

MAJ

Merged MARQUE ELISE requested to merge e.marque/sae_a21_d21:main into main
Compare and
3 files
+ 106
23
Preferences
Compare changes
Files
3
@@ -136,15 +136,46 @@ namespace SAE_D21_A21_Jeroglifico.Pages
private void txtNom_KeyPress(object sender, KeyPressEventArgs e)
{
erpMessageNom.Clear();
// Traitement de la touche Entrée
if (e.KeyChar == (char)Keys.Enter) { }
// Traitement de la touche Retour
else if (e.KeyChar == (char)Keys.Back) { }
// Ce qu'on accepte dans la cbo : des lettres et un tiret pour les noms composés
else if (char.IsLetter(e.KeyChar) || e.KeyChar == '-') { }
// Sinon on accepte rien
if (txtNom.Text.Length <= 30 || e.KeyChar == (char)Keys.Back)
{
// Traitement de la touche retour
if (e.KeyChar == (char)Keys.Back) { }
// Ce qu'on accepte dans la texteBox : des lettres et un tiret pour les noms composés
// Il peut y avoir un nom composé donc on accepte plusieurs tirets,
// mais pas d'affilée
else if (char.IsLetter(e.KeyChar))
{
erpMessageNom.Clear();
}
else if (e.KeyChar == '-')
{
try
{
if (txtNom.SelectionStart == 0)
{
// empecher l'évènement
e.Handled = true;
}
else if (txtNom.Text[txtNom.Text.Length - 1] == '-')
{
// empecher l'évènement
e.Handled = true;
}
}
catch (IndexOutOfRangeException)
{
}
}
// Sinon on accepte rien
else
{
e.Handled = true;
}
}
else
{
erpMessageNom.SetError(txtNom, "C'est beaucoup trop long!");
e.Handled = true;
}
}
@@ -152,15 +183,46 @@ namespace SAE_D21_A21_Jeroglifico.Pages
private void txtPrenom_KeyPress(object sender, KeyPressEventArgs e)
{
erpMessagePrenom.Clear();
// Traitement de la touche Entrée
if (e.KeyChar == (char)Keys.Enter) { }
// Traitement de la touche Retour
else if (e.KeyChar == (char)Keys.Back) { }
// Ce qu'on accepte dans la cbo : des lettres et un tiret pour les noms composés
else if (char.IsLetter(e.KeyChar) || e.KeyChar == '-') { }
// Sinon on accepte rien
if (txtPrenom.Text.Length <= 30 || e.KeyChar == (char)Keys.Back)
{
// Traitement de la touche retour
if (e.KeyChar == (char)Keys.Back) { }
// Ce qu'on accepte dans le txt : des lettres et un tiret pour les noms composés
// Il peut avoir un prénom composé donc on accèpte plusieurs tirets,
// mais pas d'affilée
else if (char.IsLetter(e.KeyChar))
{
erpMessagePrenom.Clear();
}
else if (e.KeyChar == '-')
{
try
{
if (txtPrenom.SelectionStart == 0)
{
// empecher l'évènement
e.Handled = true;
}
else if (txtPrenom.Text[txtPrenom.Text.Length - 1] == '-')
{
// empecher l'évènement
e.Handled = true;
}
}
catch (IndexOutOfRangeException)
{
}
}
// Sinon on accepte rien
else
{
e.Handled = true;
}
}
else
{
erpMessagePrenom.SetError(txtPrenom, "C'est beaucoup trop long!");
e.Handled = true;
}
}
@@ -261,6 +323,8 @@ namespace SAE_D21_A21_Jeroglifico.Pages
// Execution de la requete
OleDbCommand cd = new OleDbCommand(requete, connec);
cd.ExecuteNonQuery();
MessageBox.Show("Vous avez bien été ajouté!");
}
catch (InvalidOperationException)
{
@@ -329,17 +393,26 @@ namespace SAE_D21_A21_Jeroglifico.Pages
private void txtMail_KeyPress(object sender, KeyPressEventArgs e)
{
// Traitement de la touche Entrée
if (e.KeyChar == (char)Keys.Enter){
// Check si le mail est correctement construit
if (IsValidEmail(txtMail.Text) == true) { }
else
if (txtMail.Text.Length <= 30 || e.KeyChar == (char)Keys.Back)
{
// Traitement de la touche Entrée
if (e.KeyChar == (char)Keys.Enter)
{
erpMessageMail.SetError(txtMail, "Mail non valide");
// Check si le mail est correctement construit
if (IsValidEmail(txtMail.Text) == true) { }
else
{
erpMessageMail.SetError(txtMail, "Mail non valide");
}
}
// Traitement de la touche retour
else if (e.KeyChar == (char)Keys.Back) { }
}
else
{
erpMessageMail.SetError(txtMail, "C'est beaucoup trop long!");
e.Handled = true;
}
// Traitement de la touche retour
else if (e.KeyChar == (char)Keys.Back) { }
}
private void check_focus(object sender, EventArgs e)