private void Button1_Click(object sender, EventArgs e) { try { oc.Close(); oc.Open(); Form_Main fm = new Form_Main(); id_pegawai = textBox1.Text; //MessageBox.Show(id_pegawai); // MessageBox.Show(textBox2.Text); string ceklog = "select count(id_pegawai) from pegawai where password='******' and id_pegawai='" + textBox1.Text + "'"; //string ceklog = "select count(*) from Pegawai where pegawai.id_pegawai ='" + textBox1.Text + "' and(select my_decrypt(Password, 'aplikasi client server') from Pegawai where pegawai.id_pegawai ='" + textBox1.Text + "') = '" + textBox2.Text + "'"; OracleCommand cmd = new OracleCommand(ceklog, oc); cmd.ExecuteNonQuery(); int cek = Convert.ToInt32(cmd.ExecuteScalar()); // MessageBox.Show(cek + ""); if (cek >= 1) { this.Hide(); string cekakses = "select id_Hak_Akses from Hak_Akses where id_Pegawai='" + textBox1.Text + "'"; idbranch = "select id_branch from pegawai where id_Pegawai='" + textBox1.Text + "'"; OracleCommand cari_id_branch = new OracleCommand(idbranch, oc); idb = cari_id_branch.ExecuteScalar().ToString(); OracleCommand cm = new OracleCommand(cekakses, oc); OracleDataReader read = cm.ExecuteReader(); while (read.Read()) { string akses = read.GetString(0); if (akses == "HA001") { fm.lihatKontakToolStripMenuItem.Enabled = true; } else if (akses == "HA002") { fm.lihatKontakToolStripMenuItem.Enabled = true; en = true; } else if (akses == "HA003") { fm.lihatOrderToolStripMenuItem.Enabled = true; } else if (akses == "HA004") { fm.assignPrevilegeToolStripMenuItem.Enabled = true; } else if (akses == "HA005") { fm.lihatInventoryToolStripMenuItem.Enabled = true; } else if (akses == "HA006") { fm.lihatKontakToolStripMenuItem.Enabled = true; fm.lihatOrderToolStripMenuItem.Enabled = true; fm.tambahUserToolStripMenuItem.Enabled = true; fm.lihatInventoryToolStripMenuItem.Enabled = true; fm.assignPrevilegeToolStripMenuItem.Enabled = true; fm.laporanToolStripMenuItem.Enabled = true; en = true; } else if (akses == "HA007") { fm.laporanToolStripMenuItem.Enabled = true; } else if (akses == "HA008") { fm.lihatOrderToolStripMenuItem.Enabled = true; } else if (akses == "HA009") { fm.tambahUserToolStripMenuItem.Enabled = true; } } string query = "Select id_branch from pegawai where id_pegawai = '" + id_pegawai + "'"; cmd = new OracleCommand(query, oc); Cabang = cmd.ExecuteScalar().ToString(); read.Close(); id_pegawai = textBox1.Text; fm.ShowDialog(); this.Close(); } else { MessageBox.Show("Gagal Login password atau username salah"); } oc.Close(); } catch (OracleException ex) { MessageBox.Show(Convert.ToString(ex)); MessageBox.Show("error"); SettingConnection s = new SettingConnection(); s.Show(); } }
private void Button1_Click_1(object sender, EventArgs e) { SettingConnection s = new SettingConnection(); s.Show(); }