Example #1
0
        private void Osvezi()
        {
            SqlConnection SqlConn = new SqlConnection(@"Data Source=DESKTOP-3QT4TNV\SQLEXPRESS;Initial Catalog=Teretana;Integrated Security=True");

            SqlConn.Open();
            SqlCommand    cmd  = new SqlCommand("SELECT * FROM View_ListaAktivnihClanova", SqlConn);
            SqlDataReader read = cmd.ExecuteReader();

            while (read.Read())
            {
                Clanovi cl = new Clanovi();
                //int AktivnaClanarinaId = read.GetInt32(0);
                string   Ime     = read.GetString(0);
                string   Prezime = read.GetString(1);
                DateTime VremeDo = read.GetDateTime(2);

                //cl.AktivnaClanarinaId = AktivnaClanarinaId;
                cl.Ime     = Ime;
                cl.Prezime = Prezime;
                cl.VremeDo = VremeDo;

                clanovi.Add(cl);
            }
            SqlConn.Close();
            listView.ItemsSource = null;
            listView.ItemsSource = clanovi;
        }
Example #2
0
        private void listView_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            Clanovi item = (Clanovi)listView.SelectedItem;

            textBoxIme.Text     = item.Ime;
            textBoxPrezime.Text = item.Prezime;
            textBoxVremeDo.Text = item.VremeDo.ToShortDateString();
        }
Example #3
0
 private void listView_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     try
     {
         Clanovi items = (Clanovi)listView.SelectedItem;
         textBoxIme.Text     = items.Ime;
         textBoxPrezime.Text = items.Prezime;
         textBoxVremeDo.Text = items.VremeDo.ToShortDateString();
     }
     catch
     {
         clanovi.Clear();
         Osvezi();
     }
 }