Beispiel #1
0
        private bool IsValidInput()
        {
            if (!T8GlobalFunc.isAlphaNumeric(txtUsername.Text))
            {
                MessageBox.Show(this, "Username hanya berlaku untuk abjad, angka, simbol underscore (_) dan simbol titik (.) saja.", "Null Input", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                txtUsername.Focus();
                txtUsername.SelectAll();
                return(false);
            }

            if (!T8GlobalFunc.isAlphaNumeric(txtPassword.Text))
            {
                MessageBox.Show(this, "Password hanya berlaku untuk abjad dan angka saja.", "Null Input", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                txtPassword.Focus();
                txtPassword.SelectAll();
                return(false);
            }

            if (string.IsNullOrEmpty(txtUsername.Text))
            {
                MessageBox.Show(this, "Username tidak boleh kosong.", "Null Input", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                txtUsername.Focus();
                txtUsername.SelectAll();
                return(false);
            }

            if (string.IsNullOrEmpty(txtPassword.Text))
            {
                MessageBox.Show(this, "Password tidak boleh kosong", "Null Input", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                txtPassword.Focus();
                txtPassword.SelectAll();
                return(false);
            }

            if (txtUsername.Text.Length < 4)
            {
                MessageBox.Show(this, "Panjang karakter username paling sedikit 4 karakter.", "Input Salah", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                txtUsername.Focus();
                txtUsername.SelectAll();
                return(false);
            }

            if (txtPassword.Text.Length < 4)
            {
                MessageBox.Show(this, "Panjang karakter password paling sedikit 4 karakter.", "Input Salah", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                txtPassword.Focus();
                txtPassword.SelectAll();
                return(false);
            }

            return(true);
        }
Beispiel #2
0
        private bool IsValidInput()
        {
            if (!T8GlobalFunc.isAlphaNumeric(txtUsername.Text))
            {
                MessageBox.Show(this, "Username hanya berlaku untuk abjad, angka, simbol underscore (_) dan simbol titik (.) saja.", "Null Input", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                txtUsername.Focus();
                txtUsername.SelectAll();
                return(false);
            }

            if (!T8GlobalFunc.isAlphaNumeric(txtPassword.Text))
            {
                MessageBox.Show(this, "Password hanya berlaku untuk abjad dan angka saja.", "Null Input", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                txtPassword.Focus();
                txtPassword.SelectAll();
                return(false);
            }

            if (string.IsNullOrEmpty(txtUsername.Text))
            {
                MessageBox.Show(this, "Username tidak boleh kosong.", "Null Input", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                txtUsername.Focus();
                txtUsername.SelectAll();
                return(false);
            }

            if (string.IsNullOrEmpty(txtPassword.Text))
            {
                MessageBox.Show(this, "Password tidak boleh kosong", "Null Input", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                txtPassword.Focus();
                txtPassword.SelectAll();
                return(false);
            }

            if (string.IsNullOrEmpty(hakAksesUser.ToString()))
            {
                MessageBox.Show(this, "Hak akses tidak boleh kosong.", "Null Input", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return(false);
            }

            if (txtUsername.Text.Length < 4)
            {
                MessageBox.Show(this, "Panjang karakter username paling sedikit 4 karakter.", "Input Salah", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return(false);
            }

            if (txtPassword.Text.Length < 4)
            {
                MessageBox.Show(this, "Panjang karakter password paling sedikit 4 karakter.", "Input Salah", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return(false);
            }

            if (!rdoAktif.IsChecked && !rdoNonAktif.IsChecked)
            {
                MessageBox.Show(this, "Status user belum dipilih.", "Input Salah", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return(false);
            }

            if (lvKategori.CheckedItems.Count == 0)
            {
                MessageBox.Show(this, "Kategori akses user harus dipilih minimal 1 item.", "Null Input", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return(false);
            }

            if (lvTkKeamanan.CheckedItems.Count == 0)
            {
                MessageBox.Show(this, "Tingkat keamanan akses user harus dipilih minimal 1 item.", "Null Input", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return(false);
            }

            return(true);
        }