narsil/Tanshu.Accounts.BI/LedgerBI.cs
2011-12-05 14:53:02 +05:30

81 lines
2.6 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)
{
var factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
using (var connection = factory.Connection)
{
using (ILedgerDAO dao = factory.GetLedgerDAO(connection))
{
return dao.GetLedger(ledgerID);
}
}
}
public LedgerBO GetLedgerByName(string name)
{
var factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
using (var connection = factory.Connection)
{
using (ILedgerDAO dao = factory.GetLedgerDAO(connection))
{
return dao.GetLedger(name);
}
}
}
public bool Insert(LedgerBO ledger)
{
var factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
using (var connection = factory.Connection)
{
using (ILedgerDAO dao = factory.GetLedgerDAO(connection))
{
return dao.Insert(ledger);
}
}
}
public bool Update(LedgerBO ledger)
{
var factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
using (var connection = factory.Connection)
{
using (ILedgerDAO dao = factory.GetLedgerDAO(connection))
{
return dao.Update(ledger);
}
}
}
public List<LedgerDisplayBO> GetLedgers()
{
var factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
using (var connection = factory.Connection)
{
using (ILedgerDAO dao = factory.GetLedgerDAO(connection))
{
return dao.GetLedgers();
}
}
}
public List<LedgerDisplayBO> GetLedgersOfType(char type)
{
var factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
using (var connection = factory.Connection)
{
using (ILedgerDAO dao = factory.GetLedgerDAO(connection))
{
return dao.GetLedgers(type);
}
}
}
}
}