narsil/Tanshu.Accounts.Contracts/Helper Functions/EnumHelper.cs
unknown d8ecec8bb6 Added inverse Attribute to ProductGroup.
BillInventory Renamed.
Refactored Bill to be more usable.
Added Bill Detail Report.
Added Open Bill and Bill Details Roles.
Zero Rate Products have Yellow background Color.
Refactored UserBI, FoodTableBI, ModifierBI, PrintLocationBI, ProductBI, ProductGroupBI, TaxBI, UserBI,
Cached the Products List.
Product and Product Group Form Working.
2011-06-23 18:17:48 +05:30

24 lines
1.0 KiB
C#

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 : "";
}
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;
}
}
}