//============================================================================* // OnGetKeyClicked() //============================================================================* protected void OnGetKeyClicked(Object sender, EventArgs e) { bool fValidKey = true; string strName = NameTextBox.Value.Trim(); string strEmail = EmailTextBox.Value.Trim(); string strKey = cRWRegistry.CreateKey(strName, strEmail, VersionTextBox.Value); if (string.IsNullOrEmpty(strKey)) { KeyLabel.Text = "Invalid Parms!"; } else { KeyLabel.Text = strKey; if (cRWRegistry.ValidateKey(strKey, NameTextBox.Value, EmailTextBox.Value, VersionTextBox.Value)) { ValidatedLabel.Text = " (Validated)"; } else { ValidatedLabel.Text = " (NOT VALID!!)"; fValidKey = false; } } if (fValidKey) { cRWLicenseCommands RWLicenseCommands = new cRWLicenseCommands(); m_RWLicenseList = null; cKeyCommand.eErrorCodes eErrorCode = RWLicenseCommands.GetLicenseList(NameTextBox.Value, EmailTextBox.Value, strKey, out m_RWLicenseList); if (eErrorCode == cKeyCommand.eErrorCodes.None) { LicenseCountLabel.Text = String.Format("{0:G0} current licenses", m_RWLicenseList.Count); if (m_RWLicenseList.Count > 0) { AdditionalLicenseCheckBox.Checked = true; } m_fGetKey = true; } else { LicenseCountLabel.Text = String.Format("Error {0} encountered during GetLicenseList() operation.", cKeyCommand.ErrorString(eErrorCode)); } } UpdateButtons(); }
//============================================================================* // OnAddClicked() //============================================================================* protected void OnAddClicked(Object sender, EventArgs e) { cRWLicenseCommands RWLicenseCommands = new cRWLicenseCommands(); string strKey = KeyLabel.Text; cKeyCommand.eErrorCodes eErrorCode = RWLicenseCommands.AddLicense(NameTextBox.Value, EmailTextBox.Value, strKey); if (eErrorCode == cKeyCommand.eErrorCodes.None) { LicenseCountLabel.Text = "License Added Successfully!"; m_fAddKey = true; m_RWLicenseList = null; eErrorCode = RWLicenseCommands.GetLicenseList(NameTextBox.Value, EmailTextBox.Value, strKey, out m_RWLicenseList); if (eErrorCode == cKeyCommand.eErrorCodes.None) { LicenseCountLabel.Text = String.Format("{0:G0} current licenses", m_RWLicenseList.Count); AdditionalLicenseCheckBox.Checked = m_RWLicenseList.Count > 1; } else { LicenseCountLabel.Text = String.Format("Error {0} encountered during GetLicenseList() operation.", cKeyCommand.ErrorString(eErrorCode)); } } else { LicenseCountLabel.Text = String.Format("Error {0} Adding License!", eErrorCode); } if (m_RWLicenseList.Count > 1) { AdditionalLicenseCheckBox.Checked = true; } UpdateButtons(); }