Beispiel #1
0
        private void Button_DodajVozaca_Click(object sender, RoutedEventArgs e)
        {
            DodajVozaca prozor = new DodajVozaca();

            prozor.ShowDialog();
            Button_Click_Vozaci(sender, e);
        }
Beispiel #2
0
        private void btnIzmeniVozaca_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                azuriraj = true;
                DodajVozaca prozor = new DodajVozaca();

                konekcija.Open();
                DataRowView red = (DataRowView)CentralniGrid.SelectedItems[0];
                selektovan = red;
                string upit = "Select ImeVozaca, PrezimeVozaca, BrojVozacke from tblVozac where VozacID=" + red["ID"];

                SqlCommand    komanda = new SqlCommand(upit, konekcija);
                SqlDataReader citac   = komanda.ExecuteReader();

                while (citac.Read())
                {
                    prozor.txtImeVozaca.Text     = citac["ImeVozaca"].ToString();
                    prozor.txtPrezimeVozaca.Text = citac["PrezimeVozaca"].ToString();
                    prozor.txtBrojVozacke.Text   = citac["BrojVozacke"].ToString();
                }
                prozor.ShowDialog();
            }
            catch (ArgumentOutOfRangeException)
            {
                MessageBox.Show("Potrebno je selektovati odgovarajuci red!");
            }
            finally
            {
                if (konekcija != null)
                {
                    konekcija.Close();
                }
                Button_Click_Vozaci(sender, e);
                azuriraj = false;
            }
        }