using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace db1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            
            // initiate combo boxes, hardcoded in this simple demo
            comboLand.Items.AddRange(
                    new String[4] { "England", "Italia", "Tyskland", "Spania" });
            comboLand.SelectedItem=comboLand.Items[0];
            comboLevel.Items.AddRange(
                    new String[2] { "1", "2" });
            comboLevel.SelectedItem = comboLevel.Items[0];
            comboAr.Items.AddRange(
                    new String[6] { "2000-2001", "2001-2002", "2002-2003", "2003-2004", "2004-2005", "2005-2006" });
            comboAr.SelectedItem = comboAr.Items[0];
        }

        private void buttonVis_Click(object sender, EventArgs e)
        {
            // Control selection, collect data and show result
            String country = comboLand.SelectedItem.ToString();
            String level = comboLevel.SelectedItem.ToString();
            String year = comboAr.SelectedItem.ToString();
            // fix parameters to match database
            year = year.Substring(0, 4);
            if (country.ToLower().CompareTo("england") == 0) country = "en";
            else if (country.ToLower().CompareTo("italia") == 0) country = "it";
            else if (country.ToLower().CompareTo("spania") == 0) country = "es";
            else country = "de"; //Tyskland
            // do it
            if (sender.Equals(buttonVis))
                webBrowser1.DocumentText = DBAccess.getTeams(country, level, year);
            else
                webBrowser1.DocumentText = DBAccess.getGames(country, level, year);
        }

    }
}