Beispiel #1
0
        private void btnIzmeni_Click(object sender, EventArgs e)
        {
            if (!validacija())
            {
                return;
            }
            if (listaStaratelja.SelectedItems.Count == 0)
            {
                MessageBox.Show("Izaberite staratelja koga zelite da izmenite!");
                return;
            }

            int idStaratelja = Int32.Parse(listaStaratelja.SelectedItems[0].SubItems[0].Text);

            if (btnIzmeni.Text == "Izmeni")
            {
                StarateljPregled s = DTOManager.vratiStaratelja(idStaratelja);
                txbIme.Text     = s.Ime;
                txbPrezime.Text = s.Prezime;
                if (s.clanSaveta == 1)
                {
                    chBClanRodSaveta.Checked = true;
                }
                else
                {
                    chBClanRodSaveta.Checked = false;
                }
                btnIzmeni.Text = "Sacuvaj izmene";
            }
            else
            {
                String ime     = txbIme.Text;
                String prezime = txbPrezime.Text;
                int    clan    = 0;
                if (chBClanRodSaveta.Checked == true)
                {
                    clan = 1;
                }
                StarateljPregled  s       = new StarateljPregled(idStaratelja, ime, prezime, clan);
                string            poruka  = "Da li zelite da izmenite izabranog staratelja?";
                string            title   = "Pitanje";
                MessageBoxButtons buttons = MessageBoxButtons.OKCancel;
                DialogResult      result  = MessageBox.Show(poruka, title, buttons);
                if (result == DialogResult.OK)
                {
                    DTOManager.azurirajStaratelja(s);
                }
                else
                {
                }
                btnIzmeni.Text = "Izmeni";
                popuniPodacima();
                txbIme.ResetText();
                txbPrezime.ResetText();
            }
        }