Ejemplo n.º 1
0
        /// <summary>
        /// Check to see if website registration is allowed.
        /// </summary>
        /// <param name="registrationAllowed">Out parameter whether registration is allowed.</param>
        /// <returns>The outcome of the operation.</returns>
        public Response IsRegistrationAllowed(out bool registrationAllowed)
        {
            registrationAllowed = false;
            using (DatabaseConnectivity db = new DatabaseConnectivity())
            {
                // Try to establish a database connection
                Response r = db.OpenConnection();
                if (r.error)
                    return r;

                string registrationAllowedString;
                r = db.GetSetting("webRegistration", out registrationAllowedString);
                if (r.error)
                    return r;

                if (!bool.TryParse(registrationAllowedString, out registrationAllowed))
                {
                    r.error = true;
                    r.message = "Could not read setting";
                    return r;
                }
                return r;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Check to see if website registration is allowed.
        /// </summary>
        /// <param name="registrationAllowed">Out parameter whether registration is allowed.</param>
        /// <returns>The outcome of the operation.</returns>
        public Response IsRegistrationAllowed(out bool registrationAllowed)
        {
            registrationAllowed = false;
            using (DatabaseConnectivity db = new DatabaseConnectivity())
            {
                // Try to establish a database connection
                ExpResponse r = db.OpenConnection();
                if (r.error)
                    return Common.LogErrorRetNewMsg(r, Messages.ERR_SERVER, Common.LogFile.Web);

                string registrationAllowedString;
                r = db.GetSetting("webRegistration", out registrationAllowedString);
                if (r.error)
                    return Common.LogErrorRetNewMsg(r, Messages.ERR_SERVER, Common.LogFile.Web);

                if (!bool.TryParse(registrationAllowedString, out registrationAllowed))
                {
                    r.setErMsgStk(true, "Could not read setting", Environment.StackTrace);
                    return Common.LogErrorRetNewMsg(r, Messages.ERR_SERVER, Common.LogFile.Web);
                }
                return r;
            }
        }