using System;
using System.Web.UI;
using Northwind45.BusinessObject;
using System.Web.Services;
 
namespace Northwind45
{
    public partial class GridView_Products : System.Web.UI.Page
    {
        protected void GridView1_RowDataBound(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e)
        {
            Functions.GridViewRowDataBound(sender, e, 1);
        }
 
        protected void GridView1_RowCreated(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e)
        {
            Functions.GridViewRowCreated(sender, e, 1);
        }
 
        public ProductsCollection GetGridData(int maximumRows, int startRowIndex, out int totalRowCount, string sortByExpression)
        {
            return Products.SelectSkipAndTake(maximumRows, startRowIndex, out totalRowCount, sortByExpression);
        }
 
        public void DeleteGridItem(int productID)
        {
            try
            {
                Products.Delete(productID);
            }
            catch (Exception ex)
            {
                Functions.ShowModalError(ex, this);
            }
        }
    }
}