narsil/Tanshu.Accounts.BI/ManagementBI.cs
2010-03-02 23:26:21 +05:30

87 lines
3.2 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)
{
GetFactory factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
using (IConnectionDAO connection = factory.Connection)
{
using (IManagementDAO dao = factory.GetManagementDAO(startDate, endDate, connection))
{
return dao.GetBalance(tax);
}
}
}
public List<Guid> GetUpdateBillList(decimal tax, bool voided, bool paid, bool creditCard, DateTime startDate, DateTime endDate)
{
GetFactory factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
using (IConnectionDAO connection = factory.Connection)
{
using (IManagementDAO dao = factory.GetManagementDAO(startDate, endDate, connection))
{
return dao.GetUpdateBillList(tax, voided, paid, creditCard);
}
}
}
public decimal Update(Guid voucherID, decimal tax, DateTime startDate, DateTime endDate)
{
GetFactory factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
using (IConnectionDAO 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)
{
GetFactory factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
using (IConnectionDAO 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)
{
GetFactory factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
using (IConnectionDAO connection = factory.Connection)
{
using (IManagementDAO dao = factory.GetManagementDAO(startDate, endDate, connection))
{
return dao.MergeData(sourceDB, targetDB);
}
}
}
public List<PendingBillsBO> GetPaidBills(DateTime startDate, DateTime finishDate)
{
GetFactory factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
using (IConnectionDAO connection = factory.Connection)
{
using (IManagementDAO dao = factory.GetManagementDAO(startDate, finishDate, connection))
{
return dao.GetPaidBills();
}
}
}
}
}