using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using Westwind.BusinessObjects;
using ScriptCallbacks.BusinessObjects;

/// <summary>
/// Summary description for busItem
/// </summary>
public class busItem : wwBusiness<ProductsRow>
{
	public busItem()
	{
        this.ConnectionString = ConfigurationManager.ConnectionStrings["AjaxAspNet"].ConnectionString;
        this.ConnectType = ServerTypes.SqlServer;
        this.DataRowUpdateMode = DataRowUpdateModes.OptimizedByPk;
        this.Tablename = "Products";
        this.PkField = "ProductId";
        this.PkType = PkFieldTypes.intType;
	}


    /// <summary>
    /// Returns a list of products
    /// </summary>
    /// <returns></returns>
    public DataTable GetProductList()
    {
        int Result = this.Execute(
@"select *
    from Products 
    WHERE Discontinued = 0 AND UnitsInStock > 0
    ORDER BY ProductName", "TProducts");
        if (Result < 0)
               return null;

        return this.DataSet.Tables["TProducts"];
    }
    
}
