Beispiel #1
0
        private void btnSimpan_Click(object sender, EventArgs e)
        {
            lib.conn_open();
            lib.begintransaction();

            try
            {
                NameValueCollection nvc = new NameValueCollection();
                NameValueCollection key = new NameValueCollection();

                lib.addToNVC(key, "kontrakid", txtNoKontrak.Value);
                lib.addToNVC(nvc, "nama", txtNama.Text);
                lib.addToNVC(nvc, "ktp", txtKtp.Value);
                lib.addToNVC(nvc, "status_pernikahan", txtStatusPernikahan.Text);
                lib.addToNVC(nvc, "limit", txtLimit.Value);
                lib.addToNVC(nvc, "tenor", txtTenor.Value);
                lib.addToNVC(nvc, "bunga", txtBunga.Value);
                lib.addToNVC(nvc, "angsuran", txtAngsuran.Value);
                lib.addToNVC(nvc, "alamat", txtAlamat.Text);
                lib.addToNVC(nvc, "created_date", DateTime.Now.ToString("yyyy-MM-dd dd:mm:ss.fff"));
                lib.addToNVC(nvc, "created_by", "yusron");

                DataTable dtExisting = lib.getDataTable("SELECT *FROM kredit where kontrakid=@1", new object[] { txtNoKontrak.Value });

                if (lib.saveNVC(key, nvc, "kredit") > 0)
                {
                    MessageBox.Show("Data disimpan!");

                    if (dtExisting.Rows.Count == 0)
                    {
                        lib.executeNonQuery("exec sp_updateidinc 'kredit'");
                    }
                    clearAll();
                }

                lib.committransaction();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Perhatian", MessageBoxButtons.OK, MessageBoxIcon.Error);
                lib.rollbackTransaction();
            }

            lib.conn_close();
        }
Beispiel #2
0
        private void btnSimpan_Click(object sender, EventArgs e)
        {
            lib.conn_open();

            try
            {
                lib.begintransaction();

                NameValueCollection nvc = new NameValueCollection();
                NameValueCollection key = new NameValueCollection();

                lib.addToNVC(key, "bayarid", txtIDBayar.Value);
                lib.addToNVC(nvc, "nama", txtNama.Value);
                lib.addToNVC(nvc, "kontrakid", txtNoKontrak.Value);
                lib.addToNVC(nvc, "tgl", txtTgl.Text + DateTime.Now.ToString(" HH:mm:ss.fff"));
                lib.addToNVC(nvc, "bayarke", txtBayarKe.Value);
                lib.addToNVC(nvc, "sisaangsuranbln", lblSisaBulan.Text.Replace(" bulan", ""));
                lib.addToNVC(nvc, "sisaangsurannominal", lblSisaTagihan.Text.Replace(".", "").Replace("Rp", "").Replace(" ", ""));
                lib.addToNVC(nvc, "bayarke", txtBayarKe.Value);

                if (lib.saveNVC(key, nvc, "pembayaran") > 0)
                {
                    MessageBox.Show("Pembayaran berhasil!", "Perhatian");

                    lib.executeNonQuery("exec sp_updateidinc 'bayar'");
                }
                clearAll();
                lib.committransaction();
            }
            catch (Exception ex)
            {
                lib.rollbackTransaction();
                MessageBox.Show(ex.Message, "Perhatian", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            lib.conn_close();
        }