private async void BtnZavrsi_Click(object sender, EventArgs e)
        {
            NabavkeUpsertRequest req = new NabavkeUpsertRequest
            {
                NabavkaId = _id,
                Zavrsena  = true
            };
            await _nabavka.Update <NabavkeUpsertRequest>(_id, req);

            MessageBox.Show("Narudzba uspjesno zavrsena", " ", MessageBoxButtons.OK, MessageBoxIcon.Information);

            NabavkaSearchRequest reload = new NabavkaSearchRequest {
                Zavrsena = false
            };
            await _parent.LoadNabavke(reload);

            Close();
        }
Esempio n. 2
0
        private async void BtnNaruci_Click(object sender, EventArgs e)
        {
            if (await Validacija())
            {
                MessageBox.Show("Unesite trazena polja");
            }
            else
            {
                NabavkaStavkeUpsertRequest model = new NabavkaStavkeUpsertRequest();

                model.NabavkaId = _id;

                if (int.TryParse(txtKolicina.Value.ToString(), out int kol))
                {
                    model.Kolicina = kol;
                }

                var proizvod = cmbProizvod.SelectedValue;
                if (int.TryParse(proizvod.ToString(), out int pid))
                {
                    model.RobaId = pid;
                }


                var nesto = await _detalji.Insert <Model.NabavkaStavke>(model);

                MessageBox.Show("Dodano na listu!");
                Close();
                NabavkaSearchRequest search = new NabavkaSearchRequest
                {
                    Zavrsena = false
                };
                await _parent.LoadNabavke(search);

                frmNabavkaNova form = new frmNabavkaNova(_id, _parent);
                form.Show();
            }
        }