Sei sulla pagina 1di 5

FORMA 1:

using
using
using
using
using
using
using
using

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

namespace WindowsFormsApplication8
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Form2 forma2 = new Form2();
forma2.Show();
this.Hide();
}
private void button3_Click(object sender, EventArgs e)
{
Form2 forma2 = new Form2();
forma2.Show();
this.Hide();
}
private void button2_Click(object sender, EventArgs e)
{
Form3 forma3 = new Form3();
forma3.Show();
this.Hide();
}
private void button4_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void button5_Click(object sender, EventArgs e)
{
if (textBox1.Text == "Admin" && textBox2.Text == "admin")
{
groupBox1.Visible = true;
}
}
private void Form1_Load(object sender, EventArgs e)
{

FORMA 2:
using
using
using
using
using
using
using
using

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

namespace WindowsFormsApplication8
{
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
private void Form2_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the 'vojnikDataSet1.Vojnik' table. You can move,
or remove it, as needed.
this.vojnikTableAdapter2.Fill(this.vojnikDataSet1.Vojnik);
// TODO: This line of code loads data into the 'vojnikDataSet3.Vojnik' table. You can move,
or remove it, as needed.
this.vojnikTableAdapter1.Fill(this.vojnikDataSet.Vojnik);
// TODO: This line of code loads data into the 'vojnikDataSet.Vojnik' table. You can move,
or remove it, as needed.
this.vojnikTableAdapter.Fill(this.vojnikDataSet.Vojnik);
}
private void button1_Click(object sender, EventArgs e)

if (txtBrVojnika.Text == "")
{
MessageBox.Show("Unesite redni broj vojnika");
return;
}
if (txtIme.Text == "")
{
MessageBox.Show("Unesite ime vojnika");
return;
}
if (txtPrezime.Text == "")

MessageBox.Show("Unesite prezime vojnika");


return;

}
if (vojnikTableAdapter.VratiBrojVojnika(txtBrVojnika.Text) == 1)
{
MessageBox.Show("Vec postoji vojnik sa unetim brojem");
return;
}
vojnikTableAdapter.UnesiVojnika (txtBrVojnika.Text, txtIme.Text, txtPrezime.Text,
dtpDatumRodjenja.Value);
vojnikTableAdapter.Fill(vojnikDataSet.Vojnik);
txtBrVojnika.Text = "";
txtIme.Text = "";
txtPrezime.Text = "";
dtpDatumRodjenja.Value = DateTime.Now;
MessageBox.Show("Vojnik je uspesno unesen");
}
private void txtBrisanje_Click(object sender, EventArgs e)
{
DialogResult asd = MessageBox.Show("Da li ste sigurni da zelite da nastavite?", "Brisanje
Vojnika", MessageBoxButtons.YesNoCancel);
if (asd == DialogResult.No)
{
return;
}
string brVojnika = Convert.ToString(dataGridView1.SelectedRows[0].Cells[0].Value);
vojnikTableAdapter.ObrisiVojnika(brVojnika);
vojnikTableAdapter.Fill(vojnikDataSet.Vojnik);
MessageBox.Show("Vojnik uspesno obrisan");
}
private void txtNazad_Click(object sender, EventArgs e)
{
Form1 forma1 = new Form1();
forma1.Show();
this.Close();
}
private void button2_Click(object sender, EventArgs e)
{
Form3 forma3 = new Form3();
forma3.Show();
this.Close();
}
}
}

FORMA 3:

using
using
using
using
using
using
using
using

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

namespace WindowsFormsApplication8
{
public partial class Form3 : Form
{
public Form3()
{
InitializeComponent();
}
private void Form3_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the 'vojnikDataSet1.Vojnik' table. You can move,
or remove it, as needed.
this.vojnikTableAdapter.Fill(this.vojnikDataSet1.Vojnik);
}
private void txtPretraga_Click(object sender, EventArgs e)
{
VojnikDataSet1.VojnikDataTable tabelaVojnik = vojnikDataSet1.Vojnik;
if (checkBox1.Checked)
{
if (txtBrojVojnika.Text != "")
{
tabelaVojnik = vojnikTableAdapter.VratiVojnikaPoBroju(txtBrojVojnika.Text);
}
}
else
{
tabelaVojnik = vojnikTableAdapter.VratiVojnikePoSvimKriterijumima(txtBrojVojnika.Text,
txtIme.Text, txtPrezime.Text);
}
}

dataGridView1.DataSource = tabelaVojnik;

private void checkBox1_CheckedChanged(object sender, EventArgs e)


{
if (checkBox1.Checked)
{
txtBrojVojnika.Visible = true;
txtIme.Visible = false;
txtPrezime.Visible = false;
}
else
{
txtIme.Visible = true;

txtPrezime.Visible = true;
txtBrojVojnika.Visible = false;
}

private void txtNazad_Click(object sender, EventArgs e)


{
Form1 forma1 = new Form1();
forma1.Show();
this.Close();
}
private void button1_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void button2_Click(object sender, EventArgs e)
{
Form2 forma2 = new Form2();
forma2.Show();
this.Hide();
}
private void Kriterijumi_Enter(object sender, EventArgs e)
{
}
}

Potrebbero piacerti anche