private void LOGIN_USER_Leave(object sender, EventArgs e) { try { //dt = CLIENT_APP_PARAM.GEST.P_UTILISATEUR.RECHERCHE_UTILISATEUR(LOGIN_USER.Text); dt = CLIENT_APP_PARAM.gcws.RECHERCHE_UTILISATEUR(LOGIN_USER.Text); bs.DataSource = dt; bs.MoveFirst(); if (((DataRowView)bs.Current)["PHOTO_USER"] != null && LOGIN_USER.Text != "") { PHOTO_USER.DataBindings.Add("Image", bs, "PHOTO_USER", true); PHOTO_USER.DataBindings.Clear(); } if (Convert.ToBoolean(((DataRowView)bs.Current)["ETAT_USER"]) == true) { MessageBox.Show("Acces refusé, Cet utilisateur est bloqué!", "Accés refusé", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); LOGIN_USER.SelectAll(); buttonVALIDER.Enabled = false; } else { buttonVALIDER.Enabled = true; } } catch (Exception) { MessageBox.Show("Login invalide !", "Attention", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); PHOTO_USER.Image = PHOTO_USER.InitialImage; LOGIN_USER.SelectAll(); } }
private void LOGIN_USER_TextChanged(object sender, EventArgs e) { try { if (LOGIN_USER.Text == "") { PHOTO_USER.Image = PHOTO_USER.InitialImage; } } catch (Exception) { MessageBox.Show("Login invalide !", "Attention", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); PHOTO_USER.Image = PHOTO_USER.InitialImage; LOGIN_USER.SelectAll(); } }