private void pictureBox1_Click(object sender, EventArgs e) { AtmaAuto peg = new AtmaAuto(); peg.Show(); this.Hide(); }
private void UpdateBtn_Click(object sender, EventArgs e) { if (Nametb.Text == "" || Usernametb.Text == "" || Passwordtb.Text == "" || alamattb.Text == "" || telepontb.Text == "") { MessageBox.Show("Ada Inputan belum diisi"); } else { conn.Open(); try { string sql = "UPDATE pegawai SET NAMA_PEGAWAI=@NAMA_PEGAWAI,USERNAME=@USERNAME,PASSWORD=@PASSWORD,ALAMAT_PEGAWAI=@ALAMAT_PEGAWAI,NO_TELP_PEGAWAI=@NO_TELP_PEGAWAI WHERE IDPEGAWAI=@IDPEGAWAI "; MySqlCommand cmd = new MySqlCommand(sql, conn); cmd.Parameters.AddWithValue("@IDPEGAWAI", AtmaAuto.idpeg); cmd.Parameters.AddWithValue("@NAMA_PEGAWAI", Nametb.Text); cmd.Parameters.AddWithValue("@USERNAME", Usernametb.Text); cmd.Parameters.AddWithValue("@PASSWORD", Passwordtb.Text); cmd.Parameters.AddWithValue("@ALAMAT_PEGAWAI", alamattb.Text); cmd.Parameters.AddWithValue("@NO_TELP_PEGAWAI", telepontb.Text); // conn.Open(); int rows = cmd.ExecuteNonQuery(); if (rows > 0) { MessageBox.Show("Data Terupdate !"); AdminView.nama = Nametb.Text; AtmaAuto frm2 = new AtmaAuto(); if (AtmaAuto.ted == "Owner") { AdminView obj = (AdminView)Application.OpenForms["AdminView"]; obj.Close(); } else { User obj = (User)Application.OpenForms["User"]; obj.Close(); } AtmaAuto.log = "LogOut"; frm2.Show(); } else { MessageBox.Show("Data Tidak terupdate !"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { conn.Close(); this.Close(); } } }
private void logout_Click(object sender, EventArgs e) { DialogResult result = MessageBox.Show("Apakah Anda ingin Log Out ?", "LOG OUT", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (result == DialogResult.Yes) { AtmaAuto peg = new AtmaAuto(); AtmaAuto.log = "LogOut"; peg.Show(); this.Hide(); MessageBox.Show("Berhasil Log Out !"); } else { MessageBox.Show("Batal Log Out", "LOG OUT", MessageBoxButtons.OK, MessageBoxIcon.Information); } }