54 lines
1.7 KiB
C#
54 lines
1.7 KiB
C#
using System;
|
|
using System.Windows;
|
|
using System.Windows.Input;
|
|
|
|
using BeWo.ServiceProxy;
|
|
|
|
using BS.Shared.Extensions;
|
|
|
|
namespace BeWo
|
|
{
|
|
public partial class PwVergessenView
|
|
{
|
|
private string email = "";
|
|
public PwVergessenView()
|
|
{
|
|
InitializeComponent();
|
|
CommandBindings.Add(new CommandBinding(ApplicationCommands.Close, (s, e) => Close()));
|
|
}
|
|
|
|
private void RootGroupBox_OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
DragMove();
|
|
}
|
|
catch (Exception) { }
|
|
}
|
|
|
|
private void AnfordernClick(object sender, RoutedEventArgs e)
|
|
{
|
|
var benutzername = BenutzernamenTextBox.Text;
|
|
if (benutzername.Equals(""))
|
|
{
|
|
MessageBox.Show("Bitte geben Sie einen " + BS.Shared.Translation.Translator.Translate("Benutzernamen") + " an", "Passwort anfordern fehlgeschlagen", MessageBoxButton.OK, MessageBoxImage.Information);
|
|
return;
|
|
}
|
|
|
|
ServiceFacade.DoUserServiceAsync(s => s.GetEmailForUserName(out email, benutzername, BeWoApp.SiteOfOrigin), CallBack, true);
|
|
}
|
|
|
|
private void CallBack(bool hatEmail)
|
|
{
|
|
if(email.Equals("") || !hatEmail)
|
|
{
|
|
MessageBox.Show("Es konnte " + BS.Shared.Translation.Translator.Translate("kein Benutzer") + " mit diesem Namen gefunden werden oder " + BS.Shared.Translation.Translator.Translate("der Benutzer") + " hat keine E-Mail Adresse hinterlegt\nBitte wenden Sie sich an " + BS.Shared.Translation.Translator.Translate("Ihren Systemadministrator") + ".", "Passwort anfordern fehlgeschlagen", MessageBoxButton.OK, MessageBoxImage.Information);
|
|
return;
|
|
}
|
|
|
|
MessageBox.Show("Es wurde eine E-Mail an " + email + " gesendet");
|
|
this.Dispatch(Close);
|
|
}
|
|
}
|
|
}
|