Moved to fluent. Added support for Modifiers. Fixtures to load intial test data

This commit is contained in:
unknown
2011-01-30 12:44:05 +05:30
parent c841dc25f4
commit eb48c3754a
272 changed files with 10470 additions and 47160 deletions

View File

@ -0,0 +1,137 @@
using System;
using System.Runtime.Serialization;
using Tanshu.Accounts.Entities;
using System.Collections.Generic;
namespace Tanshu.Accounts.Contracts
{
public class BillInventory
{
public int ProductID { get; set; }
public string Name { get; set; }
private decimal price;
public decimal Price
{
get { return price; }
set
{
if (value <= 0)
throw new ArgumentException("Price has to be non-negative greater than zero.");
else
price = value;
}
}
private decimal quantity = 1;
public decimal Quantity
{
get { return quantity; }
set
{
if (value <= 0)
throw new ArgumentException("Quantity has to be non-negative greater than zero.");
quantity = value;
}
}
private decimal discount = 0;
public decimal Discount
{
get { return discount; }
set
{
if (value < 0)
throw new ArgumentException("Discount has to be non-negative greater than or equal to zero.");
else if (value > 1)
throw new ArgumentException("Discount has to be less than one.");
else
discount = value;
}
}
public decimal Tax { get; set; }
public decimal TaxAmount
{
get
{
return quantity * price * (1 - discount) * (1 + ServiceCharge) * Tax;
}
}
public decimal ServiceCharge { get; set; }
public decimal ServiceChargeAmount
{
get
{
return quantity * price * (1 - discount) * ServiceCharge;
}
}
public decimal DiscountAmount
{
get
{
return quantity * price * discount;
}
}
public decimal GrossAmount
{
get
{
return quantity * price * (1 - discount);
}
}
private decimal printed;
public decimal Printed
{
get { return printed; }
set
{
if (value < 0)
throw new ArgumentException("Printed has to be non-negative greater than or equal to zero.");
else
printed = value;
}
}
public decimal Value
{
get
{
return price * quantity * (1 - discount) * (1 + ServiceCharge) * (1 + Tax);
}
}
public decimal Additional
{
get
{
return quantity - printed;
}
}
public bool isNew;
public string Display
{
get
{
string output = string.Format("{0} @ Rs. {1:#.##}", Name, price);
if (discount != 0)
output += string.Format(" - {0:#.##%}", discount);
return output;
}
}
public IList<Modifier> Modifiers { get; set; }
public BillInventory()
{
printed = 0;
isNew = true;
Modifiers = new List<Modifier>();
}
}
}

View File

@ -0,0 +1,57 @@
using System;
using System.Runtime.Serialization;
namespace Tanshu.Accounts.Contracts
{
public class BillItemKey
{
public BillItemKey(int productID, bool isNew)
{
ProductID = productID;
IsNew = isNew;
}
public int ProductID
{
get;
private set;
}
public bool IsNew
{
get;
private set;
}
public override int GetHashCode()
{
return ProductID.GetHashCode() ^ IsNew.GetHashCode();
}
public override bool Equals(object obj)
{
if (obj is BillItemKey)
return (this == (BillItemKey)obj);
else
return false;
}
public override string ToString()
{
return string.Format("{0} - {1}", ProductID, IsNew);
}
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;
return a.ProductID == b.ProductID && a.IsNew == b.IsNew;
}
public static bool operator !=(BillItemKey a, BillItemKey b)
{
return !(a == b);
}
}
}

View File

@ -0,0 +1,32 @@
using System;
using System.Runtime.Serialization;
using FluentNHibernate.Mapping;
namespace Tanshu.Accounts.Contracts
{
public enum PendingType
{
Today = 0,
Week = 1,
All = 2,
Important = 4,
Alarms = 8
}
public class PendingBills
{
public virtual Guid voucherID { get; set; }
public virtual string BillNo { get; set; }
public virtual string Kot { get; set; }
public virtual string TableID { get; set; }
public virtual decimal Amount { get; set; }
public virtual bool Important { get; set; }
public virtual bool Alarm { get; set; }
public virtual DateTime BookingTime { get; set; }
public virtual DateTime LastEdited { get; set; }
public virtual string Waiter { get; set; }
public virtual string Cashier { get; set; }
public virtual bool Printed { get; set; }
public virtual Nullable<DateTime> AlarmTime { get; set; }
}
}

View File

@ -0,0 +1,13 @@
using System;
using System.Runtime.Serialization;
using FluentNHibernate.Mapping;
using Tanshu.Accounts.Entities;
namespace Tanshu.Accounts.Contracts
{
public class ProductDisplay : Product
{
public virtual decimal Price { get; set; }
public virtual string Group { get; set; }
}
}

View File

@ -0,0 +1,15 @@
using System;
using System.Runtime.Serialization;
using FluentNHibernate.Mapping;
namespace Tanshu.Accounts.Contracts
{
public class ProductDisplaySmall
{
public virtual int Code { get; set; }
public virtual string Name { get; set; }
public virtual decimal Price { get; set; }
public virtual string Category { get; set; }
public virtual int ProductID { get; set; }
}
}

View File

@ -0,0 +1,23 @@
using System;
using System.Runtime.Serialization;
using FluentNHibernate.Mapping;
namespace Tanshu.Accounts.Contracts
{
public class SalesAnalysis
{
public virtual int TypeID { get; set; }
public virtual string Section { get; set; }
public virtual decimal Quantity { get; set; }
public virtual decimal Gross { get; set; }
public virtual decimal Net { get; set; }
}
public class SalesAnalysisDetail
{
public virtual string Section { get; set; }
public virtual string Product { get; set; }
public virtual decimal Quantity { get; set; }
public virtual decimal Amount { get; set; }
}
}