Beispiel #1
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     Library.Usluge usluge = new Library.Usluge();
     if (!usluge.CheckIfExist(txtNaziv.Text))
     {
         usluge.Naziv = txtNaziv.Text;
         usluge.InsertData();
     }
     else
     {
         usluge.Naziv = txtNaziv.Text;
         usluge.UpdateData();
     }
     this.Close();
 }
Beispiel #2
0
 private void gridControl1_EmbeddedNavigator_ButtonClick(object sender, DevExpress.XtraEditors.NavigatorButtonClickEventArgs e)
 {
     if (e.Button.ButtonType == NavigatorButtonType.Append)
     {
         Editors.Usluge usluge = new Editors.Usluge();
         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.Usluge item = new Library.Usluge();
             item.DeleteData(id);
         }
     }
 }