Exemplo n.º 1
0
        private void btn_ChangePassword_Click(object sender, EventArgs e)
        {
            Credential_DB cDB = new Credential_DB();

            cDB.UserName = label1.Text;
            cDB.UserType = label2.Text;
            cDB.Password = txt_OldPassword.Text;
            if (cDB.Authenticate(cDB))
            {
                if (txt_NewPassword.Text == txt_Confirmpassword.Text)
                {
                    cDB.Password = txt_NewPassword.Text;
                    cDB.changemypassword(cDB);
                    MessageBox.Show("Password Changed Successfully");
                }
                else
                {
                    MessageBox.Show("Password doesnot match");
                }
            }
            else
            {
                MessageBox.Show("old password is incorrect");
            }
        }
Exemplo n.º 2
0
        private void btn_login_Click(object sender, EventArgs e)
        {
            Credential_DB cDB = new Credential_DB();

            cDB.Name     = txt_name.Text;
            cDB.UserName = txt_username.Text;
            cDB.Password = txt_password.Text;
            if (rbtn_owner.Checked)
            {
                cDB.UserType = "Owner";
            }
            else if (rbtn_staff.Checked)
            {
                cDB.UserType = "Staff";
            }
            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");
            }
        }
Exemplo n.º 3
0
        private void btn_submit_Click(object sender, EventArgs e)
        {
            Login         lgn = new Login();
            Credential_DB cDB = new Credential_DB();

            cDB.Name     = A;
            cDB.UserName = B;
            if (C == txt_confirmpassword.Text)
            {
                cDB.Password = C;
            }
            if (D == true)
            {
                cDB.UserType = "Owner";
            }
            else if (E == true)
            {
                cDB.UserType = "Staff";
            }
            if (C == txt_confirmpassword.Text)
            {
                cDB.createnewuser(cDB);
                MessageBox.Show("New User Created");
            }
            else
            {
                MessageBox.Show("Re-Enter! Password Does Not Match");
            }
            this.Dispose();
        }
Exemplo n.º 4
0
        public void deleteuser(Credential_DB cDB)
        {
            string         query = String.Format("delete from UserDetails where username = '******'", cDB.UserName);
            Business_Logic BL    = new Business_Logic();

            BL.NonQuery(query);
        }
Exemplo n.º 5
0
        public void changemypassword(Credential_DB cDB)
        {
            string         query = String.Format("UPDATE [UserDetails] SET [PASSWORD] = '{0}' WHERE [USERNAME] = '{1}' AND [USERTYPE] = '{2}' ", cDB.Password, cDB.UserName, cDB.UserType);
            Business_Logic BL    = new Business_Logic();

            BL.NonQuery(query);
        }
Exemplo n.º 6
0
        public void createnewuser(Credential_DB cDB)
        {
            string         query = String.Format("Insert into UserDetails Values('{0}','{1}','{2}', '{3}')", cDB.Name, cDB.UserName, cDB.Password, cDB.UserType);
            Business_Logic BL    = new Business_Logic();

            BL.NonQuery(query);
        }
Exemplo n.º 7
0
        private void ViewUser_Load(object sender, EventArgs e)
        {
            Credential_DB cDB = new Credential_DB();

            dataGridView1.AutoGenerateColumns = true;
            cDB.FillGrid(dataGridView1);
        }
Exemplo n.º 8
0
        private void btn_Delete_Click(object sender, EventArgs e)
        {
            Credential_DB cDB = new Credential_DB();

            cDB.UserName = cBox_SelectUser.Text;
            cDB.deleteuser(cDB);
            lbl_message.Text = "User Deleted";
        }
Exemplo n.º 9
0
        public bool Authenticate(Credential_DB cDB)
        {
            string          query = String.Format("select * from UserDetails where name = '{0}' and username = '******' and password ='******' and usertype ='{3}'", cDB.Name, cDB.UserName, cDB.Password, cDB.UserType);
            Business_Logic  BL    = new Business_Logic();
            OleDbDataReader rec   = BL.SelectQuery(query);

            if (rec.Read())
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 10
0
        private void button1_Click(object sender, EventArgs e)
        {
            Credential_DB cDB = new Credential_DB();

            cDB.UserName = txt_UserName.Text;
            if (txt_Password.Text == txt_ConfirmPassword.Text)
            {
                cDB.Password = txt_Password.Text;
            }
            cDB.UserType = cBox_UserType.Text;
            if (txt_Password.Text == txt_ConfirmPassword.Text)
            {
                cDB.createnewuser(cDB);
                MessageBox.Show("New User Created");
            }
            else
            {
                MessageBox.Show("Re-Enter! Password Does Not Match");
            }
        }
Exemplo n.º 11
0
        private void DeleteUser_Load(object sender, EventArgs e)
        {
            Credential_DB cDB = new Credential_DB();

            cDB.fillcombobox(cBox_SelectUser);
        }