//
// Copyright (c) 2016, MindFusion LLC - Bulgaria.
//


namespace MindFusion.Reporting.WinForms.Samples.CS.SideBySideReport
{
	partial class SimpleReport : Report
	{
		public SimpleReport()
		{
			InitializeComponent();
		}

		public override void Run()
		{
			productsTableAdapter1.Fill(nwindDataSet1.Products);
			productsTableAdapter1.Fill(nwindDataSet2.Products);
			categoryById1.FillBy(nwindDataSet1.Categories, GetParameterByName("FirstCategory"));
			categoryById2.FillBy(nwindDataSet2.Categories, GetParameterByName("SecondCategory"));

			base.Run();
		}

		int GetParameterByName(string name)
		{
			foreach (var param in Parameters)
			{
				if (param.Name == name)
					return (int)param.Value;
			}

			return 0;
		}
	}
}