using GrapeCity.ActiveReports;
using System.Data;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;

namespace MVC_LocateDataSource
{
    /// <summary>
    /// WebService1 的摘要说明
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // 若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务，请取消注释以下行。 
    // [System.Web.Script.Services.ScriptService]
    public class WebService1 : GrapeCity.ActiveReports.Web.ReportService
    {
        SectionReport definition;
           

        [WebMethod]
        protected override object OnCreateReportHandler(string reportPath)
        {
            definition = (SectionReport)base.OnCreateReportHandler(reportPath);
            definition.DataSource = returndata();           
            return definition;
        }
        public DataTable returndata()
        {
            DataTable dt = new DataTable();

            dt.Columns.Add("产品编号");
            dt.Columns.Add("产品名称");
            dt.Columns.Add("单价");
            dt.Columns.Add("库存量");
            dt.Rows.Add("A001", "苹果", 10, 300);
            dt.Rows.Add("A002", "葡萄", 20, 200);
            dt.Rows.Add("A003", "荔枝", 30, 600);
            dt.Rows.Add("A004", "芒果", 40, 300);
            dt.Rows.Add("A005", "油桃", 20, 330);
            dt.Rows.Add("A006", "猕猴桃", 30, 480);
            dt.Rows.Add("A007", "菠萝", 70, 360);
            dt.Rows.Add("A008", "提子", 25, 280);
            dt.Rows.Add("A009", "西瓜", 80, 550);
            dt.Rows.Add("A010", "香蕉", 300, 400);
            dt.Rows.Add("A011", "苹果", 180, 300);
            dt.Rows.Add("A012", "葡萄", 280, 200);
            dt.Rows.Add("A013", "荔枝", 340, 600);
            dt.Rows.Add("A014", "芒果", 400, 300);
            dt.Rows.Add("A015", "油桃", 220, 330);
            dt.Rows.Add("A016", "猕猴桃", 430, 450);
            dt.Rows.Add("A017", "菠萝", 710, 460);
            dt.Rows.Add("A018", "提子", 215, 180);
            dt.Rows.Add("A019", "西瓜", 180, 550);
            dt.Rows.Add("A020", "香蕉", 130, 480);
            return dt;
        }
    }
}
