Exemple #1
0
        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);
        }
Exemple #2
0
        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");
                    }
                }
            }
        }
Exemple #3
0
        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");
            }
        }
Exemple #4
0
        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();
        }
Exemple #5
0
        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");
                }
            }
        }
Exemple #6
0
        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");
            }
        }
Exemple #7
0
        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");
            }
        }