| 1234567891011121314151617181920212223242526272829303132 |
- using System;
- using System.Linq;
- using InABox.Clients;
- namespace InABox.Core
- {
- public static class SecurityDescriptorUtils
- {
- public static string Type(Type type)
- {
- type = type.BaseType?.GetGenericArguments().FirstOrDefault();
- if (type != null)
- {
- var caption = type.GetCustomAttributes(typeof(Caption), true).FirstOrDefault() as Caption;
- return caption != null ? caption.Text : type.EntityName();
- }
- return "General";
- }
- public static string Code(Type type)
- {
- return type.EntityName().Split('.').Last();
- }
- public static string Description(Type type)
- {
- var caption = type.GetCustomAttributes(typeof(Caption), true).FirstOrDefault() as Caption;
- return caption != null ? caption.Text : type.EntityName();
- }
- }
- }
|