narsil/Tanshu.Accounts.SqlDAO/PrintLocationDAO.cs

46 lines
1.6 KiB
C#
Raw Normal View History

using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using Tanshu.Accounts.Contracts;
using Tanshu.Data.DAO;
using Tanshu.Accounts.DAOFactory;
namespace Tanshu.Accounts.SqlDAO
{
public class PrintLocationDAO : BaseDAO, IPrintLocationDAO
{
public PrintLocationDAO(IConnectionDAO connection)
: base(connection)
{ }
public void Insert(PrintLocationBO printLocation)
{
throw new NotImplementedException();
}
public void Update(PrintLocationBO printLocation)
{
throw new NotImplementedException();
}
public bool Delete(int tableID)
{
throw new NotImplementedException();
}
public PrintLocationBO GetPrintLocation(int printLocationID)
{
SqlCommand cmd = new SqlCommand("SELECT * FROM PrintLocations WHERE PrintLocationID = @PrintLocationID;");
cmd.Parameters.AddWithValue("@PrintLocationID", printLocationID);
return BusinessObjectDAO<PrintLocationBO>.GetBusinessObject(connection.ExecuteReader(cmd));
}
public PrintLocationBO GetPrintLocation(Guid productTypeID, string location)
{
using (SqlCommand cmd = new SqlCommand("SELECT * FROM PrintLocations WHERE ProductTypeID = @ProductTypeID AND Location = @Location"))
{
cmd.Parameters.AddWithValue("@ProductTypeID", productTypeID);
cmd.Parameters.AddWithValue("@Location", location);
return BusinessObjectDAO<PrintLocationBO>.GetBusinessObject(connection.ExecuteReader(cmd));
}
}
}
}