blob: 1756d71bc93939d7926271569111385b9b4edf00 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Tango PPC Publish Utility")]
[assembly: AssemblyVersion("2.0.9.1657")]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
//Friends With
[assembly: InternalsVisibleTo("Tango.PPC.UI")]
class="w"> System.Threading.Tasks;
using System.Windows.Data;
using Tango.BL.Entities;
using Tango.MachineStudio.DB.ViewModels;
namespace Tango.MachineStudio.DB.Converters
{
/// <summary>
/// Converts user permission to string.
/// </summary>
/// <seealso cref="System.Windows.Data.IValueConverter" />
public class RolesPermissionsToStringConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value == null) return "";
if (value is IEnumerable<RolesPermission>)
{
IEnumerable<RolesPermission> rolesPermissions = value as IEnumerable<RolesPermission>;
return String.Join(", ", rolesPermissions.Select(x => x.Permission.Name));
}
else
{
IEnumerable<MultiComboVM<Permission>> rolesPermissions = value as IEnumerable<MultiComboVM<Permission>>;
return String.Join(", ", rolesPermissions.Where(x => x.IsSelected).Select(x => x.Entity.Name));
}
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
|