Webiant Logo Webiant Logo
  1. No results found.

    Try your search with a different keyword or use * as a wildcard.

CustomerExtensions.cs

namespace Nop.Core.Domain.Customers;

/// 
/// Customer extensions
/// 
public static class CustomerExtensions
{
    /// 
    /// Gets a value indicating whether customer a search engine
    /// 
    /// Customer
    /// Result
    public static bool IsSearchEngineAccount(this Customer customer)
    {
        ArgumentNullException.ThrowIfNull(customer);

        if (!customer.IsSystemAccount || string.IsNullOrEmpty(customer.SystemName))
            return false;

        var result = customer.SystemName.Equals(NopCustomerDefaults.SearchEngineCustomerName, StringComparison.InvariantCultureIgnoreCase);

        return result;
    }

    /// 
    /// Gets a value indicating whether the customer is a built-in record for background tasks
    /// 
    /// Customer
    /// Result
    public static bool IsBackgroundTaskAccount(this Customer customer)
    {
        ArgumentNullException.ThrowIfNull(customer);

        if (!customer.IsSystemAccount || string.IsNullOrEmpty(customer.SystemName))
            return false;

        var result = customer.SystemName.Equals(NopCustomerDefaults.BackgroundTaskCustomerName, StringComparison.InvariantCultureIgnoreCase);

        return result;
    }
}