using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace Baza_Reklam { public partial class AddKontoForm : Form { public AddKontoForm(int idKonta, int IdAgencji) { InitializeComponent(); this.kONTATableAdapter.Connection.ConnectionString = ConnString.getConnString().Value; if (idKonta == 0) { DataView table = (DataView)kONTABindingSource.List; DataRowView row = table.AddNew(); row["idAgencji"] = IdAgencji; row["opis"] = "nowe konto"; kONTABindingSource.EndEdit(); } else { this.kONTATableAdapter.FillById(this.sLOWNIKDataSet.KONTA, idKonta); } } private void ZapiszButton_Click(object sender, EventArgs e) { this.kONTABindingSource.EndEdit(); this.kONTATableAdapter.Update(this.sLOWNIKDataSet.KONTA); MessageBox.Show("Zmiany zostały zapisane"); this.Close(); } private void AnulujButton_Click(object sender, EventArgs e) { this.Close(); } /* * if (idKontaTextBox.Text == "") { MessageBox.Show("Uzupełnij wszystkie pola"); return; } if (kONTOTextBox.Text == "") { MessageBox.Show("Uzupełnij wszystkie pola"); return; } if (opisTextBox1.Text == "") { MessageBox.Show("Uzupełnij wszystkie pola"); return; } if (kONTABindingSource.Current != null) { DataRowView row = (DataRowView)kONTABindingSource.Current; row["idAgencji"] = ((DataRowView)aGENCJEBindingSource.Current)["Id_agencji"]; Validate(); kONTABindingSource.EndEdit(); kONTATableAdapter.Update(this.sLOWNIKDataSet.KONTA); MessageBox.Show("Zmiany zapisane"); }*/ } }