private void OK_Click(object sender, EventArgs e) { LicenseConnection connection = new LicenseConnection(); var userName = this.txtUserName.Text; var password = this.txtPassword.Text; var existingUser = connection.Users. FirstOrDefault(x => x.UserName == userName && x.Password == password); if (existingUser == null) { MessageBox.Show("Invalid username and password! please try again."); } else { var mainForm = new Main(); mainForm.Show(); this.Hide(); } }
protected void btnCheck_Click(object sender, EventArgs e) { LicenseConnection connection = new LicenseConnection(); var firstName = txtFirstName.Text; var lastName = txtLastName.Text; var trn = txtTRN.Text; var existingLicense = connection.Licenses.FirstOrDefault(x => x.FirstName == firstName && x.LastName == lastName && x.Trn == trn); if (existingLicense == null) { Session.Add("CurrentLicense", null); this.alertInvalidInfo.Attributes["class"] = this.alertInvalidInfo.Attributes["class"].Replace("hidden", ""); } else { Session.Add("CurrentLicense", existingLicense); this.alertInvalidInfo.Attributes["class"] += " hidden"; } }
public LicenseDetailForm(LicenseConnection connection, Guid?id = null) { this.connection = connection; this.id = id; InitializeComponent(); }
public LicenseListForm() { this.connection = new LicenseConnection(); InitializeComponent(); }