narsil/Tanshu.Accounts.BI/PaymentBI.cs
2011-12-05 14:53:02 +05:30

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