narsil/Tanshu.Accounts.BI/PaymentBI.cs

50 lines
1.7 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 PaymentBI : IPaymentBI
{
public void Insert(PaymentBO payment)
{
GetFactory factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
using (IConnectionDAO connection = factory.Connection)
{
using (IPaymentDAO dao = factory.GetPaymentDAO(connection))
{
dao.Insert(payment);
}
}
}
public List<PaymentDisplayBO> GetPayments(Guid? userID, DateTime fromDate, DateTime toDate)
{
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 (IPaymentDAO dao = factory.GetPaymentDAO(connection))
{
return dao.GetPayments(userID, fromDate, toDate);
}
}
}
public void Delete(Guid paymentID)
{
GetFactory factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
using (IConnectionDAO connection = factory.Connection)
{
using (IPaymentDAO dao = factory.GetPaymentDAO(connection))
{
dao.Delete(paymentID);
}
}
}
}
}