예제 #1
0
        private void login_btn_Click(object sender, EventArgs e)
        {
            if (this.username.Text == "" || this.password.Text == "")
            {
                MessageBox.Show("Username or Password Field Should Not Be Blank");
            }
            else
            {
                UserInfoDAO userInfoDAO = new UserInfoDAO();
                UserForm    userForm    = new UserForm();
                if (userInfoDAO.validateUser(this.username.Text, this.password.Text))
                {
                    if (userInfoDAO.getUserype() == "admin")
                    {
                        AdminWindow adminWindow = new AdminWindow();
                        adminWindow.Show();
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("Normal User");
                    }
                }
                else
                {
                    MessageBox.Show("Wrong Username Or Password");
                }


                //String result="UserName"+user.getUsername+"\n" + "Password" + user.setPassword + "\n" + "UserType" + user.setUserCategory;
                //MessageBox.Show(result);

                // userForm.Show();
            }
        }
예제 #2
0
        private void login_btn_Click(object sender, EventArgs e)
        {
            if (this.username.Text == "" || this.password.Text == "")
            {
                MessageBox.Show("Username or Password Field Should Not Be Blank");
            }
            else
            {
                UserInfoDAO userInfoDAO = new UserInfoDAO();
                UserForm    userForm    = new UserForm();
                if (userInfoDAO.validateUser(this.username.Text, this.password.Text))
                {
                    if (userInfoDAO.getUserype() == "admin")
                    {
                        AdminWindow adminWindow = new AdminWindow(username.Text.ToUpper());
                        adminWindow.Show();
                        log.Info("User " + this.username.Text.ToUpper() + " Successfully Logged In");
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("Normal User");
                    }
                }
                else
                {
                    log.Info("UserName: "******" Tried To Logged In");
                    string userName = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
                    log.Info("Window UserName " + userName + " Tried To Logged In");
                    MessageBox.Show("Wrong Username Or Password");
                }


                //String result="UserName"+user.getUsername+"\n" + "Password" + user.setPassword + "\n" + "UserType" + user.setUserCategory;
                //MessageBox.Show(result);

                // userForm.Show();
            }
        }