public static LoginAttempt GetLoginAttempt(LoginUser loginUser, int loginAttemptID)
        {
            LoginAttempts loginAttempts = new LoginAttempts(loginUser);

            loginAttempts.LoadByLoginAttemptID(loginAttemptID);
            if (loginAttempts.IsEmpty)
            {
                return(null);
            }
            else
            {
                return(loginAttempts[0]);
            }
        }
        public static void AddAttempt(LoginUser loginUser, int userID, bool success, string ipAddress, HttpBrowserCapabilities browser, string userAgent, string deviceID)
        {
            LoginAttempts loginAttempts = new LoginAttempts(loginUser);

            using (SqlCommand command = new SqlCommand())
            {
                command.CommandText =
                    @"INSERT INTO [LoginAttempts]
           ([UserID]
           ,[Successful]
           ,[IPAddress]
           ,[Browser]
           ,[Version]
           ,[MajorVersion]
           ,[CookiesEnabled]
           ,[Platform]
           ,[UserAgent]
           ,[DateCreated]
           ,[DeviceID])
     VALUES
           (@UserID
           ,@Success
           ,@IPAddress
           ,@Browser
           ,@Version
           ,@MajorVersion
           ,@Cookies
           ,@Platform
           ,@UserAgent
           ,GETUTCDATE()
           ,@DeviceID)";
                command.CommandType = CommandType.Text;
                command.Parameters.AddWithValue("@UserID", userID);
                command.Parameters.AddWithValue("@Success", success);
                command.Parameters.AddWithValue("@IPAddress", ipAddress);
                command.Parameters.AddWithValue("@Browser", DataUtils.GetBrowserName(userAgent));
                command.Parameters.AddWithValue("@Version", browser.Version);
                command.Parameters.AddWithValue("@MajorVersion", browser.MajorVersion.ToString());
                command.Parameters.AddWithValue("@Cookies", browser.Cookies);
                command.Parameters.AddWithValue("@Platform", browser.Platform);
                command.Parameters.AddWithValue("@UserAgent", userAgent);
                command.Parameters.AddWithValue("@DeviceID", deviceID);
                loginAttempts.ExecuteNonQuery(command, "LoginAttempts");
            }
        }
 public LoginAttempt(DataRow row, LoginAttempts loginAttempts) : base(row, loginAttempts)
 {
     _loginAttempts = loginAttempts;
 }