Пример #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            Credential_DB cDB = new Credential_DB();

            cDB.UserName = txt_username.Text;
            cDB.Password = txt_password.Text;
            if (rbtn_admin.Checked)
            {
                cDB.UserType = "Admin";
            }
            else if (rbtn_user.Checked)
            {
                cDB.UserType = "User";
            }
            if (cDB.Authenticate(cDB))
            {
                Home hform = new Home();
                hform.lbl_GetIDhere.Text   = txt_username.Text;
                hform.lbl_getusertype.Text = cDB.UserType;
                txt_password.Text          = "";
                hform.Show();
                //MessageBox.Show("Login Successfully");
            }
            else
            {
                MessageBox.Show("Login Failed");
            }
        }
Пример #2
0
        private void btn_changePassword_Click(object sender, EventArgs e)
        {
            Credential_DB cDB = new Credential_DB();

            //Home hobj = new Home();
            cDB.UserName = label4.Text;
            cDB.UserType = label5.Text;
            cDB.Password = txt_oldpassword.Text;
            // cDB.txt_newpassword = txt_cnewpassword.Text;
            if (cDB.Authenticate(cDB))
            {
                if (txt_newpassword.Text == txt_cnewpassword.Text)
                {
                    cDB.Password = txt_newpassword.Text;
                    cDB.changemypassword(cDB);
                    MessageBox.Show("Password Changed");
                }
                else
                {
                    MessageBox.Show("Password Does Not Match");
                }
            }
            else
            {
                MessageBox.Show("Old Password is incorrect");
            }
        }