private void toolStripMenuItem3_Click(object sender, EventArgs e) { Home h = new Home(); h.Show(); }
private void btnLogin_Click(object sender, EventArgs e) { try { string userName = txtUserID.Text.Trim(); string password = txtPassword.Text.Trim(); errorProvider1.Clear(); lblMessage.Text = string.Empty; if (userName == string.Empty && password == string.Empty) { lblMessage.Text = MessageManager.GetMessage("1", false); errorProvider1.SetError(txtUserID, MessageManager.GetMessage("1", false)); return; } if (userName == string.Empty) { lblMessage.Text = MessageManager.GetMessage("1", false); errorProvider1.SetError(txtUserID, MessageManager.GetMessage("1", false)); return; } if (password == string.Empty) { lblMessage.Text = MessageManager.GetMessage("1", false); errorProvider1.SetError(txtPassword, MessageManager.GetMessage("1", false)); return; } int userId = 0; Common.UserRole role = new Common.UserRole(); bool validUser = _userAuthentication.IsValidUser(userName, password, out userId, out role); Logger.WriteTrace("Login", "Username : "******"Success : " + validUser.ToString()); if (!validUser) { MessageManager.DisplayCustomMessage("Invalid user Id or password."); } else { if (chkRememberMe.Checked) { SavePreference(true); } else { SavePreference(false); } SessionParameters.UserID = userId; SessionParameters.UserName = userName; SessionParameters.UserRole = role; (new Users()).UpdateLastLoginDate(SessionParameters.UserID); this.Hide(); Home objHome = new Home(this); objHome.Show(); } } catch (Exception ex) { throw ex; } }