From 76cd512ebccd1ccea6513ca7bfa6a259f9d6a05e Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 14 Jan 2011 01:51:02 +0530 Subject: [PATCH] Table load complete. Printer stub removed for actual code. --- Tanshu.Accounts.BI/PrintLocationBI.cs | 69 +++++++++++++++++++ Tanshu.Accounts.BI/Tanshu.Accounts.BI.csproj | 1 + .../DAOFactory/PrintLocationDAO.cs | 15 ++++ .../Data Contracts/PrintLocationBO.cs | 13 ++++ .../Service Contracts/PrintLocationBI.cs | 18 +++++ .../Tanshu.Accounts.Contracts.csproj | 3 + Tanshu.Accounts.DAOFactory/DAOFactory.cs | 1 + .../SqlServerDAOFactory.cs | 5 ++ Tanshu.Accounts.Helpers/ControlFactory.cs | 3 +- Tanshu.Accounts.PointOfSale/App.config | 1 + .../Authentication/Session.cs | 4 -- .../Controllers/BillController.cs | 36 ++++++---- .../Sales/SalesForm.cs | 41 ++++++++--- Tanshu.Accounts.SqlDAO/MembershipDAO.cs | 3 +- Tanshu.Accounts.SqlDAO/PrintLocationDAO.cs | 45 ++++++++++++ .../Tanshu.Accounts.SqlDAO.csproj | 1 + 16 files changed, 230 insertions(+), 29 deletions(-) create mode 100644 Tanshu.Accounts.BI/PrintLocationBI.cs create mode 100644 Tanshu.Accounts.Contracts/DAOFactory/PrintLocationDAO.cs create mode 100644 Tanshu.Accounts.Contracts/Data Contracts/PrintLocationBO.cs create mode 100644 Tanshu.Accounts.Contracts/Service Contracts/PrintLocationBI.cs create mode 100644 Tanshu.Accounts.SqlDAO/PrintLocationDAO.cs diff --git a/Tanshu.Accounts.BI/PrintLocationBI.cs b/Tanshu.Accounts.BI/PrintLocationBI.cs new file mode 100644 index 0000000..a763900 --- /dev/null +++ b/Tanshu.Accounts.BI/PrintLocationBI.cs @@ -0,0 +1,69 @@ +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 PrintLocationBI : IPrintLocationBI + { + public void Insert(PrintLocationBO printLocation) + { + GetFactory factory = GetFactory.GetDAOFactory(Database.GetFactoryType); + using (IConnectionDAO connection = factory.Connection) + { + using (IPrintLocationDAO dao = factory.GetPrintLocationDAO(connection)) + { + dao.Insert(printLocation); + } + } + } + public void Update(PrintLocationBO printLocation) + { + GetFactory factory = GetFactory.GetDAOFactory(Database.GetFactoryType); + using (IConnectionDAO connection = factory.Connection) + { + using (IPrintLocationDAO dao = factory.GetPrintLocationDAO(connection)) + { + dao.Update(printLocation); + } + } + } + public bool Delete(int tableID) + { + GetFactory factory = GetFactory.GetDAOFactory(Database.GetFactoryType); + using (IConnectionDAO connection = factory.Connection) + { + using (IPrintLocationDAO dao = factory.GetPrintLocationDAO(connection)) + { + return dao.Delete(tableID); + } + } + } + public PrintLocationBO GetPrintLocation(int printLocationID) + { + GetFactory factory = GetFactory.GetDAOFactory(Database.GetFactoryType); + using (IConnectionDAO connection = factory.Connection) + { + using (IPrintLocationDAO dao = factory.GetPrintLocationDAO(connection)) + { + return dao.GetPrintLocation(printLocationID); + } + } + } + public PrintLocationBO GetPrintLocation(Guid productTypeID, string location) + { + GetFactory factory = GetFactory.GetDAOFactory(Database.GetFactoryType); + using (IConnectionDAO connection = factory.Connection) + { + using (IPrintLocationDAO dao = factory.GetPrintLocationDAO(connection)) + { + return dao.GetPrintLocation(productTypeID, location); + } + } + } + } +} diff --git a/Tanshu.Accounts.BI/Tanshu.Accounts.BI.csproj b/Tanshu.Accounts.BI/Tanshu.Accounts.BI.csproj index 7910111..cb24d68 100644 --- a/Tanshu.Accounts.BI/Tanshu.Accounts.BI.csproj +++ b/Tanshu.Accounts.BI/Tanshu.Accounts.BI.csproj @@ -64,6 +64,7 @@ + diff --git a/Tanshu.Accounts.Contracts/DAOFactory/PrintLocationDAO.cs b/Tanshu.Accounts.Contracts/DAOFactory/PrintLocationDAO.cs new file mode 100644 index 0000000..9b25e2e --- /dev/null +++ b/Tanshu.Accounts.Contracts/DAOFactory/PrintLocationDAO.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using Tanshu.Accounts.Contracts; + +namespace Tanshu.Accounts.DAOFactory +{ + public interface IPrintLocationDAO : IDisposable + { + void Insert(PrintLocationBO printLocation); + void Update(PrintLocationBO printLocation); + bool Delete(int tableID); + PrintLocationBO GetPrintLocation(int printLocationID); + PrintLocationBO GetPrintLocation(Guid productTypeID, string location); + } +} \ No newline at end of file diff --git a/Tanshu.Accounts.Contracts/Data Contracts/PrintLocationBO.cs b/Tanshu.Accounts.Contracts/Data Contracts/PrintLocationBO.cs new file mode 100644 index 0000000..7ae8467 --- /dev/null +++ b/Tanshu.Accounts.Contracts/Data Contracts/PrintLocationBO.cs @@ -0,0 +1,13 @@ +using System; +using System.Runtime.Serialization; + +namespace Tanshu.Accounts.Contracts +{ + public class PrintLocationBO + { + public int PrintLocationID { get; set; } + public Guid ProductTypeID { get; set; } + public string Location { get; set; } + public string Printer { get; set; } + } +} diff --git a/Tanshu.Accounts.Contracts/Service Contracts/PrintLocationBI.cs b/Tanshu.Accounts.Contracts/Service Contracts/PrintLocationBI.cs new file mode 100644 index 0000000..f10b4e9 --- /dev/null +++ b/Tanshu.Accounts.Contracts/Service Contracts/PrintLocationBI.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.ServiceModel; + +using System.Data.SqlClient; + +namespace Tanshu.Accounts.Contracts +{ + public interface IPrintLocationBI + { + void Insert(PrintLocationBO printLocation); + void Update(PrintLocationBO printLocation); + bool Delete(int tableID); + PrintLocationBO GetPrintLocation(int printLocationID); + PrintLocationBO GetPrintLocation(Guid productTypeID, string location); + } +} diff --git a/Tanshu.Accounts.Contracts/Tanshu.Accounts.Contracts.csproj b/Tanshu.Accounts.Contracts/Tanshu.Accounts.Contracts.csproj index 8a88cdd..6c3bd78 100644 --- a/Tanshu.Accounts.Contracts/Tanshu.Accounts.Contracts.csproj +++ b/Tanshu.Accounts.Contracts/Tanshu.Accounts.Contracts.csproj @@ -56,6 +56,7 @@ + @@ -76,6 +77,7 @@ + @@ -112,6 +114,7 @@ + diff --git a/Tanshu.Accounts.DAOFactory/DAOFactory.cs b/Tanshu.Accounts.DAOFactory/DAOFactory.cs index 66d07e9..8158b3f 100644 --- a/Tanshu.Accounts.DAOFactory/DAOFactory.cs +++ b/Tanshu.Accounts.DAOFactory/DAOFactory.cs @@ -25,6 +25,7 @@ namespace Tanshu.Accounts.DAOFactory public abstract IManagementDAO GetManagementDAO(DateTime startDate, DateTime finishDate, IConnectionDAO connection); public abstract IMembershipDAO GetMembershipDAO(IConnectionDAO connection); public abstract IPaymentDAO GetPaymentDAO(IConnectionDAO connection); + public abstract IPrintLocationDAO GetPrintLocationDAO(IConnectionDAO connection); public abstract IProductDAO GetProductDAO(IConnectionDAO connection); public abstract IProductTypeDAO GetProductTypeDAO(IConnectionDAO connection); public abstract ISalesAnalysisDAO GetSalesAnalysisDAO(IConnectionDAO connection); diff --git a/Tanshu.Accounts.DAOFactory/SqlServerDAOFactory.cs b/Tanshu.Accounts.DAOFactory/SqlServerDAOFactory.cs index 7d248fd..12ce3c4 100644 --- a/Tanshu.Accounts.DAOFactory/SqlServerDAOFactory.cs +++ b/Tanshu.Accounts.DAOFactory/SqlServerDAOFactory.cs @@ -59,6 +59,11 @@ namespace Tanshu.Accounts.DAOFactory return new PaymentDAO(connection); } + public override IPrintLocationDAO GetPrintLocationDAO(IConnectionDAO connection) + { + return new PrintLocationDAO(connection); + } + public override IProductDAO GetProductDAO(IConnectionDAO connection) { return new ProductDAO(connection); diff --git a/Tanshu.Accounts.Helpers/ControlFactory.cs b/Tanshu.Accounts.Helpers/ControlFactory.cs index 7bb88ca..613bc7e 100644 --- a/Tanshu.Accounts.Helpers/ControlFactory.cs +++ b/Tanshu.Accounts.Helpers/ControlFactory.cs @@ -99,7 +99,7 @@ namespace Tanshu.Accounts.Helpers } } } - public static void GenerateButtons(ref Panel panel, ref List