예제 #1
0
 public frmKlijentiDetalji(int?klijentId = null, frmKlijenti frm1 = null)
 {
     InitializeComponent();
     _id  = klijentId;
     frm2 = frm1;
     this.AutoValidate = AutoValidate.Disable;
 }
예제 #2
0
        private async void BtnSacuvaj_Click(object sender, EventArgs e)
        {
            var spol = " ";

            if (rbMusko.Checked)
            {
                spol = rbMusko.Text;
            }
            else
            {
                spol = rbZensko.Text;
            }
            bool status;

            if (checkBox1.Checked)
            {
                status = true;
            }
            else
            {
                status = false;
            }


            if (this.ValidateChildren())
            {
                var request = new KorisniciInsertRequest()
                {
                    Ime                  = txtIme.Text,
                    Prezime              = txtPrezime.Text,
                    DatumRodjenja        = dtpDatumRodjenja.Value,
                    Telefon              = txtTelefon.Text,
                    Grad                 = txtGrad.Text,
                    Adresa               = txtAdresa.Text,
                    Email                = txtEmail.Text,
                    Spol                 = spol,
                    KorisnickoIme        = txtKorisnickoIme.Text,
                    Password             = txtPassword.Text,
                    PasswordConfirmation = txtPasswordPotvrda.Text,
                    UlogeId              = int.Parse(cbUloge.SelectedValue.ToString()),
                    IsDeleted            = false,
                    RadniStaz            = "0",
                    Status               = status,
                    JMBG                 = txtJMBG.Text
                };

                if (_id.HasValue)
                {
                    await _aPIService.Update <Model.Korisnici>(_id, request);

                    MessageBox.Show(Properties.Resources.MessageBoxForSave);
                    this.Hide();
                    frm2.RefreshData();
                }
                else
                {
                    await _aPIService.Insert <Model.Korisnici>(request);

                    MessageBox.Show(Properties.Resources.MessageBoxForSave);
                    this.Hide();
                    frmKlijenti frm = new frmKlijenti();
                    frm.Show();
                }
            }
        }