Ejemplo n.º 1
0
        private void btnSacuvajLj_Click(object sender, EventArgs e)
        {
            if (rbMuski.Checked == true)
            {
                pol = "M";
            }
            if (rbZenski.Checked == true)
            {
                pol = "Z";
            }

            if (btnSacuvajLj.Text == "Izmeni Ljubimca")
            {
                try
                {
                    if (kontroler.IzmeniLjubimca(txtIDljub, txtImeLjubimca, cmbZivotinje, txtRasa, txtStarost, txtBoja, pol, txtID, txtJmbg, txtIme, txtPrezime, txtEmail, txtTelefon, txtZanimanje, txtNapomena, odgovor))
                    {
                        MessageBox.Show("Uspešno ste izmenili ljubimca!");
                        this.Close();
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                    throw;
                }
            }
            else
            {
                if (kontroler.sacuvajLjubimca(txtImeLjubimca, cmbZivotinje, txtRasa, txtStarost, txtBoja, pol, txtIme, txtPrezime, txtEmail, txtJmbg, lj.Id, txtID, txtZanimanje, txtTelefon))
                {
                    this.Close();
                }
            }
        }