Example #1
0
        private bool authenticate(string usr, string pass, int id)
        {
            AuthenticateTableAdapter u = new AuthenticateTableAdapter();
            int k = (int)u.GetData(id, usr, pass).Rows[0].ItemArray[0];

            return(k == 1);
        }
Example #2
0
        private void Button1_Click(object sender, EventArgs e)
        {
            Logins login = new Logins();
            AuthenticateTableAdapter taAuth = new AuthenticateTableAdapter();

            login.userName = textBox1.Text;
            login.passWord = textBox2.Text;
            try
            {
                DataTable dt = new DataTable();
                taAuth.Fill(authDS.Authenticate, login.userName, login.passWord);
                if (authDS.Tables[0].Rows.Count == 1)
                {
                    label3.Text = "Success!";

                    // Application.Run(new Main());
                }
                else
                {
                    label3.Text = "Failure!";
                }
            }
            catch (Exception ex)
            {
                label3.Text = ex.Message;
            }
        }
Example #3
0
        private void Button1_Click(object sender, EventArgs e)
        {
            Logins login = new Logins();
            AuthenticateTableAdapter taAuth = new AuthenticateTableAdapter();

            login.userName = userText.Text;
            login.passWord = userPass.Text;
            try
            {
                DataTable dt = new DataTable();
                taAuth.Fill(authDS.Authenticate, login.userName, login.passWord);
                if (authDS.Tables[0].Rows.Count == 1)
                {
                    Ready_Label.Text = "Login Success!";
                    MessageBox.Show("Welcome " + " " + login.userName + " :)");
                    Main main = new Main();
                    this.Hide();
                    // ^ this hides the login box after they login but then we cant exit the program properly so we have to figure that out.
                    main.Show();
                }
                else
                {
                    Ready_Label.Text = "login unsucessful\n" + attempts
                                       + "out of 3";
                    attempts++;
                }

                if (login.userName == userText.Text && login.passWord == "")
                {
                    Ready_Label.Text = "Please enter the password";
                }

                if (login.userName == "" && login.passWord == "")
                {
                    Ready_Label.Text = "Please enter the username and password";
                }
            }
            catch (Exception ex)
            {
                Ready_Label.Text = "Something went wrong... please try again\n" + ex.Message;
            }
            if (attempts == 4)
            {
                MessageBox.Show("You have reached maximum number of attempts... ");
            }
        }
        private void submit_Click(object sender, EventArgs e)
        {
            Logins login = new Logins();
            AuthenticateTableAdapter authTable = new AuthenticateTableAdapter();

            login.userName = username.Text;

            try
            {
                DataTable dataTable = new DataTable();
                authTable.ForgotPassword(authDS.Authenticate, login.userName);
                if (authDS.Tables[0].Rows.Count == 1)
                {
                }
            }
            catch
            {
            }
        }