| 1 | using System;
|
|---|
| 2 | using System.Collections.Generic;
|
|---|
| 3 | using System.ComponentModel;
|
|---|
| 4 | using System.Data;
|
|---|
| 5 | using System.Drawing;
|
|---|
| 6 | using System.Text;
|
|---|
| 7 | using System.Windows.Forms;
|
|---|
| 8 |
|
|---|
| 9 | namespace Baza_Reklam
|
|---|
| 10 | {
|
|---|
| 11 | public partial class AddKontoForm : Form
|
|---|
| 12 | {
|
|---|
| 13 | public AddKontoForm(int idKonta, int IdAgencji)
|
|---|
| 14 | {
|
|---|
| 15 | InitializeComponent();
|
|---|
| 16 |
|
|---|
| 17 | this.kONTATableAdapter.Connection.ConnectionString = ConnString.getConnString().Value;
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 | if (idKonta == 0)
|
|---|
| 21 | {
|
|---|
| 22 | DataView table = (DataView)kONTABindingSource.List;
|
|---|
| 23 | DataRowView row = table.AddNew();
|
|---|
| 24 | row["idAgencji"] = IdAgencji;
|
|---|
| 25 | row["opis"] = "nowe konto";
|
|---|
| 26 | kONTABindingSource.EndEdit();
|
|---|
| 27 | }
|
|---|
| 28 | else
|
|---|
| 29 | {
|
|---|
| 30 | this.kONTATableAdapter.FillById(this.sLOWNIKDataSet.KONTA, idKonta);
|
|---|
| 31 | }
|
|---|
| 32 | }
|
|---|
| 33 |
|
|---|
| 34 | private void ZapiszButton_Click(object sender, EventArgs e)
|
|---|
| 35 | {
|
|---|
| 36 | this.kONTABindingSource.EndEdit();
|
|---|
| 37 | this.kONTATableAdapter.Update(this.sLOWNIKDataSet.KONTA);
|
|---|
| 38 | MessageBox.Show("Zmiany zosta³y zapisane");
|
|---|
| 39 | this.Close();
|
|---|
| 40 | }
|
|---|
| 41 |
|
|---|
| 42 | private void AnulujButton_Click(object sender, EventArgs e)
|
|---|
| 43 | {
|
|---|
| 44 | this.Close();
|
|---|
| 45 | }
|
|---|
| 46 |
|
|---|
| 47 | /*
|
|---|
| 48 | * if (idKontaTextBox.Text == "")
|
|---|
| 49 | {
|
|---|
| 50 | MessageBox.Show("Uzupe³nij wszystkie pola");
|
|---|
| 51 | return;
|
|---|
| 52 | }
|
|---|
| 53 |
|
|---|
| 54 | if (kONTOTextBox.Text == "")
|
|---|
| 55 | {
|
|---|
| 56 | MessageBox.Show("Uzupe³nij wszystkie pola");
|
|---|
| 57 | return;
|
|---|
| 58 | }
|
|---|
| 59 |
|
|---|
| 60 | if (opisTextBox1.Text == "")
|
|---|
| 61 | {
|
|---|
| 62 | MessageBox.Show("Uzupe³nij wszystkie pola");
|
|---|
| 63 | return;
|
|---|
| 64 | }
|
|---|
| 65 |
|
|---|
| 66 | if (kONTABindingSource.Current != null)
|
|---|
| 67 | {
|
|---|
| 68 | DataRowView row = (DataRowView)kONTABindingSource.Current;
|
|---|
| 69 |
|
|---|
| 70 | row["idAgencji"] = ((DataRowView)aGENCJEBindingSource.Current)["Id_agencji"];
|
|---|
| 71 |
|
|---|
| 72 | Validate();
|
|---|
| 73 | kONTABindingSource.EndEdit();
|
|---|
| 74 | kONTATableAdapter.Update(this.sLOWNIKDataSet.KONTA);
|
|---|
| 75 | MessageBox.Show("Zmiany zapisane");
|
|---|
| 76 | }*/
|
|---|
| 77 | }
|
|---|
| 78 | } |
|---|