private void applyBTN_Click(object sender, EventArgs e) { string lic = licenseCodeTB.Text; bool good = ManageLicense.ApplyNewLicense(lic); if (good) { origin.AppliedNewLicense(); this.Close(); } }
private void loginBTN_Click(object sender, EventArgs e) { //string licenseType = ManageLicense.PullCurrentLicenseType(); int lic = ManageLicense.CheckCurrentLicense(); if (lic != 2) { // No license applied if (lic == 1) { MessageBox.Show("Current license is invalid. Please enter a new license."); } loginBTN.Enabled = false; button1.Enabled = false; LicenseWindow lw = new LicenseWindow(this); lw.BringToFront(); lw.Show(); } else { string username = usernameTB.Text; string pw = FSManager.HashString(passwordTB.Text); // Check database //int permLevel = db.CheckLogin(username, pw); User u = db.CheckLogin(username, pw); invalidLoginLBL.Visible = false; inactiveAccountLBL.Visible = false; if (u == null) { // Invalid login invalidLoginLBL.Visible = true; } else if (u.PermissionLevel == 0) { // Inactive account (0 level permission) inactiveAccountLBL.Visible = true; } else if (u.PermissionLevel > 0) { LocalUserSession.LoggedIn = true; LocalUserSession.Username = username; LocalUserSession.HashedPassword = pw; LocalUserSession.PermissionLevel = u.PermissionLevel; if (cw == null) { cw = new ConsoleWindow(); } cw.Show(); cw.UpdateUser(); this.Hide(); } } }
private void SetSystemCode() { string c = ManageLicense.GenerateOutputCode(); systemCodeLBL.Text = c; }