Пример #1
0
        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);
        }
Пример #2
0
        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);
        }
Пример #3
0
        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);
                }
            }
        }