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 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); } } } } }