Candor.Security.SqlProvider.UserProvider.InsertUserHistory C# (CSharp) Method

InsertUserHistory() protected method

Inserts a new user authentication history.
protected InsertUserHistory ( AuthenticationHistory history ) : void
history Candor.Security.AuthenticationHistory
return void
        protected override void InsertUserHistory(AuthenticationHistory history)
        {
            using (var cn = new SqlConnection(ConnectionStringAudit))
            {
                cn.Open();
                using (var cmd = new SqlCommand())
                {
                    cmd.Connection = cn;
                    cmd.CommandType = System.Data.CommandType.Text;
                    cmd.CommandText = @"insert into Security.AuthenticationHistory
             (UserName, IpAddress, IsAuthenticated)
             Values (@UserName, @IpAddress, @IsAuthenticated)";
                    cmd.Parameters.AddWithValue("UserName", history.UserName);
                    cmd.Parameters.AddWithValue("IpAddress", history.IPAddress);
                    cmd.Parameters.AddWithValue("IsAuthenticated", history.IsAuthenticated);
                    cmd.ExecuteNonQuery();
                }
            }
            SaveUserSession(history.UserSession);
        }