narsil/Tanshu.Accounts.Contracts/Helper Functions/ReflectionHelper.cs
unknown 831ec37cda Reprint and Printed bill editing logged.
Printed bill can no longer be changed, any changes voids the bill and prints a new one.
Added option to Split Bill.
Kot printed with right time.
Numerous bug fixes.
2011-08-23 12:40:05 +05:30

28 lines
801 B
C#

using System.Reflection;
using Tanshu.Accounts.Entities;
namespace Tanshu.Common.Helpers
{
public enum VoucherFields
{
CreationDate,
LastEditDate,
Date,
BillID,
KotID
}
public static class ReflectionHelper
{
public static void SetValue(this Voucher voucher, VoucherFields field, object value)
{
var fi = typeof(Voucher).GetField(ConvertToCamelCaseUnderscore(field.ToString()), BindingFlags.NonPublic | BindingFlags.Instance);
if (fi != null)
fi.SetValue(voucher, value);
}
private static string ConvertToCamelCaseUnderscore(string propertyName)
{
return "_" + propertyName[0].ToString().ToLower() + propertyName.Substring(1);
}
}
}