public void reset() { T_id.Clear(); T_lantai.Clear(); T_nomor.Clear(); C_tipe.SelectedIndex = 0; T_harga.Clear(); }
private void B_simpan_Click(object sender, EventArgs e) { if (L_header.Text == "Tambah Data") { if (string.IsNullOrEmpty(T_lantai.Text)) { Interaction.MsgBox("Kolom Lantai Masih Kosong!", Constants.vbInformation, "Pemberitahuan"); T_lantai.Focus(); } else if (C_tipe.SelectedIndex == 0) { Interaction.MsgBox("Kolom Tipe Kamar Masih Kosong!", Constants.vbInformation, "Pemberitahuan"); C_tipe.Focus(); } else if (string.IsNullOrEmpty(T_harga.Text)) { Interaction.MsgBox("Kolom Harga Masih Kosong!", Constants.vbInformation, "Pemberitahuan"); T_harga.Focus(); } else if (string.IsNullOrEmpty(T_nomor.Text)) { Interaction.MsgBox("Kolom No. Kamar Masih Kosong!", Constants.vbInformation, "Pemberitahuan"); T_nomor.Focus(); } else { simpan(); } } else if (L_header.Text == "Edit Data") { if (string.IsNullOrEmpty(T_lantai.Text)) { Interaction.MsgBox("Kolom Lantai Masih Kosong!", Constants.vbInformation, "Pemberitahuan"); T_lantai.Focus(); } else if (!(C_tipe.SelectedIndex == 1 | C_tipe.SelectedIndex == 2)) { Interaction.MsgBox("Kolom Tipe Kamar Masih Kosong!", Constants.vbInformation, "Pemberitahuan"); C_tipe.Focus(); } else if (string.IsNullOrEmpty(T_harga.Text)) { Interaction.MsgBox("Kolom Harga Masih Kosong!", Constants.vbInformation, "Pemberitahuan"); T_harga.Focus(); } else if (string.IsNullOrEmpty(T_nomor.Text)) { Interaction.MsgBox("Kolom No. Kamar Masih Kosong!", Constants.vbInformation, "Pemberitahuan"); T_nomor.Focus(); } else { koneksi(); try { cmd = new OdbcCommand("select * from tb_kamar where id='" + L_id.Text + "'", conn); dr = cmd.ExecuteReader(); dr.Read(); if (dr.HasRows) { simpanUpdate(); } else { Interaction.MsgBox("Data Tidak Ditemukan", Constants.vbInformation, "Pemberitahuan"); Close(); } } catch (Exception ex) { } } } }