2023-06-22 09:35:51 +02:00
using BeWo.ServiceProxy ;
using BS.Shared ;
using BS.Shared.Translation ;
using System ;
using System.Windows ;
namespace BeWo.View
{
public partial class ExceptionMessageBoxWithSupportMail
{
public ExceptionMessageBoxWithSupportMail ( Exception ex )
{
InitializeComponent ( ) ;
tb_errorTitle . Text = Translator . Translate ( "Es ist leider ein unbekannter Fehler aufgetreten." ) ;
tb_message . Text = Translator . Translate (
"Wir entschuldigen uns für die Unannehmlichkeiten. Wenn Sie möchten, können Sie die Fehlermeldung direkt an unseren Support schicken." ) ;
tb_description . Text = Translator . Translate ( "Möchten Sie uns erläutern, unter welchen Umständen der Fehler aufgetreten ist?" ) ;
chkKontaktdaten . Content = Translator . Translate ( "Kontaktdaten übermittlen" ) ;
tb_kontaktdatentitle . Text = Translator . Translate ( "Wenn Sie uns Ihre E-Mail Adresse oder Telefonnummer mitteilen, können wir Sie bei Rückfragen leichter kontaktieren." ) ;
if ( ex ! = null )
{
tb_stack . Text = String . Format ( "{0}:\n{1}" , ex . Message , ex . StackTrace ) ;
}
}
private void Button_SendToSupport_Click ( object sender , RoutedEventArgs e )
{
string nachricht = String . Format ( "Beschreibung:\n{0}" , tb_errorDesciption . Text ) ;
2024-03-18 00:16:56 +01:00
nachricht + = string . Format ( "\n\n{0}" , BeWoApp . Version ) ;
2023-06-22 09:35:51 +02:00
if ( CheckBoxSupportPin . IsChecked . HasValue & & CheckBoxSupportPin . IsChecked . Value )
{
2023-10-26 00:06:56 +02:00
nachricht + = string . Format ( "\n\nPIN: *****" ) ;
2023-06-22 09:35:51 +02:00
}
if ( chkKontaktdaten . IsChecked . HasValue & & chkKontaktdaten . IsChecked . Value )
{
nachricht + = string . Format ( "\n\nKontaktdaten: {0}" , tb_kontaktdaten . Text ) ;
}
nachricht + = String . Format ( "\n\nFehlerdetails:\n{0}" , tb_stack . Text ) ;
EMailVersenden ( "" , "" , "FEHLERMELDUNG" , nachricht ) ;
}
private void EMailVersenden ( string senderName , string senderEMail , string betreff , string nachricht )
{
var result = ServiceFacade . DoMailServiceSync ( m = > m . SendEMailWithSender ( senderName , senderEMail , betreff , nachricht ) ) ;
if ( result )
{
CloseDialog ( ) ;
MessageBox . Show ( "Die E-Mail wurde erfolgreich versendet." , "E-Mail senden" , MessageBoxButton . OK ,
MessageBoxImage . Information ) ;
}
else
{
MessageBox . Show ( "Die E-Mail konnte leider nicht gesendet werden" , "E-Mail senden" , MessageBoxButton . OK ,
MessageBoxImage . Error ) ;
}
}
private void Button_Click ( object sender , RoutedEventArgs e )
{
CloseDialog ( ) ;
}
private void CloseDialog ( )
{
if ( BeWoApp . MainControl ! = null )
{
BeWoApp . MainControl . CloseCurrentPopUp ( ) ;
}
else if ( BeWoApp . LoginControl ! = null )
{
BeWoApp . LoginControl . CloseCurrentPopUp ( ) ;
}
}
private void chkKontaktdaten_Checked ( object sender , RoutedEventArgs e )
{
if ( chkKontaktdaten . IsChecked . HasValue & & chkKontaktdaten . IsChecked . Value )
{
if ( BeWoApp . LoggedOnEmployee ! = null )
{
if ( BeWoApp . LoggedOnEmployee . ContactInformations ! = null )
{
foreach ( var contact in BeWoApp . LoggedOnEmployee . ContactInformations )
{
if ( contact . ContactType = = ContactType . business_Mail )
{
tb_kontaktdaten . Text = contact . ContactValue ;
}
}
}
}
}
}
}
}