/// <summary>
/// Handles the Click event of the btnChange control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
protected void btnChange_Click( object sender, EventArgs e )
{
var userLoginService = new UserLoginService();
var userLogin = userLoginService.GetByUserName( tbUserName.Text );
if ( userLogin != null )
{
if ( UserLoginService.IsPasswordValid( tbPassword.Text ) )
{
if ( userLoginService.ChangePassword( userLogin, tbOldPassword.Text, tbPassword.Text ) )
{
userLoginService.Save( userLogin, CurrentPersonId );
lSuccess.Text = GetAttributeValue( "SuccessCaption" );
pnlEntry.Visible = false;
pnlSuccess.Visible = true;
}
else
DisplayError( "InvalidPasswordCaption" );
}
else
{
InvalidPassword();
}
}
else
DisplayError( "InvalidUserNameCaption" );
}