private void btnResetPassword_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { try { ValidateLayout(); using (ResetPasswordDialogue dialogue = new ResetPasswordDialogue()) { if (dialogue.ShowDialog() == DialogResult.OK) { ((DB.SEC_User)BindingSource.DataSource).Password = dialogue.Password; txtPassword.Text = dialogue.Password; } } } catch (Exception ex) { if (CDS.Shared.Exception.UserInterfaceExceptionHandler.HandleException(ref ex)) { throw ex; } } }
private bool IsPasswordValid() { try { bool isValid = true; if (((DB.SEC_User)BindingSource.DataSource).Password == null || ((DB.SEC_User)BindingSource.DataSource).Password == string.Empty) { using (ResetPasswordDialogue dialogue = new ResetPasswordDialogue()) { if (dialogue.ShowDialog() == DialogResult.OK) { ((DB.SEC_User)BindingSource.DataSource).Password = dialogue.Password; txtPassword.Text = dialogue.Password; } else { isValid = false; } } } if (!isValid) { Essential.BaseAlert.ShowAlert("Invalid Password", "The user needs to have a password to be able to save.", Essential.BaseAlert.Buttons.Ok, Essential.BaseAlert.Icons.Error); } return(isValid); } catch (Exception ex) { if (CDS.Shared.Exception.UserInterfaceExceptionHandler.HandleException(ref ex)) { throw ex; } return(false); } }