narsil/Tanshu.Accounts.BI/ManagementBI.cs
unknown ca7a198616 Open Bill by BillID
Fixed discount bill in Checkout
Fixed Management module (maybe)
2012-04-07 01:37:58 +05:30

87 lines
3.0 KiB
C#

using System;
using System.Collections.Generic;
using System.Text;
using System.Data.SqlClient;
using Tanshu.Accounts.DAOFactory;
using Tanshu.Accounts.Contracts;
using Tanshu.Data.DAO;
namespace Tanshu.Accounts.BI
{
public class ManagementBI
{
public decimal GetBalance(decimal? tax, DateTime startDate, DateTime endDate)
{
var factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
using (var connection = factory.Connection)
{
using (IManagementDAO dao = factory.GetManagementDAO(startDate, endDate, connection))
{
return dao.GetBalance(tax);
}
}
}
public List<Guid> GetUpdateBillList(decimal tax, DateTime startDate, DateTime endDate)
{
var factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
using (var connection = factory.Connection)
{
using (IManagementDAO dao = factory.GetManagementDAO(startDate, endDate, connection))
{
return dao.GetUpdateBillList(tax);
}
}
}
public decimal Update(Guid voucherID, decimal tax, DateTime startDate, DateTime endDate)
{
var factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
using (var connection = factory.Connection)
{
using (IManagementDAO dao = factory.GetManagementDAO(startDate, endDate, connection))
{
return dao.Update(voucherID, tax);
}
}
}
public void Reorder(DateTime startDate, DateTime endDate, ShowProgessDelegate showProgressDelegate)
{
var factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
using (var connection = factory.Connection)
{
using (IManagementDAO dao = factory.GetManagementDAO(startDate, endDate, connection))
{
dao.Reorder(showProgressDelegate);
}
}
}
public bool MergeData(DateTime startDate, DateTime endDate, string sourceDB, string targetDB)
{
var factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
using (var connection = factory.Connection)
{
using (IManagementDAO dao = factory.GetManagementDAO(startDate, endDate, connection))
{
return dao.MergeData(sourceDB, targetDB);
}
}
}
public List<PendingBillsBO> GetPaidBills(DateTime startDate, DateTime finishDate)
{
var factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
using (var connection = factory.Connection)
{
using (IManagementDAO dao = factory.GetManagementDAO(startDate, finishDate, connection))
{
return dao.GetPaidBills();
}
}
}
}
}