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

51 lines
1.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 AdvanceBI : IAdvanceBI
{
public void Insert(AdvanceBO advance)
{
GetFactory factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
using (IConnectionDAO connection = factory.Connection)
{
using (IAdvanceDAO dao = factory.GetAdvanceDAO(connection))
{
dao.Insert(advance);
}
}
}
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));
GetFactory factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
using (IConnectionDAO connection = factory.Connection)
{
using (IAdvanceDAO dao = factory.GetAdvanceDAO(connection))
{
return dao.GetAdvances(fromDate, toDate, all);
}
}
}
public void Adjust(Guid advanceID, Guid userID)
{
GetFactory factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
using (IConnectionDAO connection = factory.Connection)
{
using (IAdvanceDAO dao = factory.GetAdvanceDAO(connection))
{
dao.Adjust(advanceID, userID);
}
}
}
}
}