Initial Commit
This commit is contained in:
54
Tanshu.Accounts.DAOFactory/DAOFactory.cs
Normal file
54
Tanshu.Accounts.DAOFactory/DAOFactory.cs
Normal file
@ -0,0 +1,54 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
22
Tanshu.Accounts.DAOFactory/GetFactoryTypes.cs
Normal file
22
Tanshu.Accounts.DAOFactory/GetFactoryTypes.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using System.Configuration;
|
||||
using System;
|
||||
|
||||
namespace Tanshu.Accounts.DAOFactory
|
||||
{
|
||||
public static class Database
|
||||
{
|
||||
public static DAOFactoryTypes GetFactoryType
|
||||
{
|
||||
get
|
||||
{
|
||||
string type = ConfigurationManager.AppSettings["Factory"].ToLowerInvariant();
|
||||
if (DAOFactoryTypes.SqlServer.ToString().ToLowerInvariant() == type)
|
||||
return DAOFactoryTypes.SqlServer;
|
||||
else if (DAOFactoryTypes.PostgreSQL.ToString().ToLowerInvariant() == type)
|
||||
return DAOFactoryTypes.PostgreSQL;
|
||||
else
|
||||
throw new ArgumentException();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
158
Tanshu.Accounts.DAOFactory/PostgresDAOFactory.cs
Normal file
158
Tanshu.Accounts.DAOFactory/PostgresDAOFactory.cs
Normal file
@ -0,0 +1,158 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Tanshu.WebAccounts.PostgresDAO;
|
||||
using Tanshu.Data.DAO;
|
||||
using Tanshu.WebAccounts.PostgresDAO.Reports;
|
||||
|
||||
namespace Tanshu.WebAccounts.DAOFactory
|
||||
{
|
||||
public class PostgresDAOFactory : GetFactory
|
||||
{
|
||||
public override ICostCenterDAO GetCostCenterDAO(IConnectionDAO connection)
|
||||
{
|
||||
return new CostCenterDAO(connection);
|
||||
}
|
||||
|
||||
public override IEmployeeDAO GetEmployeeDAO(IConnectionDAO connection)
|
||||
{
|
||||
return new EmployeeDAO(connection);
|
||||
}
|
||||
|
||||
public override IInventoryDAO GetInventoryDAO(IConnectionDAO connection)
|
||||
{
|
||||
return new InventoryDAO(connection);
|
||||
}
|
||||
|
||||
public override IInventoryDisplayDAO GetInventoryDisplayDAO(IConnectionDAO connection)
|
||||
{
|
||||
return new InventoryDisplayDAO(connection);
|
||||
}
|
||||
|
||||
public override IIssueDAO GetIssueDAO(IConnectionDAO connection)
|
||||
{
|
||||
return new IssueDAO(connection);
|
||||
}
|
||||
|
||||
public override IJournalDAO GetJournalDAO(IConnectionDAO connection)
|
||||
{
|
||||
return new JournalDAO(connection);
|
||||
}
|
||||
|
||||
public override ILedgerDAO GetLedgerDAO(IConnectionDAO connection)
|
||||
{
|
||||
return new LedgerDAO(connection);
|
||||
}
|
||||
|
||||
public override IMaintenanceDAO GetMaintenanceDAO(IConnectionDAO connection)
|
||||
{
|
||||
return new MaintenanceDAO(connection);
|
||||
}
|
||||
|
||||
public override IMembershipDAO GetMembershipDAO(IConnectionDAO connection)
|
||||
{
|
||||
return new MembershipDAO(connection);
|
||||
}
|
||||
|
||||
public override IPaymentSheetDAO GetPaymentSheetDAO(IConnectionDAO connection)
|
||||
{
|
||||
return new PaymentSheetDAO(connection);
|
||||
}
|
||||
|
||||
public override IProductDAO GetProductDAO(IConnectionDAO connection)
|
||||
{
|
||||
return new ProductDAO(connection);
|
||||
}
|
||||
|
||||
public override IProductTypeDAO GetProductTypeDAO(IConnectionDAO connection)
|
||||
{
|
||||
return new ProductTypeDAO(connection);
|
||||
}
|
||||
|
||||
public override IRequirementDAO GetRequirementDAO(IConnectionDAO connection)
|
||||
{
|
||||
return new RequirementDAO(connection);
|
||||
}
|
||||
|
||||
public override ISalarySheetDAO GetSalarySheetDAO(IConnectionDAO connection)
|
||||
{
|
||||
return new SalarySheetDAO(connection);
|
||||
}
|
||||
|
||||
public override ITaxDAO GetTaxDAO(IConnectionDAO connection)
|
||||
{
|
||||
return new TaxDAO(connection);
|
||||
}
|
||||
|
||||
public override IUserDAO GetUserDAO(IConnectionDAO connection)
|
||||
{
|
||||
return new UserDAO(connection);
|
||||
}
|
||||
|
||||
public override IVerificationDAO GetVerificationDAO(IConnectionDAO connection)
|
||||
{
|
||||
return new VerificationDAO(connection);
|
||||
}
|
||||
|
||||
public override IVoucherDAO GetVoucherDAO(IConnectionDAO connection)
|
||||
{
|
||||
return new VoucherDAO(connection);
|
||||
}
|
||||
|
||||
public override IConnectionDAO Connection
|
||||
{
|
||||
get { return new Tanshu.WebAccounts.PostgresDAO.PostgresConnectionDAO(); }
|
||||
}
|
||||
|
||||
public override ICashFlowDAO GetCashFlowDAO(IConnectionDAO connection)
|
||||
{
|
||||
return new CashFlowDAO(connection);
|
||||
}
|
||||
|
||||
public override IClosingStockDAO GetClosingStockDAO(IConnectionDAO connection)
|
||||
{
|
||||
return new ClosingStockDAO(connection);
|
||||
}
|
||||
|
||||
public override IEntriesDAO GetEntriesDAO(IConnectionDAO connection)
|
||||
{
|
||||
return new EntriesDAO(connection);
|
||||
}
|
||||
|
||||
public override IIssueReportsDAO GetIssueReportsDAO(IConnectionDAO connection)
|
||||
{
|
||||
return new IssueReportsDAO(connection);
|
||||
}
|
||||
|
||||
public override ILedgerReportDAO GetLedgerReportDAO(IConnectionDAO connection)
|
||||
{
|
||||
return new LedgerReportDAO(connection);
|
||||
}
|
||||
|
||||
public override ILiabilityReportsDAO GetLiabilityReportsDAO(IConnectionDAO connection)
|
||||
{
|
||||
return new LiabilityReportsDAO(connection);
|
||||
}
|
||||
|
||||
public override IProductLedgerDAO GetProductLedgerDAO(IConnectionDAO connection)
|
||||
{
|
||||
return new ProductLedgerDAO(connection);
|
||||
}
|
||||
|
||||
public override IProfitLossDAO GetProfitLossDAO(IConnectionDAO connection)
|
||||
{
|
||||
return new ProfitLossDAO(connection);
|
||||
}
|
||||
|
||||
public override IPurchaseDAO GetPurchaseDAO(IConnectionDAO connection)
|
||||
{
|
||||
return new PurchaseDAO(connection);
|
||||
}
|
||||
|
||||
public override IStockDAO GetStockDAO(IConnectionDAO connection)
|
||||
{
|
||||
return new StockDAO(connection);
|
||||
}
|
||||
}
|
||||
}
|
||||
36
Tanshu.Accounts.DAOFactory/Properties/AssemblyInfo.cs
Normal file
36
Tanshu.Accounts.DAOFactory/Properties/AssemblyInfo.cs
Normal file
@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Tanshu.WebAccounts.DAOFactory")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Tanshu.WebAccounts.DAOFactory")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2009")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("4d63472a-b214-416c-a26b-1f963d39743b")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
92
Tanshu.Accounts.DAOFactory/SqlServerDAOFactory.cs
Normal file
92
Tanshu.Accounts.DAOFactory/SqlServerDAOFactory.cs
Normal file
@ -0,0 +1,92 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Tanshu.Accounts.SqlDAO;
|
||||
using Tanshu.Data.DAO;
|
||||
|
||||
namespace Tanshu.Accounts.DAOFactory
|
||||
{
|
||||
public class SqlServerDAOFactory : GetFactory
|
||||
{
|
||||
public override IAdvanceDAO GetAdvanceDAO(IConnectionDAO connection)
|
||||
{
|
||||
return new AdvanceDAO(connection);
|
||||
}
|
||||
|
||||
public override ICheckoutDAO GetCheckoutDAO(DateTime startDate, DateTime finishDate, Guid userID, IConnectionDAO connection)
|
||||
{
|
||||
return new CheckoutDAO(startDate, finishDate, userID, connection);
|
||||
}
|
||||
|
||||
public override IConnectionDAO Connection
|
||||
{
|
||||
get { return new Tanshu.Accounts.SqlDAO.SqlConnectionDAO(); }
|
||||
}
|
||||
|
||||
public override ICustomerDAO GetCustomerDAO(IConnectionDAO connection)
|
||||
{
|
||||
return new CustomerDAO(connection);
|
||||
}
|
||||
|
||||
public override IInventoryDAO GetInventoryDAO(IConnectionDAO connection)
|
||||
{
|
||||
return new InventoryDAO(connection);
|
||||
}
|
||||
|
||||
public override ILedgerDAO GetLedgerDAO(IConnectionDAO connection)
|
||||
{
|
||||
return new LedgerDAO(connection);
|
||||
}
|
||||
|
||||
public override IManagementDAO GetManagementDAO(DateTime startDate, DateTime finishDate, IConnectionDAO connection)
|
||||
{
|
||||
return new ManagementDAO(startDate, finishDate, connection);
|
||||
}
|
||||
|
||||
public override IMembershipDAO GetMembershipDAO(IConnectionDAO connection)
|
||||
{
|
||||
return new MembershipDAO(connection);
|
||||
}
|
||||
|
||||
public override IPaymentDAO GetPaymentDAO(IConnectionDAO connection)
|
||||
{
|
||||
return new PaymentDAO(connection);
|
||||
}
|
||||
|
||||
public override IProductDAO GetProductDAO(IConnectionDAO connection)
|
||||
{
|
||||
return new ProductDAO(connection);
|
||||
}
|
||||
|
||||
public override ISalesAnalysisDAO GetSalesAnalysisDAO(IConnectionDAO connection)
|
||||
{
|
||||
return new SalesAnalysisDAO(connection);
|
||||
}
|
||||
|
||||
public override ISaleVoucherDAO GetSaleVoucherDAO(IConnectionDAO connection)
|
||||
{
|
||||
return new SaleVoucherDAO(connection);
|
||||
}
|
||||
|
||||
public override ISaleVoucherMixDAO GetSaleVoucherMixDAO(IConnectionDAO connection)
|
||||
{
|
||||
return new SaleVoucherMixDAO(connection);
|
||||
}
|
||||
|
||||
public override IUserDAO GetUserDAO(IConnectionDAO connection)
|
||||
{
|
||||
return new UserDAO(connection);
|
||||
}
|
||||
|
||||
public override IVoucherDAO GetVoucherDAO(IConnectionDAO connection)
|
||||
{
|
||||
return new VoucherDAO(connection);
|
||||
}
|
||||
|
||||
public override IWaiterDAO GetWaiterDAO(IConnectionDAO connection)
|
||||
{
|
||||
return new WaiterDAO(connection);
|
||||
}
|
||||
}
|
||||
}
|
||||
76
Tanshu.Accounts.DAOFactory/Tanshu.Accounts.DAOFactory.csproj
Normal file
76
Tanshu.Accounts.DAOFactory/Tanshu.Accounts.DAOFactory.csproj
Normal file
@ -0,0 +1,76 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>9.0.30729</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{AC7AA7C5-4712-4992-B733-092D703E7AA9}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Tanshu.Accounts.DAOFactory</RootNamespace>
|
||||
<AssemblyName>Tanshu.Accounts.DAOFactory</AssemblyName>
|
||||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\Bin\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>..\Bin\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.configuration" />
|
||||
<Reference Include="System.Core">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml.Linq">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Data.DataSetExtensions">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="Tanshu.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=fd89fe1d2351f8b5, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\Include\Tanshu.Data.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="DAOFactory.cs" />
|
||||
<Compile Include="GetFactoryTypes.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="SqlServerDAOFactory.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Tanshu.Accounts.Contracts\Tanshu.Accounts.Contracts.csproj">
|
||||
<Project>{59A6F8B8-12EE-4D8E-BEBB-61CB665A2C17}</Project>
|
||||
<Name>Tanshu.Accounts.Contracts</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Tanshu.Accounts.SqlDAO\Tanshu.Accounts.SqlDAO.csproj">
|
||||
<Project>{B755D152-37C3-47D6-A721-3AD17A8EF316}</Project>
|
||||
<Name>Tanshu.Accounts.SqlDAO</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
Reference in New Issue
Block a user