Example #1
0
        internal E_VerificationStatus GetVerificationStatus(string email, string passwordHash)
        {
            E_VerificationStatus resultStatus = E_VerificationStatus.emailUnknown;

            var sqlCom = _db.GetReadCommand(@"
                SELECT `EmailID`, `EmailAddress`, `PasswordHash`, EmailVerificationID
                FROM email 
                WHERE `EmailAddress` LIKE ?Address;");

            sqlCom.Parameters.AddWithValue("?Address", email);


            try
            {
                using (var rdr = sqlCom.ExecuteReader())
                {
                    while (rdr.Read())
                    {
                        if (rdr.GetString("PasswordHash") == passwordHash)
                        {
                            resultStatus = E_VerificationStatus.successfull;
                            if (rdr["EmailVerificationID"] != DBNull.Value)
                            {
                                resultStatus = E_VerificationStatus.emailNotYetVerified;
                            }
                        }
                        else
                        {
                            resultStatus = E_VerificationStatus.wrongPassword;
                        }
                    }
                }
            }
            finally
            {
                _db.CloseConnections();
            }

            return(resultStatus);
        }
Example #2
0
        public DataTable GetAllLogs(string severityLevel)
        {
            if (string.IsNullOrEmpty(severityLevel))
            {
                severityLevel = "%";
            }

            try
            {
                MySqlCommand sqlCom = _db.GetReadCommand(@"SELECT `Date`,LogLevel,`ExceptionMessage`,`ExceptionStacktrace`,`CustomMessage` 
                                                            FROM logs 
                                                            WHERE (LogLevel like ?LogLevel )
                                                            ORDER BY Date DESC;");
                sqlCom.Parameters.AddWithValue("?LogLevel", severityLevel);

                var result = GetResultAsDataTable(sqlCom);

                return(result);
            }
            finally
            {
                _db.CloseConnections();
            }
        }