Example #1
0
        // method deals with user registration
        private void RegisterButton_Click(object sender, EventArgs e)
        {
            string userName = UserNameTextBox.Text;
            string password = PasswordTextBox.Text;

            // Checks for empty values

            if (UserNameTextBox.Text != "" && PasswordTextBox.Text != "")
            {
                LibraryDBClassProject.Login libDataclass = new LibraryDBClassProject.Login();

                int x = libDataclass.Register(userName, password);
                // Checks whetehr the record being inserted in the database


                if (x > 0)
                {
                    ErrorLabel.Text = "Registered Successfully";
                }
                else
                {
                    ErrorLabel.Text = "Registration Failure. Try again.";
                }
            }
            else
            {
                ErrorLabel.Text = "Input can not blank. Please enter all fields.";
            }
        }
Example #2
0
        //method checks login

        private void LoginButton_Click(object sender, EventArgs e)
        {
            string userName = UserNameTextBox.Text;
            string password = PasswordTextBox.Text;

            // checks whether input is blank
            if (UserNameTextBox.Text != "" && PasswordTextBox.Text != "")
            {
                LibraryDBClassProject.Login libDataclass = new LibraryDBClassProject.Login();

                string x = libDataclass.getLogin(userName, password);
                if (x.Equals("success"))
                {
                    MenuForm childForm = new MenuForm();
                    childForm.MdiParent = this;
                    childForm.Show();
                }
                else
                {
                    ErrorLabel.Text = "Invalid Credentials";
                }
            }
            else
            {
                ErrorLabel.Text = "Input can not blank. Please enter all fields.";
            }
        }