2011-04-11 12:55:45 +00:00
|
|
|
|
using Tanshu.Accounts.Entities;
|
|
|
|
|
using Tanshu.Accounts.Contracts;
|
|
|
|
|
|
|
|
|
|
namespace Tanshu.Common.Helpers
|
|
|
|
|
{
|
|
|
|
|
public static class EnumHelper
|
|
|
|
|
{
|
|
|
|
|
public static string Display(this SettleOption settleOption)
|
|
|
|
|
{
|
|
|
|
|
var attribute = (DisplayAttribute)settleOption.GetType().GetField(settleOption.ToString()).GetCustomAttributes(typeof(DisplayAttribute), false)[0];
|
|
|
|
|
return attribute != null ? attribute.Name : "";
|
|
|
|
|
}
|
2014-11-06 10:39:11 +00:00
|
|
|
|
public static bool Print(this SettleOption settleOption)
|
|
|
|
|
{
|
|
|
|
|
var attribute = (DisplayAttribute)settleOption.GetType().GetField(settleOption.ToString()).GetCustomAttributes(typeof(DisplayAttribute), false)[0];
|
|
|
|
|
return attribute != null ? attribute.Print : false;
|
|
|
|
|
}
|
2011-06-23 12:47:48 +00:00
|
|
|
|
public static bool Visible(this SettleOption settleOption)
|
|
|
|
|
{
|
|
|
|
|
var attribute = (DisplayAttribute)settleOption.GetType().GetField(settleOption.ToString()).GetCustomAttributes(typeof(DisplayAttribute), false)[0];
|
|
|
|
|
return attribute != null ? attribute.ShowInChoices : false;
|
|
|
|
|
}
|
|
|
|
|
public static DisplayAttribute Attribute(this SettleOption settleOption)
|
|
|
|
|
{
|
|
|
|
|
var attribute = (DisplayAttribute)settleOption.GetType().GetField(settleOption.ToString()).GetCustomAttributes(typeof(DisplayAttribute), false)[0];
|
|
|
|
|
return attribute;
|
|
|
|
|
}
|
2011-12-05 09:41:02 +00:00
|
|
|
|
public static DisplayAttribute Attribute(this VoucherType settleOption)
|
|
|
|
|
{
|
|
|
|
|
var attribute = (DisplayAttribute)settleOption.GetType().GetField(settleOption.ToString()).GetCustomAttributes(typeof(DisplayAttribute), false)[0];
|
|
|
|
|
return attribute;
|
|
|
|
|
}
|
2011-04-11 12:55:45 +00:00
|
|
|
|
}
|
|
|
|
|
}
|