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

81 lines
2.7 KiB
C#

using System;
using System.Collections.Generic;
using System.Text;
using Tanshu.Accounts.Contracts;
using Tanshu.Accounts.DAOFactory;
using System.Data.SqlClient;
using Tanshu.Data.DAO;
namespace Tanshu.Accounts.BI
{
public class LedgerBI : ILedgerBI
{
public LedgerBO GetLedger(Guid ledgerID)
{
GetFactory factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
using (IConnectionDAO connection = factory.Connection)
{
using (ILedgerDAO dao = factory.GetLedgerDAO(connection))
{
return dao.GetLedger(ledgerID);
}
}
}
public LedgerBO GetLedgerByName(string name)
{
GetFactory factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
using (IConnectionDAO connection = factory.Connection)
{
using (ILedgerDAO dao = factory.GetLedgerDAO(connection))
{
return dao.GetLedger(name);
}
}
}
public bool Insert(LedgerBO ledger)
{
GetFactory factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
using (IConnectionDAO connection = factory.Connection)
{
using (ILedgerDAO dao = factory.GetLedgerDAO(connection))
{
return dao.Insert(ledger);
}
}
}
public bool Update(LedgerBO ledger)
{
GetFactory factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
using (IConnectionDAO connection = factory.Connection)
{
using (ILedgerDAO dao = factory.GetLedgerDAO(connection))
{
return dao.Update(ledger);
}
}
}
public List<LedgerDisplayBO> GetLedgers()
{
GetFactory factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
using (IConnectionDAO connection = factory.Connection)
{
using (ILedgerDAO dao = factory.GetLedgerDAO(connection))
{
return dao.GetLedgers();
}
}
}
public List<LedgerDisplayBO> GetLedgersOfType(char type)
{
GetFactory factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
using (IConnectionDAO connection = factory.Connection)
{
using (ILedgerDAO dao = factory.GetLedgerDAO(connection))
{
return dao.GetLedgers(type);
}
}
}
}
}