narsil/Tanshu.Accounts.BI/PaymentBI.cs

50 lines
1.6 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)
{
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 (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));
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 (IPaymentDAO dao = factory.GetPaymentDAO(connection))
{
return dao.GetPayments(userID, fromDate, toDate);
}
}
}
public void Delete(Guid paymentID)
{
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 (IPaymentDAO dao = factory.GetPaymentDAO(connection))
{
dao.Delete(paymentID);
}
}
}
}
}