narsil/Tanshu.Accounts.DAOFactory/DAOFactory.cs
2010-03-02 23:26:21 +05:30

55 lines
2.3 KiB
C#

using System;
using Tanshu.Data.DAO;
namespace Tanshu.Accounts.DAOFactory
{
// List of DAO types supported by the factory
public enum DAOFactoryTypes
{
SqlServer = 0,
PostgreSQL = 1
}
// Abstract class DAO Factory
public abstract class GetFactory
{
// There will be a method for each DAO that can be
// created. The concrete factories will have to
// implement these methods.
public abstract IAdvanceDAO GetAdvanceDAO(IConnectionDAO connection);
public abstract ICheckoutDAO GetCheckoutDAO(DateTime startDate, DateTime finishDate, Guid userID, IConnectionDAO connection);
public abstract ICustomerDAO GetCustomerDAO(IConnectionDAO connection);
public abstract IInventoryDAO GetInventoryDAO(IConnectionDAO connection);
public abstract ILedgerDAO GetLedgerDAO(IConnectionDAO connection);
public abstract IManagementDAO GetManagementDAO(DateTime startDate, DateTime finishDate, IConnectionDAO connection);
public abstract IMembershipDAO GetMembershipDAO(IConnectionDAO connection);
public abstract IPaymentDAO GetPaymentDAO(IConnectionDAO connection);
public abstract IProductDAO GetProductDAO(IConnectionDAO connection);
public abstract ISalesAnalysisDAO GetSalesAnalysisDAO(IConnectionDAO connection);
public abstract ISaleVoucherDAO GetSaleVoucherDAO(IConnectionDAO connection);
public abstract ISaleVoucherMixDAO GetSaleVoucherMixDAO(IConnectionDAO connection);
public abstract IUserDAO GetUserDAO(IConnectionDAO connection);
public abstract IVoucherDAO GetVoucherDAO(IConnectionDAO connection);
public abstract IWaiterDAO GetWaiterDAO(IConnectionDAO connection);
public abstract IConnectionDAO Connection { get; }
public static GetFactory GetDAOFactory(DAOFactoryTypes type)
{
switch (type)
{
//case DAOFactoryTypes.PostgreSQL:
// return new PostgreSQLDAOFactory();
case DAOFactoryTypes.SqlServer:
return new SqlServerDAOFactory();
//case DAOFactoryTypes.PostgreSQL:
// return new PostgresDAOFactory();
default:
throw new ArgumentException();
}
}
}
}