narsil/Tanshu.Accounts.Contracts/Data Contracts/ModifierBO.cs
tanshu da929ad036 Breaking Change: Changed Kot/Voucher Table Name to Guid Foreign key
Breaking Change: Renamed Discontinued to IsActive and added NA field to products.
Cleanup: Removed not used attributes
Change: RoleConstants changed to simple string
Feature: Table Create/Edit/Reorder and Modifier Create/Edit Form
Feature: Bills now show the Tax name from the database and not a hack
2014-10-16 16:41:55 +05:30

41 lines
1.6 KiB
C#

using System;
using System.Runtime.Serialization;
using System.Collections.Generic;
using Tanshu.Accounts.Contracts;
using NHibernate.Mapping.ByCode.Conformist;
using NHibernate.Mapping.ByCode;
namespace Tanshu.Accounts.Entities
{
public class Modifier
{
public Modifier()
{
ProductGroupModifiers = new List<ProductGroupModifier>();
InventoryModifiers = new List<InventoryModifier>();
}
public virtual Guid ModifierID { get; set; }
public virtual string Name { get; set; }
public virtual bool ShowInBill { get; set; }
public virtual decimal Price { get; set; }
public virtual IList<ProductGroupModifier> ProductGroupModifiers { get; set; }
public virtual IList<InventoryModifier> InventoryModifiers { get; set; }
}
public class ModifierMap : ClassMapping<Modifier>
{
public ModifierMap()
{
Table("Modifiers");
Schema("dbo");
Lazy(true);
Id(x => x.ModifierID, m => m.Generator(Generators.GuidComb));
Property(x => x.Name, map => { map.NotNullable(true); map.Unique(true); });
Property(x => x.ShowInBill, map => { map.NotNullable(true); });
Property(x => x.Price, map => { map.NotNullable(true); });
Bag(x => x.InventoryModifiers, colmap => { colmap.Key(x => x.Column("ModifierID")); colmap.Inverse(true); }, map => { map.OneToMany(); });
Bag(x => x.ProductGroupModifiers, colmap => { colmap.Key(x => x.Column("ModifierID")); colmap.Inverse(true); }, map => { map.OneToMany(); });
}
}
}