private void btnSimpan_Click(object sender, EventArgs e) { if (WithErrors()) { val.validateTextBox(txtIndex, errorProvider1, "Index harus diisi."); return; } if (Convert.ToInt32(txtId.Text) == 0) { var index = new REF_INDEX_GAJI(); index.INDEX_GAJI = Convert.ToDecimal(txtIndex.Text); context.REF_INDEX_GAJIs.InsertOnSubmit(index); } else { var query = from a in context.REF_INDEX_GAJIs where a.ID_INDEX_GAJI == Convert.ToInt32(txtId.Text) select a; foreach (var a in query) { a.INDEX_GAJI = Convert.ToDecimal(txtIndex.Text); } } context.SubmitChanges(); Close(); }
partial void DeleteREF_INDEX_GAJI(REF_INDEX_GAJI instance);
partial void UpdateREF_INDEX_GAJI(REF_INDEX_GAJI instance);
partial void InsertREF_INDEX_GAJI(REF_INDEX_GAJI instance);