public List <Vozilo> SvaVozila() { List <Vozilo> Sva_Vozila = new List <Vozilo>(); try { connection.Open(); OleDbCommand comm = new OleDbCommand(); comm.Connection = connection; comm.CommandText = "select * from Vozilo;"; OleDbDataReader reader = comm.ExecuteReader(); while (reader.Read()) { Vozilo vozilo = new Vozilo(); vozilo.Tablice = reader["Tablice"].ToString(); vozilo.Dolazak = (DateTime)reader["Dolazak"]; Sva_Vozila.Add(vozilo); } connection.Close(); } catch (Exception ex) { if (ex is SystemException || ex is OleDbException || ex is NotSupportedException || ex is UnauthorizedAccessException || ex is FormatException || ex is IndexOutOfRangeException || ex is InsufficientMemoryException || ex is EntryPointNotFoundException || ex is EntryPointNotFoundException || ex is InvalidCastException || ex is InvalidProgramException) { MessageBox.Show(ex.Message, "Greska"); } else { MessageBox.Show(ex.Message, "Greska"); } if (connection != null) { connection.Close(); } } return(Sva_Vozila); }
private void SefForma_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Control && e.KeyCode == Keys.P) { Uvid uv = new Uvid(); uv.Show(); } else if (e.KeyCode == Keys.Control && e.KeyCode == Keys.T) { try { Parking parking = new Parking(); Vozilo vozilo = new Vozilo(); parking.TrenutnoStanje(); int BrojSlobodnih = parking.BrojMesta - vozilo.IzbrojVozila(); textBoxBrojSlobodnih.Text = BrojSlobodnih.ToString(); textBoxBrojVozila.Text = vozilo.IzbrojVozila().ToString(); label2.Visible = true; label3.Visible = true; textBoxBrojSlobodnih.Visible = true; textBoxBrojVozila.Visible = true; } catch (Exception ex) { if (ex is SystemException || ex is NotSupportedException || ex is UnauthorizedAccessException || ex is FormatException || ex is IndexOutOfRangeException || ex is InsufficientMemoryException || ex is EntryPointNotFoundException || ex is EntryPointNotFoundException || ex is EvaluateException || ex is InvalidCastException || ex is InvalidProgramException) { MessageBox.Show(ex.Message, "Greska"); } else { MessageBox.Show(ex.Message, "Greska"); } } } }
private void buttonDodajVozilo_Click(object sender, EventArgs e) { try { Vozilo vozilo = new Vozilo(); vozilo.Tablice = textBoxTablice.Text; vozilo.DodajVozilo(); this.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Greska"); } }
private void izmeniBrojMestaToolStripMenuItem_Click(object sender, EventArgs e) { IzmenaMesta zime = new IzmenaMesta(); zime.ShowDialog(); Parking parking = new Parking(); Vozilo vozilo = new Vozilo(); parking.TrenutnoStanje(); int BrojSlobodnih = parking.BrojMesta - vozilo.IzbrojVozila(); textBoxBrojSlobodnih.Text = BrojSlobodnih.ToString(); textBoxBrojVozila.Text = vozilo.IzbrojVozila().ToString(); }
private void button1_Click(object sender, EventArgs e) { try { Naplata naplata = new Naplata(); naplata.Radnik = logRadnik; naplata.ShowDialog(); textBoxRadnik.Text = logRadnik.Ime; Parking parking = new Parking(); Vozilo vozilo = new Vozilo(); parking.TrenutnoStanje(); BrojSlobodnih = parking.BrojMesta - vozilo.IzbrojVozila(); textBoxBrojSlobodnih.Text = BrojSlobodnih.ToString(); textBoxBrojVozila.Text = vozilo.IzbrojVozila().ToString(); } catch (Exception ex) { if (ex is SystemException || ex is OleDbException || ex is NotSupportedException || ex is UnauthorizedAccessException || ex is FormatException || ex is IndexOutOfRangeException || ex is InsufficientMemoryException || ex is EntryPointNotFoundException || ex is EntryPointNotFoundException || ex is EvaluateException || ex is InvalidCastException || ex is AccessViolationException || ex is InvalidProgramException) { MessageBox.Show(ex.Message, "GRESKA"); } else { MessageBox.Show(ex.Message, "GRESKA"); } } }
public void UcitajGrid() { try { Vozilo v = new Vozilo(); SvaVozila = v.SvaVozila(); foreach (Vozilo x in SvaVozila) { TimeSpan span = DateTime.Now.Subtract(x.Dolazak); dataGridViewVozila.Rows.Add(x.Tablice, span.TotalMinutes.ToString("#"), x.Dolazak); } dataGridViewVozila.Sort(dataGridViewVozila.Columns[1], ListSortDirection.Descending); } catch (Exception ex) { MessageBox.Show(ex.Message, "Greska"); } }
private void buttonStampaj_Click(object sender, EventArgs e) { try { Vozilo vozilo = new Vozilo(); Racun racun = new Racun(); racun.VremeDolaska = Dolazak; racun.Radnik = Radnik; racun.Naplata = cena; racun.SacuvajRacun(); vozilo.Tablice = Tablice; vozilo.MakniVozilo(); this.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Greska"); } }