예제 #1
0
 private void Loginbtn_Click(object sender, EventArgs e)
 {
     try
     {
         /*LoginDTO loginDTO = LoginController.searchUser(int.Parse(txtUserName.text));
          * if (loginDTO.getLoginid() == int.Parse(txtUserName.text) && loginDTO.getPassword() == txtPassword.text)
          * {
          *  this.Hide();
          *  main m = new main(loginDTO.getUsername());
          *  m.ShowDialog();
          * }
          * else
          * {
          *  MessageBox.Show("Invalid Username or password ");
          *  txtUserName.text = "";
          *  txtPassword.text = "";
          *  txtUserName.Focus();
          * }*/
         UserLoginDTO loginDTO = LoginController.searchUser((txtUserName.text));
         if (loginDTO.getUsername() == txtUserName.text && loginDTO.getPassword() == txtPassword1.Text)
         {
             this.Hide();
             main m = new main(loginDTO.getName(), loginDTO.getPosition());
             m.ShowDialog();
         }
         else
         {
             MessageBox.Show("Invalid Username or password ");
             txtUserName.text  = "";
             txtPassword1.Text = "";
             txtUserName.Focus();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Invalid Username or password ");
         Console.WriteLine(ex.ToString());
     }
 }
예제 #2
0
        private void BtnUserSearch_Click(object sender, EventArgs e)
        {
            string       searchUser   = txtUserSearch.Text;
            UserLoginDTO userLoginDTO = LoginController.searchUser(searchUser);

            if (userLoginDTO == null)
            {
                MessageBox.Show("No user found....");
            }
            else
            {
                txtUsername.Text = userLoginDTO.getUsername();
                txtName.Text     = userLoginDTO.getName();
                if (userLoginDTO.getPosition() == "M")
                {
                    rdbManager.Checked = true;
                }
                else
                {
                    rdbUser.Checked = true;
                }
            }
        }