public bool konfirmasiPembayaran(KonfrimasiPembayaran CIN) { DBConnect db = new DBConnect(); MySqlConnection conn = new MySqlConnection(db.connectionString()); MySqlCommand cmd; conn.Open(); try { cmd = conn.CreateCommand(); cmd.CommandText = "INSERT INTO `checkin_checkout`(`DEPOSIT`, `CASH`, `ID_BOOKING`) VALUES (@deposit,@cash,@id); INSERT INTO `detil_transaksi_pembayaran`(`JENIS_PEMBAYARAN`, `NOMOR_KARTU_KREDIT`, `NO_INVOICE`) VALUES (@jenis,@kartu,@no)"; cmd.Parameters.AddWithValue("@deposit", CIN.Deposit); cmd.Parameters.AddWithValue("@cash", CIN.Cash); cmd.Parameters.AddWithValue("@id", CIN.Id_Booking); cmd.Parameters.AddWithValue("@jenis", CIN.Jenis_pembayaran); cmd.Parameters.AddWithValue("@kartu", CIN.Nomor_kartu_kredit); cmd.Parameters.AddWithValue("@no", CIN.No_invoice); updateStatusPembayaran(CIN.No_invoice); cmd.ExecuteNonQuery(); return(true); } catch (Exception ex) { Console.WriteLine(ex.Message); return(false); } finally { if (conn.State == ConnectionState.Open) { conn.Close(); } } }
private void btnKonfrimasi_Click(object sender, EventArgs e) { if (cmbJenis.Text.ToLower() == "kredit") { if (txtNoKartu.Text != "") { float deposit = 300000; float cash = 123; string id_booking_invoice = txtId.Text; string jenis = cmbJenis.Text; string no = txtNoKartu.Text; KonfrimasiPembayaran KON = new KonfrimasiPembayaran(jenis, no, id_booking_invoice, deposit, cash, id_booking_invoice); DataTable dt = new DataTable(); MySqlDataAdapter adapter = KRC.CekKonfirmasi(id_booking_invoice); adapter.Fill(dt); if (dt.Rows.Count > 0) { string JENIS = dt.Rows[0]["JENIS_STATUS"].ToString(); if (JENIS == "LUNAS") { MessageBox.Show("Sudah Lunas", "INFORMASI", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { DialogResult dr = MessageBox.Show("Apakah anda yakin untuk Konfirmasi Pembayaran?", "Pertanyaan", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr == DialogResult.Yes) { KRC.KonfirmasiPembayaran(KON); MessageBox.Show("Berhasil DiKonfirmasi", "INFORMASI", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } } else if (cmbJenis.Text.ToLower() == "pilih") { MessageBox.Show("Pili Terlebih Dahulu", "INFORMASI", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("No Rekening tidak boleh kosong", "INFORMASI", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { float deposit = 300000; float cash = 123; string id_booking_invoice = txtId.Text; string jenis = cmbJenis.Text; string no = ""; KonfrimasiPembayaran KON = new KonfrimasiPembayaran(jenis, no, id_booking_invoice, deposit, cash, id_booking_invoice); DataTable dt = new DataTable(); MySqlDataAdapter adapter = KRC.CekKonfirmasi(id_booking_invoice); adapter.Fill(dt); if (dt.Rows.Count > 0) { string JENIS = dt.Rows[0]["JENIS_STATUS"].ToString(); if (JENIS == "LUNAS") { MessageBox.Show("Sudah Lunas", "INFORMASI", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { DialogResult dr = MessageBox.Show("Apakah anda yakin untuk Konfirmasi Pembayaran?", "Pertanyaan", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr == DialogResult.Yes) { KRC.KonfirmasiPembayaran(KON); MessageBox.Show("Berhasil DiKonfirmasi", "INFORMASI", MessageBoxButtons.OK, MessageBoxIcon.Information); visibleText(false); } else { visibleText(false); } } } } /* * float deposit = 300000; * float cash = 123; * string id_booking_invoice = txtId.Text; * string jenis = cmbJenis.Text; * string no = txtNoKartu.Text; * * KonfrimasiPembayaran KON = new KonfrimasiPembayaran(jenis, no, id_booking_invoice, deposit, cash, id_booking_invoice); * * DialogResult dr = MessageBox.Show("Apakah anda yakin untuk Konfirmasi Pembayaran?", "Pertanyaan", MessageBoxButtons.YesNo, MessageBoxIcon.Question); * if (dr == DialogResult.Yes) * { * KRC.KonfirmasiPembayaran(KON); * RefreshGridView(); * enableText(false); * btnKonfrimasi.Enabled = false; * }*/ }
private void btnKonfirmasi_Click(object sender, EventArgs e) { if (cmbJenis.Text.ToLower() == "kredit") { if (txtNoKartu.Text != "") { float deposit = 300000; float cash = float.Parse(lblTotalHarga.Text) - deposit; string id_booking_invoice = txtId_Booking.Text; string jenis = cmbJenis.Text; string no = txtNoKartu.Text; KonfrimasiPembayaran KON = new KonfrimasiPembayaran(jenis, no, id_booking_invoice, deposit, cash, id_booking_invoice); DataTable dt = new DataTable(); MySqlDataAdapter adapter = KRC.CekKonfirmasi(id_booking_invoice); adapter.Fill(dt); if (dt.Rows.Count > 0) { string JENIS = dt.Rows[0]["JENIS_STATUS"].ToString(); if (JENIS == "LUNAS") { MessageBox.Show("Sudah Lunas", "INFORMASI", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { DialogResult dr = MessageBox.Show("Apakah anda yakin untuk Konfirmasi Pembayaran?", "Pertanyaan", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr == DialogResult.Yes) { KRC.KonfirmasiPembayaran(KON); MessageBox.Show("Berhasil DiKonfirmasi", "INFORMASI", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } } else { MessageBox.Show("No Rekening tidak boleh kosong", "INFORMASI", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { float deposit = 300000; float cash = float.Parse(lblTotalHarga.Text) - deposit; string id_booking_invoice = txtId_Booking.Text; string jenis = cmbJenis.Text; string no = ""; KonfrimasiPembayaran KON = new KonfrimasiPembayaran(jenis, no, id_booking_invoice, deposit, cash, id_booking_invoice); DataTable dt = new DataTable(); MySqlDataAdapter adapter = KRC.CekKonfirmasi(id_booking_invoice); adapter.Fill(dt); if (dt.Rows.Count > 0) { string JENIS = dt.Rows[0]["JENIS_STATUS"].ToString(); if (JENIS == "LUNAS") { MessageBox.Show("Sudah Lunas", "INFORMASI", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { DialogResult dr = MessageBox.Show("Apakah anda yakin untuk Konfirmasi Pembayaran?", "Pertanyaan", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr == DialogResult.Yes) { KRC.KonfirmasiPembayaran(KON); MessageBox.Show("Berhasil DiKonfirmasi", "INFORMASI", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } } }
public bool KonfirmasiPembayaran(KonfrimasiPembayaran KP) { return(KRD.konfirmasiPembayaran(KP)); }