private void btnSimpan_Click(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(txtNama.Text)) { iMessage.iBoxOk("Harap isi nama umat"); } else { DialogResult result = iMessage.quBoxCon("Simpan data?"); if (result == DialogResult.Yes) { String sex = String.Empty; String status = String.Empty; if (rdPria.Checked) { sex = "P"; } else { sex = "W"; } if (rdSingle.Checked) { status = "Single"; } else { status = "Married"; } if (umat.saveUmat(lblId.Text, txtNama.Text.Trim(), txtAlias.Text.Trim(), txtAlamat.Text.Trim(), txtHp.Text.Trim(), txTempat.Text.Trim(), dtLahirJemaat.Value.ToShortDateString(), sex, txtParoki.Text.Trim(), txtLingkungan.Text.Trim(), txtTlpRmh.Text.Trim(), status, cmbAgama.Text, txtSibuk.Text.Trim(), txtKomunitas.Text.Trim(), cmbSosMed.Text, txtSosMed.Text.Trim()) == true && pd.insertLine(this.headerId, lblId.Text, txtNama.Text, txtAlias.Text, txTempat.Text, dtLahirJemaat.Value.ToShortDateString(), txtHp.Text, sex) == true) { iMessage.iBoxOk("Data berhasil disimpan"); this.Close(); } else { iMessage.iBoxOk("Data gagal disimpan"); } } } }
private void btnSimpan_Click(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(txtNama.Text)) { iMessage.iBoxOk("Harap isi nama umat"); } else { DialogResult result = iMessage.quBoxCon("Simpan data?"); if (result == DialogResult.Yes) { String sex = String.Empty; String status = String.Empty; if (rdPria.Checked) { sex = "P"; } else { sex = "W"; } if (rdSingle.Checked) { status = "Single"; } else { status = "Married"; } if (editMode == false) { currId = getMaxNo(); if (umat.saveUmat(getMaxNo(), txtNama.Text.Trim(), txtAlias.Text.Trim(), txtAlamat.Text.Trim(), txtHp.Text.Trim(), txTempat.Text.Trim(), dtLahirJemaat.Value.ToShortDateString(), sex, txtParoki.Text.Trim(), txtLingkungan.Text.Trim(), txtTlpRmh.Text.Trim(), status, cmbAgama.Text, txtSibuk.Text.Trim(), txtKomunitas.Text.Trim(), cmbSosMed.Text, txtSosMed.Text.Trim()) == true) { iMessage.iBoxOk("Data berhasil disimpan"); } else { iMessage.iBoxOk("Data gagal disimpan"); } } else { currId = lblId.Text; if (umat.editUmat(currId, txtNama.Text.Trim(), txtAlias.Text.Trim(), txtAlamat.Text.Trim(), txtHp.Text.Trim(), txTempat.Text.Trim(), dtLahirJemaat.Value.ToShortDateString(), sex, txtParoki.Text.Trim(), txtLingkungan.Text.Trim(), txtTlpRmh.Text.Trim(), status, cmbAgama.Text, txtSibuk.Text.Trim(), txtKomunitas.Text.Trim(), cmbSosMed.Text, txtSosMed.Text.Trim()) == true) { editMode = false; iMessage.iBoxOk("Data berhasil diperbarui"); } else { iMessage.iBoxOk("Data gagal diperbarui"); } } disableControl(); getData(); dgvUmat.Focus(); for (int a = 0; a <= dgvUmat.Rows.Count - 1; a++) { if (dgvUmat.Rows[a].Cells[1].Value.ToString() == currId) { dgvUmat.CurrentCell = dgvUmat.Rows[a].Cells[2]; bindControls(); } } } } }