public bool IsEmpty(IEnumerable enumerable, DisplayFieldRules displayFieldRules, bool registered) { if (!FieldCategoryRel.IsLoaded) { FieldCategoryRel.Load(); } foreach (FieldCategoryRel fieldCategory in FieldCategoryRel) { if (!fieldCategory.FieldReference.IsLoaded) { fieldCategory.FieldReference.Load(); } if (registered || !fieldCategory.Field.OnlyForRegistered) { bool allFieldsHasValue = true; foreach (object o in enumerable) { switch (displayFieldRules) { case DisplayFieldRules.Always: return(false); case DisplayFieldRules.AtLeastOne: if (fieldCategory.Field.GetValue(o) != null) { return(false); } break; case DisplayFieldRules.MustAll: if (fieldCategory.Field.GetValue(o) == null) { allFieldsHasValue = false; } break; default: break; } } if (displayFieldRules == DisplayFieldRules.MustAll && allFieldsHasValue) { return(false); } } } return(true); }
public bool IsEmpty(object o) { if (!FieldCategoryRel.IsLoaded) { FieldCategoryRel.Load(); } foreach (FieldCategoryRel fieldCategory in FieldCategoryRel) { if (!fieldCategory.FieldReference.IsLoaded) { fieldCategory.FieldReference.Load(); } if (fieldCategory.Field.GetValue(o) != null) { return(false); } } return(true); }
private void LoadFields() { fields = new List <Field>(); if (!FieldCategoryRel.IsLoaded) { FieldCategoryRel.Load(); } foreach (FieldCategoryRel fieldCategory in FieldCategoryRel) { if (!fieldCategory.FieldReference.IsLoaded) { fieldCategory.FieldReference.Load(); } if (!fields.Contains(fieldCategory.Field)) { fields.Add(fieldCategory.Field); } } }