Exemplo n.º 1
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtUsername.Text))
            {
                MessageBox.Show("Please enter your username.", "Message", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (db.SearchUserInfo(txtUsername.Text, txtPassword.Text))
            {
                MainScreen mainScreen = new MainScreen();
                mainScreen.Show();
                this.Hide();
            }
            else
            {
                MessageBox.Show("Username or password is wrong.", "Message", MessageBoxButtons.OK, MessageBoxIcon.Stop);
            }
        }
Exemplo n.º 2
0
        private void btnKaydet_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtUsername.Text) || string.IsNullOrEmpty(txtPassword.Text) || string.IsNullOrEmpty(txtEmail.Text))
            {
                MessageBox.Show("Please enter your credentials.", "Message", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (!db.SearchUserInfo(txtUsername.Text, txtPassword.Text))
            {
                db.InsertUserInfo(txtUsername.Text, txtPassword.Text, txtEmail.Text);
                MessageBox.Show("You are signed up successfully!", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.Close();
            }
            else
            {
                MessageBox.Show("Sign up failed : The user already exists", "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }