protected void SubmitLogin_OnClick(object sender, EventArgs e) { try { // Disallow empty fields if (displayName.Text.Trim().Length == 0 || userName.Text.Trim().Length == 0 || password.Text.Trim().Length == 0) { throw new ApplicationException("Please provide the required details"); } // Check Username (email) var userSearch = SqlHelpers.SelectScalar(SqlStatements.SQL_LOOKUP_USERNAME.FormatWith(userName.Text.Trim().FixSqlString())); if (!userSearch.IsNullOrEmpty()) { throw new ApplicationException("Email Address is already in use, please check your entry or use the Forgot Password to reset."); } // Insert Base Record var newRegistration = SqlHelpers.InsertScalar(SqlStatements.SQL_CREATE_USER_REGISTRATION.FormatWith( displayName.Text.Trim().FixSqlString(), userName.Text.Trim().FixSqlString(), password.Text.Trim().EncryptString())); var usrRec = new SystemUser(); usrRec.LoadUserDetails(newRegistration); SessionInfo.SendRegistrationEmail(usrRec); SessionInfo.SendResetEmail(usrRec, password.Text.Trim().EncryptString()); RegistrationPage.Visible = false; RegistrationThankYou.Visible = true; } catch (Exception ex) { lErrorMessage.Text = ex.Message; SessionInfo.Settings.LogError("Registration Failed", ex); } }
public string PageContent(PageContentBlocks pageLocation) => SqlHelpers.SelectScalar(SqlStatements.SQL_GET_PAGE_CONTENT_FOR_DISPLAY.FormatWith(pageLocation.TextValue())).ToString();