Exemplo n.º 1
0
        private void dataGridViewVozila_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                string   tablice = dataGridViewVozila.Rows[e.RowIndex].Cells[0].FormattedValue.ToString();
                DateTime dolazak = (DateTime)dataGridViewVozila.Rows[e.RowIndex].Cells[2].Value;

                StampajRacun racun = new StampajRacun();
                racun.Tablice = tablice;
                racun.Dolazak = dolazak;
                racun.Radnik  = Radnik;



                racun.ShowDialog();
                dataGridViewVozila.Rows.RemoveAt(e.RowIndex);
            }
            catch (Exception exx)
            {
                MessageBox.Show(exx.Message, "Greska");
            }
        }
Exemplo n.º 2
0
        private void buttonPronadji_Click(object sender, EventArgs e)
        {
            DateTime dolazak;

            if (!string.IsNullOrEmpty(textBox1.Text))
            {
                try
                {
                    int br = 0;
                    foreach (Vozilo v in SvaVozila)
                    {
                        if (v.Tablice == textBox1.Text)
                        {
                            br++;
                        }
                    }


                    if (br == 1)
                    {
                        StampajRacun racun = new StampajRacun();


                        for (int i = 0; i < dataGridViewVozila.RowCount; i++)
                        {
                            string tablice = dataGridViewVozila.Rows[i].Cells[0].FormattedValue.ToString();

                            if (textBox1.Text == tablice)

                            {
                                dolazak = (DateTime)dataGridViewVozila.Rows[i].Cells[2].Value;
                                dataGridViewVozila.Rows.RemoveAt(i);
                                racun.Tablice = textBox1.Text;
                                racun.Dolazak = dolazak;
                                racun.Radnik  = Radnik;
                            }
                        }



                        racun.ShowDialog();
                        textBox1.Clear();
                        this.Invalidate();
                    }
                    else
                    {
                        MessageBox.Show("Unesite tacne tablice!", "Greska");
                    }
                }
                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");
                    }
                }
            }
            else
            {
                MessageBox.Show("Unesite tablice!", "Greska");
            }
        }