| 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 | using BazaZamowien.Classes;
|
|---|
| 9 | using BazaZamowien.PREMIEDataSetTableAdapters;
|
|---|
| 10 |
|
|---|
| 11 | namespace BazaZamowien
|
|---|
| 12 | {
|
|---|
| 13 | public partial class UserAddFormPremie : Form
|
|---|
| 14 | {
|
|---|
| 15 | GrupyTableAdapter grupyTableAdapter = new GrupyTableAdapter();
|
|---|
| 16 |
|
|---|
| 17 | public UserAddFormPremie(int id)
|
|---|
| 18 | {
|
|---|
| 19 | InitializeComponent();
|
|---|
| 20 |
|
|---|
| 21 | grupyTableAdapter.Connection.ConnectionString = ConnString.getConnString().PremieConnStr;
|
|---|
| 22 | usersTableAdapter.Connection.ConnectionString = ConnString.getConnString().PremieConnStr;
|
|---|
| 23 |
|
|---|
| 24 | interface_Pracownicy2TableAdapter.Connection.ConnectionString = ConnString.getConnString().PremieConnStr;
|
|---|
| 25 | this.interface_Pracownicy2TableAdapter.Fill(this.pREMIEDataSet.Interface_Pracownicy2);
|
|---|
| 26 |
|
|---|
| 27 | iDEGrupaComboBox.DataSource = grupyTableAdapter.GetData();
|
|---|
| 28 | iDEGrupaComboBox.DisplayMember = "NazwaGrupy";
|
|---|
| 29 | iDEGrupaComboBox.ValueMember = "IDE";
|
|---|
| 30 |
|
|---|
| 31 | if (id == 0)
|
|---|
| 32 | {
|
|---|
| 33 | DataView table = (DataView)usersBindingSource.List;
|
|---|
| 34 | DataRowView row = table.AddNew();
|
|---|
| 35 |
|
|---|
| 36 | usersBindingSource.MoveLast();
|
|---|
| 37 | usersBindingSource.EndEdit();
|
|---|
| 38 | }
|
|---|
| 39 | else
|
|---|
| 40 | {
|
|---|
| 41 | usersTableAdapter.FillByIDEPracownik(this.pREMIEDataSet.Users, id);
|
|---|
| 42 | }
|
|---|
| 43 | }
|
|---|
| 44 |
|
|---|
| 45 | private void anulujButton_Click(object sender, EventArgs e)
|
|---|
| 46 | {
|
|---|
| 47 | this.Close();
|
|---|
| 48 | }
|
|---|
| 49 |
|
|---|
| 50 | private void zapiszButton_Click(object sender, EventArgs e)
|
|---|
| 51 | {
|
|---|
| 52 | this.usersBindingSource.EndEdit();
|
|---|
| 53 | this.usersTableAdapter.Update(this.pREMIEDataSet.Users);
|
|---|
| 54 | MessageBox.Show("Zmiany zosta³y zapisane");
|
|---|
| 55 | this.DialogResult = DialogResult.OK;
|
|---|
| 56 | }
|
|---|
| 57 |
|
|---|
| 58 | }
|
|---|
| 59 | } |
|---|