Exemplo n.º 1
0
        private void BtnBack_Click(object sender, RoutedEventArgs e)
        {
            PegawaiHome ph = new PegawaiHome(database, pegawai);

            this.Close();
            ph.Show();
        }
Exemplo n.º 2
0
        private void BtnLogin_Click(object sender, RoutedEventArgs e)
        {
            if (peg.IsChecked==true)
            {
                bool done = false;
                conn.Open();
                string query = "SELECT id_pegawai FROM PEGAWAI";
                OracleCommand cmd = new OracleCommand(query, conn);
                OracleDataReader reader = cmd.ExecuteReader();
                List<string> listpeg = new List<string>();
                while (reader.Read())
                {
                    listpeg.Add(reader.GetString(0));
                }
                conn.Close();
                for (int i = 0; i < listpeg.Count; i++)
                {
                    if (listpeg[i] == tb_username.Text)
                    {
                        done = true;
                    }
                }
                if(!done)
                {
                    MessageBox.Show("Id pegawai tidak terdaftar");
                }
                else
                {
                    if (tb_username.Text == tb_pass.Password.ToString())
                    {
                        PegawaiHome pg = new PegawaiHome(database, tb_username.Text);
                        pg.Show();
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("Password salah");
                    }
                }
            }
            else if (adm.IsChecked == true)
            {
                if(tb_username.Text=="admin" && tb_pass.Password == "nimda")
                {

                    admin a = new admin();
                    a.Show();
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Password salah");
                }
            }
            else
            {
                MessageBox.Show("Pilih login sebagai apa");
            }
        }