示例#1
0
        private void changeButton_Click(object sender, EventArgs e)
        {
            DataSet ds  = pD.getPassword();
            string  old = ds.Tables[0].Rows[0]["password"].ToString();

            if (oldBox.Text == old)
            {
                if (newBox.Text == confirmBox.Text)
                {
                    p = new passwordDTO(newBox.Text);
                    pD.updatePassword(p);
                    oldBox.Text     = "";
                    newBox.Text     = "";
                    confirmBox.Text = "";
                    MessageBox.Show("Password Changed !");
                }
                else
                {
                    MessageBox.Show("Passwords not matched !");
                }
            }
            else
            {
                MessageBox.Show("Incorrect password !");
            }
        }
示例#2
0
        private void loginButton_Click(object sender, EventArgs e)
        {
            passwordDAO pD   = new passwordDAO();
            string      name = userNameBox.Text;
            string      pass = passwordBox.Text;

            if (name == "admin" && pass == pD.getPassword().Tables[0].Rows[0]["password"].ToString() || workingMode)
            {
                mainForm frm = new mainForm();
                frm.Show();
                this.Hide();
            }
            else
            {
                MessageBox.Show("Enter correct username and password !");
            }
        }