private void TxtNoKontrak_btnClick(object sender, EventArgs e) { PopUpFindKontrak pfk = new PopUpFindKontrak(); if (pfk.ShowDialog() == DialogResult.OK) { txtNoKontrak.Value = pfk.Response; lib.conn_open(); try { DataTable dt = lib.getDataTable("SELECT *FROM kredit WHERE kontrakid=@1", new object[] { txtNoKontrak.Value }); if (dt.Rows.Count > 0) { txtNama.Text = dt.Rows[0]["nama"].ToString(); txtAlamat.Text = dt.Rows[0]["alamat"].ToString(); txtAngsuran.Value = dt.Rows[0]["angsuran"].ToString(); txtBunga.Value = dt.Rows[0]["bunga"].ToString(); txtKtp.Value = dt.Rows[0]["ktp"].ToString(); txtLimit.Value = dt.Rows[0]["limit"].ToString(); txtStatusPernikahan.SelectedItem = dt.Rows[0]["status_pernikahan"].ToString(); txtTenor.Value = dt.Rows[0]["tenor"].ToString(); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Perhatian", MessageBoxButtons.OK, MessageBoxIcon.Error); } lib.conn_close(); } }
private void txtNoKontrak_btnClick(object sender, EventArgs e) { PopUpFindKontrak pfk = new PopUpFindKontrak(); if (pfk.ShowDialog() == DialogResult.OK) { txtNoKontrak.Value = pfk.Response; lib.conn_open(); try { DataTable dt = lib.getDataTable("SELECT *FROM kredit WHERE kontrakid=@1", new object[] { txtNoKontrak.Value }); if (dt.Rows.Count > 0) { txtNama.Value = dt.Rows[0]["nama"].ToString(); DataTable dtNextPembayaran = lib.getDataTable(@"select *from dbo.getDataNextPembayaran(@1)", new object[] { txtNoKontrak.Value }); if (dtNextPembayaran.Rows.Count > 0) { txtBayarKe.Value = dtNextPembayaran.Rows[0]["bayarke"].ToString(); lblSisaBulan.Text = dtNextPembayaran.Rows[0]["sisa_angsuran_bulan"].ToString(); lblSisaTagihan.Text = dtNextPembayaran.Rows[0]["sisa_angsuran_nominal"].ToString(); } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Perhatian", MessageBoxButtons.OK, MessageBoxIcon.Error); } lib.conn_close(); } }