private void btnBack_Click(object sender, EventArgs e)
        {
            this.Hide();
            Form_Main nextForm = new Form_Main();

            nextForm.Show();
        }
 private void Updating()
 {
     try
     {
         Objects.con.Open();
         Objects.cmd             = new MySqlCommand("UPDATE tbl_Users set Password=@Password WHERE Username=@Username ", Objects.con);
         Objects.cmd.CommandType = System.Data.CommandType.Text;
         Objects.cmd.Parameters.Add(new MySqlParameter("@Password", txtNewPassword.Text));
         Objects.cmd.Parameters.Add(new MySqlParameter("@Username", usernameGetter));
         Objects.cmd.ExecuteNonQuery();
         Objects.con.Close();
         MessageBox.Show("SUCCESSFULLY UPDATED", "ATTENTION", MessageBoxButtons.OK, MessageBoxIcon.Information);
         passwordGetter = txtNewPassword.Text;
         this.Hide();
         Reset();
         var nextForm = new Form_Main();
         nextForm.Show();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         Objects.con.Close();
     }
 }
예제 #3
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            if ((txtUsername.Text == "" && txtPassword.Text == ""))
            {
                MessageBox.Show("No Username and Password Found", "ATTENTION", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.ActiveControl = txtUsername;
            }
            else if ((txtUsername.Text == ""))
            {
                MessageBox.Show("No Username Found", "ATTENTION", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.ActiveControl = txtUsername;
            }
            else if ((txtPassword.Text == ""))
            {
                MessageBox.Show("No Password Found", "ATTENTION", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.ActiveControl = txtPassword;
            }
            else
            {
                try
                {
                    Objects.con.Open();
                    Objects.cmd             = new MySqlCommand("SELECT * FROM tbl_Users WHERE Username=@Username AND BINARY Password=@Password ", Objects.con);
                    Objects.cmd.CommandType = System.Data.CommandType.Text;
                    Objects.cmd.Parameters.Add(new MySqlParameter("@Username", txtUsername.Text));
                    Objects.cmd.Parameters.Add(new MySqlParameter("@Password", txtPassword.Text));
                    Objects.dr = Objects.cmd.ExecuteReader();
                    int count = 0;
                    while (Objects.dr.Read())
                    {
                        count = count + 1;
                    }
                    switch (count)
                    {
                    case 1:
                        Form_ChangePassword.usernameGetter = this.txtUsername.Text;
                        Form_ChangePassword.passwordGetter = this.txtPassword.Text;
                        Objects.con.Close();
                        this.Hide();
                        var myForm = new Form_Main();
                        myForm.Show();
                        break;

                    default:
                        MessageBox.Show("Invalid Details", "ATTENTION", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        Reset();
                        Objects.con.Close();
                        break;
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
            }
        }
        private void btnBack_Click(object sender, EventArgs e)
        {
            this.Hide();
            var nextForm = new Form_Main();

            nextForm.Show();
            this.txtCurrentPassword.Clear();
            this.txtNewPassword.Clear();
            this.txtConfirmNewPassword.Clear();
        }
        private void btnBack_Click(object sender, EventArgs e)
        {
            this.Hide();
            var nextForm = new Form_Main();

            nextForm.Show();
            this.txtUsername.Clear();
            this.txtPassword.Clear();
            this.cmbboxSecretQuestion.Text = "";
            this.txtSecretAnswer.Clear();
            this.chckbox_ShowPassword.Checked     = false;
            this.chckbox_ShowSecretAnswer.Checked = false;
        }