예제 #1
0
        private void btn_login_Click(object sender, RoutedEventArgs e)
        {
            LoginDAO ld = new LoginDAO();

            if ((txt_namaPengguna.Text == "") && (txt_password.Password == "") || (txt_namaPengguna.Text == "") || (txt_password.Password == ""))
            {
                MessageBox.Show("Nama Pengguna atau Password masih kosong bosku", "Peringatan", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
            else
            {
                try
                {
                    if (ld.Login(txt_namaPengguna.Text.ToString(), txt_password.Password.ToString()))
                    {
                        saveRememberMe();
                        DashboardWindow dw = new DashboardWindow();
                        Hide();
                        dw.Show();
                    }
                    else
                    {
                        MessageBox.Show("Nama Pengguna atau Kata Sandi Tidak Sesuai Bosku!", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                        txt_namaPengguna.Clear();
                        txt_password.Clear();
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Kesalahan :" + ex, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
        }
예제 #2
0
        private void init()
        {
            c = new ConnectionUtils();
            LoginDAO ld = new LoginDAO();

            if (!c.checkLoginTable())
            {
                ld.createTableLogin("admin", "admin");
            }
        }