private void btnSubmit_Click(object sender, EventArgs e) { if (txtLoginID.Text.Trim() == string.Empty) { MessageBox.Show("Please enter user id"); return; } if (txtPassword.Text.Trim() == string.Empty) { MessageBox.Show("Please enter password"); } BOUsers boUsers = new BOUsers(System.Configuration.ConfigurationManager.AppSettings["ConnectionString"].ToString()); DC_User user = boUsers.AuthenticateUser(txtLoginID.Text.Trim(), txtPassword.Text.Trim()); if (user != null) { AppContext.Login(user); RollExam examForm = new RollExam(this); examForm.Show(); this.Hide(); } else { MessageBox.Show("Record not found"); } }
public static void Login(DC_User user) { current = new AppContext() { User = user }; }