59 lines
2.0 KiB
C#
59 lines
2.0 KiB
C#
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)
|
|
{
|
|
var factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
|
|
using (var connection = factory.Connection)
|
|
{
|
|
using (IAdvanceDAO dao = factory.GetAdvanceDAO(connection))
|
|
{
|
|
dao.Insert(advance);
|
|
}
|
|
}
|
|
}
|
|
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);
|
|
}
|
|
}
|
|
}
|
|
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));
|
|
var factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
|
|
using (var connection = factory.Connection)
|
|
{
|
|
using (IAdvanceDAO dao = factory.GetAdvanceDAO(connection))
|
|
{
|
|
return dao.GetAdvances(fromDate, toDate, all);
|
|
}
|
|
}
|
|
}
|
|
public void Adjust(Guid advanceID, Guid userID)
|
|
{
|
|
var factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
|
|
using (var connection = factory.Connection)
|
|
{
|
|
using (IAdvanceDAO dao = factory.GetAdvanceDAO(connection))
|
|
{
|
|
|
|
dao.Adjust(advanceID, userID);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|