示例#1
0
        private void loadDataBooking()
        {
            dgvPembayaran.Rows.Clear();
            try
            {
                String sql = "select * FROM Booking";
                cmd = new OleDbCommand(sql, dbConn);
                dbConn.Open();
                adapter = new OleDbDataAdapter(cmd);
                adapter.Fill(dt);

                foreach (DataRow row in dt.Rows)
                {
                    Bayar byr = new Bayar();
                    byr.Identitas = row[6].ToString();
                    byr.Tipe      = row[0].ToString();
                    byr.TipeBed   = row[1].ToString();
                    byr.NoKamar   = row[3].ToString();
                    byr.ExtraBed  = row[4].ToString();
                    byr.Harga     = Int32.Parse(row[5].ToString());
                    populate(byr);
                }
                dbConn.Close();
                dt.Rows.Clear();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                dbConn.Close();
            }
        }
示例#2
0
        private void addPembayaran(Bayar byr)
        {
            const string sql = "insert into Pembayaran(Identitas, Tipe, Tipe_Bed, No_Kamar, Extra_Bed, Harga, Metode, Bank, No_Rekening) values (@identitas, @tipe, @tipeBed, @noKamar, @extraBed, @harga, @metode, @bank, @no)";

            cmd = new OleDbCommand(sql, dbConn);
            cmd.Parameters.AddWithValue("@identitas", byr.Identitas);
            cmd.Parameters.AddWithValue("@tipe", byr.Tipe);
            cmd.Parameters.AddWithValue("@tipeBed", byr.TipeBed);
            cmd.Parameters.AddWithValue("@noKamar", byr.NoKamar);
            cmd.Parameters.AddWithValue("@extraBed", byr.ExtraBed);
            cmd.Parameters.AddWithValue("@harga", byr.Harga);
            cmd.Parameters.AddWithValue("@metode", byr.Metode);
            cmd.Parameters.AddWithValue("@bank", byr.Bank);
            cmd.Parameters.AddWithValue("@no", byr.No);
            try
            {
                dbConn.Open();
                if (cmd.ExecuteNonQuery() > 0)
                {
                }
                dbConn.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                dbConn.Close();
            }
        }
示例#3
0
        public MainWindow()
        {
            InitializeComponent();
            payment = new Bayar(this);
            KeranjangBelanja keranjangBelanja = new KeranjangBelanja(payment, this);

            controller = new MainWindowController(keranjangBelanja, payment);

            listKeranjangBelanja.ItemsSource = controller.getItems();
            voucher.ItemsSource = controller.getDiskon();

            initializeView();
        }
示例#4
0
 private void populate(Bayar byr)
 {
     dgvPembayaran.Rows.Add(byr.Identitas, byr.Tipe, byr.Tipe, byr.NoKamar, byr.ExtraBed, byr.Harga);
 }
示例#5
0
 private void byrButton_Click(object sender, EventArgs e)
 {
     if (txtNoKamar.Text.Trim() == "")
     {
         MessageBox.Show("Pilih Booking");
         return;
     }
     if (cbMetode.Text.Trim() == "")
     {
         MessageBox.Show("Metode required");
     }
     else if (cbMetode.Text.Trim() != "")
     {
         if (txtBank.Enabled == true)
         {
             if (txtBank.Text.Trim() == "")
             {
                 MessageBox.Show("Nama Bank required");
             }
             else if (txtNo.Text.Trim() == "")
             {
                 MessageBox.Show("No Rekening/Kartu required");
             }
             else
             {
                 DialogResult dr = MessageBox.Show("Pembayaran Sukses?", "Konfirmasi", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                 if (dr == DialogResult.Yes)
                 {
                     try
                     {
                         Bayar byr = new Bayar();
                         byr.Identitas = txtIdentitas.Text.Trim();
                         byr.Tipe      = txtTipe.Text.Trim();
                         byr.TipeBed   = txtTipeBed.Text.Trim();
                         byr.NoKamar   = txtNoKamar.Text.Trim();
                         byr.ExtraBed  = txtExtraBed.Text.Trim();
                         byr.Harga     = Int32.Parse(txtHarga.Text.Trim());
                         byr.Metode    = cbMetode.Text.Trim();
                         byr.Bank      = txtBank.Text.Trim();
                         byr.No        = Int32.Parse(txtNo.Text.Trim());
                         addPembayaran(byr);
                         MessageBox.Show("Thankyou for coming and ENJOYYYY");
                         this.Hide();
                     }
                     catch (Exception)
                     {
                         MessageBox.Show("No Rekening/Kartu harus dalam bentuk angka");
                     }
                 }
                 else if (dr == DialogResult.No)
                 {
                     Book obj = new Book();
                     obj.NoKamar = txtNoKamar.Text.Trim();
                     deleteBooking(obj);
                     this.Hide();
                 }
             }
         }
         else if (txtBank.Enabled == false)
         {
             DialogResult dr = MessageBox.Show("Pembayaran Sukses?", "Konfirmasi", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
             if (dr == DialogResult.Yes)
             {
                 MessageBox.Show("Thankyou for coming and ENJOYYYY");
                 Bayar byr = new Bayar();
                 byr.Identitas = txtIdentitas.Text.Trim();
                 byr.Tipe      = txtTipe.Text.Trim();
                 byr.TipeBed   = txtTipeBed.Text.Trim();
                 byr.NoKamar   = txtNoKamar.Text.Trim();
                 byr.ExtraBed  = txtExtraBed.Text.Trim();
                 byr.Harga     = Int32.Parse(txtHarga.Text.Trim());
                 byr.Metode    = cbMetode.Text.Trim();
                 byr.Bank      = "-";
                 byr.No        = 0;
                 addPembayaran(byr);
                 this.Hide();
             }
             else if (dr == DialogResult.No)
             {
                 Book obj = new Book();
                 obj.NoKamar = txtNoKamar.Text.Trim();
                 deleteBooking(obj);
                 this.Hide();
             }
         }
     }
 }
示例#6
0
 public MainWindowController(KeranjangBelanja keranjangBelanja, Bayar payment)
 {
     this.keranjangBelanja = keranjangBelanja;
 }