private void Btnsearchreseridcheckout_Click(object sender, EventArgs e)
        {
            koneksi kon = new koneksi();

            Data.Reservation dr = new Data.Reservation();
            dr.No_reservasi = tbxreservationidcheckout.Text;
            try
            {
                if (new Controller.ClientReservation().searchreservid(dr))
                {
                    binding();
                    kon.openConnection();
                    dr.No_reservasi = tbxreservationidcheckout.Text;
                    string          query = "select date_in, date_out, checkin from tb_reservation where no_reservation='" + dr.No_reservasi + "'";
                    MySqlDataReader dre   = kon.DataReader(query);
                    dre.Read();
                    tbxdateincheckout.Text  = dre["date_in"].ToString();
                    tbxdateoutcheckout.Text = dre["date_out"].ToString();
                    tbxcheckincheckout.Text = dre["checkin"].ToString();
                    kon.closeConnection();
                }
                else
                {
                    MessageBox.Show("Reservation ID belum terdaftar!");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Masukan Reserv. ID");
            }
        }
        public int inputcheckout()
        {
            bool     stat    = false;
            int      v       = 0;
            DateTime checkin = DateTime.Now;

            checkin = dtcheckoutcheckout.Value;
            koneksi kon = new koneksi();

            Data.Reservation dre = new Data.Reservation();
            dre.Check_out    = dtcheckoutcheckout.Value.ToString("yyyy-MM-dd hh:mm:ss");
            dre.Check_in     = tbxcheckincheckout.Text;
            dre.No_reservasi = tbxreservationidcheckout.Text;
            try
            {
                //MySqlCommand cmd = new MySqlCommand("update tb_reservation set check_in='" + dre.Check_in + "' where no_reservation='" + dre.No_reservasi + "'", conn);
                //checkin = Convert.ToDateTime(tbxcheckinadmin.Text);
                kon.openConnection();
                string query = "update tb_reservation set checkout='" + dre.Check_out + "' where no_reservation='" + dre.No_reservasi + "'";
                kon.ExecuteQueries(query);
                v = 1;
                kon.closeConnection();
            }
            catch (Exception ex)
            {
            }
            return(v);
        }
        private void Btnsearchreservbilpay_Click(object sender, EventArgs e)
        {
            koneksi kon = new koneksi();

            Data.Reservation dr = new Data.Reservation();
            dr.No_reservasi = tbxreservationidbilpay.Text;
            try
            {
                if (new Controller.ClientReservation().searchreservid(dr))
                {
                    binding();
                    Data.Reservation drv = new Data.Reservation();
                    kon.openConnection();
                    drv.No_reservasi = tbxreservationidbilpay.Text;
                    string          query = "select billing, cara_bayar from tb_reservation where no_reservation='" + drv.No_reservasi + "'";
                    MySqlDataReader dre   = kon.DataReader(query);
                    dre.Read();
                    tbxbilling.Text         = dre["billing"].ToString();
                    tbxcarabayarbilpay.Text = dre["cara_bayar"].ToString();
                    kon.closeConnection();
                }
                else
                {
                    MessageBox.Show("Reservation ID belum terdaftar!");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Masukan Reserv. ID");
            }
        }
        private void Btnbsysrreserv_Click(object sender, EventArgs e)
        {
            bool stat = false;

            Data.Reservation dr = new Data.Reservation();
            try
            {
                if (Convert.ToInt32(tbxpembayaranbilpay.Text) > Convert.ToInt32(tbxbilling.Text))
                {
                    dr.No_reservasi = tbxreservationidbilpay.Text;
                    dr.Pembayaran   = Convert.ToInt32(tbxpembayaranbilpay.Text);
                    dr.Kembali      = Convert.ToInt32(tbxkembalianbilpay.Text);
                    dr.Keterangan   = tbxketeranganbilpay.Text;
                    koneksi kon = new koneksi();
                    kon.openConnection();
                    string query = "update tb_reservation set pembayaran='" + dr.Pembayaran + "', kembalian='" + dr.Kembali + "', keterangan='" + dr.Keterangan + "' where no_reservation='" + dr.No_reservasi + "'";
                    kon.ExecuteQueries(query);
                    stat = true;
                    kon.closeConnection();
                    MessageBox.Show("Pembayaran berhasil!");
                    binding();
                }
                else
                {
                    MessageBox.Show("Uang anda tidak mencukupi!");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Anda belum memasukan nominal pembayaran");
            }
        }
Exemplo n.º 5
0
        private void Btnloginfrmlogin_Click(object sender, EventArgs e)
        {
            koneksi kon = new koneksi();

            Data.Client dc = new Data.Client();
            dc.No_identity = tbxnoidentitylogin.Text;
            dc.Phone       = tbxphonelogin.Text;
            kon.openConnection();
            string query = "select no_identity, phone from tb_client where no_identity='" + dc.No_identity + "' and phone='" + dc.Phone + "'";

            if (kon.loginreader(query) == 1)
            {
                Client_Menu cp = new Client_Menu();
                MessageBox.Show("'" + dc.No_identity + "' Login berhasil!");
                cp.Show();
                cp.lemparidentity(tbxnoidentitylogin.Text);
                this.Hide();
            }
            else if (tbxnoidentitylogin.Text == "admin" && tbxphonelogin.Text == "admin")
            {
                Menu mn = new Menu();
                MessageBox.Show("Login sebagai admin berhasil!");
                mn.Show();
                this.Hide();
            }
            else if (tbxnoidentitylogin.Text == "" && tbxphonelogin.Text == "")
            {
                MessageBox.Show("Masukan No. Identity dan Phone!");
            }
            else
            {
                MessageBox.Show("No. Identity atau Phone salah!");
            }
            kon.closeConnection();
        }
        public string generateKode()
        {
            string  query = "Select Max(no_reservation) as ReservID from tb_reservation";
            koneksi k     = new koneksi();

            k.openConnection();
            MySqlDataReader dr = k.DataReader(query);

            dr.Read();
            string kode = dr["ReservID"].ToString();
            int    angka;

            if (kode == "")
            {
                angka = 0;
            }
            else
            {
                angka = int.Parse(kode.Substring(3, 3));
            }
            angka += 1;
            string id = "RV-" + (string.Format("{0:00}", angka.ToString().PadLeft(3, '0')));

            k.closeConnection();
            return(id);
        }
        public void linkcbx()
        {
            koneksi kon = new koneksi();

            kon.openConnection();
            adapter = new MySqlDataAdapter("select type_room from tb_room order by room_id asc", conn);
            DataTable dt = new DataTable();

            adapter.Fill(dt);
            tbxroomtypefrmroom.DisplayMember = "type_room";
            tbxroomtypefrmroom.DataSource    = dt;
            kon.closeConnection();
        }
        public void pilihtipe()
        {
            Data.Reservation dr  = new Data.Reservation();
            koneksi          kon = new koneksi();

            kon.openConnection();
            string          query = "select price_room from tb_room where type_room = '" + cbxroomtypereserv.Text + "'";
            MySqlDataReader dre   = kon.DataReader1(query);

            dre.Read();
            tbxroompricereserv.Text = dre["price_room"].ToString();
            kon.closeConnection();
        }
        public void lemparidentity(string no_identity)
        {
            Data.Client dc    = new Data.Client();
            koneksi     konek = new koneksi();

            dc.No_identity = label6.Text;
            konek.openConnection();
            string          query = "select no_identity from tb_client where no_identity='" + no_identity + "'";
            MySqlDataReader dr    = konek.DataReader(query);

            dr.Read();
            label6.Text = dr["no_identity"].ToString();
            konek.closeConnection();
        }
        public bool readbilpay()
        {
            bool    stat = false;
            koneksi kon  = new koneksi();

            try
            {
                kon.openConnection();
                string query = "select * from tb_reservation where client_id='" + label6 + "' and keterangan=Belum Lunas";
                kon.ExecuteQueries(query);
                stat = true;
                kon.closeConnection();
            }
            catch (Exception ex)
            {
            }
            return(stat);
        }
        public void checkid()
        {
            bool stat = false;

            Data.Client dc  = new Data.Client();
            koneksi     kon = new koneksi();

            dc.No_identity = tbxnoidentityregis.Text;
            kon.openConnection();
            string query = "select no_identity from tb_client where no_identity = '" + dc.No_identity + "'";

            if (kon.checkidreader(query) == 1)
            {
                lblcheckidclient.Text = "'" + tbxnoidentityregis.Text + "' sudah terpakai!";
            }
            else
            {
                lblcheckidclient.Text = "'" + tbxnoidentityregis.Text + "' bisa digunakan!";
            }
            kon.closeConnection();
            //return stat;
        }