using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Web.Script.Services;
using System.Collections.Generic;
using System.Reflection;
using Telerik.Web.UI;
using System.ComponentModel;
using System.Linq;

/// <summary>
/// Summary description for WebService
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ScriptService]
public class WebService : System.Web.Services.WebService {

    public WebService () 
    {
       
    }
   
   
    [WebMethod(EnableSession = true)]    
    [ScriptMethod]
    public Dictionary<string, object> GetDataAndCount(int startRowIndex, int maximumRows, List<GridSortExpression> sortExpression, List<GridFilterExpression> filterExpression)
    {
        Dictionary<string, object> data = new Dictionary<string, object>();
        DataClassesDataContext context = new DataClassesDataContext();    
        data.Add("Data", context.Suppliers.Skip(startRowIndex).Take(maximumRows).ToList<Supplier>());
        data.Add("Count", context.Suppliers.Count<Supplier>());        

        return data;
    }    
    
}

