Skip to content

Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.

1012 B
Raw Blame
using Grand.Domain.Catalog;

namespace Grand.Domain.Customers;

/// <summary>
///     Extensions
/// </summary>
public static class CustomerAttributeExtensions
{
    /// <summary>
    ///     A value indicating whether this customer attribute should have values
    /// </summary>
    /// <param name="customerAttribute">Customer attribute</param>
    /// <returns>Result</returns>
    public static bool ShouldHaveValues(this CustomerAttribute customerAttribute)
    {
        if (customerAttribute == null)
            return false;

        if (customerAttribute.AttributeControlTypeId == AttributeControlType.TextBox ||
            customerAttribute.AttributeControlTypeId == AttributeControlType.MultilineTextbox ||
            customerAttribute.AttributeControlTypeId == AttributeControlType.Datepicker ||
            customerAttribute.AttributeControlTypeId == AttributeControlType.FileUpload)
            return false;

        //other attribute controle types support values
        return true;
    }
}