public frmRocistaDetalji(int?rocisteId = null, frmRocista frm1 = null) { InitializeComponent(); _id = rocisteId; frm2 = frm1; this.AutoValidate = AutoValidate.Disable; }
private async void BtnSacuvaj_Click(object sender, EventArgs e) { bool odrzano = false; if (radioButtonDA.Checked) { odrzano = true; } else { odrzano = false; } if (this.ValidateChildren()) { var request = new RocistaInsertRequest() { ZaposlenikId = int.Parse(cbZaposlenik.SelectedValue.ToString()), PredmetID = int.Parse(cbPredmet.SelectedValue.ToString()), DatumRocista = dtpDatumRocista.Value, Mjesto = txtMjesto.Text, Napomena = txtNapomena.Text, Odrzano = odrzano, IsDeleted = false }; if (_id.HasValue) { await _aPIServiceRociste.Update <Model.Rocista>(_id, request); MessageBox.Show(Properties.Resources.MessageBoxForSave); this.Hide(); frm2.RefreshData(); } else { await _aPIServiceRociste.Insert <Model.Rocista>(request); MessageBox.Show(Properties.Resources.MessageBoxForSave); this.Hide(); frmRocista frm = new frmRocista(); frm.Show(); } } }