Exemple #1
0
        private void tampillogin()
        {
            this.Hide();
            Login fmLogin = new Login();
            DialogResult dr = fmLogin.ShowDialog();
            if (dr != DialogResult.OK)
            {
                this.Close();
            }
            else
            {
                //this.Text = "Input NIP : " + fmLogin.usernamelogin;
                usernamewelcome = fmLogin.usernamelogin;
                this.Show();
            }

            if (usernamewelcome != "")
            {
                CariPengguna cp = new CariPengguna();

                if (cp.statusCariUser2(usernamewelcome) == true)
                {
                    DBConnect koneksi_db = new DBConnect();
                    MySqlConnection db = new MySqlConnection(koneksi_db.koneksi());
                    db.Open();
                    MySqlCommand dbcmd2 = db.CreateCommand();
                    string sql = "select user_login,Jab from user_system";
                    dbcmd2.CommandText = sql;
                    MySqlDataReader reader = dbcmd2.ExecuteReader();
                    while (reader.Read())
                    {
                        if ((reader.GetString(0).ToString().ToLower() == usernamewelcome))
                        {
                            //label_Nama.Text = reader.GetString(1).ToString();
                            jabat = reader.GetString(1).ToString();
                            if (jabat == "Admin")
                            {
                                button_Daftar.Enabled = true;
                            }
                        }
                    }
                    db.Close();
                }
            }
        }