64 lines
1.4 KiB
C#
64 lines
1.4 KiB
C#
using BS.Shared;
|
|
using BS.Shared.Core;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Globalization;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Data;
|
|
|
|
namespace BeWo.Converter
|
|
{
|
|
public class UserPermission2BoolConverter : IValueConverter
|
|
{
|
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
#if DEBUG
|
|
if (BeWoApp.IsInDesignMode)
|
|
return true;
|
|
#endif
|
|
|
|
try
|
|
{
|
|
if (value is UserRightType type)
|
|
{
|
|
return BeWoApp.HasLoggedOnUserRight(type);
|
|
}
|
|
|
|
if (parameter is UserRightType type2)
|
|
{
|
|
return BeWoApp.HasLoggedOnUserRight(type2);
|
|
}
|
|
|
|
if (parameter is string setting && !string.IsNullOrWhiteSpace(setting))
|
|
{
|
|
if (setting == SettingsKeys.AllowGkvAbrechnung)
|
|
return BeWoApp.AppSettings.AllowGkvAbrechnung;
|
|
|
|
if (setting == SettingsKeys.ShowGkvBzEinzel)
|
|
return BeWoApp.Mandator.ShowGkvBzEinzel;
|
|
|
|
if (setting == SettingsKeys.ShowGkvBzUrbelege)
|
|
return BeWoApp.Mandator.ShowGkvBzUrbelege;
|
|
|
|
if (setting == SettingsKeys.ShowAI)
|
|
return BeWoApp.AppSettings.ShowAI;
|
|
}
|
|
}
|
|
catch (Exception)
|
|
{
|
|
if (BeWoApp.IsInDesignMode)
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
}
|
|
}
|