public Loginfrm(UserDetail userDetail) { InitializeComponent(); //ExecutiveName = userDetail.UserId; UserDetail = userDetail; IsLogedIn = false; }
private void ValidateUser() { if (string.IsNullOrEmpty(txtExecutiveName.Text)) { MessageBox.Show("Please Enter Executive Name", "Message", MessageBoxButtons.OK); return; } if (UserDetail.SrNo <= 0) { var uniDb = new UniDBDataContext(); UserDetail = uniDb.UserDetails.SingleOrDefault(x => x.UserId == txtExecutiveName.Text); } if (UserDetail == null) { MessageBox.Show("You have enter wrong User Name", "Message", MessageBoxButtons.OK); return; } if (UserDetail.Password.ToUpper() == txtPassword.Text.ToUpper()) { IsLogedIn = true; this.Close(); } else { MessageBox.Show("You have enter wrong password ", "Message", MessageBoxButtons.OK); } }