narsil/Tanshu.Accounts.Contracts/Data Contracts/PrintLocationBO.cs
tanshu 3ca8b29e04 Regression: BillItemKey added the compare methods back
Regression: PrintLocation added the compare methods back
Breaking: Kot.Code is now integers
Breaking: Kot Update is now via Stored Procedure to get DB Values
Breaking: Reprints Insert is now via Stored Procedure to get DV Values
Breaking: Voucher.BillID and KotID are now integers
Breaking: Voucher Insert/Update is now via Stored Procedures to get DV Values also Dirty Checking for Voucher has been overwritten to set dirty for LastEditDate update
Fix: Login forms simplified
Feature: PrintLocation and Products are cached application wide.
2014-11-02 13:33:31 +05:30

69 lines
2.1 KiB
C#

using System;
using System.Runtime.Serialization;
using NHibernate.Mapping.ByCode.Conformist;
using NHibernate.Mapping.ByCode;
namespace Tanshu.Accounts.Entities
{
public class PrintLocation
{
public virtual Guid PrintLocationID { get; set; }
public virtual ProductGroup ProductGroup { get; set; }
public virtual string Location { get; set; }
public virtual string Printer { get; set; }
public virtual int Copies { get; set; }
public virtual string CutCode { get; set; }
public override int GetHashCode()
{
return Location.GetHashCode() ^ Printer.GetHashCode() ^ Copies.GetHashCode() ^ CutCode.GetHashCode();
}
public static bool operator ==(PrintLocation a, PrintLocation b)
{
if (object.ReferenceEquals(null, a))
return object.ReferenceEquals(null, b);
if (!(a is PrintLocation))
return false;
if (!(b is PrintLocation))
return false;
return a.Location == b.Location && a.Printer == b.Printer && a.Copies == b.Copies && a.CutCode == b.CutCode;
}
public static bool operator !=(PrintLocation a, PrintLocation b)
{
return !(a == b);
}
public override bool Equals(System.Object obj)
{
if (obj is PrintLocation)
return (this == (PrintLocation)obj);
else
return false;
}
}
public class PrintLocationMap : ClassMapping<PrintLocation>
{
public PrintLocationMap()
{
Table("PrintLocations");
Schema("dbo");
Lazy(true);
Id(x => x.PrintLocationID, map => map.Generator(Generators.GuidComb));
Property(x => x.Location);
Property(x => x.Printer);
Property(x => x.Copies);
Property(x => x.CutCode);
ManyToOne(x => x.ProductGroup, map =>
{
map.Column("ProductGroupID");
map.Cascade(Cascade.None);
});
}
}
}