Erweitertes Fehlerhandling
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using BeWo.View.Controls;
|
||||
using BeWo.ViewModel;
|
||||
using BS.Shared.Extensions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -55,11 +56,6 @@ namespace BeWo.View
|
||||
return beWoWindow;
|
||||
}
|
||||
|
||||
public static void ShowErrorMessageBox(string text)
|
||||
{
|
||||
MessageBox.Show(text, "Fehler", MessageBoxButton.OK, MessageBoxImage.Asterisk);
|
||||
}
|
||||
|
||||
private static BeWoWindow GetGenericBeWoWindow(string title, double min_height, double height, double max_height, double min_width, double width, double max_width)
|
||||
{
|
||||
var beWoWindow = new BeWoWindow();
|
||||
@@ -78,5 +74,18 @@ namespace BeWo.View
|
||||
|
||||
return beWoWindow;
|
||||
}
|
||||
|
||||
public static void ShowErrorMessageBox(string text)
|
||||
{
|
||||
MessageBox.Show(text, "Fehler", MessageBoxButton.OK, MessageBoxImage.Asterisk);
|
||||
}
|
||||
|
||||
public static void ShowTitleErrorMessageBox(string text, string title)
|
||||
{
|
||||
if (title.IsNullOrWhiteSpace())
|
||||
ShowErrorMessageBox(text);
|
||||
else
|
||||
MessageBox.Show(text, "Fehler", MessageBoxButton.OK, MessageBoxImage.Asterisk);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,26 +14,26 @@
|
||||
x:Name="btn"
|
||||
Height="24"
|
||||
Padding="0"
|
||||
Background="Transparent"
|
||||
HorizontalContentAlignment="Stretch"
|
||||
VerticalContentAlignment="Stretch"
|
||||
dx:ThemeManager.ThemeName="None"
|
||||
Background="Transparent"
|
||||
BorderBrush="Black"
|
||||
BorderThickness="1"
|
||||
Click="button_select_color_Click"
|
||||
Style="{x:Null}">
|
||||
<Grid Background="{Binding ElementName=root, Path=SelectedColor}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="auto"/>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button
|
||||
Margin="2"
|
||||
x:Name="delete_btn"
|
||||
Grid.Column="1"
|
||||
x:Name="delete_btn"
|
||||
Width="18"
|
||||
Height="18"
|
||||
Click="delete_btn_DeleteClick">
|
||||
Width="18"
|
||||
Height="18"
|
||||
Margin="2"
|
||||
Click="delete_btn_DeleteClick">
|
||||
X
|
||||
</Button>
|
||||
</Grid>
|
||||
|
||||
@@ -165,7 +165,7 @@ namespace BeWo.View.Detail.Accounting
|
||||
}
|
||||
else
|
||||
{
|
||||
BeWoWindowBuilder.ShowErrorMessageBox(cb.Message);
|
||||
BeWoWindowBuilder.ShowTitleErrorMessageBox(cb.Message, cb.TitleMessage);
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -861,7 +861,9 @@ namespace BeWo.Service.ServiceImplementations
|
||||
}
|
||||
catch (GkvException exc)
|
||||
{
|
||||
response.Message = exc.Message;
|
||||
if (exc.Title.IsNotNullOrWhiteSpace())
|
||||
response.TitleMessage = exc.Title;
|
||||
response.Message = exc.Message;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
@@ -12,6 +12,7 @@ namespace BS.Shared.DataContracts
|
||||
{
|
||||
[DataMember] public bool Success { get; set; }
|
||||
[DataMember] public string Message { get; set; }
|
||||
[DataMember] public string TitleMessage { get; set; }
|
||||
|
||||
public AppResponseDC(bool success)
|
||||
{
|
||||
@@ -22,5 +23,10 @@ namespace BS.Shared.DataContracts
|
||||
{
|
||||
Message = message;
|
||||
}
|
||||
|
||||
public AppResponseDC(bool success, string message, string title) : this(success, message)
|
||||
{
|
||||
TitleMessage = title;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,5 +13,6 @@ namespace BS.Shared.DataContracts.GkvAbrechnung
|
||||
public GkvResponseDC() : base(false) { }
|
||||
public GkvResponseDC(bool success) : base(success) { }
|
||||
public GkvResponseDC(bool success, string message) : base(success, message) { }
|
||||
public GkvResponseDC(bool success, string message, string title) : base(success, message, title) { }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,10 +88,12 @@ namespace BS.Shared.Extensions
|
||||
return pString?.Replace("ẞ", "ß");
|
||||
}
|
||||
|
||||
public static bool IsNotNullOrWhiteSpace(this string pString)
|
||||
=> !pString.IsNullOrWhiteSpace();
|
||||
public static bool IsNullOrWhiteSpace(this string str)
|
||||
=> string.IsNullOrEmpty(str);
|
||||
public static string ToNullIfEmpty(this string str)
|
||||
{
|
||||
return string.IsNullOrWhiteSpace(str) ? null : str;
|
||||
}
|
||||
=> str.IsNullOrWhiteSpace() ? null : str;
|
||||
|
||||
public static string ToFormatFollows(this string str1, string str2, char seperator = ' ')
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user