private void simpleButtonAdd_Click(object sender, EventArgs e) { IndexSurat indexSurat = new IndexSurat(XpoDefault.Session) { Index = textEditIndex.Text.Trim(), Keperluan = textEditKeperluan.Text.Trim(), }; indexSurat.Save(); ClearForm(); xpCollectionData.Reload(); }
private void simpleButtonUpdate_Click(object sender, EventArgs e) { try { if (indexSurat != null) { indexSurat.Index = textEditIndex.Text.Trim(); indexSurat.Keperluan = textEditKeperluan.Text.Trim(); indexSurat.Save(); ClearForm(); xpCollectionData.Reload(); } else { throw new Exception("Anda belum memilih data"); } } catch (Exception exception) { XtraMessageBox.Show(exception.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }