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

namespace Northwind
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            new Form2().Show();   
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'northwindDataSet.Produkty' table. You can move, or remove it, as needed.
            this.produktyTableAdapter.Fill(this.northwindDataSet.Produkty);

        }

        private void Form1_FormClosing(object sender, FormClosingEventArgs e)
        {            
            switch(MessageBox.Show("Czy zapisaæ zmiany do bazy danych?", "Northwind", MessageBoxButtons.YesNoCancel))
            {
                case DialogResult.Cancel: 
                    e.Cancel = true;
                    break;
                case DialogResult.Yes: 
                    this.produktyTableAdapter.Update(northwindDataSet);
                    break;
                case DialogResult.No:
                    break;
            }
        }
    }
}