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"); } }
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); }
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(); }
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); }
public int binding2() { int a = 0; koneksi kon = new koneksi(); bool stat = false; dataGridView1.DataSource = new koneksi().ShowDatainGridView(getdataread()); a = 1; return(a); }
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(); }
private void Btnshowallreservationcheckout_Click(object sender, EventArgs e) { koneksi kon = new koneksi(); string query = "select * from tb_reservation"; adapter = new MySqlDataAdapter(query, conn); DataSet ds = new DataSet(); conn.Open(); adapter.Fill(ds, "tb_reservation"); conn.Close(); dataGridView1.DataSource = ds; dataGridView1.DataMember = "tb_reservation"; }
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); }
private void Lbladdreservationclient_Click(object sender, EventArgs e) { try { koneksi kon = new koneksi(); Data.Reservation drv = new Data.Reservation(); drv.No_reservasi = tbxreservationidclient.Text; drv.Client_id = tbxclientidreserv.Text; drv.Room_type = cbxroomtypereserv.Text; drv.Room_price = Convert.ToInt32(tbxroompricereserv.Text); drv.No_room = Convert.ToInt32(tbxnoroomreserv.Text); drv.Booking_date = dtbookingdate.Value.ToString("yyyy-MM-dd hh:mm:ss"); drv.Date_in = dtdatein.Value.ToString("yyyy-MM-dd hh:mm:ss"); drv.Date_out = dtdateout.Value.ToString("yyyy-MM-dd hh:mm:ss"); drv.Carabayar = cbxcarabayarreserv.Text; //drv.Lamahari = Convert.ToInt32(tbxjumlahhari.Text); if (new Controller.ClientReservation().reservationclient(drv)) { MessageBox.Show("Reservation '" + drv.No_reservasi + "' Success"); ClearField(); } else { MessageBox.Show("Reservation Failed"); } } catch (Exception ex) { MessageBox.Show("Lengkapi persyaratan reservasi!"); } /*kon.openConnection(); * string query = "insert into tb_reservation values('" + drv.No_reservasi + "', '" + drv.Client_id + "', '" + drv.Room_type + "', '" + drv.Room_price + "', '" + drv.No_room + "', '" + drv.Date_in + "', '" + drv.Date_out + "')"; * kon.ExecuteQueries(query); * stat = true; * kon.closeConnection(); * if (stat) * { * MessageBox.Show("Reservation Success"); * } * else * MessageBox.Show("Reservation Failed");*/ }
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; }
private void Btnremoveclient_Click(object sender, EventArgs e) { try { Data.Client dcle = new Data.Client(); dcle.No_identity = tbxnoidentityadmin.Text; koneksi kon = new koneksi(); if (new Controller.RegisClient().deleteclient(dcle)) { MessageBox.Show("Client dengan ID '" + dcle.No_identity + "' berhasil dihapus dari data!"); binding(); clearfieldcl(); } else { MessageBox.Show("Client gagal di hapus!"); } } catch (Exception ex) { MessageBox.Show("Pilih Client yang ingin di hapus!"); } }
private void Btnaddreservadmin_Click(object sender, EventArgs e) { try { Reservation_Page rp = new Reservation_Page(); koneksi kon = new koneksi(); Data.Reservation drv = new Data.Reservation(); drv.No_reservasi = tbxreservationid.Text; drv.Client_id = tbxclientidreserv.Text; drv.Room_type = cbxroomtypereserv.Text; drv.Room_price = Convert.ToInt32(tbxroompriceadmin.Text); drv.No_room = Convert.ToInt32(tbxnoroomadmin.Text); drv.Booking_date = dateTimePicker3.Value.ToString("yyyy-MM-dd hh:mm:ss"); drv.Date_in = dateTimePicker1.Value.ToString("yyyy-MM-dd hh:mm:ss"); drv.Date_out = dateTimePicker2.Value.ToString("yyyy-MM-dd hh:mm:ss"); drv.Carabayar = cbxcarabayarreservadmin.Text; //drv.Lamahari = Convert.ToInt32(tbxjumlahhari.Text); if (new Controller.ClientReservation().reservationclient(drv)) { MessageBox.Show("Reservation '" + drv.No_reservasi + "' Success"); binding(); generateKode(); clearfieldrv(); } else { MessageBox.Show("Reservation Failed"); } } catch (Exception ex) { MessageBox.Show("Lengkapi persyaratan dengan benar"); } }
public void binding() { koneksi kon = new koneksi(); dataGridView1.DataSource = new koneksi().ShowDatainGridView(new Controller.RegisClient().getdataclient()); }
public void binding() { koneksi kon = new koneksi(); dataGridView1.DataSource = new koneksi().ShowDatainGridView(getdatasearch()); }
public void binding() { koneksi kon = new koneksi(); dataGridView1.DataSource = new koneksi().ShowDatainGridView(new Controller.ClientReservation().getdatareservation()); }
public void binding() { koneksi kon = new koneksi(); dataGridView1.DataSource = new koneksi().ShowDatainGridView(new Controller.RoomCtrl().getdataroom()); }