Пример #1
0
        private void ButtonPromeni_Click(object sender, RoutedEventArgs e)
        {
            if (ListBox1.SelectedIndex < 0)
            {
                MessageBox.Show("Odaberi clana");
                return;
            }

            Clan clanPromena     = ListBox1.SelectedItem as Clan;
            WindowClanPromena w1 = new WindowClanPromena();

            w1.Owner = this;
            w1.Title = "Promeni podatke o clanu";
            w1.Clan  = clanPromena;
            int id = clanPromena.ClanId;

            if (w1.ShowDialog() == true)
            {
                clanPromena        = w1.Clan;
                clanPromena.ClanId = id;



                int rezultat = cDal.PromeniClana(clanPromena);

                if (rezultat == 0)
                {
                    PrikaziClanove();
                    ListBox1.SelectedIndex = listaClanova.FindIndex(c1 => c1.ClanId == clanPromena.ClanId);
                    MessageBox.Show("Podaci promenjeni");
                }
                else
                {
                    MessageBox.Show("Greska pri promeni");
                }
            }
        }
Пример #2
0
        private void ButtonUbaci_Click(object sender, RoutedEventArgs e)
        {
            WindowClanPromena w1 = new WindowClanPromena();

            w1.Title = "Ubaci podatke o clanu";
            w1.Owner = this;
            if (w1.ShowDialog() == true)
            {
                Clan c = w1.Clan;

                int id = cDal.UbaciClana(c);

                if (id != -1)
                {
                    PrikaziClanove();
                    ListBox1.SelectedIndex = listaClanova.FindIndex(c1 => c1.ClanId == id);
                    MessageBox.Show("Ubacen novi clan");
                }
                else
                {
                    MessageBox.Show("Greska pri unosu clana");
                }
            }
        }