narsil/Tanshu.Accounts.Contracts/Helper Functions/EnumHelper.cs
unknown 964d0a78bf Added Basecode to Product
Added Voucher Type During Printing
Added Discount Report
Fixed Void bill table not getting cleared error
Added PAX to table
Removed Itital Setup button in MainForm as it was not doing anything
2011-12-05 15:11:02 +05:30

29 lines
1.3 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;
}
public static DisplayAttribute Attribute(this VoucherType settleOption)
{
var attribute = (DisplayAttribute)settleOption.GetType().GetField(settleOption.ToString()).GetCustomAttributes(typeof(DisplayAttribute), false)[0];
return attribute;
}
}
}