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

namespace MaestroDetalle
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void productSubcategoryBindingNavigatorSaveItem_Click(object sender, EventArgs e)
        {
             try
            {
                this.Validate();
                this.productSubcategoryBindingSource.EndEdit();
                this.productSubcategoryTableAdapter.Update(this.adventureWorks_DataDataSet.ProductSubcategory);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Se produjo un error al grabar el item: " + ex.Message, "Error",
                    MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

        }

        private void Form1_Load(object sender, EventArgs e)
        {
            try
            {
                this.productTableAdapter.Fill(this.adventureWorks_DataDataSet.Product);
                this.productSubcategoryTableAdapter.Fill(this.adventureWorks_DataDataSet.ProductSubcategory);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Se produjo un error al cargar el formulario: " + ex.Message, "Error",
                    MessageBoxButtons.OK,MessageBoxIcon.Error);
            }

        }
    }
}