using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlServerCe;
using SinosysHardware.DataAccess;

namespace SinosysHardware.Business
{
    class TruckDB
    {
       
        /// <summary>
        /// Retrieve a Collection of Truck objects
        /// </summary>
        /// <param name="orderId"></param>
        /// <returns></returns>
        public DataSet GetTruckToLoad(int orderId)
        {
            string Sql = "SELECT Trucks.TruckId, Trucks.LicensePlateStateProvince, Trucks.LicensePlateNumber, Trucks.RouteId " +
                               "FROM Orders, Customers, Trucks " +
                               "WHERE Orders.OrderId = @OrderId " +
                               "AND Orders.CustomerId = Customers.CustomerId " +
                               "AND Customers.RouteId = Trucks.RouteId";
            SqlCeParameter paras = new SqlCeParameter("@OrderId", orderId);
            HelperDB hdb = new HelperDB();
            DataSet Ds = hdb.GetDataSet(Sql, "octtablename",paras);
            return Ds;
        }
    }
}
