narsil/Tanshu.Accounts.BI/PaymentBI.cs

46 lines
1.4 KiB
C#

using System;
using System.Collections.Generic;
using Tanshu.Accounts.Contracts;
namespace Tanshu.Accounts.BI
{
public class PaymentBI
{
public void Insert(PaymentBO payment)
{
using (var connection = new SqlDAO.SqlConnectionDAO())
{
using (var dao = new SqlDAO.PaymentDAO(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));
using (var connection = new SqlDAO.SqlConnectionDAO())
{
using (var dao = new SqlDAO.PaymentDAO(connection))
{
return dao.GetPayments(userID, fromDate, toDate);
}
}
}
public void Delete(Guid paymentID)
{
using (var connection = new SqlDAO.SqlConnectionDAO())
{
using (var dao = new SqlDAO.PaymentDAO(connection))
{
dao.Delete(paymentID);
}
}
}
}
}