private void btnActivate_Click(object sender, EventArgs e) { try { var ID = ProID.Substring(0, ProID.Length - 3); if (string.IsNullOrEmpty(txtProID.Text)) { throw new Exception("Enter Product ID"); } if (txtProID.Text != ID.ToUpper()) { throw new Exception("Invalid Product ID"); } if (string.IsNullOrEmpty(txtActivation.Text)) { throw new Exception("Enter Activation Key"); } var key = SecuredPass.Encrypt(txtProID.Text.TrimEnd()); if (txtActivation.Text == key.Substring(0, 24).ToUpper().TrimEnd()) { AppActivation.activate(txtActivation.Text); //MessageBox.Show("Activation Successful", "Cash Desk", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } else { MessageBox.Show("Invalid Activation Key", "Cash Desk", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception Ex) { MessageBox.Show(Ex.Message + "\nActivation Failed", "Cash Desk", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void btnActivate_Click(object sender, EventArgs e) { try { if (string.IsNullOrEmpty(txtActivation.Text)) { throw new Exception("Enter Activation Key"); } var key = PasswordEncryptor.Encrypt(txtProID.Text.TrimEnd()); if (txtActivation.Text == key.Substring(0, 24).ToUpper().TrimEnd()) { AppActivation.activate(txtActivation.Text); this.Close(); } else { MessageBox.Show("Invalid Activation Key", "Cash Desk", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { MessageBox.Show(ex.Message + "\nActivation Failed", "Cash Desk", MessageBoxButtons.OK, MessageBoxIcon.Information); } }