narsil/Tanshu.Accounts.BI/AdvanceBI.cs

59 lines
2.0 KiB
C#
Raw Normal View History

2010-03-02 17:56:21 +00:00
using System;
using System.Collections.Generic;
using Tanshu.Accounts.Contracts;
using Tanshu.Accounts.DAOFactory;
namespace Tanshu.Accounts.BI
{
public class AdvanceBI : IAdvanceBI
{
public void Insert(AdvanceBO advance)
{
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 (IAdvanceDAO dao = factory.GetAdvanceDAO(connection))
{
dao.Insert(advance);
}
}
}
2011-12-05 09:23:02 +00:00
public AdvanceBO Get(Guid advanceID)
{
var factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
using (var connection = factory.Connection)
{
using (var dao = factory.GetAdvanceDAO(connection))
{
return dao.Get(advanceID);
}
}
}
2010-03-02 17:56:21 +00:00
public List<AdvanceDisplayBO> GetAdvances(DateTime fromDate, DateTime toDate, bool all)
{
fromDate = Convert.ToDateTime(string.Format("{0:dd-MMM-yyyy} 00:00:00", fromDate));
toDate = Convert.ToDateTime(string.Format("{0:dd-MMM-yyyy} 23:59:59", toDate));
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 (IAdvanceDAO dao = factory.GetAdvanceDAO(connection))
{
return dao.GetAdvances(fromDate, toDate, all);
}
}
}
public void Adjust(Guid advanceID, Guid userID)
{
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 (IAdvanceDAO dao = factory.GetAdvanceDAO(connection))
{
dao.Adjust(advanceID, userID);
}
}
}
}
}