private void btnSave_Click(object sender, EventArgs e) { Library.Zakoni usluge = new Library.Zakoni(); if (!usluge.CheckIfExist(txtNaziv.Text)) { usluge.Naziv = txtNaziv.Text; usluge.Napomena = txtNapomena.Text; usluge.InsertData(); } else { usluge.Naziv = txtNaziv.Text; usluge.Napomena = txtNapomena.Text; usluge.UpdateData(); } this.Close(); }
private void gridControl1_EmbeddedNavigator_ButtonClick(object sender, DevExpress.XtraEditors.NavigatorButtonClickEventArgs e) { if (e.Button.ButtonType == NavigatorButtonType.Append) { Editors.Zakoni usluge = new Editors.Zakoni(); usluge.Show(); } else if (e.Button.ButtonType == NavigatorButtonType.Remove) { int iFocus = gridView1.FocusedRowHandle; if (iFocus < 0) { return; } int id = (int)gridView1.GetFocusedRowCellValue("Id"); if (MessageBox.Show("Dali ste sigurni za brisanje označenog zapisa?", "Upozorenje", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) == DialogResult.Yes) { Library.Zakoni item = new Library.Zakoni(); item.DeleteData(id); } } }