narsil/Tanshu.Accounts.BI/ProductBI.cs
Amritanshu 8be15d2d33 Fixed: Error in ProductsBI
Added: Copy to clipboard in SaleAnalysis/Detail
2013-12-08 02:44:31 +05:30

131 lines
3.7 KiB
C#

using System;
using System.Collections.Generic;
using Tanshu.Accounts.Contracts;
namespace Tanshu.Accounts.BI
{
public class ProductBI
{
public bool Insert(ProductBO product)
{
using (var connection = new SqlDAO.SqlConnectionDAO())
{
using (var dao = new SqlDAO.ProductDAO(connection))
{
return dao.Insert(product);
}
}
}
public bool Update(ProductBO product)
{
using (var connection = new SqlDAO.SqlConnectionDAO())
{
using (var dao = new SqlDAO.ProductDAO(connection))
{
return dao.Update(product);
}
}
}
public bool Delete(Guid productID)
{
using (var connection = new SqlDAO.SqlConnectionDAO())
{
using (var dao = new SqlDAO.ProductDAO(connection))
{
return dao.Delete(productID);
}
}
}
public ProductBO GetProductFromName(string nameAndUnits)
{
using (var connection = new SqlDAO.SqlConnectionDAO())
{
using (var dao = new SqlDAO.ProductDAO(connection))
{
return dao.GetProduct(nameAndUnits);
}
}
}
public ProductBO GetProduct(Guid productID)
{
using (var connection = new SqlDAO.SqlConnectionDAO())
{
using (var dao = new SqlDAO.ProductDAO(connection))
{
return dao.GetProduct(productID);
}
}
}
public List<ProductDisplayBO> GetProducts()
{
using (var connection = new SqlDAO.SqlConnectionDAO())
{
using (var dao = new SqlDAO.ProductDAO(connection))
{
return dao.GetProducts();
}
}
}
public List<ProductDisplaySmallBO> GetFilteredProducts(Dictionary<string, string> filter)
{
using (var connection = new SqlDAO.SqlConnectionDAO())
{
using (var dao = new SqlDAO.ProductDAO(connection))
{
return dao.GetFilteredProducts(filter);
}
}
}
public void UpdateShortName()
{
using (var connection = new SqlDAO.SqlConnectionDAO())
{
using (var dao = new SqlDAO.ProductDAO(connection))
{
dao.UpdateShortName();
}
}
}
public List<ProductDisplaySmallBO> GetUnFilteredProducts()
{
Dictionary<string, string> filter = new Dictionary<string, string>();
filter.Add("Name", "");
filter.Add("ProductGroup", "");
return GetFilteredProducts(filter);
}
public List<ProductGroupBO> GetProductGroups()
{
using (var connection = new SqlDAO.SqlConnectionDAO())
{
using (var dao = new SqlDAO.ProductDAO(connection))
{
return dao.GetProductGroups();
}
}
}
public List<TaxBO> GetTaxes()
{
using (var connection = new SqlDAO.SqlConnectionDAO())
{
using (var dao = new SqlDAO.ProductDAO(connection))
{
return dao.GetTaxes();
}
}
}
}
}