narsil/Tanshu.Accounts.BI/LedgerBI.cs

81 lines
2.6 KiB
C#
Raw Normal View History

2010-03-02 17:56:21 +00:00
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)
{
2011-12-05 09:23:02 +00:00
var factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
using (var connection = factory.Connection)
2010-03-02 17:56:21 +00:00
{
using (ILedgerDAO dao = factory.GetLedgerDAO(connection))
{
return dao.GetLedger(ledgerID);
}
}
}
public LedgerBO GetLedgerByName(string name)
{
2011-12-05 09:23:02 +00:00
var factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
using (var connection = factory.Connection)
2010-03-02 17:56:21 +00:00
{
using (ILedgerDAO dao = factory.GetLedgerDAO(connection))
{
return dao.GetLedger(name);
}
}
}
public bool Insert(LedgerBO ledger)
{
2011-12-05 09:23:02 +00:00
var factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
using (var connection = factory.Connection)
2010-03-02 17:56:21 +00:00
{
using (ILedgerDAO dao = factory.GetLedgerDAO(connection))
{
return dao.Insert(ledger);
}
}
}
public bool Update(LedgerBO ledger)
{
2011-12-05 09:23:02 +00:00
var factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
using (var connection = factory.Connection)
2010-03-02 17:56:21 +00:00
{
using (ILedgerDAO dao = factory.GetLedgerDAO(connection))
{
return dao.Update(ledger);
}
}
}
public List<LedgerDisplayBO> GetLedgers()
{
2011-12-05 09:23:02 +00:00
var factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
using (var connection = factory.Connection)
2010-03-02 17:56:21 +00:00
{
using (ILedgerDAO dao = factory.GetLedgerDAO(connection))
{
return dao.GetLedgers();
}
}
}
public List<LedgerDisplayBO> GetLedgersOfType(char type)
{
2011-12-05 09:23:02 +00:00
var factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
using (var connection = factory.Connection)
2010-03-02 17:56:21 +00:00
{
using (ILedgerDAO dao = factory.GetLedgerDAO(connection))
{
return dao.GetLedgers(type);
}
}
}
}
}