private void btnSnimi_Click(object sender, EventArgs e)
        {
            try {
                if (ValidateChildren() && pictureBox1Validate())
                {
                    if (korisnik == null)
                    {
                        korisnik = new Korisnik();

                        DodijeliAtributeKorisniku(korisnik);
                        //Baza.Korisnici.Add(korisnik);
                        //Baza.SnimiKorisnika(korisnik, IspisiKorisnika(korisnik));
                        Baza.SnimiKorisnika(korisnik /*, x => MessageBox.Show(x.Ime)*/);
                    }
                    else
                    {
                        DodijeliAtributeKorisniku(korisnik);
                    }

                    Close();
                }
            } catch (Exception) {
                MessageBox.Show("", "Greška", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 2
0
 private void btnSnimi_Click(object sender, EventArgs e)
 {
     try
     {
         if (this.ValidateChildren())
         {
             Korisnik korisnik = new Korisnik();
             korisnik.Ime      = txtIme.Text;
             korisnik.Prezime  = txtPrezime.Text;
             korisnik.Username = txtUsername.Text;
             korisnik.Password = txtPassword.Text;
             korisnik.Validate();
             Baza.SnimiKorisnika(korisnik, (x) => { MessageBox.Show(x.Ime); });
             this.Close();
         }
     }
     //catch(Exception ex)
     finally
     {
         MessageBox.Show("", "Greška", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }