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.
This commit is contained in:
@ -156,7 +156,7 @@ namespace Tanshu.Accounts.Contracts
|
||||
Product = null;
|
||||
ProductID = kot.KotID;
|
||||
Discount = 0;
|
||||
Name = string.Format("Kot: {0} / {1:dd-MMM HH:mm} ({2})", kot.Code, kot.Date, kot.User.Name);
|
||||
Name = string.Format("Kot: S-{0} / {1:dd-MMM HH:mm} ({2})", kot.Code, kot.Date, kot.User.Name);
|
||||
Price = 0;
|
||||
FullPrice = 0;
|
||||
Printed = true;
|
||||
|
||||
@ -5,9 +5,7 @@ namespace Tanshu.Accounts.Contracts
|
||||
public enum BillItemType
|
||||
{
|
||||
Product,
|
||||
Kot,
|
||||
Information,
|
||||
Total
|
||||
Kot
|
||||
}
|
||||
public class BillItemKey
|
||||
{
|
||||
@ -34,5 +32,38 @@ namespace Tanshu.Accounts.Contracts
|
||||
public Guid KotID { get; private set; }
|
||||
|
||||
public BillItemType BillItemType { get; private set; }
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return BillItemType.GetHashCode() ^ KotID.GetHashCode() ^ ProductID.GetHashCode();
|
||||
}
|
||||
public static bool operator ==(BillItemKey a, BillItemKey b)
|
||||
{
|
||||
if (object.ReferenceEquals(null, a))
|
||||
return object.ReferenceEquals(null, b);
|
||||
|
||||
if (!(a is BillItemKey))
|
||||
return false;
|
||||
if (!(b is BillItemKey))
|
||||
return false;
|
||||
|
||||
if (a.BillItemType != b.BillItemType)
|
||||
return false;
|
||||
|
||||
return a.KotID == b.KotID && a.BillItemType == b.BillItemType && a.ProductID == b.ProductID;
|
||||
}
|
||||
public static bool operator !=(BillItemKey a, BillItemKey b)
|
||||
{
|
||||
return !(a == b);
|
||||
}
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (obj is BillItemKey)
|
||||
return (this == (BillItemKey)obj);
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -17,7 +17,7 @@ namespace Tanshu.Accounts.Entities
|
||||
}
|
||||
public virtual Guid KotID { get; set; }
|
||||
public virtual Voucher Voucher { get; set; }
|
||||
public virtual string Code { get; set; }
|
||||
public virtual int Code { get; set; }
|
||||
public virtual FoodTable Table { get; set; }
|
||||
public virtual bool Printed { get; set; }
|
||||
public virtual DateTime Date { get; set; }
|
||||
@ -32,10 +32,20 @@ namespace Tanshu.Accounts.Entities
|
||||
Table("Kots");
|
||||
Schema("dbo");
|
||||
Lazy(true);
|
||||
SqlInsert(@"exec KotInsert ?,?,?,?,?");
|
||||
Id(x => x.KotID, map => map.Generator(Generators.GuidComb));
|
||||
Property(x => x.Code, map => { map.NotNullable(true); map.Unique(true); });
|
||||
Property(x => x.Code, map =>
|
||||
{
|
||||
map.NotNullable(true);
|
||||
map.Unique(true);
|
||||
map.Generated(PropertyGeneration.Insert);
|
||||
});
|
||||
Property(x => x.Printed, map => map.NotNullable(true));
|
||||
Property(x => x.Date, map => map.NotNullable(true));
|
||||
Property(x => x.Date, map =>
|
||||
{
|
||||
map.NotNullable(true);
|
||||
map.Generated(PropertyGeneration.Insert);
|
||||
});
|
||||
ManyToOne(x => x.Voucher, map =>
|
||||
{
|
||||
map.Column("VoucherID");
|
||||
|
||||
@ -13,6 +13,37 @@ namespace Tanshu.Accounts.Entities
|
||||
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>
|
||||
{
|
||||
|
||||
@ -20,8 +20,13 @@ namespace Tanshu.Accounts.Entities
|
||||
Table("Reprints");
|
||||
Schema("dbo");
|
||||
Lazy(true);
|
||||
SqlInsert(@"exec ReprintInsert ?,?,?");
|
||||
Id(x => x.ReprintID, map => map.Generator(Generators.GuidComb));
|
||||
Property(x => x.Date, map => map.NotNullable(true));
|
||||
Property(x => x.Date, map =>
|
||||
{
|
||||
map.NotNullable(true);
|
||||
map.Generated(PropertyGeneration.Insert);
|
||||
});
|
||||
ManyToOne(x => x.User, map =>
|
||||
{
|
||||
map.Column("UserID");
|
||||
|
||||
@ -43,7 +43,7 @@ namespace Tanshu.Accounts.Entities
|
||||
public virtual User User { get; set; }
|
||||
public virtual DateTime CreationDate { get; set; }
|
||||
public virtual DateTime LastEditDate { get; set; }
|
||||
public virtual string BillID { get; set; }
|
||||
public virtual int? BillID { get; set; }
|
||||
public virtual FoodTable Table { get; set; }
|
||||
public virtual Waiter Waiter { get; set; }
|
||||
public virtual Customer Customer { get; set; }
|
||||
@ -53,31 +53,48 @@ namespace Tanshu.Accounts.Entities
|
||||
public virtual string VoidReason { get; set; }
|
||||
public virtual bool Printed { get; set; }
|
||||
public virtual VoucherType VoucherType { get; set; }
|
||||
public virtual string KotID { get; set; }
|
||||
public virtual int KotID { get; set; }
|
||||
public virtual IList<Kot> Kots { get; set; }
|
||||
public virtual IList<Reprint> Reprints { get; set; }
|
||||
}
|
||||
|
||||
public class VoucherMap : ClassMapping<Voucher>
|
||||
{
|
||||
|
||||
public VoucherMap()
|
||||
{
|
||||
Table("Vouchers");
|
||||
Schema("dbo");
|
||||
Lazy(true);
|
||||
SqlInsert(@"exec VoucherInsert ?,?,?,?,?,?,?,?,?,?,?");
|
||||
SqlUpdate(@"exec VoucherUpdate ?,?,?,?,?,?,?,?,?,?,?");
|
||||
Id(x => x.VoucherID, map => map.Generator(Generators.GuidComb));
|
||||
Property(x => x.Date, map => map.NotNullable(true));
|
||||
Property(x => x.Date, map =>
|
||||
{
|
||||
map.NotNullable(true);
|
||||
map.Generated(PropertyGeneration.Always);
|
||||
});
|
||||
Property(x => x.Pax);
|
||||
Property(x => x.VoucherType, map => map.NotNullable(true));
|
||||
Property(x => x.Narration);
|
||||
Property(x => x.CreationDate, map => map.NotNullable(true));
|
||||
Property(x => x.LastEditDate, map => map.NotNullable(true));
|
||||
Property(x => x.BillID, map => map.NotNullable(true));
|
||||
Property(x => x.CreationDate, map =>
|
||||
{
|
||||
map.NotNullable(true);
|
||||
map.Generated(PropertyGeneration.Insert);
|
||||
});
|
||||
Property(x => x.LastEditDate, map =>
|
||||
{
|
||||
map.NotNullable(true);
|
||||
map.Generated(PropertyGeneration.Always);
|
||||
});
|
||||
Property(x => x.BillID, map => map.Generated(PropertyGeneration.Always));
|
||||
Property(x => x.Void, map => map.NotNullable(true));
|
||||
Property(x => x.VoidReason);
|
||||
Property(x => x.Printed, map => map.NotNullable(true));
|
||||
Property(x => x.KotID, map => map.NotNullable(true));
|
||||
Property(x => x.KotID, map =>
|
||||
{
|
||||
map.NotNullable(true);
|
||||
map.Generated(PropertyGeneration.Insert);
|
||||
});
|
||||
ManyToOne(x => x.User, map =>
|
||||
{
|
||||
map.Column("UserID");
|
||||
|
||||
Reference in New Issue
Block a user