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

namespace СУБД_Альфапол
{
    public partial class FormAddEdit : Form
    {
        public FormAddEdit()
        {
            InitializeComponent();
        }

        private void FormAddEdit_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'alfafloorGDVDataSet1.PostCode' table. You can move, or remove it, as needed.
            this.postCodeTableAdapter.Fill(this.alfafloorGDVDataSet1.PostCode);
            // TODO: This line of code loads data into the 'alfafloorGDVDataSet1.Street' table. You can move, or remove it, as needed.
            this.streetTableAdapter.Fill(this.alfafloorGDVDataSet1.Street);
            // TODO: This line of code loads data into the 'alfafloorGDVDataSet1.City' table. You can move, or remove it, as needed.
            this.cityTableAdapter.Fill(this.alfafloorGDVDataSet1.City);
            // TODO: This line of code loads data into the 'alfafloorGDVDataSet1.Region' table. You can move, or remove it, as needed.
            this.regionTableAdapter.Fill(this.alfafloorGDVDataSet1.Region);
            // TODO: This line of code loads data into the 'alfafloorGDVDataSet1.TypePartner' table. You can move, or remove it, as needed.
            this.typePartnerTableAdapter.Fill(this.alfafloorGDVDataSet1.TypePartner);
            // TODO: This line of code loads data into the 'alfafloorGDVDataSet1.Partner' table. You can move, or remove it, as needed.
            this.partnerTableAdapter.Fill(this.alfafloorGDVDataSet1.Partner);
            lblIdPartner.Hide();
            if (lblTitleForm.Text == "Добавление партнера")
            {
                bsPartner.AddNew();
            }    
            //bsRegion.Filter = bsPartner.Filter;
            //bsCity.Filter = bsPartner.Filter;
            //bsStreet.Filter = bsPartner.Filter;
            //bsPostCode.Filter = bsPartner.Filter;
        }

        private void btnSave_Click(object sender, EventArgs e)
        {
            bsPartner.EndEdit();
            this.partnerTableAdapter.Update(this.alfafloorGDVDataSet1.Partner);
            this.Close();
        }
    }
}
