Ejemplo n.º 1
0
 private void FormKlasifikasiSurat_FormClosed(object sender, FormClosedEventArgs e)
 {
     if (user.hak_akses == "admin")
     {
         FormMainAdmin form_main = new FormMainAdmin();
         form_main.Show();
     }
     else
     {
         FormMain form_main = new FormMain();
         form_main.Show();
     }
 }
Ejemplo n.º 2
0
        public bool cekLogin(string username, string password)
        {
            Database        db    = new Database();
            MySqlConnection conn  = db.connect(db.getString());
            bool            benar = false;

            try
            {
                conn.Open();
                string       query = "SELECT * FROM user WHERE username = @username AND password = @password";
                MySqlCommand cmd   = new MySqlCommand(query, conn);
                cmd.Parameters.AddWithValue("@username", username);
                cmd.Parameters.AddWithValue("@password", password);

                MySqlDataReader reader = cmd.ExecuteReader();
                if (!reader.Read())
                {
                    MessageBox.Show("Username atau Password salah. Silahkan ulangi kembali.", "Kesalahan");
                }
                else
                {
                    benar     = true;
                    id_user   = reader[0].ToString();
                    hak_akses = reader[4].ToString();
                    if (hak_akses == "Admin")
                    {
                        FormLogin     form_login = new FormLogin();
                        FormMainAdmin main       = new FormMainAdmin();
                        main.Show();
                    }
                    else if (hak_akses == "User")
                    {
                        FormLogin form_login = new FormLogin();
                        FormMain  main       = new FormMain();
                        main.Show();
                    }
                }
                conn.Close();
            }
            catch (MySqlException)
            {
                db.createDatabase();
                this.cekLogin(username, password);
            }
            return(benar);
        }
Ejemplo n.º 3
0
        private void FormSuratKeluar_FormClosed(object sender, FormClosedEventArgs e)
        {
            FormMainAdmin form_main = new FormMainAdmin();

            form_main.Show();
        }
Ejemplo n.º 4
0
        private void FormBackup_FormClosed(object sender, FormClosedEventArgs e)
        {
            FormMainAdmin main = new FormMainAdmin();

            main.Show();
        }