private void BtnLogin_Click(object sender, EventArgs e) { UserDetailModel = null; if (_ValidForm) { //Check the nikname and the password // / LoginWork.DoLogin(tbName.Text, tbPassword.Text); var model = _userDetailService.GetUserByUser(txtUserName.Text, txtPassword.Text, Convert.ToInt32(cmbOrgaisationName.SelectedValue)); if (model != null) { if (model.Password == txtPassword.Text) { UserDetailModel = model; this.Close(); } else { MessageBox.Show("You entered wrong Organisation or username or password"); // Thread.Sleep(60000); return; this.Close(); } } } else { MessageBox.Show("Please, fill all text boxes"); } }